Traditional Chinese medicine prescription compatibility method and device based on large model and mapping knowledge domain

By building a large model and knowledge graph of traditional Chinese medicine, using the knowledge graph to enhance knowledge, the problem of structured knowledge enhancement of large language models in the prescription compatibility task in the field of traditional Chinese medicine is solved, the professionalism and accuracy of the model are improved, and the more Good prescription combination effect.

CN119149754APending Publication Date: 2024-12-17TIANJIN UNIV +1
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202411298897.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-18
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

The existing large language models have poor performance in the field of traditional Chinese medicine, especially in the prescription compatibility task, and the lack of structural knowledge enhancement, resulting in poor interpretability of the prescription composition and difficult to evaluate the effect.

Method used

Using methods based on big models and knowledge graphs, we will build big models and knowledge graphs of traditional Chinese medicine, enhance knowledge through knowledge graphs as external data sources, maintain knowledge structure, and improve the professionalism and accuracy of the model in prescription compatibility tasks.

Benefits of technology

Effectively improve the ability of the traditional Chinese medicine model in the task of prescription matching, improve the maintenance and professionalism of the knowledge structure, and the quality of the model's answers performs better in accuracy, safety and fluency. The objective indicators BLEU-1 and Rouge- 1 has also been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149754A_ABST
    Figure CN119149754A_ABST
Patent Text Reader

Abstract

The invention provides a traditional Chinese medicine prescription compatibility method and device based on a large model and a knowledge graph. The traditional Chinese medicine prescription compatibility method based on the large model and the knowledge graph comprises the following steps: constructing a traditional Chinese medicine large model; constructing a traditional Chinese medicine knowledge graph; and performing traditional Chinese medicine prescription compatibility based on the traditional Chinese medicine large model and the traditional Chinese medicine knowledge map. According to the method, the traditional Chinese medicine knowledge graph is taken as an external data source, so that the capability of a traditional Chinese medicine large-scale model on knowledge structure maintenance and high-speciality requirement tasks can be effectively improved, and the knowledge structure is maintained in a knowledge enhancement process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular to a method and device for combining traditional Chinese medicine prescriptions based on a large model and a knowledge graph. Background Art

[0002] Recently, there have been significant advances in large language models (LLMs), such as ChatGPT and GPT-4. These models can understand and answer a variety of questions and outperform humans in many general domains. Although they are not open source, the open source community has quickly introduced high-performance LLMs such as LLaMA, Bloom, and Falcon. To fill the gap in these models' Chinese processing capabilities, researchers have also introduced more powerful Chinese models.

[0003] However, despite the excellent performance of these general LLMs in many tasks, their performance in specific professional fields (such as biomedicine) is often limited due to the lack of domain expertise. The knowledge in the biomedical field is intricate and highly specialized, which places higher accuracy and safety requirements on the successful development of LLMs. Despite the challenges, medical LLMs still have great potential and can provide value in auxiliary diagnosis, consultation, drug recommendation, etc. In the field of traditional Chinese medicine, a number of medical LLMs have been proposed. These LLMs are mainly trained through supervised fine-tuning (SFT). Studies have shown that almost all knowledge is learned during pre-training, which is a key stage for accumulating domain foundations. Reinforcement learning with human feedback (RLHF) can guide the model to identify its ability boundaries and enhance instruction following ability. Over-reliance on SFT may lead to overconfident generalization, and the model basically memorizes the answers instead of understanding and reasoning about intrinsic knowledge. Their training datasets mainly focus on single-round dialogues, ignoring the process of real doctor-patient dialogues.

[0004] The outstanding achievements of large language models (LLMs) such as ChatGPT and GPT-4 have attracted widespread attention and ignited a new wave of artificial intelligence. Although OpenAI has not yet disclosed its training strategies or weights, the rapid rise of open source LLMs such as LLaMA, Bloom, and Falcon has attracted the attention of the research community. Although their initial Chinese proficiency was limited, they successfully improved their Chinese skills by training with large Chinese datasets. Chinese LLaMA and Chinese Alpaca are constantly pre-trained and optimized using Chinese data and vocabulary. Ziya-LaMA completes the RLHF process and improves instruction following ability and safety. In addition, building a proficient Chinese LLM from scratch is also a noteworthy attempt.

[0005] For large models in vertical fields, methods such as secondary pre-training, SFT and RLHF are generally used. Secondary pre-training uses a large-scale unlabeled corpus to train the model's ability to predict the next word; SFT is supervised pre-training, which uses labeled corpus to train the model's ability to answer correctly; RLHF uses human feedback on the model's answers and uses reinforcement learning methods for training.

