Customized traditional chinese medicine prescription recommendation large model based on generative simulated medical records
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING UNIV OF CHINESE MEDICINE
- Filing Date
- 2026-02-12
- Publication Date
- 2026-08-07
AI Technical Summary
主要技术问题有1:高质量专业语料资源的稀缺
[0011]本发明的有益效果体现在:1, 本发明可有效弥补真实世界中特定名老中医诊疗经验相关训练数据缺乏,收集成本高、耗时长的问题,尤其在涉及罕见疾病、专家独有经验和非常规疗法的场景中。本发明可快速获得表征特定中医师的诊疗思路的训练数据,促进名老中医诊疗经验在LLM上的复刻、再现。
Smart Images

Figure CN122531762A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of auxiliary diagnosis and treatment, and in particular to a large-scale model for customized TCM prescription recommendation based on generative simulation medical records. Background Technology
[0002] Currently, several large-scale models for the TCM vertical domain, built upon large language models (LLMs), have been released, such as Tian-yi, TCM-GPT, QiBo, HuatuoGPT, and ZhongjingLLaMa. Building a TCM vertical domain LLM typically follows a core path of "pre-training-fine-tuning." First, it requires the massive collection and meticulous cleaning of professional data to construct a high-quality TCM knowledge base. Its data sources cover ancient and modern classic medical texts, modern TCM textbooks, academic journals, clinical case records, and pharmacopoeias. Next, based on general large-scale models (such as LLaMA and ChatGLM), supervised domain-adaptive pre-training and instruction fine-tuning are performed using the aforementioned professional corpora, enabling the model to deeply understand the unique thought patterns and terminology system of TCM. Key steps also include integrating TCM knowledge graphs to structurally associate entities and employing reinforcement learning or expert feedback to optimize the accuracy and safety of responses. Its design goal is to generate appropriate TCM prescriptions through clinical information to assist in diagnosis and treatment.
[0003] The development of current TCM prescription recommendation models still faces several technical challenges. The main technical problems are: 1. The scarcity of high-quality professional corpus resources. High-quality datasets of specific renowned TCM doctors' clinical experience are often insufficient, and data acquisition is costly and time-consuming. Insufficient data can lead to significant long-tail effects and overfitting problems, especially in scenarios involving rare diseases, expert-specific experience, and unconventional treatments. 2. Large-scale TCM vertical domain models trained on massive amounts of real-world data lack manipulability, making it impossible to specify, edit, or remove specific interventions. 3. TCM involves the medical field, requiring high-quality training data and heavily relying on manual annotation; however, there is currently a lack of universally accepted and efficient annotation paradigms. 4. The insufficient interpretability of deep learning models; the massive amounts of data are difficult to trace, which may lead to user distrust and confusion. 5. While RAG and knowledge graphs can enable knowledge retrieval, they are not a deep replication or imitation of TCM expert experience, and may be insufficient in accurately applying expert experience.
[0004] Using generated data to train models is a key approach to alleviating data scarcity. Synthetic medical data can improve model performance, enhance controllability and scalability, and mitigate privacy issues, demonstrating high efficiency in downstream tasks. However, relying solely on LLM, generative adversarial networks, or diffusion models to generate medical records based on the probability distribution of large-scale training corpora cannot represent the clinical experience of specific renowned traditional Chinese medicine (TCM) practitioners. Furthermore, unprocessed large-scale TCM corpora suffer from contradictions, conceptual ambiguity, and a lack of efficacy evaluation. On the other hand, a wealth of effective clinical experience in TCM is embedded in the minds of individual renowned TCM practitioners in the form of tacit knowledge. TCM treatment plans recorded in traditional text formats are prone to information loss. For example, the *Shanghan Lun* states, "For headache, fever, sweating, and aversion to wind, Guizhi Tang is the main treatment," but in reality, Guizhi Tang is applicable to various combinations of the above symptoms. Currently, there is a lack of methods to accurately represent this type of tacit knowledge. Summary of the Invention
[0005] The purpose of this invention is to provide a method for efficiently, rapidly, and at low cost to acquire a customized TCM prescription recommendation model representing the diagnostic and treatment experience of TCM experts. Specifically, this method is based on a customized TCM prescription recommendation model constructed using generative simulated medical records, and aims to solve the following problems: 1. Under the premise of ensuring close alignment with clinical practice, how to quickly and accurately obtain training data that represents the diagnostic and treatment thinking of specific TCM doctors, so as to reduce the need for real-world TCM corpora when training TCM vertical domain LLM, and promote the replication of the diagnostic and treatment experience of famous veteran TCM doctors based on LLM at the application level.
[0006] 2. When using generative simulation of TCM medical case training models, how to improve the model's generalization ability in related fields and reduce model decay are technical issues.
[0007] To achieve the above objectives, this invention employs an exhaustive scenario simulation approach. Based on the characteristics of traditional Chinese medicine (TCM) theory and syndrome differentiation, it constructs an integrated system for knowledge annotation and simulated medical case generation that can accurately and efficiently represent TCM diagnostic and treatment experience. It generates simulated medical case data and multi-task learning data reflecting the experience of TCM experts, and uses generative data to train and fine-tune the LLM (Limited Learning Model) to achieve the construction of a customized TCM prescription recommendation system. The technical solution of this invention includes the following modules: Module 1: Obtaining a structured TCM feature set based on a TCM syndrome differentiation rule base and a generation engine, wherein the TCM syndrome differentiation rule base can be customized according to expert experience; Module 2: Using LLM to transform the structured TCM feature set into simulated TCM medical cases written in natural language to obtain training data; Module 3: Using the generated data to fine-tune and train the LLM to obtain a customized large-scale TCM prescription recommendation model.
[0008] Module 1, the rule-based generation engine, aims to exhaustively generate multiple sets of structured TCM feature sets based on manually annotated customized TCM diagnosis and treatment plans; this generation engine is developed based on formal logic.
[0009] Module 2, through prompt word engineering, uses LLM to transform structured TCM feature sets into simulated TCM medical records written in natural language to acquire training data; simultaneously, it acquires other multi-task training data related to the TCM prescription and syndrome rule base.
[0010] Module 3 involves fine-tuning the LLM training model using generated data to obtain a customized TCM prescription recommendation model. During training, LoRA (Low-Rank Adaptation) fine-tuning and Direct Preference Optimization (DPO) are employed.
[0011] The beneficial effects of this invention are as follows: 1. This invention can effectively compensate for the lack of training data related to the clinical experience of specific renowned traditional Chinese medicine (TCM) practitioners in the real world, as well as the high cost and time consumption of data collection, especially in scenarios involving rare diseases, unique expert experience, and unconventional treatments. This invention can quickly obtain training data representing the diagnostic and treatment thinking of specific TCM practitioners, promoting the replication and reproduction of the clinical experience of renowned TCM practitioners in LLM (Liver Management Model).
[0012] 2. Compared to fragmented, limited, highly heterogeneous, and potentially error-prone real medical cases, TCM (Traditional Chinese Medicine) formula-pattern rules can more accurately capture the physician's thinking patterns and decision-making basis. Through TCM formula-pattern rules and related experience knowledge carefully edited by TCM experts, this invention can obtain more rigorous, comprehensive, and high-quality training data, effectively avoiding the loss of TCM expert experience knowledge information caused by natural language writing. Multi-scenario simulation and related multi-task learning of TCM expert experience enable LLM to deeply learn and replicate TCM expert experience at the practical application level.
[0013] 3. This invention enhances the editability and interpretability of TCM prescription recommendation models. The treatment plans in the TCM prescription and syndrome rule base under this invention, once written, can be checked, monitored, and modified, providing space for human editing of the model's treatment plans. Simultaneously, by tracing the TCM prescription and syndrome rules and related knowledge, the model's decision-making basis and potential illusions can be investigated.
[0014] 4. By replicating the clinical experience of renowned veteran TCM doctors at the application level based on LLM, we can provide more authoritative and reasonable clinical advice for junior TCM doctors, and promote the preservation and dissemination of the academic thoughts of renowned veteran TCM doctors.
[0015] 5. Because Traditional Chinese Medicine (TCM) emphasizes individualized treatment and involves complex interventions, the efficacy of TCM treatment is difficult to accurately evaluate using traditional methods such as randomized controlled trials. This invention, based on replicating the experience of renowned veteran TCM doctors, helps solve the problem of objectifying complex interventions in TCM clinical trials, increases the reproducibility and credibility of TCM clinical trials, and makes AI-based TCM clinical research and iterative TCM treatment protocols possible.
[0016] 6. Because this technology can generate a large number of clinically relevant cases through multi-scenario simulations of TCM expert experience and knowledge, it facilitates the application-level annotation of certain TCM knowledge. Therefore, it can help address the problem of LLM's insufficient understanding of some TCM theories, TCM diagnostic and treatment experience, and TCM classics. It lays the foundation for future training in more advanced TCM treatment strategies (such as "treat the symptoms in acute cases and the root cause in chronic cases," "treat the exterior before the interior," "treat acute diseases before chronic diseases," and "the balance between adhering to and changing prescriptions"), training the model's understanding of TCM classics, and training on rare diseases, complex pathogenesis, and uncommon prescriptions. Attached Figure Description
[0017] Figure 1 This is a flowchart of the development process for a customized TCM prescription recommendation model based on generative simulation medical case construction.
[0018] Figure 2 This is an example diagram of the TCM formula and syndrome rule library.
[0019] Figure 3 It is a rule-based generation engine workflow.
[0020] Figure 4 LLM rewrites the structured TCM feature set X into a simulated TCM medical case process.
[0021] Figure 5 It is based on DPO to achieve model output preference alignment.
[0022] Figure 6 This is an example of the adaptability of the TCM formula and syndrome rule base to different TCM theoretical systems.
[0023] Figure 7 It is a 3D visualization of principal component analysis.
[0024] Figure 8 This is a schematic diagram of the improved Transformer model.
[0025] Figure 9 It is a model evaluation summary based on real-world medical cases.
[0026] Figure 10 This is an example comparing the output of the Qwen model before and after fine-tuning.
[0027] Figure 11 This is an example of the Qwen model trained using this technique.
[0028] Figure 12A , 12B 12C, 12D, and 12E are all scores for the rationality of the prescription.
[0029] Figure 13 It is an ablation experiment to measure the fit of customized TCM treatment plans.
[0030] Figure 14 It is an ablation experiment for model degradation. Detailed implementation method: The technical solution of this invention includes the following modules: Module 1, obtaining a structured TCM feature set based on a TCM prescription and syndrome rule base and a generation engine, wherein the TCM prescription and syndrome rule base can be customized according to expert experience; Module 2, using LLM to transform the structured TCM feature set into simulated TCM medical records written in natural language to obtain training data; Module 3, using the generated data to fine-tune the training LLM to obtain a customized TCM prescription recommendation model.
[0031] Module 1, the rule-based generation engine, aims to exhaustively generate multiple sets of structured TCM feature sets based on manually annotated customized TCM diagnosis and treatment plans; this generation engine is developed based on formal logic.
[0032] Module 2, through prompt word engineering, uses LLM to transform structured TCM feature sets into simulated TCM medical records written in natural language to acquire training data; simultaneously, it acquires other multi-task training data related to the TCM prescription and syndrome rule base.
[0033] Module 3 involves fine-tuning the LLM training model using generated data to obtain a customized TCM prescription recommendation model. During training, LoRA (Low-Rank Adaptation) fine-tuning and Direct Preference Optimization (DPO) are employed.
[0034] For details, please refer to the technical solution. Figure 1 As shown. Specifically, it includes the following steps: Module 1: Obtaining Structured TCM Feature Sets Based on TCM Prescription and Syndrome Rule Base and Generation Engine The rule-based generation engine aims to generate structured TCM feature sets based on manually annotated customized TCM diagnosis and treatment plans; this generation engine is developed based on formal logic. The TCM formula-pattern rule library stores customized TCM diagnosis and treatment plans composed of multiple TCM formula-pattern rules, thereby representing the experience of TCM experts; the TCM formula-pattern rules are written in a specific format and serve as the raw data for the generation engine to generate the structured TCM feature sets.
[0035] 1. Core Logic of Rule-Based Generation Engine For a given TCM syndrome differentiation rule P, let S A S B S C Let A, B, C, etc. represent a set of TCM characteristics associated with it. Sufficient conditions for P are met when conditions A, B, C, etc., are simultaneously satisfied:
[0036] For each condition K ( Given a set of TCM features S K Relationship with a predefined set R K (like , , (etc.) if and only if there exists a set of TCM features F. K , so that (F K , S K Satisfying relation R K Only when condition K is met is it determined that condition K is true. Based on the predefined P, the generation engine can reverse-engineer multiple structured TCM feature sets Xs that satisfy the sufficient condition P. For a given set of features (… The process for generating a single structured TCM feature set X, defined by the TCM syndrome differentiation rule P, is as follows: set up yes A division, each This is called a feature group (i.e., elements within the group share some common characteristic, such as commonly expressing clinical symptoms). Upper definition equivalence relation As follows: For any , If and only if there exists a certain A and B both belong to G i For each Randomly select a feature set F K This makes the binary pair Satisfying the given relevant conditions R K Then we generate X: In the source code, each structured TCM feature set X is categorized and stored in a dictionary according to the habits of clinical cases. The dictionary keys (i.e. The data includes "gender," "age," "chief complaint," "symptoms and signs," and "onset time." For ease of annotation, we encapsulate the storage space containing the generation rules into an annotation template, including a necessary element library (CEP), an alternative element library (OEP), and a negative element library (NEP). The characteristics and generation patterns of each element library are shown in Table 1.
[0037] Table 1. Basic Generation Rules of the Traditional Chinese Medicine Prescription and Syndrome Rule Base
[0038] N is a custom collection. A single element may contain multiple child elements, where special markers are used to indicate the different generation rules among the child elements.
[0039] 2. Classification of Traditional Chinese Medicine Prescription and Syndrome Rules Feature groups of the TCM prescription and syndrome rule base This includes the chief complaint, gender, age, onset time, symptoms and signs, tongue and pulse, precipitating factors, treatment, past medical history, auxiliary examinations, diagnosis, prescription, and precautions. Tongue appearance includes five dimensions: tongue body, coating thickness, coating color, coating moisture, and coating texture. Pulse appearance includes eight dimensions: pulse rate, pulse rhythm, pulse location, pulse body, pulse strength, pulse flow, and pulse tension. The basic logic for labeling and generating the TCM feature sets corresponding to all feature groups follows the aforementioned necessary element library, alternative element library, and negative element library; based on this, each element library is fine-tuned according to its own needs. Refer to the specific operating procedure. See the specific labeling format below. Figure 2 . Figure 2 The required element library and alternative element library in the text both refer to the element libraries corresponding to symptoms and signs used to generate information on the four diagnostic methods of traditional Chinese medicine.
[0040] 3. Conflicting Element Filtering Mechanism If the generated structured TCM feature set X contains contradictory elements, the set will be deleted to ensure the high quality of the generated medical records. There are two methods to determine whether elements are contradictory: ① For words in the built-in thesaurus, check the pre-annotated list of contradictory elements to determine if contradictory elements exist; ② Use LLM (Limited Language Management) to determine if self-contradictory elements exist.
[0041] 4. Rule-based generation engine operation process Based on the rule generation engine and according to preset generation rules (see Table 1), from each TCM feature set S K Elements are randomly selected with replacement. These elements are then combined into a structured TCM feature set X according to rules that group elements with the same characteristics (name, gender, age, chief complaint, symptoms and signs, onset time, disease characteristics, cause of aggravation, treatment history, auxiliary examinations, past medical history, menstrual history, personal history, etc.). Each structured TCM feature set X corresponds to a unique, pre-labeled TCM prescription, including the prescription name, ingredients, dosage, and decoction method. After the generated structured TCM feature set X is processed by a conflict element filtering mechanism, it enters the LLM generation task module.
[0042] See Figure 3 . Figure 3This diagram illustrates the workflow of a rule-based generation engine. It shows the process of generating multiple structured TCM feature sets Xs (clinical scenarios) based on a specific syndrome rule. C-CEP: Necessary element library (symptoms and signs); A / B-OEP: Alternative element library (symptoms and signs); P-OEP: Alternative element library (tongue appearance); PM: Prescription and medication. For simplicity, the generation process of P-OEP is omitted. Random sampling of n elements is performed from H / A / B / P-OEP, meaning n elements are randomly selected from the corresponding element libraries; Sampling all is performed from C-CEP, meaning all elements in the corresponding element library are extracted.
[0043] Module 2: Training Data Generation Based on Large Language Models 1. Generation of Traditional Chinese Medicine Medical Records Based on a Large Language Model Appropriate prompts are designed and concatenated with the structured TCM feature set X mentioned above. Through LLM processing and rewriting, medical case data written in natural language is obtained, such as... Figure 4 When using LLM to generate simulated TCM medical records, a multi-stage generation process is adopted, including input generation and output generation. In the input generation stage, LLM is required to rewrite the generated structured TCM feature set X into a TCM medical record in natural language form, and supplement blank information and refine relevant content based on the given structured TCM feature set X. To improve generalization ability, LLM is required to add reasonable noise to the input part of the training data. This invention defines noise as: irrelevant or unnecessary clinical information present when using specific TCM knowledge to interpret key clinical information. Such noise includes, but is not limited to, positive or negative but irrelevant signs, symptoms, past medical history, diagnostic test results, etc. In the output generation stage, LLM is required to analyze the generated simulated TCM medical records, extract and supplement relevant knowledge. If personal unique experience is involved, LLM can refer to pre-annotated personal unique relevant knowledge in the knowledge base to analyze the medical record. Afterwards, the generated data is cleaned and filtered through keyword matching and LLM. Ultimately, the generated simulated TCM medical case about the structured TCM feature set X can be conceptually divided into three components: (1) TCM feature information derived from X; (2) noise information that matches the current medical case; and (3) the reasoning process behind TCM syndrome differentiation and treatment.
[0044] Figure 4The LLM process rewrites the structured TCM feature set X into a simulated TCM medical record workflow. Q represents the input and A represents the output. A multi-stage generation process is employed. The left side of the diagram shows the input portion of the simulated medical record generated through LLM based on the structured TCM feature set X (Q) and instructions (Q), primarily focusing on clinical information. The right side of the diagram shows the output portion of the simulated medical record generated through LLM based on the generated input portion, the structured TCM feature set X (A), and instructions (A), primarily focusing on medical record analysis and prescriptions. The Knowledge section is used to introduce relevant reference materials for LLM analysis of medical records. Data cleaning and filtering are mainly based on keyword matching and LLM.
[0045] 2. Large Model Instruction Design In summary, the instructions can be divided into three aspects: basic requirements, format and style, and content. The content can be further divided into "input part" and "output part." Examples of instructions for generating simulated TCM medical records are shown in Table 2; more instructions can be found in the source code.
[0046] The basic requirements specify the fundamental principles for generating medical records, including: ① Preserving the original meaning of the structured TCM feature set X; ② Ensuring the language conforms to medical standards; ③ Maintaining logical consistency throughout the text; ④ Avoiding unnecessary repetition; ⑤ Supplementary information must not alter the results of syndrome differentiation and treatment. Multiple formats and styles are designed for generating medical records, from which one of the following can be randomly selected: ① Medical records should be recorded in a standard format; ② Medical records should be expressed using professional medical terminology, but in a non-standard format; ③ Medical records should be expressed in a more colloquial style; ④ The writing style of renowned modern Chinese TCM doctors; ⑤ The writing style of renowned ancient doctors; ⑥ The writing style of renowned Japanese and Korean Kampo (traditional Japanese medicine) doctors.
[0047] The main task of the input part is to "rewrite the structured TCM feature set X into natural language." Other requirements for the input part include: ① restating the TCM features using synonyms; ② adjusting the order of the TCM features; ③ introducing appropriate noise, including adding relevant negative information and irrelevant but compatible information; ④ supplementing missing information in the structured TCM features; ⑤ refining the description of specific information based on the given features; and ⑥ deleting certain features that are clearly inconsistent with the overall clinical manifestations. The main task of the output part is to "analyze the medical case from multiple perspectives, including theory, method, prescription, and medicine, based on the given TCM medical case and prescription information." Other requirements for the output part include: ① reviewing relevant TCM knowledge; ② performing TCM differential diagnosis; ③ analyzing the medical case in conjunction with the given knowledge if relevant knowledge is provided; and ④ appropriately supplementing blank information.
[0048] Table 2 Examples of prompt words in the large language model
[0049] 3. Training data generation for multi-task learning Based on the existing TCM syndrome rule base and LLM, the following additional training data are generated: ① Clinical information-prescription mapping task: Directly predict TCM prescriptions based on TCM medical records written in natural language, without reasoning process; ② Clinical information prediction task: Predict other possible clinical information based on existing clinical information, simulating the consultation process; ③ Element-related knowledge question answering task: Generate simple knowledge question answering tasks using LLM based on the elements and knowledge involved in the TCM syndrome rule base; ④ General question answering task: Fine-tuning dataset for training a general large model (existing datasets can be selected, or it can be generated by LLM).
[0050] Module 3: Training Module for a Customized TCM Prescription Recommendation Model Based on Generated Data 1. Training a large-scale model for customized TCM prescription recommendation using simulated TCM medical case studies. Using a mixture of generated medical records, multi-task learning training data, and general fine-tuning data as training data, LoRA fine-tuning is employed on a general large-scale language model (Qwen) or a general large-scale TCM vertical domain model to infuse expert diagnostic and treatment experience. Further fine-tuning using real-world medical records and their augmented data will then be conducted to achieve a customized TCM prescription recommendation model based on TCM expert experience. The LoRA architecture assumes that the weight updates (ΔW) during model fine-tuning have low-rank characteristics, decomposing ΔW into the product of two small matrices ΔW = A·B, where the ranks r of A (d×r) and B (r×k) are much smaller than the original dimensions (d and k). During fine-tuning, the original weights W of the pre-trained model are frozen, and only the newly added low-rank matrix ΔW is trained.
[0051]
[0052] 2. Model preference optimization Based on the aforementioned fine-tuned expert-customized large model, DPO (Data Point Output) was performed using manually modified generative simulated medical records and unmodified generative simulated medical records to align the model output preferences. See also Figure 5 . Figure 5 This diagram illustrates the alignment of model output preferences based on DPO. DPO is a reinforcement learning algorithm used to align LLM and human preferences. The core idea of DPO is to model human preferences as a Bradley-Terry model, and by deriving the analytical relationship between the policy and the optimal reward function, transform the reinforcement learning problem into a simple supervised learning problem.
[0053]
[0054] in:
[0055] The main working principle of this invention is to exhaustively simulate scenarios based on the experience of TCM experts. This method efficiently defines the execution logic of TCM expert experience and TCM treatment plans in the form of rules through a TCM syndrome rule base. The definition is based on formal logic, that is, defining the sufficient, necessary, and secondary conditions of syndromes. These annotations are based on TCM knowledge, expert experience, and real clinical cases. A rule-based generation engine is used to generate multiple scenarios from the manually annotated TCM treatment plans, obtaining clinical instances (structured TCM feature sets Xs) with different combinations of clinical manifestations. These structured TCM feature sets are then transformed into simulated TCM medical records written in natural language, with complete structure and content, simulating real clinical scenarios, thereby achieving multi-scenario simulation of TCM expert experience. The simulated medical records, combined with additionally generated multi-task related knowledge question-and-answer pairs, are used to train and construct a customized TCM prescription recommendation model.
[0056] Traditional Chinese medicine (TCM) uses analytical tools such as Yin-Yang, the Eight Principles, Ying-Wei Qi-Xue (nutritive and defensive Qi and blood), the Six Channels, and the Zang-Fu organs to guide diagnosis and treatment. The commonality among these tools lies in deconstructing, combining, summarizing, and deducing different "states" manifested in the human body under disease conditions at a high-dimensional level. Similar expressions to "states" include formula-pattern, syndrome type, and pathogenesis. Different "states" can be combined and superimposed, corresponding to concepts such as addition and subtraction, combined formulas, and complex pathogenesis. Each "necessary element library" and "alternative element library" in the formula-pattern rule base can be considered a "state," and multiple "necessary element libraries" and "alternative element libraries" together form a high-dimensional information set that can represent the experience of TCM experts. The mechanism of expressing expert experience through multiple element libraries is beneficial for expressing certain complex pathogenesis. The basic principle of generating simulated medical cases is to enumerate the different clinical situations corresponding to "states" or "superimposed states," with each situation corresponding to a set of structured TCM feature sets X; then, LLM is used to transform the labeled structured TCM feature set X into medical case data written in natural language. The "enumeration" and "exhaustive enumeration" methods mentioned earlier are difficult to implement in practice. Therefore, a high-frequency sampling approach is adopted to represent the experience of a TCM expert using as many scenarios (cases) as possible. See also Figure 6 . Figure 6 This provides an example of the adaptability of the TCM formula and syndrome rule base to different TCM theoretical systems. For the specific meanings of each database and element, please refer to the "Specific Operation Methods" section.
[0057] Real-world medical case information can be artificially divided into Traditional Chinese Medicine (TCM) knowledge used to explain the condition ("state," "superposition state") and noise. Noise refers to clinical information irrelevant and unimportant to specific medical knowledge when explaining a patient's condition. Noise includes clinical symptoms, signs, triggers, medical history, past medical history, auxiliary examinations, and disease names. TCM knowledge itself generally contains little or no noise. The process of TCM syndrome differentiation and treatment is essentially a process of identifying a certain "state," discerning noise, and prescribing medication. Therefore, appropriate noise should be incorporated when generating simulated medical cases to enable TCM prescription recommendation models to possess the aforementioned capabilities.
[0058] In the process of TCM syndrome differentiation and treatment, the attribute of an element is often determined in conjunction with the context. For example, "aversion to cold" accompanied by "sweating and a floating, slow pulse" is diagnosed as "disharmony of Ying and Wei," while "aversion to cold" accompanied by "absence of sweating and a floating, tight pulse" is diagnosed as "wind-cold binding the exterior." Models using attention mechanisms trained through simulated medical cases exhibit similar feature classification patterns during inference. Since the clinical features of simulated medical cases originate from element combinations, elements pointing to the same attribute under the same rule share similar contexts. After capturing semantic features through the attention mechanism, these elements pointing to the same attribute obtain relatively similar word vectors. During inference, elements with the same attribute have high similarity due to their similar word vectors, thus receiving higher attention scores and weights. Conversely, elements with less similarity receive less attention, thereby achieving attribute judgment of clinical features and prescription decisions (i.e., simulation of the TCM syndrome differentiation and treatment process). See also Figure 7 . Figure 7 This is a 3D visualization of principal component analysis of word vectors from an improved Transformer model trained with a structured TCM feature set X, visualized using the Embedding Projector tool. A represents the distribution of highly related words in the vector space that are semantically similar to "evil wind"; B represents the distribution of highly related words in the vector space that are semantically similar to "bitter mouth".
[0059]
[0060] The following introduces two main paths for generating simulated medical records.
[0061] 1. Generate simulated medical cases based on the experience (TCM knowledge) of TCM experts. Traditional Chinese medicine (TCM) knowledge (experience) existing in the human brain in the form of "states" contains a vast amount of information. However, when this high-dimensional information is written down, information loss is inevitable (see Table 3). If we consider the concurrent symptoms corresponding to the Guizhi Tang formula in clinical practice, the number of case studies is countless. This phenomenon is common in TCM classics, summaries of renowned doctors' experiences, and textbooks. We believe that simple text is not conducive to expressing the high-dimensional, high-information "states" in the human brain. A better writing medium should accurately represent the formula syndrome ("state") and reflect specific cases under different scenarios. This writing medium is the "TCM Formula Syndrome Rule Base" mentioned above. The TCM Formula Syndrome Rule Base uses a rule-based generation engine to enumerate different specific scenarios of "states." Each case approximates a relatively idealized simulated medical case, thereby realizing the generation of simulated medical cases based on TCM knowledge. The generated simulated medical cases are used for fine-tuning training of LLM to achieve the imitation and replication of the experience of TCM experts.
[0062] Table 3 Enumeration of Guizhi Tang (Cinnamon Twig Decoction)
[0063] √: Guizhi Tang is suitable. ?: Further diagnosis is needed.
[0064] 2. Generating simulated medical cases based on real-world medical records Real-world medical cases are often based on specific knowledge, experience, and rules, and therefore possess an underlying "state." However, a single real-world medical case cannot accurately and completely contain all the information about this "state." Real-world medical cases can be generated by the physician through hypothetical simulations of similar but different scenarios. For example, for a given real-world medical case, the physician can, based on experiential knowledge, enumerate other similar conditions for which the same prescription can be used (e.g., modifying individual clinical manifestations in the medical case), or enumerate similar conditions corresponding to the prescription after additions or subtractions.
[0065] Specific operating procedures: S1 Traditional Chinese Medicine Formula and Syndrome Rule Database Compilation Based on the diagnostic and treatment experience of the solution provider, and with reference to relevant literature and medical records in both Chinese and Western medicine, we write customized treatment plans by renowned veteran TCM doctors.
[0066] 1.1. Category: The core problem this rule aims to address is the chief complaint in clinical cases, typically including corresponding symptoms and signs. Multiple unit elements can be separated by semicolons (;). When generating the structured TCM feature set X, one unit element will be extracted as the core problem. To extract multiple elements at once, they can be expressed using ampersands (&). Examples: "Sweating; Spontaneous sweating", "Fever & Cough; Fever & Shortness of Breath".
[0067] 1.2. Essential Element Library (Symptoms and Signs): Used to annotate elements that are necessarily present in this rule. Multiple unit elements are separated by ";". When generating the structured TCM feature set X, all unit elements in this library will be extracted. To express probabilistic situations in unit elements, use the " / " symbol, or directly use the alternative element library. Examples: "Fever; aversion to wind", "Fever; cough / wheezing" 1.3. Candidate Element Library (Symptoms and Signs): Each unit element in the library may or may not exist in a specific TCM feature set X. All unit elements in a candidate element library often share some common attribute (formula, syndrome element, pathogenesis, etc.). In a specific candidate element library, multiple unit elements can be separated by ";". When generating the structured TCM feature set X, one or more unit elements will be extracted. If a candidate element library is marked "null", there is a probability that no element from that library will be extracted when generating the structured TCM feature set X. To express multiple elements in a unit element, allowing multiple elements to appear simultaneously, multiple elements can be connected using "&"; when extracting elements, all elements in that unit element will be extracted as a whole. To express a probabilistic situation in a unit element, the " / " symbol can be used; when extracting elements, one of the elements in that unit element will be extracted. Example: "Chest fullness; wheezing", "Rash; pinpoint rash; rash / pinpoint rash & red rash".
[0068] 1.4. Non-numerical element libraries: These element libraries do not involve numerical sampling and include element libraries for aggravated conditions, precipitating factors, treatments, past medical history, auxiliary examinations, gender, and diseases. The annotation method is the same, and the sampling logic is essentially the same as that for necessary and alternative element libraries, but the specific sampling method needs to be manually specified. When annotating, if the unit element is annotated... <c>This indicates that the unit element must exist, and its property is equivalent to marking the unit element in the necessary element library; if the unit element is marked with this symbol... <ox>(x∈{A, B, C...}, for example) <oa>), indicating all labels specific <ox>The unit elements together form a candidate element library (virtual), and at least one unit element from this candidate element library (virtual) must exist when generating features. If a unit element is labeled... <maj>This indicates that when extracting unit elements from this element library, elements marked with a specified high probability will be extracted. <maj>The unit element is a single, undefined element. To express multiple elements within a unit element, allowing them to appear simultaneously, use "&" to connect them; all elements within the unit element will be extracted as a whole. To express a probabilistic situation within a unit element, use the " / " symbol; only one element from the unit element will be extracted. If no special symbol precedes a unit element, it, along with other unit elements without special symbols in the library, forms a pool of candidate elements marked "null," from which zero or more unit elements are randomly selected. Example: "Atherosclerotic obliterans; Thromboangiitis obliterans; Diabetic gangrene," <c>Sciatica <oa>Chronic obstructive pulmonary disease; <oa>Chronic bronchitis; <oa>"Emphysema", etc.
[0069] 1.5. Numerical Element Library: This type of element library involves numerical sampling within a specific range, including age, onset time, etc. The method for labeling unit elements in numerical element libraries is the same as for non-numerical element libraries. The difference is that all unit elements in numerical element libraries must specify a time range, as a specific time will be sampled from this range when generating the structured TCM feature set X. When labeling the time range, the unit element and the time range are connected by a colon (:), and the time range is written in the format "numerical value" - "unit" -> "numerical value" - "unit". For example, " <maj>Acute course: 1 day -> 14 days; Subacute course: 15 days -> 6 months.
[0070] 1.6. Negative Element Library: This library is used to label specific elements that are not allowed to exist. Multiple unit elements are connected by ";". When generating the structured TCM feature set X, zero or several unit elements are randomly selected and assigned a negative meaning to the elements; at the same time, if there is an intersection between the elements in the structured TCM feature set X and the negative element library, the TCM feature set is skipped and a new round of TCM feature set generation begins.
[0071] 1.7. Precautions Database: This database is used to annotate precautions for taking this prescription, preparation methods, etc. All information in this database will be directly added to the structured TCM feature set X.
[0072] 1.8. Reference Library: All information in this library will be used as reference material when analyzing the medical case using LLM.
[0073] 1.9. Tongue and Pulse Element Database: The tongue image element database includes five sub-element databases: tongue body, coating thickness, coating color, coating moisture, and coating texture. The pulse image element database includes eight sub-element databases: pulse rate, pulse rhythm, pulse position, pulse body, pulse strength, pulse flow, and pulse tension. Clinically common tongue and pulse elements for each dimension are listed in the database (manual additions are possible if needed). Each dimension's tongue and pulse information is treated as a single entity. Specific symbols are used to represent the existence of each element. "T" indicates that the corresponding element exists. If only one element in a dimension is marked "T," it means that element definitely exists. If multiple elements in a dimension are marked "T," then one of them will be selected. If "null" in a dimension is also marked "T," it means that no element may be extracted from that dimension. Additional information can be annotated with special symbols, with the remaining information connected by ";". The database can be divided into three parts. All information in this database can be divided into three parts using semicolons: A. The first part is used to label "T", as above; B. The second part can be labeled... <c> 、 <ox>(x∈{A, B, C...}, for example) <oa>); if marked <c>This indicates that the element must exist, and its property is equivalent to marking the element in the necessary element library; if marked... <ox>, indicating all labels specific <ox>The elements together form a candidate element library (virtual), and at least one element from this candidate element library (virtual) must exist when generating features; C. The third part can label any element, indicating that the existence of the element must be accompanied by the existence of the labeled element.
[0074] 1.10. Prescription Name: The specific prescription corresponding to this rule. If multiple prescriptions are involved, they are connected by ";".
[0075] 1.11. Drugs: Used to indicate the drug, dosage, unit, and decoction method. The above four pieces of information are separated by ";". For example: "Evodia rutaecarpa; 10; g;", "Aconitum carmichaelii; 10; g; decoct first".
[0076] S2's rule-based generative engine generates a set of structured medical features. In the source code cgen, the generate_structured_cases() method can generate a structured TCM feature set Xs according to a specific generation logic based on an existing TCM prescription and syndrome rule library. At the same time, it adds specific requirements for generating medical cases through a dynamic prompt word generator.
[0077] S3 uses a large language model to convert structured medical features into natural language written medical question-and-answer pairs. This document outlines a local deployment workflow for building an open-source large language model. Qwen3-32B-A3B is the lowest-cost known large language model available for this task. It is recommended to use a large language model with equivalent or higher performance than Qwen3-32B-A3B. Hardware configuration should be adjusted based on model parameters; the minimum known equipment configuration is as follows: GPU: A100 40GB × 2 and supporting server equipment, including CPU Intel i7-13700K, 128GB+ DDR4 / DDR5 memory, and 2TB NVMe SSD storage. Software configuration includes Limux system, Python: 3.10, CUDA 12.5, cuDNN version matching CUDA, PyTorch and related dependencies. The large model sampling parameters are as follows: 'temperature': 0.3, 'top_p': 0.9, 'top_k': 50, 'repetition_penalty': 1.1. In the source code cgen, the cg.generate_with_LLM() method enables LLM to convert structured TCM features into medical records written in natural language. The medical record question-answer pairs are generated through a multi-stage process. When generating the medical record, the mod parameter is specified as 'simulated_case'; when generating the corresponding answer, the mod parameter is specified as "output".
[0078] S4 Data Cleaning and Filtering The generated simulated medical records are cleaned using the `clean_data` module in the source code. The cleaning process is performed in stages, separating the questions and answers from the simulated TCM medical records. Cleaning is primarily accomplished through keyword matching; recommended keywords for cleaning are listed below. Alternatively, you can build your own code for cleaning as needed.
[0079] S5 uses generated TCM medical record data to train a large language model. 5.1 LoRA Fine-tuning Fine-tune the 7B general model or the TCM vertical domain model using generated data. Qwen2.5 7B is the lowest-performing LLM known to achieve this task; it is recommended to use Qwen2.5 7B or a better-performing LLM for training. Training uses LoRA fine-tuning with hyperparameters set to r=128, α=256, and dropout=0.1. The training set contains 90% generated medical records in question-and-answer format and 10% general question-and-answer data. Other multi-task learning data can also be added, such as clinical information-prescription mapping tasks, clinical information prediction tasks, and element-related knowledge question-and-answer tasks. Relevant real-world medical records can also be added. Question-and-answer pairs generated based on existing relevant literature can also be added.
[0080] 5.2 Direct Preference Optimization (Optional, Recommended) Based on the aforementioned finely tuned expert-customized large model, DPO was performed using manually modified generative simulated medical records and unmodified generative simulated medical records to achieve model output preference alignment.
[0081] S6 Large Language Model Call When calling the fine-tuned LLM, the recommended parameters are as follows: temperature=0.1, top_p=0.90, top_k=10, repetition_penalty=1.1. See 17 for the effect.
[0082] Example 1: 1. Model Example Construction The *Shanghan Lun* and *Jinkui Yaolue* are recognized as among the most complex and representative diagnostic and treatment systems in Traditional Chinese Medicine (TCM). They exhibit low heterogeneity among TCM practitioners, making them suitable for objectively evaluating the feasibility and efficacy of proposed methods. This invention manually constructs a TCM formula and syndrome rule base for the *Shanghan Lun* and *Jinkui Yaolue* according to a predetermined format. The content includes the original texts of the *Shanghan Lun* and *Jinkui Yaolue*, annotations by renowned physicians throughout history, and relevant literature reviews. Simultaneously, TCM formula and syndrome rules are compiled based on real-world TCM medical cases to present the clinical experience contained within these cases. To expand the model's application scope and enhance its generalization ability, this invention additionally annotates prescription modification schemes. More than 2000 TCM formula and syndrome rules were manually compiled, as detailed in the supplementary materials. All TCM formula and syndrome rules were written by experienced registered TCM physicians, with some rules further revised based on the physicians' personal experience. To generate a large number of simulated medical cases, a locally deployed open-source LLM Qwen3-32B-A3B is used to build the workflow. Based on over 2000 TCM syndrome differentiation rules, 3GB of simulated TCM medical case question-and-answer pairs were generated for model fine-tuning. Finally, the generated data was used to fine-tune the Qwen2.5 7B general model using LoRA. The training data consisted of 90% generative simulated TCM medical cases and 10% general data.
[0083] Furthermore, to verify whether the constructed structured TCM feature set X can approximately reflect the TCM diagnostic and treatment thought process in the human brain, we also constructed an improved Transformer model based on an encoder-decoder architecture and trained it using structured TCM features. This model is not a natural language processing model, but a mapping model built based on standardized feature vocabulary, containing a total of 8 million trainable parameters. Model training began with random parameter initialization. Figure 8 As shown in the figure. 'Represents the sequence of chief complaints,' 'This represents a medical record sequence; neither uses positional coding.' ' represents the output sequence containing positional encoding. The training data uses a structured TCM feature set X instead of natural language; the input is medical case features, and the output is a TCM prescription.
[0084] 2. Test Data Real-world clinical cases were randomly selected from *A Record of One-Dose Cures from Famous Prescriptions by Physicians Throughout History* for model testing. This book systematically records hundreds of clinical cases where traditional Chinese medicine (TCM) physicians achieved satisfactory results using prescriptions from *Shanghan Lun* and *Jinkui Yaolue*. The prescriptions are recorded in random order, which helps reduce selection bias. Furthermore, the inclusion of clinical cases from hundreds of different physicians facilitates the evaluation of the model's generalization ability. *A Record of One-Dose Cures from Famous Prescriptions by Physicians Throughout History* was not referenced or used in the development of this TCM prescription recommendation model.
[0085] When including medical records, they were arranged in the original order of the book according to the inclusion criteria. The inclusion criteria were: ① recorded in "Records of One-Dose Cures from Famous Physicians of All Dynasties"; ② the prescription used was from "Treatise on Cold Damage" or "Essential Prescriptions of the Golden Chamber". The exclusion criteria included: ① lacking essential information for diagnosis such as tongue and pulse examination; ② containing obvious errors, contradictions, or unclear descriptions; ③ prescriptions involving the addition or subtraction of 5 or more drugs; ④ duplicate inclusion of medical records.
[0086] 3. Evaluation Process The following eight groups of prescriptions were compared: original prescriptions from medical records (original prescription group, OPG), prescriptions generated by Qwen2.5 7B trained with generative data (trained Qwen group, TQwG), original prescriptions generated by Qwen2.5 7B (original Qwen group, OQwG), prescriptions generated by a modified Transformer model trained with structured TCM feature set Xs (modified Transformer group, MTG), prescriptions generated by an existing TCM prescription recommendation model (developed by Dajing TCM) (existing model group, EMG), and prescriptions written by three graduate students specializing in *Shanghan Lun* and *Jinkui Yaolue* (graduate student groups -1 / -2 / -3, denoted as SG-1, SG-2, and SG-3, respectively). All prescriptions were scored by experienced registered TCM physicians who were not involved in the study design. Blinding was used for the evaluators regarding group assignments during the scoring process. This invention uses prescription rationality scoring to evaluate the feasibility of this technology and the performance of the model. The rationality score comprises five dimensions: adherence to the principles of syndrome differentiation and treatment, recommendation level, formula identification, prescription modifications, and violation of contraindications. The scoring criteria for each dimension are shown in Table 4. The evaluation process is detailed in [link to evaluation process]. Figure 9 . Figure 9 Some prescription results from EMG were lost.
[0087] Table 4. Prescription Rationality Scoring Table
[0088] Remark: 1. All indicators are scored based on the doctor's personal experience, classic Chinese medicine texts, literature reports, and clinical research; 2. Conforming to the principles of syndrome differentiation and treatment means that the prescription and the medical record reflect the same TCM pathogenesis, including the nature of the pathogenic factors, the location of the disease, the nature of the disease, and the relationship between the victory of pathogenic factors and the outcome of the treatment.
[0089] 4. Statistical Analysis Since the prescription rationality score data did not meet the normality assumption, the Friedman test was used for repeated measures analysis. Post-hoc pairwise comparisons were performed using the Wilcoxon signed-rank test, and multiple test corrections were applied using the Benjamini-Hochberg method (FDR = 0.05). All quantitative results were expressed as medians (interquartiles) for intergroup comparisons. The statistical significance threshold was set at 5%, and two-sided 95% confidence intervals were calculated for all estimates.
[0090] 5. Ablation test To evaluate the contribution of different data to model training, we conducted ablation experiments on training data combinations. The data included complete generative simulated medical records and general question-answering data. In the ablation experiments, we used manually revised simulated TCM medical records as a benchmark, employing ROUGE-L and Jaccard similarity to measure the model's fit to the proposed TCM treatment plan. Simultaneously, we assessed the degradation of the basic model capabilities using the following benchmarks: HellaSwag, WinoGrande, ARC-c, ceval, and ceval-hard. HellaSwag was used to assess English contextual understanding and common-sense reasoning abilities; WinoGrande was used to assess common-sense reasoning abilities based on denotation in English contexts; ARC-c was used to assess scientific reasoning abilities in English contexts; ceval was used to assess multidisciplinary reasoning abilities in Chinese contexts; and ceval-hard was used to assess reasoning abilities in difficult subjects in Chinese contexts, including mathematics, statistics, physics, and chemistry. All model degradation metrics were calculated using the OpenCompass evaluation framework.
[0091] 6. Results 153 clinical cases were sequentially selected from *Records of One-Dose Cures by Famous Physicians Throughout History*. 49 cases were excluded based on the exclusion criteria, leaving 104 cases for model evaluation. See also... Figure 9 See the example of model invocation. Figure 10 , Figure 11 .
[0092] 6.1 Prescription rationality score based on manual evaluation See Figure 12, where, Figure 12A Including A1 and A2; Figure 12B Including B1 and B2; Figure 12C Including C1 and C2; Figure 12D Including D1 and D2, the above images are stacked bar charts representing the scores for adherence to the principles of syndrome differentiation and treatment, recommendation, prescription recognition, and prescription addition / subtraction. In the charts, 0, 1, 2, and 3 represent the scores given by the raters to the prescriptions in that dimension. * indicates a significant difference (p < 0.05), ** indicates a significant difference (p < 0.01), *** indicates a significant difference (p < 0.001), and ns indicates no statistical difference. E1 is a violin plot of the total prescription rationality score. The solid line in the violin plot represents the median (Q2), and the upper and lower dashed lines represent the upper quartile (Q3) and lower quartile (Q1), respectively. A2-E2 are heatmaps comparing the p-values of the scores for adherence to the principles of syndrome differentiation and treatment, recommendation, prescription recognition, and prescription addition / subtraction.
[0093] The TQwG performed significantly better than the baseline OQwG on the assessment set. Significant differences were found between TQwG and OQwG in terms of adherence to the principles of syndrome differentiation and treatment (P<0.001), recommendation score (P<0.001), prescription identification score (P<0.01), and total prescription rationality score (P<0.001). The percentage of prescriptions adhering to the principles of syndrome differentiation and treatment (adherence score ≥2) in TQwG was 82.7%, while the percentage in baseline OQwG was 61.5%. The percentage of prescriptions recommended by assessors (recommendation score ≥2) in TQwG was 75.0%, while the percentage in baseline OQwG was 52.9%. The percentage of identifiable prescriptions in TQwG was 100.0%, while the percentage in baseline OQwG was 86.5%. Although there was no statistically significant difference in addition and subtraction scores between TQwG and OQwG (P≥0.05), TQwG showed an increase in the percentage of correct additions and subtractions compared to baseline OQwG (53.8% vs 42.3%). The percentage of prescriptions deemed to violate contraindications by raters was 1.0% on TQwG, compared to 9.6% on OQwG.
[0094] The percentages of prescriptions following the principles of syndrome differentiation and treatment (with a compliance score ≥ 2) for TQwG, MTG, OPG, SG-1, SG-2, and SG-3 were 82.7%, 76.0%, 72.1%, 72.1%, 62.5%, and 74.0%, respectively. The percentages of prescriptions not following the principles of syndrome differentiation and treatment (with a compliance score == 0) were 4.8%, 6.7%, 6.7%, 8.7%, 16.3%, and 7.7%, respectively. (See Figure 12 (A1)). The percentages of prescriptions recommended by assessors for TQwG, MTG, OPG, SG-1, SG-2, and SG-3 were 75.0%, 69.2%, 64.2%, 71.2%, 60.6%, and 73.1%, respectively. The percentages of prescriptions not recommended (with a recommendation score == 0) were 4.8%, 7.7%, 7.7%, 9.6%, 15.4%, and 8.7%, respectively. Referring to Figure 12 (A2), the percentages of identifiable prescriptions for TQwG, MTG, OPG, SG-1, SG-2, and SG-3 were 100%, 98.1%, 98.1%, 99.0%, 99.0%, and 99.0%, respectively; the percentages of correct addition and subtraction were 53.8%, 34.6%, 35.6%, 36.5%, 28.8%, and 42.3%, respectively; and the percentages of prescriptions that violated contraindications were 1.0%, 1.9%, 2.9%, 2.9%, 2.9%, and 1.9%, respectively.
[0095] MTG showed no statistically significant differences compared to OPG, SG-1, SG-2, and SG-3 in terms of adherence to the principles of syndrome differentiation and treatment, recommendation score, formula identification score, addition and subtraction score, and total score of prescription rationality (P≥0.05). See Figure 12 (A2-E2).
[0096] 6.2 Ablation Experiment of Training Data Contribution See Figure 13 Including A and B. The ablation experiment results represent the fit of the customized TCM treatment plan. Figure 13 A represents the test results using a manually modified simulated medical case (full text) as the benchmark; the full text includes the reasoning process of syndrome differentiation and treatment, and the specific prescription. B represents the test results using a manually modified simulated medical case (prescription only) as the benchmark. In the icon, "Simulated Medical Case + General Questions and Answers" refers to the response output by the qwen2.5 7B model trained with the corresponding data. The baseline is the response output by the qwen2.5 7B general LLM.
[0097] In the evaluation using manually modified simulated medical records (full text) as the benchmark, the general question-and-answer data improved the ROUGE-L (F1) value by 0.002 to 0.019, with an average improvement of 0.009. In the evaluation using manually modified simulated medical records (prescriptions only) as the benchmark, the Jaccard similarity changed between -0.005 and +0.023 after introducing the general question-and-answer data, with an average improvement of 0.006.
[0098] 6.3 Model Degradation Evaluation and Ablation Experiment Figure 14 The ablation experiment results represent the model degradation. Figure 14 Figures A1, A2, A3, B1, and B2 are included, where figures A1, A2, and A3 represent LLM benchmark results in an English context, and figures B1 and B2 represent LLM benchmark results in a Chinese context. The icons and baselines have the same meaning. Figure 13 The provided A and B.
[0099] In HellaSwag, an assessment of English contextual comprehension and common sense reasoning abilities, the Qwen model with simulated medical case adjustments showed a 1.7–2.2% decrease in accuracy compared to the baseline (original Qwen model, hereinafter the same), with an average decrease of 2.0%. Adding general question-and-answer data improved accuracy by 1.5–1.9%, with an average improvement of 1.7. See [link / reference]. Figure 14 In the WinoGrande test, which assesses English pronoun resolution ability, the Qwen model, which simulates medical case adjustments, showed a 3.3–6.3% decrease in accuracy compared to baseline, with an average decrease of 5.2%. Adding general question-and-answer data improved accuracy by 2.8–5.3%, with an average improvement of 4.3. See [link / reference]. Figure 14 In the A2 test, the ARC-c test assessing scientific reasoning in English-speaking contexts, the Qwen model with simulated medical case adjustments showed a 7.5–9.9% decrease in accuracy compared to baseline, with an average decrease of 8.4%. Including general question-and-answer data further reduced accuracy by 12.5–19.4%, with an average further decrease of 15.5. See also... Figure 14 A3.
[0100] In the CEVA test, which assesses multidisciplinary reasoning ability in a Chinese context, the Qwen model, which simulates fine-tuning of medical cases, showed an accuracy variation of -0.6 to +1.0 compared to the baseline, with an average decrease of 0.4. Adding general question-and-answer data improved accuracy by 0.3 to 0.6, with an average improvement of 0.5. See also... Figure 14 In the B1 level, in the ceval-hard test assessing difficult multidisciplinary reasoning ability in a Chinese context, the Qwen model with simulated medical case fine-tuning improved accuracy by 1.8–3.2 compared to the baseline, with an average improvement of 2.2; adding general question-and-answer data further improved accuracy by 0.3–4.8, with an average improvement of 2.4. See also Figure 14 B2.
[0101] In summary, simulated medical case studies decreased the accuracy of general assessment tasks related to English by 1.7 to 9.9, and affected the accuracy of general assessment tasks related to Chinese by -3.2 to +1.0. Except for the ARC-c assessment, general question-and-answer data was beneficial to improving the accuracy of other general assessments (by 0.3 to 5.3). When simulated medical case studies were combined with general question-and-answer data for training, the accuracy of general assessment tasks related to English changed by -0.5 to +2.1, and the accuracy of general assessment tasks related to Chinese changed by -6.6 to +0.3.
[0102] 6.4 The results show that the generative simulation of TCM medical case fine-tuning LLM can significantly improve the performance of LLM in processing TCM prescription recommendations within a specific domain, especially in adhering to the principles of syndrome differentiation and treatment, prescription recommendation rate, and prevention of fictitious prescriptions. It also shows varying degrees of improvement in prescription modification and avoidance of contraindications. When processing TCM medical cases in a specific domain, the prescription recommendation model constructed based on this method performs comparably to or even better than that of TCM graduate students and even licensed physicians in terms of overall performance, adherence to the principles of syndrome differentiation and treatment, prescription recommendation rate, prescription recognition rate, prescription modification, and avoidance of contraindications. The phenomenon that the OPG score did not reach the optimal level but the actual clinical efficacy was satisfactory is attributed to the differences in knowledge and experience among different TCM physicians.
[0103] There were no statistically significant differences in scores across all dimensions between MTG and OPG, SG-1, SG-2, and SG-3. This indicates that, without relying on the inherent knowledge of LLM, the training paradigm of exhaustive scenario simulation based on the experience representation of TCM experts, combined with the attention mechanism of Transformer, can effectively simulate TCM syndrome differentiation and treatment. TQwG outperformed MTG in several aspects, including adherence to syndrome differentiation and treatment principles, recommendation scores, and addition / subtraction scores, with statistically significant differences. This suggests that LLM's natural language processing capabilities, reasoning abilities, and inherent knowledge contribute to the model's ability to better fit customized TCM treatment plans.
[0104] The impact of generative simulated medical cases on the original LLM performance, when fine-tuned using LoRA, is within an acceptable range (English context +1.7~+9.9, Chinese context -3.2~1.0). If combined with general question-answering data, the performance degradation can be further narrowed (English context -0.5~+2.1, Chinese context -6.6~+0.3), especially in the Chinese context where the degradation is almost negligible. The possible reasons why general question-answering data leads to a significant decrease in reasoning ability in the scientific domain in the English context are as follows: ① General question-answering data contains a large amount of mathematical and programming data, which differs from natural language. Studies have shown that this type of data significantly reduces the model's performance in natural language; ② General question-answering data only involves Chinese corpora and does not involve English or other languages. Therefore, further designing the composition of general question-answering data may further reduce model degradation.
[0105] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.< / ox> < / ox> < / c> < / oa> < / ox> < / c> < / maj> < / oa> < / oa> < / oa> < / c> < / maj> < / maj> < / ox> < / oa> < / ox> < / c>
Claims
1. A customized TCM prescription recommendation model based on generative simulated medical records, characterized by: Using the basic method of exhaustive scenario simulation, and based on the characteristics of TCM theory and syndrome differentiation, we construct an integrated system for knowledge annotation and simulated medical case generation that can accurately and efficiently represent TCM diagnosis and treatment experience. This paper proposes a customized TCM prescription recommendation system by generating simulated medical case data and multi-task learning data that reflect the experience of TCM experts, and using generative data to train and fine-tune an LLM. The technical solution includes the following modules: Module 1: Obtaining a structured TCM feature set based on a TCM syndrome rule base and generation engine; Module 2: Generating training data based on a large language model; Module 3: Training a customized TCM prescription recommendation large model based on the generated data.
2. The model construction method as described in claim 1, characterized in that, Module 1, the rule-based generation engine, aims to exhaustively generate multiple sets of structured TCM feature sets based on manually annotated customized TCM diagnosis and treatment plans; this generation engine is developed based on formal logic.
3. The model construction method as described in claim 1, characterized in that, Module 2, through prompt word engineering, uses LLM to transform structured TCM feature sets into simulated TCM medical records written in natural language to acquire training data; simultaneously, it acquires other multi-task training data related to the TCM prescription and syndrome rule base.
4. The model construction method as described in claim 1, characterized in that, Module 3 uses generated data to fine-tune the training of LLM to obtain a customized TCM prescription recommendation model; during the training process, LoRA (Low-Rank Adaptation) fine-tuning and Direct Preference Optimization (DPO) are used.