[0006] For the task of prescription compatibility of traditional Chinese medicine, the current solution is to use traditional data mining methods, secondary fine-tuning of models in the field of traditional Chinese medicine, or directly add prescription data when training large models of traditional Chinese medicine to enable the model to have the ability to prescribe prescriptions. The methods generally used in traditional data mining include clustering and association rule mining. Shan Yumeng, Zhang Ke and others used hypergraphs to obtain the association rules between medicinal materials, and then discussed the prescription compatibility. TCMLLM-PR uses an annotated corpus of traditional Chinese medicine prescriptions to perform SFT training on the ChatGLM model. Most traditional Chinese medicine LLMs add traditional Chinese medicine prescription corpora to the model training data as data for secondary pre-training, SFT or RLHF during the training process.

[0007] There are two common schemes for enhancing LLM knowledge using external knowledge sources: traditional retrieval augmentation generation (RAG) and graph RAG. Traditional RAG vectorizes a large amount of external knowledge in the form of documents and retrieves similar documents through embedding vectors when generating LLM, thereby enhancing LLM knowledge. Graph RAG targets unstructured documents and utilizes the relationships on the graph by hierarchical clustering of entity embedding vectors in the graph.

[0008] Large models generally perform poorly in medical settings that require complex knowledge and high precision. Studies that attempt to improve this include MedAlpaca and ChatDoctor, which use continuous training; Med-PaLM and Med-PaLM2 have received good reviews from experts in clinical responses. Research in the Chinese medical field includes DoctorGLM, which uses a large amount of Chinese medical conversation data and an external medical knowledge base, and BenTsao, which only uses medical knowledge graphs to build conversations. Zhang et al. created HuatuoGPT in 2023 using a dataset of 25 million conversations, achieving better response quality by mixing refined data and real data from SFT and ChatGPT, and used it for RLHF feedback ranking. Yang et al. created CMtMedQA, a Chinese multi-round medical conversation dataset containing 70,000 real doctor-patient conversations, which greatly improved the model's ability to handle complex conversations and actively initiate inquiries. Ren et al. created TCM-SD, a benchmark for exploring syndrome identification in the field of traditional Chinese medicine, considering the characteristics of traditional Chinese medicine. Although there have been many works on big models in the field of traditional Chinese medicine, and these works have further promoted the development of big models in the field of traditional Chinese medicine, the characteristics of traditional Chinese medicine are often ignored.

[0009] Generally speaking, the diagnosis of traditional Chinese medicine follows the process of "symptoms-syndrome-syndrome type", while the treatment follows the process of "effect-herbal medicine-prescription". The syndrome and syndrome type are derived through the analysis of symptoms, and prescriptions are prescribed according to the syndrome type and the efficacy of the medicinal materials. At the same time, traditional Chinese medicine has accumulated a large number of mature and stable prescriptions through practical experience during its development, which are also important references and sources of prescriptions when prescribing prescriptions. In addition, the various medicinal materials in traditional Chinese medicine prescriptions have a relatively important ratio relationship, that is, the principle of traditional Chinese medicine prescription "monarch, minister, assistant and messenger". For the task of traditional Chinese medicine prescription compatibility, the existing model does not take into account the structure of the traditional Chinese medicine prescription itself. The paradigm of prescribing based on the efficacy of medicinal materials will destroy this structure, which will lead to the problem of poor interpretability of the prescription composition and difficulty in evaluating the effect. At the same time, the prescription structure of traditional Chinese medicine requires knowledge enhancement to take into account the maintenance of the knowledge structure, and the existing knowledge enhancement scheme is difficult to achieve the maintenance of the prescription structure.

[0010] Although there are many works on big models in the field of traditional Chinese medicine, which have further promoted the development of big models in the field of traditional Chinese medicine, the characteristics of traditional Chinese medicine are often ignored by them. They have never considered the essential differences between traditional Chinese medicine and modern medical theory. Unlike modern medicine, which assigns treatment methods according to the type of disease, traditional Chinese medicine uses four diagnostic methods, namely, observation, smell, questioning, and palpation, to conduct in-depth analysis to determine the patient's syndrome type, and then adopt different treatment methods according to the syndrome type. Therefore, patients with the same disease may have different syndromes and receive different treatments; while patients with different diseases may have the same syndrome and receive the same treatment. These concepts are called "different treatments for the same disease" and "same treatment for different diseases" respectively, and are the core methods of traditional Chinese medicine. In modern medicine, with the help of medical instruments, the type of disease can be diagnosed based on clear numerical indicators (such as blood pressure levels). Traditional Chinese medicine uses abstract indicators such as yin and yang, exterior and interior, cold and heat, deficiency and excess, etc.

[0011] These differences determine the difference in theoretical knowledge systems between traditional Chinese medicine and modern medicine, which further determines that the basic knowledge required by the big model in traditional Chinese medicine is essentially different from that in modern medicine. Therefore, a big model with traditional Chinese medicine knowledge is needed in the field of traditional Chinese medicine. Other works often only inject Chinese medical knowledge into the big model, which also leads to the poor performance of the Chinese medical big model in the field of traditional Chinese medicine. Summary of the invention

[0012] This paper focuses on developing and training an LLM that can understand and apply traditional Chinese medicine knowledge to make up for the shortcomings of existing Chinese medical models in this field. At the same time, a new knowledge enhancement model is proposed to solve the problem of structured knowledge enhancement, thereby solving the structural problem of TCM prescription compatibility.

[0013] The present disclosure adopts the following technical solutions.

[0014] The embodiments of the present disclosure provide a method for compatibility of TCM prescriptions based on a big model and a knowledge graph, the method comprising: constructing a big model of TCM; constructing a knowledge graph of TCM; and compiling TCM prescriptions based on the big model of TCM and the knowledge graph of TCM.

[0015] Another embodiment of the present disclosure provides a TCM prescription compatibility device based on a big model and a knowledge graph, comprising: a model building module, configured to build a TCM big model; a graph building module, configured to build a TCM knowledge graph; and a prescription compatibility module, configured to perform TCM prescription compatibility based on the TCM big model and the TCM knowledge graph.

[0016] The present invention uses the TCM knowledge graph as an external data source based on knowledge enhancement, which can effectively improve the ability of the TCM big model in maintaining knowledge structure and tasks with high professional requirements (such as prescription compatibility tasks), so that the knowledge structure can be maintained during the knowledge enhancement process. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0018] Figure 1 It is a flow chart of a method for combining traditional Chinese medicine prescriptions based on a large model and a knowledge graph according to an embodiment of the present disclosure.

[0019] Figure 2 An architectural diagram of a method for combining traditional Chinese medicine prescriptions based on a large model and a knowledge graph according to some embodiments of the present disclosure is shown.

[0020] Figure 3 A Traditional Chinese Medicine knowledge graph model according to some embodiments of the present disclosure is shown.

[0021] Figure 4 The construction process of the traditional Chinese medicine knowledge graph according to some embodiments of the present disclosure is shown.

[0022] Figure 5 A knowledge enhancement schema diagram according to some embodiments of the present disclosure is shown.

[0023] Figure 6 A flow chart of prescription formulation according to some embodiments of the present disclosure is shown.

[0024] Figure 7 A safety comparison of prescription preparation tasks according to some embodiments of the present disclosure is shown.

[0025] Figure 8 The accuracy comparison of prescription preparation tasks according to some embodiments of the present disclosure is shown.

[0026] Fig. 9 A comparison of the fluency of prescription preparation tasks according to some embodiments of the present disclosure is shown.

[0027] Fig.10 It is a partial module of a Chinese medicine prescription compatibility device based on a large model and a knowledge graph in another embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] It should be understood that the various steps described in the method embodiments of the present disclosure can be performed in sequence and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0031] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0032] It should be noted that the modification of “one” mentioned in the present disclosure is illustrative rather than restrictive, and those skilled in the art should understand that it should be understood as “one or more” unless otherwise clearly indicated in the context.

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0034] Figure 1 A flowchart of a method for combining traditional Chinese medicine prescriptions based on a large model and a knowledge graph is provided according to an embodiment of the present disclosure. Figure 2 The following is an architecture diagram of a method for combining traditional Chinese medicine prescriptions based on a large model and a knowledge graph according to some embodiments of the present disclosure. Figure 1 and Figure 2, the disclosed method for formulating TCM prescriptions based on a large model and a knowledge graph may include step S101, constructing a large model of TCM. In some embodiments, the disclosed method may also include step S102, constructing a TCM knowledge graph. As a knowledge graph, the TCM knowledge graph can provide standardized expertise for LLM, which helps to reduce the illusion of the model. The construction of the TCM knowledge graph is centered on symptoms, and the medicinal materials are linked by efficacy. The prescription is obtained by combining the medicinal materials, which is the "symptom-medicine-prescription" process of traditional Chinese medicine. The symptoms in the graph are divided into the smallest description (usually expressed as four-character words), and each medicinal material may be able to treat multiple symptoms. According to the composition of the prescription, it contains several medicinal materials. In addition to the composition, the prescription also has the symptoms after the medicinal materials are compounded. The graph ontology is shown in the figure below. Figure 3 shown.

[0035] In some embodiments, the method of the present disclosure may further include step S103, performing TCM prescription compatibility based on the TCM big model and the TCM knowledge graph. The present disclosure provides professional knowledge prompts to the TCM big model through external knowledge sources, thereby improving the professional ability of the big model and reducing the illusion phenomenon of the model.

[0036] The present invention uses the TCM knowledge graph as an external data source based on knowledge enhancement, which can effectively improve the ability of the TCM big model in maintaining knowledge structure and tasks with high professional requirements, so that the knowledge structure can be maintained during the knowledge enhancement process.

[0037] In some embodiments, constructing a large model of traditional Chinese medicine includes: obtaining a pre-training data set and an instruction fine-tuning data set; using the pre-training data set to continuously pre-train the model to obtain a basic traditional Chinese medicine large model; using the instruction fine-tuning data set to supervise and fine-tune the basic traditional Chinese medicine large model to obtain a large model of traditional Chinese medicine. In some embodiments, the large model learns basic traditional Chinese medicine knowledge in the pre-training stage and learns traditional Chinese medicine related terms in the supervised fine-tuning stage. In the pre-training stage, the model learns the basic knowledge in the field of traditional Chinese medicine. For this purpose, traditional Chinese medicine textbooks, ancient books, medical case prescriptions, etc. are selected for pre-training, which together constitute a pre-training data set, as shown in Table 1. Table 1 shows the composition of the model pre-training data set.

[0038] Table 1

[0039]

[0040] After the pre-training model, the conversational capabilities in the field of traditional Chinese medicine are acquired through the SFT method. Since the selected data set will cause the model to crash, in order to avoid this situation affecting the accuracy of the model's answers, the instruction fine-tuning data set will not contain such data. In the SFT stage, four types of data sets, including single-round dialogue of traditional Chinese medicine, multi-round dialogue of traditional Chinese medicine, task instructions of traditional Chinese medicine, and general medical dialogue, are used for fine-tuning. The data sets are all converted into dialogue forms, as shown in Table 2, which shows the composition of the instruction fine-tuning data set.

[0041] Table 2

[0042]

[0043] In some embodiments, the model includes a Chinese LLaMA model, which has the ability to have a conversation, but does not have a TCM foundation. The basic TCM large model obtained through continuous pre-training has a TCM foundation, but does not have TCM-related conversation capabilities. The instruction fine-tuning dataset allows the model to further acquire TCM Q&A capabilities, collect modern medical Q&A instructions to enhance the understanding of modern Q&A, further support traditional TCM Q&A, and enable the model to have a strong dialectical ability.

[0044] In some embodiments, in order to improve the training quality, the pre-training dataset and the instruction fine-tuning dataset are cleaned, mainly including: (1) error correction: correcting typos and incorrect sentences, and deleting incorrectly segmented sentences and paragraphs; (2) consistency check: Chinese medicine may have different ways of expressing the same concept, such as differences in schools, so the same expression in the dataset is unified; (3) fact correction: correcting erroneous or outdated expressions to make them consistent with existing Chinese medicine theories.

[0045] In some embodiments, Figure 2 As shown, constructing a TCM knowledge graph includes: obtaining prescription data; preprocessing the prescription data to obtain preprocessed prescription data; importing the preprocessed prescription data into the graph to obtain a TCM knowledge graph. In some embodiments, the prescription data includes classic TCM prescriptions, prescription data, and incompatibility taboos. In some embodiments, the prescription data is collected from relevant medical records, corresponding prescriptions, and classic TCM prescriptions. In addition, the graph manually extracts some prescription data from ancient TCM literature and serves as the graph data source.

[0046] In some embodiments, the prescription data is preprocessed including cleaning and segmentation, cleaning includes null value screening, alias alignment and symptom alignment, and segmentation includes symptom segmentation and component segmentation. In the process of constructing the graph, in order to unify the format of data from different sources, all data are tested, which is divided into two steps: cleaning and segmentation, as shown in Table 3, which shows the data test rules of the TCM knowledge graph.

[0047] Table 3

[0048]

[0049] In some embodiments, the TCM prescription compatibility method disclosed herein further includes: before preprocessing the prescription data, extracting entities from the prescription data to obtain relevant attributes in the prescription data; during the preprocessing of the prescription data, manually verifying the data. In some embodiments, first extracting relevant attributes from the prescription data according to the graph pattern, then preprocessing the prescription data according to the verification rules; after obtaining the preprocessed prescription data, importing it into the graph to construct a TCM knowledge graph, the process is as follows: Figure 4 shown.

[0050] In some embodiments of the present disclosure, the compatibility of TCM prescriptions based on the TCM big model and the TCM knowledge graph includes: obtaining symptom description; symptom diagnosis based on the symptom description; generating a retrieval plan based on the result of the symptom diagnosis; performing graph retrieval based on the retrieval plan to obtain a prescription to be selected; combining the prescriptions to be selected based on preset considerations to obtain a recommended prescription; and prescribing a prescription based on the recommended prescription. The present disclosure is a way of knowledge enhancement to compatibility of TCM prescriptions based on the TCM big model and the TCM knowledge graph. Knowledge enhancement can provide professional knowledge prompts to the TCM big model through external knowledge sources, thereby improving the professional ability of the TCM big model and reducing the illusion phenomenon of the model. Generally speaking, knowledge enhancement adopts the paradigm of "index-retrieval-generation". In the indexing stage, an index is established for the external data source; in the retrieval stage, the knowledge source is retrieved according to the user's question and relevant knowledge is given; in the generation stage, the original question and the retrieved knowledge are fused as the input of the big model, so that the big model can be generated according to professional knowledge and the accuracy of the answer is improved. In view of the strong structural characteristics of external knowledge, this model directly uses the knowledge graph (i.e., the TCM knowledge graph) to complete key knowledge reasoning, avoiding the situation where only a single entity is retrieved, resulting in the inability to utilize the relationship between entities. This model is divided into three stages: primary generation, retrieval, and secondary generation. Among them, the primary generation uses a large model to generate a retrieval plan; the retrieval stage uses the knowledge graph to retrieve external knowledge, and uses the structural information of the graph for reasoning; the secondary generation stage uses the reasoning results of the retrieval stage and the original input to generate the final knowledge-enhanced answer, as shown in the algorithm below. The flowchart is as follows: Figure 5 shown.

[0051] Algorithm (knowledge enhancement mode)

[0052] Input: knowledge graph G, large model M, input I

[0053] Output: Output answer O

[0054] 1.O 1 ←M(I) / / Get the model output once

[0055] 2.P←retrieve(O 1) / / Extract the retrieval plan based on one output

[0056] 3.E 1 ←G(P) / / Search the graph according to the search plan and obtain basic search results

[0057] 4.E 2 ←f(E 1 ) / / Combined calculations are performed on the basic search results according to the tasks to obtain the final search results

[0058] 5.O 2 ←M(I,P,E 1 ,E 2 ) / / According to the input, primary output, basic search results and final search results, obtain the secondary output of the model

[0059] 6.O←g(O 2 ) / / Post-process the secondary output to get the output answer

[0060] 7.return O

[0061] For the prescription compatibility task, the specific process of each stage is as follows: Figure 5 and Figure 6 As shown. In the first generation stage, the main task of the model is to generate search terms. The output format of the search terms is specified for the model through prompt words, which is convenient for parsing and graph retrieval. Since the graph is centered on symptoms, in the first generation stage, the model only needs to answer the symptom treatment method corresponding to the description. In the retrieval stage, it is necessary to first search for prescriptions and medicinal materials that are suitable for the given keywords, and select the top several candidate prescriptions in order of priority. The following is an example of the sorting order: (1) relative to the prescription with the most components, the similarity of the medicinal materials in the prescription is in descending order, and (2) the use rate of medicinal materials with the same origin as medicine is in descending order. In traditional Chinese medicine prescriptions, there are conflicts and contradictions between medicinal materials. Some of the basic conflict relationships are summarized as "18 anti-compatibility and 19 fears", that is, 37 groups of conflict relationships between medicinal materials. In addition, there are empirical taboos obtained in practice, which should be considered as factors in the process of prescription combination. Try to combine the candidate prescriptions, check whether there are incompatibility taboos between the prescriptions, and appropriately control the number of medicinal materials in the combined prescription to obtain the recommended prescription. In the secondary generation stage, in order to make the model fully understand the recommended prescription, the description, symptoms, candidate prescriptions and recommended prescriptions are taken as model inputs, and the model makes prescription recommendations based on all the information and generates the final prescription opinion. The flowchart is shown in the figure below. Figure 6 shown.

[0062] For the prescription combination algorithm, different dialectical methods can be used in a cross-cutting manner. For a certain disease, Chinese medicine generally divides it into main symptoms, secondary symptoms, and concurrent symptoms. At the same time, each syndrome may be described by different dialectical methods, and each description is different. For a certain syndrome obtained by a certain dialectical method, a set of prescriptions can be prescribed. Check all the given prescriptions, and for each syndrome, count the frequency of prescription prescriptions, select several prescriptions with the highest frequency for combination, so as to obtain a combined prescription for each syndrome. Finally, each combined prescription is combined twice to obtain the final prescription. In the process of prescription combination, check the conflicts between the prescriptions. If there is a conflict, the prescription will not be combined.

[0063] In order to test the ability of Chinese medicine prescription compatibility task, a series of LLMs were selected for experimental verification, including: Chinese-LLaMA, HuaTuoGPT, ZhongJing. In this task, the evaluation is carried out through objective indicators and subjective indicators. The subjective indicators include accuracy, security and fluency, and the model's win rate, draw rate and failure rate are used as measurement criteria. Objective indicators include Rogue-1, BLEU-1 and RAGAs, among which Rogue-1 and BLEU-1 are common indicators in the field of natural language processing (NLP), and RAGAs is an indicator specifically used to evaluate knowledge enhancement capabilities.

[0064] The subjective index evaluation results are as follows: Figures 7 to 9 The objective indicator evaluation results are shown in Table 4. Figure 7 shows the safety comparison of prescription compatibility tasks according to some embodiments of the present disclosure, Figure 8 shows the accuracy comparison of prescription compatibility tasks according to some embodiments of the present disclosure, Fig. 9 FIG. 4 shows a comparison of the fluency of prescription compatibility tasks according to some embodiments of the present disclosure, wherein Figures 7 to 9 Among them, (a) corresponds to a better answer of the present disclosure, (b) corresponds to a consistent answer quality, and (c) corresponds to a poor answer of the present disclosure. The results show that in terms of subjective indicators, the proportion of better answers of the model of the present disclosure is not lower than the proportion of worse answers, and the performance of the model is better than that of the baseline model; in objective indicators, the model of the present disclosure has an improvement of 0.09 in the BLEU-1 indicator and an improvement of 0.21 in Rouge-1, reflecting that the method of the present disclosure performs better in this task. In addition, it can be found from the data that the Rouge-1 indicator of most models is higher than the BLEU-1 indicator, indicating that LLM tends to use more components to cover the correct components.

[0065] Table 4

[0066]

[0067] In order to verify the specific enhancement effect of knowledge enhancement on LLM tasks, an ablation experiment was designed for verification. On the basic knowledge graph, the scale of the graph was gradually reduced, and its performance on various objective indicators was verified. By reducing the scale of external knowledge sources, the ability to enhance professional knowledge was reduced, thereby verifying the knowledge enhancement effect of the knowledge graph. In terms of evaluation indicators, BLEU-1, Rogue-1, and fidelity, contextual precision, and contextual recall in RAGAs were selected.

[0068] The experimental results are shown in Table 5, which shows the comparison of indicators under different knowledge graph retention ratios. It can be seen that when all graphs are retained, LLM performs best, proving the effect of knowledge enhancement. As the graph retention ratio decreases, the BLEU-1 and Rouge-1 of the model prescription compatibility both decrease. After removing the graph, the BLEU-1 index of the model drops from 0.72 to 0.45, a decrease of about 37%. In addition, after completely removing the graph, its accuracy is improved compared to when very few graphs are retained, and BLEU-1 increases from 0.36 to 0.45. It is speculated that when the graph is too small, the knowledge structure in the graph has been destroyed, and the truly accurate prescription cannot be captured during knowledge enhancement, thereby reducing the accuracy; when the graph is not used, the model completely relies on the knowledge contained in the original model, and the model has basic prescription compatibility capabilities. The change trend of the RAGAs index also indirectly illustrates the rationality of this speculation.

[0069] Table 5

[0070]

[0071] In order to test the accuracy of the model's prescriptions for different types of diseases and verify the generalization of the model. The performance of the prescription prescription task is compared on different types of diseases. The experiment selects 2 common diseases and 2 uncommon diseases, screens out the test data of the corresponding symptoms in the test data set, and uses the comparative benchmark model for testing respectively, and statistically analyzes the accuracy of each model in the prescription matching task on the disease type. The experimental results are shown in Table 6, which shows the objective indicator evaluation of the prescription matching task on different types of diseases. In the selected disease types, the model has a minimum BLEU-1 index that is the same as the benchmark model, and a maximum increase of 0.12. It also has similar performance on the Rouge-1 index, which proves that the model can show good generalization on different diseases. Note that in symptom diagnosis and prescription selection, the model tends to choose common and conventional prescriptions, and generally does not choose more complex attributions. For difficult and complicated diseases in modern medicine, the model generally gives a more conservative solution. The reason is speculated to be that TCM generally treats common diseases, and the data in the corresponding atlas and datasets are all common medications. There are fewer records of uncommon diseases, which makes it impossible for the model to make a clear diagnosis of such diseases, resulting in a low BLEU-1 index.

[0072] Table 6

[0073]

[0074] In order to demonstrate the ability of different models in the prescription compatibility task and compare their differences in subjective indicators. The experiment selected a symptom description, asked each model to give a prescription, and recorded the model's answer as analysis material. The experimental results are shown in Table 7, which shows a comparison of a prescription compatibility task (a comparison example of prescription generation on the symptom of "heart pain through the back"). In terms of the quality of prescription generation, the model not only gave a clear prescription, but also gave a detailed explanation in the prescription, and the answer quality was higher than that of the benchmark model. For other benchmark models, Chinese-LLaMA only gave several basic principles, but did not give a specific prescription; HuaTuoGPT gave the name of the prescription, but did not give the specific prescription composition; ZhongJing further gave the prescription composition, and also explained the composition to a certain extent, but the prescription composition given was relatively rough.

[0075] Table 7

[0076]

[0077]

[0078] According to the above experiments, the following conclusions can be drawn: Based on knowledge enhancement, the TCM knowledge graph is used as an external data source. The method disclosed in this disclosure can effectively improve the ability of LLM in knowledge structure maintenance and tasks with high professional requirements (such as prescription compatibility tasks), so that the knowledge structure can be maintained during the knowledge enhancement process. In terms of subjective indicators, the quality of the model's answers is higher than that of the baseline model in terms of accuracy, security, and fluency; in terms of objective indicators, the performance of the model is greatly improved compared to the baseline model, with BLEU-1 increasing by 0.09 and Rouge-1 increasing by 0.21. The ablation experiment on the knowledge graph proves the role of knowledge enhancement in this type of task. The model that does not use knowledge enhancement has a decrease of about 37% in the BLEU-1 indicator.

[0079] This disclosure aims to solve the problem that the external knowledge source in the TCM prescription compatibility task has a strong structure, and proposes a knowledge enhancement mode so that the large model can obtain knowledge structure information. In addition, for the combination process in the TCM compatibility paradigm, the prescription combination is carried out by utilizing the decomposition of symptoms and the similarity of dialectical prescriptions of different schools. This disclosure provides a data processing scheme based on different granularity rules to further improve the quality of traditional Chinese medicine training corpus and TCM atlas data source.

[0080] The embodiment of the present disclosure also provides a TCM prescription compatibility device 400 based on a large model and a knowledge graph. Fig.10 A Chinese medicine prescription compatibility device 400 based on a large model and a knowledge graph according to some embodiments is shown. The Chinese medicine prescription compatibility device 400 based on a large model and a knowledge graph includes a model construction module 401, a graph construction module 402, and a prescription compatibility module 403. In some embodiments, the model construction module 401 is configured to construct a large model of Chinese medicine. In some embodiments, the graph construction module 402 is configured to construct a Chinese medicine knowledge graph. In some embodiments, the prescription compatibility module 403 is configured to perform Chinese medicine prescription compatibility based on the Chinese medicine large model and the Chinese medicine knowledge graph.

[0081] It should be understood that the contents described about the method for preparing TCM prescriptions based on a big model and a knowledge graph are also applicable to the TCM prescription preparation device 400 based on a big model and a knowledge graph herein, and for the sake of simplicity, they will not be described in detail here.

[0082] In some embodiments, constructing a large model of traditional Chinese medicine includes: obtaining a pre-training data set and an instruction fine-tuning data set; using the pre-training data set to continuously pre-train the model to obtain a basic large model of traditional Chinese medicine; using the instruction fine-tuning data set to supervise and fine-tune the basic large model of traditional Chinese medicine to obtain a large model of traditional Chinese medicine. In some embodiments, constructing a knowledge graph of traditional Chinese medicine includes: obtaining prescription data; pre-processing the prescription data to obtain pre-processed prescription data; importing the pre-processed prescription data into the graph to obtain a knowledge graph of traditional Chinese medicine. In some embodiments, the prescription data includes classic Chinese medicine prescriptions, prescription data, and incompatibility taboos. In some embodiments, pre-processing the prescription data includes cleaning and segmentation, cleaning includes null value screening, alias alignment, and symptom alignment, and segmentation includes symptom segmentation and composition segmentation. In some embodiments, the graph construction module is also configured to: before pre-processing the prescription data, entity extraction is performed on the prescription data to obtain relevant attributes in the prescription data; during the pre-processing of the prescription data, manual verification of the data is performed. In some embodiments, the TCM prescription compatibility based on the TCM big model and TCM knowledge graph includes: obtaining symptom description; symptom diagnosis based on the symptom description; generating a search plan based on the result of the symptom diagnosis; performing graph search based on the search plan to obtain a candidate prescription; combining the candidate prescriptions based on preset considerations to obtain a recommended prescription; and prescribing a prescription based on the recommended prescription. In some embodiments, the preset considerations include the ranking of candidate prescriptions and contraindication checks.

[0083] According to one or more embodiments of the present disclosure, a method for compatibility of Chinese medicine prescriptions based on a big model and a knowledge graph is provided, and the method for compatibility of Chinese medicine prescriptions based on a big model and a knowledge graph comprises: constructing a big model of Chinese medicine; constructing a knowledge graph of Chinese medicine; and compiling Chinese medicine prescriptions based on the big model of Chinese medicine and the knowledge graph of Chinese medicine.

[0084] According to one or more embodiments of the present disclosure, constructing the TCM big model includes: obtaining a pre-training data set and an instruction fine-tuning data set; using the pre-training data set to continuously pre-train the model to obtain a basic TCM big model; using the instruction fine-tuning data set to supervisely fine-tune the basic TCM big model to obtain a TCM big model.

[0085] According to one or more embodiments of the present disclosure, constructing a TCM knowledge graph includes: acquiring prescription data; preprocessing the prescription data to obtain preprocessed prescription data; and importing the preprocessed prescription data into a graph to obtain a TCM knowledge graph.

[0086] According to one or more embodiments of the present disclosure, the prescription data includes classical Chinese medicine prescriptions, prescription data and incompatibility taboos.

[0087] According to one or more embodiments of the present disclosure, preprocessing the prescription data includes cleaning and segmentation, the cleaning includes null value screening, alias alignment and symptom alignment, and the segmentation includes symptom segmentation and component segmentation.

[0088] According to one or more embodiments of the present disclosure, the method for formulating Chinese medicine prescriptions based on a large model and a knowledge graph also includes: before preprocessing the prescription data, performing entity extraction on the prescription data to obtain relevant attributes in the prescription data; and performing manual verification of the data during preprocessing of the prescription data.

[0089] According to one or more embodiments of the present disclosure, the preparation of TCM prescriptions based on the TCM big model and the TCM knowledge graph includes: obtaining symptom descriptions; performing symptom diagnosis based on the symptom descriptions; generating a retrieval plan based on the results of the symptom diagnosis; performing graph retrieval based on the retrieval plan to obtain candidate prescriptions; combining the candidate prescriptions based on preset considerations to obtain recommended prescriptions; and prescribing prescriptions based on the recommended prescriptions.

[0090] According to one or more embodiments of the present disclosure, the preset consideration factors include ranking of candidate prescriptions and contraindication checking.

[0091] According to one or more embodiments of the present disclosure, a device for preparing Chinese medicine prescriptions based on a big model and a knowledge graph is provided, and the device for preparing Chinese medicine prescriptions based on a big model and a knowledge graph comprises: a model building module, configured to build a big model of Chinese medicine; a graph building module, configured to build a knowledge graph of Chinese medicine; and a prescription preparation module, configured to prepare Chinese medicine prescriptions based on the big model of Chinese medicine and the knowledge graph of Chinese medicine.

[0092] According to one or more embodiments of the present disclosure, a terminal is provided, comprising: at least one memory and at least one processor; wherein the at least one memory is used to store program code, and the at least one processor is used to call the program code stored in the at least one memory to execute any one of the methods described above.

[0093] According to one or more embodiments of the present disclosure, a storage medium is provided, wherein the storage medium is used to store program code, and the program code is used to execute the above method.

[0094] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0095] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0096] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A method for compatibility of traditional Chinese medicine prescriptions based on a large model and knowledge graph, characterized in that: The Chinese medicine prescription compatibility method based on the large model and knowledge graph includes: Build a large model of traditional Chinese medicine; Construct a knowledge graph of traditional Chinese medicine; Traditional Chinese medicine prescriptions are prepared based on the traditional Chinese medicine big model and the traditional Chinese medicine knowledge graph.

2. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 1, characterized in that: The construction of the TCM macromodel includes: Get pre-training datasets and instruction fine-tuning datasets; Utilizing the pre-training data set to continuously pre-train the model, and obtaining a basic TCM model; The instruction fine-tuning data set is used to perform supervised fine-tuning on the basic TCM big model to obtain a TCM big model.

3. The Chinese medicine prescription compatibility method based on a large model and a knowledge graph according to claim 1, characterized in that: The construction of the TCM knowledge graph includes: Obtain prescription data; Preprocessing the prescription data to obtain preprocessed prescription data; The pre-processed prescription data is imported into a graph to obtain a traditional Chinese medicine knowledge graph.

4. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 3, characterized in that: The prescription data includes classic Chinese medicine prescriptions, prescription data and incompatibility taboos.

5. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 3, characterized in that: Preprocessing the prescription data includes cleaning and segmentation, wherein the cleaning includes null value screening, alias alignment and symptom alignment, and the segmentation includes symptom segmentation and component segmentation.

6. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 3, characterized in that: Also includes: Before preprocessing the prescription data, entity extraction is performed on the prescription data to obtain relevant attributes in the prescription data; During the preprocessing of the prescription data, manual verification of the data is performed.

7. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 1, characterized in that: The compatibility of TCM prescriptions based on the TCM big model and the TCM knowledge graph includes: Get a description of your symptoms; Performing a symptom diagnosis based on the symptom description; generating a search plan based on the result of the symptom diagnosis; Performing a graph search based on the search plan to obtain a prescription to be selected; Combining the candidate prescriptions based on preset considerations to obtain a recommended prescription; Prescriptions are prescribed based on the recommended prescriptions.

8. The method for preparing Chinese medicine prescriptions based on a large model and a knowledge graph according to claim 7, characterized in that: The preset considerations include the ranking of candidate prescriptions and contraindication checks.

9. A Chinese medicine prescription compatibility device based on a large model and knowledge graph, characterized in that: The Chinese medicine prescription compatibility device based on the big model and knowledge graph includes: A model building module, configured to build a large model of traditional Chinese medicine; A graph construction module, configured to construct a knowledge graph of traditional Chinese medicine; The prescription compatibility module is configured to compile TCM prescriptions based on the TCM big model and the TCM knowledge graph.

Citation Information

Cited By

  • Intelligent decision-making method and device based on knowledge retrieval multi-modal large model

    CN119357315A

  • Multi-modal large model-based traditional Chinese medicine tongue diagnosis medicine drink recommendation method

    CN120913769A

  • Traditional Chinese medicine tongue diagnosis medicine recommendation method based on multi-modal large model

    CN120913769B

  • Compatibility relation real-time query method and system based on pesticide knowledge graph

    CN121808111A

  • Knowledge graph and large model dual-drive-based traditional Chinese medicine diagnosis and treatment cooperation method

    CN122245648A