A traditional Chinese medicine intelligent auxiliary diagnosis system based on a decoupled double engine
Patent Information
- Application Number
- CN202611295966.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-10-27
AI Technical Summary
在该架构下,专家推理生成引擎的核心瓶颈在于:中医辨证缺乏可用的自动奖励函数(辨证正确性高度依赖上下文和专家判断,无法用简单规则打分),导致在线强化学习(RLHF,即基于人类反馈的强化学习;GRPO,即组相对策略优化)本质上不可行
[0034]效果一:双引擎解耦降低幻觉风险,提升输出一致性与可解释性。通过将"判别"与"解释"分离,诊断结论的产生过程完全由知识图谱的符号化推理完成,过程透明、结果可复现;专家推理生成引擎(第二引擎)仅在已有结构化结论的约束下进行自然语言生成,显著降低了无中生有、虚构内容的风险。医生可以清晰追溯每一个结论的证据来源和推理路径,满足医疗场景对决策可审计性的严格要求。
Smart Images

Figure CN122991556A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent diagnosis and treatment technology in traditional Chinese medicine, specifically to an intelligent auxiliary diagnosis system for traditional Chinese medicine based on a decoupled dual-engine architecture, and particularly to an offline optimization training method for the dialectical reasoning model deployed by the expert reasoning generation engine in this system. Background Technology
[0002] With the development of artificial intelligence technology, introducing intelligent algorithms into TCM-assisted diagnosis has become a research hotspot. Existing TCM consultation solutions based on knowledge graphs typically employ single-weighted or unweighted graphs, or while using bidirectional weights, the follow-up inquiry strategy uses a maximum value aggregation method, and the stopping mechanism is based on score difference judgment. The maximum value aggregation method tends to select the symptom that "strongly supports the current first symptom and widens the gap with the second symptom" as the next follow-up target, which may lead to prematurely locking onto a single candidate symptom and ignoring other possibilities; the score difference-based stopping method relies on the score difference between the first and second symptoms, but a large score difference does not necessarily mean that the absolute confidence of the first symptom is high—a large score difference between two low-scoring symptoms may lead to a misjudgment as high confidence and premature stopping.
[0003] Furthermore, existing solutions directly use general models or TCM-based models that have not undergone specialized training in dialectical reasoning for diagnostic interpretation. While these models possess basic TCM knowledge, they lack a systematic pattern of dialectical reasoning behavior (combined diagnosis of the four diagnostic methods → etiology and pathogenesis → syndrome induction), and their output quality highly depends on cue word engineering rather than internalized reasoning ability.
[0004] Therefore, there is an urgent need for a TCM intelligent auxiliary diagnostic system that separates the "discrimination" task (handled by a knowledge graph reasoning engine) from the "interpretation" task (handled by an expert reasoning generation engine) in the diagnostic process. This would ensure that the discrimination logic is deterministic and traceable, and that the interpretation generation is constrained by structured evidence to avoid illusions. Under this architecture, the core bottleneck of the expert reasoning generation engine lies in the lack of a usable automatic reward function for TCM syndrome differentiation (the correctness of syndrome differentiation highly depends on context and expert judgment, and cannot be scored using simple rules), making online reinforcement learning (RLHF, i.e., reinforcement learning based on human feedback; GRPO, i.e., group relative policy optimization) inherently infeasible. Therefore, there is an urgent need for an offline optimization training method for the model that can achieve reasoning ability transfer in the TCM field, enabling the engine to possess internalized syndrome differentiation reasoning capabilities. Summary of the Invention
[0005] Purpose of the invention: The technical problem to be solved by the present invention is to provide a TCM intelligent auxiliary diagnosis system based on a decoupled dual-engine, which addresses the shortcomings of the existing technology.
[0006] To address the aforementioned technical issues, this invention discloses a decoupled dual-engine intelligent auxiliary diagnostic system for Traditional Chinese Medicine (TCM). The system separates the "discrimination" and "interpretation" processes in diagnosis into two independent engines: the first engine (a knowledge graph reasoning engine) is responsible for symbolic reasoning based on asymmetric bidirectional edge weights, outputting structured diagnostic data; the second engine (an expert reasoning generation engine) deploys an offline-optimized and trained dialectical reasoning model, generating dialectical conclusions and explanatory texts under evidentiary constraints. The two engines interact via a structured constraint protocol, ensuring that the generated content does not exceed the scope of the knowledge graph's evidence chain.
[0007] A decoupled dual-engine TCM intelligent auxiliary diagnostic system is proposed. The system includes: a first engine, a knowledge graph reasoning engine, responsible for symbolic reasoning based on structured knowledge, completing symptom standardization, disease candidate screening, dynamic follow-up questioning, and decision-making, and outputting structured diagnostic results with confidence ranking; and a second engine, an expert reasoning generation engine, responsible for natural language generation under the guidance of structured constraint context, outputting explanatory text and treatment suggestions that conform to TCM syndrome differentiation thinking; the two engines interact with each other through a defined structured intermediate representation.
[0008] The system is characterized by the following information processing steps:
[0009] Step 1: Receive and preprocess multiple modalities of patient condition information from the user;
[0010] Step 2: Perform categorized symptom extraction on the inputs of different modalities to obtain the extraction results carrying categorization labels;
[0011] Step 3: Encode each symptom phrase into a semantic vector to obtain a standard symptom vector library, which includes three independent type subspaces: common symptoms, tongue symptoms, and pulse symptoms.
[0012] Step 4: Calculate the cosine similarity within the subspace and filter out standard symptom nodes using a confidence threshold determination mechanism;
[0013] Step 5: Combine the set of standard symptom nodes selected in Step 4. Input the knowledge graph reasoning engine to retrieve all sets in the graph. The standard symptom nodes in the dataset contain disease nodes that are "accompanied" by associated edges, forming the initial candidate disease set. ;
[0014] Step 6: For each disease node in the initial candidate disease set Calculate its confidence score Based on the principle of maximizing information gain, the top scorers are selected. One as a candidate disease symptom in the head ;
[0015] Step 7: Determine whether the highest confidence score of the disease in the initial candidate disease set reaches the dynamic stopping threshold. If the condition is met, then stop asking further questions; otherwise, consider it a potential diagnosis. Fill in the symptoms in the template to form follow-up questions;
[0016] Step 8: Summarize the structured information generated throughout the consultation process, generate a structured constraint context, convert it into prompt text, and input it into the expert reasoning generation engine to generate dialectical conclusions and explanatory text.
[0017] The knowledge graph inference engine is characterized in that the knowledge graph contains nodes: disease nodes, symptom nodes, treatment nodes, and prescription nodes; the treatment nodes are connected to the corresponding disease nodes through "treatment" edges; the prescription nodes are connected to the corresponding disease nodes through "treatment" edges; the edge relationships include: "accompanied" edges, "accompanied" edges, and "treatment" edges.
[0018] The weight of the "accompanying" edge The calculation rule is: based on symptoms Distribution concentration among all related diseases: if It has a high ability to differentiate diseases when associated with only a very small number of symptoms. A broad association with a large number of diseases and syndromes results in low differentiation ability, that is, based on symptoms alone. The reciprocal of the total number of associated diseases and symptoms was determined after normalization, and then fine-tuned and calibrated by experts based on clinical experience; the weight of the "accompanying" edge. The values are assigned based on the numerical definitions of the "primary symptoms," "secondary symptoms," and "concurrent symptoms" of diseases and syndromes in TCM textbooks and clinical guidelines, and are then reviewed and adjusted by experts based on the actual frequency of occurrence in clinical cases.
[0019] The confidence threshold determination mechanism in step 4 is as follows: when the highest cosine similarity is less than the cosine similarity threshold, the symptom corresponding to the highest cosine similarity is marked as a low-confidence match. The system prompts the user with the name and similarity score of the best match through the interface, and suggests that the user confirm, supplement the description or manually select the closest option. This symptom does not directly enter the high-confidence standard symptom set to participate in subsequent inference.
[0020] The dynamic stopping threshold is adaptively and dynamically adjusted based on the highest confidence score of the current symptom. :
[0021]
[0022]
[0023] in, Indicates the first Candidate disease syndrome The confidence score, Indicates the first The symptom cluster has been confirmed to exist in the round. Indicates symptoms To the disease symptoms The association weight is taken from the directed edge "accompanying". The weight value, Let t be the threshold for stopping the game in round t. The upper limit of the threshold, and For adjustment coefficients, Indicates the first Round all candidate diseases confidence score Take the maximum value, which is the highest confidence level.
[0024] The expert reasoning generation engine described in step 8 is constructed using an offline optimization training method that bypasses online reinforcement learning:
[0025] Step 8-1: Use the teacher model to sample TCM syndrome differentiation questions in multiple rounds. For each question, generate multiple candidate outputs. Each candidate output contains a thinking segment reflecting the syndrome differentiation reasoning process and an answer segment reflecting the diagnostic conclusion.
[0026] Step 8-2: Use the rule-based scoring function to evaluate the quality of each candidate output, select high-dominance samples, and construct a GRPO-like supervised dataset;
[0027] Step 8-3: Using the base model that has completed incremental pre-training in the field of traditional Chinese medicine as the initial model, perform standard supervised fine-tuning on the GRPO-like supervised dataset. The optimization objectives include three dimensions: answer accuracy, reasoning quality, and output distribution alignment, to obtain a reasoning model with dialectical reasoning ability.
[0028] The accuracy of the answer is: the cross-entropy loss between the answer segment output by the model and the answer segment of the high-dominance sample in the dataset is calculated to ensure that the TCM diagnostic conclusions and professional expressions generated by the model are consistent with the selected high-quality outputs; the quality of the reasoning process is: the cross-entropy loss between the thinking segment output by the model and the thinking segment of the high-dominance sample in the dataset is calculated; the alignment of the output distribution is: the KL divergence between the probability distribution of the student model output and the distribution of GRPO-like data is calculated.
[0029] GRPO-like offline optimization training objective function:
[0030]
[0031] in, To answer the question of segment cross-entropy loss, For the cross-entropy loss of the inference segment, Output distribution for teacher model With student model output distribution KL divergence between them , , These are the weighting coefficients.
[0032] The expert reasoning generation stage introduces a controllable reasoning length mechanism: During the training stage, general reasoning data is filtered according to the upper limit of the number of output tokens, and only samples with output length within the specified range are retained; During the reasoning stage, two reasoning modes are distinguished by prompt templates: (a) Standard reasoning mode: outputs complete diagnostic ideas, etiology and pathogenesis analysis, syndrome induction, prescription suggestions, medication precautions and lifestyle regulation suggestions; (b) Concise reasoning mode: outputs only the core diagnostic conclusions and brief treatment points.
[0033] Beneficial effects:
[0034] Effect 1: Dual-engine decoupling reduces the risk of hallucinations and improves output consistency and interpretability. By separating "discrimination" from "interpretation," the process of generating diagnostic conclusions is entirely completed by symbolic reasoning from the knowledge graph, ensuring transparency and reproducibility of results. The expert reasoning generation engine (the second engine) generates natural language only under the constraints of existing structured conclusions, significantly reducing the risk of fabricated or fictitious content. Doctors can clearly trace the source of evidence and reasoning path for each conclusion, meeting the stringent requirements for auditability in medical settings.
[0035] Effect 2: Graph Weighted Follow-up Questioning Strategy Improves Diagnosis Efficiency. The dynamic follow-up questioning mechanism of this invention adaptively selects questions based on the topological structure and edge weight distribution of the current candidate disease set, rather than using a fixed template. Within a limited number of consultation rounds, the system prioritizes asking questions about the most valuable, highly discriminative symptoms for differentiating head candidate diseases, avoiding redundant questions irrelevant to the current case, significantly improving information gain and diagnostic convergence speed per unit round. Specific default values for follow-up questioning parameters: number of head candidate diseases. Maximum number of follow-up questions In a typical gynecological diagnostic scenario, the system can determine the final diagnosis within an average of no more than 5 rounds of follow-up questioning, reducing the number of follow-up questioning rounds by about 40% compared to a fixed template approach.
[0036] Effect 3: Multimodal fusion and semantic alignment improve mapping accuracy. By categorizing symptoms into common symptoms, tongue symptoms, and pulse symptoms, and performing vector similarity matching within the corresponding subspaces, cross-matching errors between different symptom types are effectively avoided. Simultaneously, a low-confidence prompt mechanism is introduced to proactively prompt users for confirmation regarding inputs with ambiguous semantic boundaries, reducing the risk of mismatches caused by terminological ambiguity and improving the accuracy of standardized image input.
[0037] Effect 4: Dynamic thresholding balances convergence speed and confidence. Compared to fixed threshold schemes, dynamic thresholding adaptively adjusts the stopping criteria based on the current level of evidence. It allows for earlier convergence in typical cases with sufficient evidence, reducing unnecessary follow-up questions; and it allows for further inquiry in complex cases with insufficient evidence, avoiding hasty low-confidence conclusions. This mechanism achieves a balance between diagnostic efficiency and diagnostic reliability.
[0038] Effect 5: The GRPO-like offline optimization training method reduces the cost of expert model construction and improves local deployability. Compared with the online reinforcement learning alignment method, the GRPO-like offline optimization method of this invention adopts a supervised fine-tuning paradigm, replaces reward scoring with data screening, and has a stable training process, fast convergence speed, and simple hyperparameter tuning. By transferring the dialectical reasoning ability of the teacher model DeepSeek-R1 to the lightweight student model BianCang-Reasoner-7B-Instruct, the number of parameters of the student model can be reduced to one-tenth of that of the teacher model, and it can be deployed locally on ordinary servers through the vLLM inference framework, meeting the computing power constraints and data privacy requirements of grassroots medical institutions. The teacher model used in the distillation training is DeepSeek-R1 (DeepSeek-AI, 2025), and the student model is BianCang-Reasoner-7B-Instruct (with approximately 7 billion parameters, which is about one-tenth of the number of parameters of the teacher model). The default values of the weights of each loss term in the distillation training objective function (formula (8)) are: (Answer paragraph loss) (Inference segment loss) (KL divergence).
[0039] Effect Six: Controllable Inference Length Reduces Resource Consumption. By filtering training data length and switching inference modes, the system can adopt a simplified inference mode in scenarios that do not require detailed explanation (such as rapid pre-screening), significantly reducing token consumption and response latency; in scenarios that require detailed explanation (such as doctor review), it can switch to the standard inference mode to output complete content. The two modes maintain consistent diagnostic conclusions, differing only in the level of detail in the explanation.
[0040] Effect Seven: Structured Constraint Hint Protocol Ensures Evidence Consistency. This invention defines a structured intermediate representation protocol between the knowledge graph reasoning engine (first engine) and the expert reasoning generation engine (second engine), explicitly constraining the scope of information that the expert reasoning generation engine (second engine) can use. This protocol strictly limits the generated results to the range supported by the knowledge graph evidence chain, avoiding inconsistencies such as "conclusion says A but explanation mentions B," and facilitating doctors to quickly verify the accuracy of the generated content.
[0041] Effect 8: Traceable evidence chain supports medical quality control and teaching applications. The system records and visualizes the entire diagnostic process in a structured manner, including symptom mapping relationships, changes in disease and syndrome scores, follow-up questioning, and user responses, forming a complete diagnostic evidence chain. This evidence chain can not only be used for physician review and medical quality control audits, but also serve as typical case materials in medical education, helping students understand the reasoning process of traditional Chinese medicine diagnostic thinking. Attached Figure Description
[0042] Figure 1 This is a schematic diagram of the knowledge graph constructed in this embodiment.
[0043] Figure 2 This is an auxiliary diagnostic effect diagram of this embodiment.
[0044] Figure 3 This is another auxiliary diagnostic effect diagram in this embodiment. Detailed Implementation
[0045] Overall Solution Overview: A decoupled dual-engine architecture is constructed to separate the "discrimination" and "interpretation" tasks in the diagnostic process. The first engine is a knowledge graph reasoning engine, responsible for symbolic reasoning based on structured knowledge, completing symptom standardization, candidate disease screening, dynamic follow-up questioning, and decision-making, outputting structured diagnostic results with confidence ranking. The second engine is an expert reasoning generation engine, responsible for natural language generation under the guidance of structured constraint context, outputting explanatory text and treatment suggestions that conform to the diagnostic thinking of traditional Chinese medicine. The two engines interact with each other through a clearly defined structured intermediate representation, ensuring both the interpretability and stability of the reasoning process and retaining the flexibility and naturalness of the generation process.
[0046] The specific technical solution can be broken down into the following components:
[0047] Component 1: Construction of multimodal input links.
[0048] The system uniformly receives and preprocesses various modalities of patient information from users, including at least common symptom text (such as chief complaint, present illness, and past medical history), and optional tongue images (photos of the patient's tongue), tongue image text descriptions (user-generated descriptions of the tongue's texture, coating, and shape), and pulse image text descriptions (user-generated descriptions of the pulse's location, rate, shape, and strength). The system performs type labeling on each modal of data, laying the foundation for subsequent categorized processing.
[0049] Component 2: Construction of standardized symptom pathways.
[0050] For inputs of different modalities, categorical symptom extraction is performed, breaking down continuous text or image information into discrete symptom phrase units. Symptom extraction is performed by the large language model qwen-max deployed on Alibaba Cloud (temperature=0.0, ensuring output determinism). Category-related prompts guide the model to focus on corresponding symptom types: tongue image prompts "Please focus on extracting symptoms related to tongue image, such as tongue color, tongue shape, coating color, and coating texture"; pulse image prompts "Please focus on extracting symptoms related to pulse image, such as deep pulse, wiry pulse, and thin pulse." When the extraction function is called, the caller explicitly passes in the symptom category parameter ("common symptoms" / "tongue image" / "pulse image"). The extraction results naturally carry type labels, eliminating the need for post-inference—that is, the type label is determined by the input, rather than being inferred post-processed through text similarity matching.
[0051] Subsequently, each symptom phrase is encoded into a 2048-dimensional semantic vector using the text-embedding-v4 embedding model deployed on Alibaba Cloud. The standard symptom vector library is semi-automatically constructed based on symptom nodes in a knowledge graph: the symptom node names themselves are manually compiled by domain experts based on traditional Chinese medicine classics and stored in the Neo4j graph database, while the 2048-dimensional vector representation of the nodes is automatically generated by the text-embedding-v4 embedding model by encoding the symptom names and cached as a local file for subsequent fast retrieval. The standard symptom vector library is divided into three independent type subspaces: common symptoms, tongue symptoms, and pulse symptoms.
[0052] The system calculates the cosine similarity (Formula (3)) in the subspace of the corresponding type based on its type label, and selects the standard symptom node with the highest similarity. As the mapping target (Formula (4)).
[0053] Formula (3): Symptom semantic alignment cosine similarity
[0054] (3)
[0055] in, To input symptom phrases, As standard symptom nodes, This is an embedded vector representation (a 2048-dimensional vector encoded by text-embedding-v4). Cosine similarity measures how close two vectors are in a direction, and is calculated only when... The standard symptoms of the corresponding type are executed in the vector subspace.
[0056] Formula (4): Selection of Standard Symptom Nodes
[0057] (4)
[0058] in, Indicates symptoms related to input The search is conducted within a subspace of standard symptoms of the same type (one of "common symptoms", "tongue symptoms", or "pulse symptoms"). This subspace-based retrieval avoids mismatches between different symptom types. The highest cosine similarity is used. hour, Considered a high-confidence match; The time marker is used to indicate a low-confidence match.
[0059] The matching process introduces a confidence threshold mechanism, with the confidence threshold set at a cosine similarity of 0.85.
[0060] (a) When the highest similarity is ≥0.85, the symptom is considered a high-confidence match and is directly mapped to a standard symptom node in the knowledge graph, and then enters the subsequent reasoning process;
[0061] (b) When the highest similarity is <0.85, the symptom is marked as a low-confidence match. The system prompts the user with the name and similarity score of the best match through the interface, suggesting that the user confirm, supplement the description, or manually select the closest option. This symptom will not directly enter the high-confidence standard symptom set to participate in subsequent inference. Here, "best match" refers to the standard symptom node with the highest cosine similarity to the input symptom in the same type of standard symptom subspace (even if the similarity does not reach the adoption threshold of 0.85). "Candidate options" refers to the three standard symptom nodes in the subspace that are ranked 1st to 3rd in terms of similarity in descending order of cosine similarity.
[0062] The purpose of low-confidence matching is to prevent mismatches caused by semantic ambiguity (such as a user inputting "dizziness" being mismapped as "headache"), and to avoid erroneous symptoms contaminating subsequent knowledge graph inference links.
[0063] Component 3: Construction of the knowledge graph reasoning engine (first engine).
[0064] Knowledge graphs contain the following four types of nodes: Figure 1 As shown: (1) Disease nodes (38), covering specific syndrome types under common gynecological diseases such as menstrual disorders, leukorrhea, pregnancy disorders, and postpartum disorders; (2) Symptom nodes (1066), divided into three categories according to type: common symptoms, tongue symptoms, and pulse symptoms; (3) Treatment nodes, such as "tonifying qi and nourishing blood" and "activating blood circulation and removing blood stasis", are connected to the corresponding disease nodes through the "treatment" edge; (4) Formula nodes, such as "Gui Pi Tang" and "Wen Jing Tang", are connected to the corresponding disease nodes through the "treatment" edge.
[0065] There are three types of edge relationships: (1) "accompanying" edge (symptom → disease), weight Indicates diagnostic specificity—that is, to what extent the appearance of this symptom points to this disease rather than other diseases; (2) "accompanying" side (disease → symptom), weight (3) "Treatment" edge (treatment method / prescription → disease) indicates the treatment relationship of the treatment method or prescription to the disease. The graph contains a total of 1,104 nodes and 5,639 directed weighted edges.
[0066] The data for constructing the knowledge graph comes from a publicly available dataset of disease-symptom relationships in traditional Chinese medicine gynecology. This dataset records disease names, associated symptom names, and their corresponding relationships in a structured table format. The specific construction process is as follows: (1) Each "disease-symptom" relationship record in the dataset is used as an edge of the graph, and the disease name and symptom name are used as disease nodes and symptom nodes, respectively; (2) The initial values of the edge weights are estimated by the basic model (text-embedding-v4) based on the semantic association strength of the description text of the symptom-disease relationship in traditional Chinese medicine classics. Subsequently, the weights are reviewed and calibrated by experts in the field of traditional Chinese medicine gynecology based on their clinical experience.
[0067] The edge weights are set according to the following calculation rules:
[0068] Accompanying border rights (Diagnostic specificity): Reflects symptoms For diseases The ability to differentiate symptoms. Its calculation is based on the concentration of symptom distribution across all associated diseases—if symptoms... If it is only associated with a very small number of diseases, then It has a high ability to differentiate between each related disease. (close to 1.0); if If it is widely associated with a large number of diseases (e.g., "fatigue" is associated with dozens of diseases), then Weak ability to differentiate between any disease or syndrome ( Close to 0.1). Specifically, ,in For symptoms The total number of associated diseases and symptoms, after normalization and mapping, is... The intervals are then fine-tuned and calibrated by experts based on clinical experience.
[0069] Accompanying border rights (Typical): Reflected in the symptoms Clinical manifestations of symptoms The frequency or typicality of occurrence. The initial values are based on the classification of "primary symptoms", "secondary symptoms" and "concurrent symptoms" in TCM gynecology textbooks and clinical guidelines - primary symptoms are assigned a weight of 0.8~1.0, secondary symptoms are assigned a weight of 0.4~0.7, and concurrent symptoms are assigned a weight of 0.1~0.3 - and then experts review and adjust them according to the actual frequency of occurrence in clinical cases.
[0070] The above weighting rules ensure that the weight settings have a reproducible calculation basis, rather than being determined subjectively and arbitrarily.
[0071] The knowledge graph reasoning engine (first engine) is a self-developed symbolic reasoning component of this invention, deployed on the Neo4j graph database (Community version 5.20.0), and includes the following self-developed algorithm modules.
[0072] (1) Initialization of candidate symptoms. In the initial stage of the consultation, the set of high-confidence standard symptom nodes S0⁺ confirmed in step S3 is input into the knowledge graph reasoning engine (first engine). The Cypher query "MATCH(s)-[r:accompanied]-(d)" retrieves all symptom nodes in the graph that have an "accompanied" association edge with the confirmed symptoms, thus forming the initial set of candidate symptoms. (Formula (2)). This set forms the basis for subsequent scoring and follow-up questions.
[0073] Formula (2): Initial set of candidate diseases
[0074] (2)
[0075] in, This represents the initial set of candidate symptoms, which consists of the set of high-confidence standard symptoms confirmed in step S3. The set is retrieved by querying `MATCH (s)-[r:accompanied]-(d)` using Neo4j Cypher. This set forms the basis for the scoring calculation in Formula (1) and the follow-up selection in Formula (5).
[0076] (2) Disease and syndrome score calculation. For each disease and syndrome node in the initial candidate disease and syndrome set. Calculate its confidence score according to formula (1). This involves summing the edge weights of all confirmed symptoms associated with the disease. After calculation, all candidate diseases are sorted in descending order of score.
[0077] Formula (1): Calculation of Confidence Score for Disease / Symptom
[0078] (1)
[0079] in, Indicates the first Candidate disease syndrome The confidence score, Indicates the first The round has confirmed the existence of a set of symptoms (composed of the initial standard symptom nodes selected in step 4, and the symptoms confirmed by the user's "yes" answer during follow-up questioning). Indicates symptoms To the disease symptoms The association weight is taken from the directed edge "accompanying". The weight value, which encodes the symptoms. For diseases Diagnostic specificity—that is To what extent does its appearance point to... Rather than other diseases or syndromes. The weights are normalized based on the inverse of the number of diseases or syndromes associated with the symptoms and then calibrated by experts. The basic meaning of this formula is that the confidence level of a disease or syndrome is determined by the sum of the strengths of evidence for the confirmed symptoms it supports.
[0080] (3) Two-way weighted dynamic follow-up questioning selection. The selection of follow-up questions is based on the principle of maximizing information gain, starting from the symptoms with the highest current scores. One candidate disease in the head ( The default value is set to 3) and selected from the associated unasked symptoms. The specific algorithm is as follows:
[0081] a. Sort the candidate diseases in descending order of their current confidence scores, and select the top-ranked ones. K (where K is a preset positive integer, defaulting to 3) are used as head candidates ;
[0082] b. Traverse each candidate disease in the head. By querying "MATCH(d)-[r:accompaniment]-(s)" using Cypher, we can obtain all associated symptoms and their weights.
[0083] c. Exclude symptoms already in the asked_symptoms set to obtain the unasked symptoms set. ;
[0084] d. Select the symptom that maximizes the weighted sum according to formula (5) as the next follow-up question. .
[0085] Formula (5): Dynamic follow-up questioning selection strategy
[0086] (5)
[0087] in, For the first The group did not inquire about the symptoms. The current highest scorer A set of candidate head diseases ( The default value is 3). This strategy prioritizes symptoms with high association weights with the top candidate symptoms and high confidence levels of the associated symptoms themselves, maximizing information gain in each round of follow-up questions and quickly widening the score gap between candidate symptoms. The formula indicates that the unquestioned symptom that maximizes the sum of the products of edge weights and confidence levels is selected as the next follow-up target. (Product form) The meaning is: symptoms Not only is it necessary to compare with candidate diagnoses in the head There is a strong correlation, but medical evidence is also needed. Its current confidence level is also high; the product is large only when both conditions are met simultaneously. The summation and aggregation methods are more effective than the previous ones. The overall information gain of each candidate symptom is considered—even if a symptom does not provide the highest support for the top candidate symptom, if it still contributes to the overall information gain of the candidate symptom. Each candidate symptom has moderate discriminative power, and its Σ product may still be the highest. The core advantage of this design is that it maintains openness to multiple candidate symptom cases, avoiding the problem that the maximum value aggregation method may cause to prematurely lock in a single candidate symptom and ignore other possibilities.
[0088] e. If all related symptoms of the candidate head disease have been inquired about, then randomly select from the remaining uninquired symptoms of all candidate diseases.
[0089] The core logic of this strategy is to prioritize symptoms that are strongly associated with the highest-scoring head disease and whose associated disease itself has high confidence, so that after user confirmation, the score gap between head diseases can be increased most effectively, and the candidate range can be quickly narrowed down.
[0090] (4) Question Formulation Method. The symptom name selected in step (3) (such as "headache") is directly embedded into the fixed question template of the front-end interface. The template format is: "Do you have the following symptoms: <symptom name?", and the user answers through the three buttons "Yes / No / Skip". The formation of follow-up questions is not generated by the large language model, but is determined by the knowledge graph reasoning engine (first engine) and then assembled by the front-end interaction layer. This design is a manifestation of the "decoupling" idea: the follow-up question strategy is controlled by symbolic reasoning, which ensures the certainty and stability of the follow-up question logic and avoids the randomness and illusion problems of follow-up questions in the large model.
[0091] Component 4: Construction of dynamic threshold mechanism.
[0092] Dynamic stopping threshold It is not a fixed constant, but rather dynamically adjusted adaptively based on the score of the highest-scoring symptom. The threshold update is performed according to formula (6), where... This is the upper limit of the threshold (default value 0.7). and The adjustment coefficient ( Default value 1.2 (Default value: 0.1).
[0093] When the highest confidence level When the evidence is low (e.g., insufficient evidence in the early stages of a medical history taking). The threshold limit has not yet been reached. At this time, the threshold ;because The threshold Higher than the current highest confidence level That is, the highest confidence level The threshold has not yet been reached. The system continues to ask follow-up questions to avoid premature convergence and drawing low-confidence conclusions; as the highest confidence level increases, achieve back, Constrained by the upper limit The confidence level stops rising; this is the highest confidence level. Once reached (that is, to achieve) This means that if the termination conditions are met, the consultation can be ended when sufficient evidence is available. A maximum limit is also set for the number of follow-up questions. (Default value 10) is used as a hard constraint.
[0094] Formula (6): Dynamic threshold update:
[0095] (6)
[0096] in, Let t be the threshold for stopping the game in round t. This is the upper limit of the threshold (default value 0.7). and This is the adjustment coefficient. The threshold is used when evidence is insufficient. Higher than the highest confidence level The system continues to ask follow-up questions to avoid premature convergence; a threshold is set when sufficient evidence is available. Constrained by the upper limit Allowed to reach the highest confidence level The consultation then ended. Specifically: at the highest confidence level... Lower, i.e. Less than At that time (insufficient evidence), lower than It rises as evidence accumulates—at this point because threshold Still higher than the current highest confidence level If the highest confidence level has not yet reached the threshold, the system continues to ask follow-up questions to avoid prematurely drawing unreliable conclusions when there is insufficient evidence; when the highest confidence level increases, achieve hour, restrained No longer rising – this is the highest confidence level. Once reached (that is, to achieve) That is, the termination condition is met (see formula (7)), ensuring that convergence is only determined when the evidence is sufficient, thus avoiding misjudgments due to superficially high confidence caused by single-dimensional evidence. Parameters , , This has been verified through experiments. (And confirmed with the upper limit of hard constraints.) As a safety net.
[0097] The consultation process terminates according to formula (7): the consultation process terminates when the highest score reaches the dynamic threshold or the maximum number of follow-up questions is reached. The "OR" logic means that the consultation stops as long as either condition is met.
[0098] Formula (7): Termination conditions for consultation
[0099] (7)
[0100] in, Sets the maximum number of follow-up questions (default value 10). This mechanism uses an "OR" logic: the consultation terminates when either condition is met. The candidate disease with the highest confidence score at termination is selected as the final conclusion. This differs from score-based decision-making schemes: these schemes lower the threshold and tend to stop when there is a large difference between the first and second place scores—but a large score difference does not necessarily mean that the first place score has high absolute confidence (both scores may be low, just with a large difference), leading to misjudgments under low confidence. This invention is based on absolute confidence; the threshold is only appropriately adjusted when there is sufficient evidence to support a particular disease, thus avoiding the above problems.
[0101] Let's illustrate with specific numerical examples: Assume The highest score at present ,but .because The termination condition was not met, so further questioning continues. If the highest score rises to [a certain level] after the next round of questioning... ,but ,because Still not satisfied. If the highest score rises to [a higher level] in another round... ,at this time The consultation is terminated, and the highest-scoring symptom is selected as the final diagnosis.
[0102] Component 5: Offline Optimization Training Methods to Bypass Online GRPO (GRPO-like Distillation)
[0103] The expert reasoning generation engine is constructed using an offline optimization training method that bypasses online reinforcement learning. This method is based on the observation that the optimization performance of online RL methods such as GRPO (Group Relative Policy Optimization) primarily stems from their high-quality output filtering mechanism, rather than the complex online interaction process itself. Existing theoretical research indicates that Supervised Fine-Tuning (SFT) and GRPO mathematically share a unified gradient update structure, both of which can be represented as... In the form of, Indicates the parameter Find the gradient. Let be the objective function. As expected, As a strategy, For the first Step output, For the question, For the front The output sequence is repeated step by step. The only difference is the gradient coefficient. Value retrieval method: SFT Constantly 1, in GRPO Add a KL correction term to the dynamic intra-group relative advantage.
[0104] Based on the above observations and existing theories, this invention proposes that if a dataset can be constructed whose sample distribution is highly similar to the distribution of high relative advantage outputs in GRPO training, then even using standard SFT, its gradient update direction can approximate the optimization direction of the GRPO policy. This constitutes the theoretical basis of this training method.
[0105] The specific implementation includes the following three steps:
[0106] The teacher model, DeepSeek-R1, is only used to generate candidate outputs as training data; its parameters are not optimized or updated, nor is it deployed in the final system. The student model, obtained through supervised fine-tuning, is the reasoning model with dialectical reasoning ability described in the claims, and is also the expert dialectical reasoning model BianCang-Reasoner-7B-Instruct deployed in the expert reasoning generation engine (second engine). The optimization target of this training method is this student model, not the teacher model.
[0107] (1) Generation of high-quality inference data over a wide area.
[0108] The DeepSeek-R1 teacher model is used to sample problems covering the following three types of tasks (Traditional Chinese Medicine gynecology diagnosis task, Traditional Chinese Medicine physician licensing exam questions, and general reasoning task) in multiple rounds, generating multiple candidate outputs for each input:
[0109] The TCM gynecology diagnostic task covers diagnostic questions related to common gynecological conditions such as menstrual disorders, leukorrhea, pregnancy-related diseases, and postpartum diseases. Each question requires the teacher's model to output structured content including a "thinking" section and an "answering" section. The thinking section contains a complete diagnostic reasoning chain (combined diagnostic methods → etiology and pathogenesis → syndrome summarization), while the answering section includes the diagnostic conclusion and suggested treatment methods and prescriptions.
[0110] The Traditional Chinese Medicine (TCM) Physician Licensing Examination includes multiple-choice questions and clinical case analysis questions, requiring candidates to provide both a thought process section and a response section. General Reasoning Tasks cover general reasoning tasks such as logical reasoning, text comprehension, and knowledge-based question answering, designed to introduce general reasoning behavior patterns.
[0111] The data generation phase places particular emphasis on output conciseness—guiding the teacher model to generate condensed intermediate reasoning chains, with the final answer (rather than the lengthy original reasoning process) as the training objective.
[0112] (2) High-dominance sample selection and dataset construction (expert reasoning generation stage)
[0113] The quality of each candidate output is evaluated using a rule-based scoring function. This rule-based scoring function is a custom scoring function defined in this invention: taking the candidate outputs generated by the teacher model as input, a comprehensive quality score for each candidate output is calculated according to the following task-specific scoring rules; a higher score indicates higher quality for the candidate output.
[0114] In TCM diagnostic tasks, assess the completeness of the diagnostic logic (whether it covers the four diagnostic methods, etiology and pathogenesis, and syndrome induction) and the rationality of the conclusion (whether the diagnostic conclusion is consistent with the reasoning process); in TCM test tasks, assess the correctness of the answers (matching the standard answer for multiple-choice questions, and assessing the rationality of the diagnostic logic and treatment plan for case analysis questions); in general reasoning tasks, assess the coherence of the reasoning chain (whether there are logical jumps or contradictions between reasoning steps). The above-mentioned scoring function is automatically executed by the judging model Kimi K2-Instruct-0905 according to the preset scoring rules. No manual judgment is required for each item. The full score for each task is 100 points. The specific scoring criteria are as follows: (1) TCM syndrome differentiation task: ① The completeness of the syndrome differentiation logic accounts for 50 points. The judging model checks whether the thinking section covers the three links of "four diagnostic methods combined with diagnosis → etiology and pathogenesis → syndrome summary". If the three links are complete and the order is reasonable, 50 points are awarded. 15 points are deducted for each missing link; ② The rationality of the conclusion accounts for 50 points. The judging model extracts the diagnostic conclusion, i.e. the syndrome type, from the answer section and compares it with the syndrome type summarized in the "syndrome summary" link of the thinking section. If the two are consistent, 50 points are awarded. If the main syndrome is consistent but the secondary syndrome is omitted, 30 points are awarded. If the syndrome types are inconsistent, 0 points are awarded. (2) Traditional Chinese Medicine (TCM) test tasks: ① Multiple choice questions are scored out of 100 points based on the correctness of the answer. 100 points are awarded for a match with the standard answer, and 0 points are awarded for a mismatch. ② Case analysis questions are scored out of 50 points based on the rationality of the diagnostic logic and the rationality of the treatment plan. The evaluation model extracts the syndrome type, treatment method, and prescription from the answer and compares them with the reference answer. Full marks are awarded for complete and consistent key elements, and points are awarded based on the hit rate for partial consistency. Full marks are awarded for treatment methods and prescriptions that match the syndrome type, and 0 points are awarded for mismatches. (3) General reasoning task: 100 points are awarded based on the coherence of the reasoning chain. The evaluation model checks whether there are logical jumps or contradictions between reasoning steps. 100 points are awarded for no jumps or contradictions, 60 points are awarded for minor jumps that can be filled in, and 0 points are awarded for obvious logical contradictions. The scoring rules are preset, reproducible, and deterministic standards. The evaluation model only performs scoring according to these rules and does not participate in online strategy updates. Therefore, the automatic scoring method of this invention replaces the reward model that needs to be updated with policy iteration in online reinforcement learning with an offline, one-time data screening method, thus realizing the automation of quality assessment.
[0115] Only high-scoring outputs are retained to construct a GRPO-like supervised dataset. The quantitative standard for "high advantage" is: a comprehensive score based on the rule-based scoring function. The comparison with the group average score determines the relative advantage of each output—for multiple candidate outputs generated by the teacher model for the same problem, the relative advantage of each output is calculated. ( , (These are the mean score and standard deviation of the candidate outputs for this group, respectively; only the relative advantage is retained.) Candidate outputs with scores higher than the group average are considered high-dominance samples; simultaneously, a comprehensive score of at least 80 points (out of 100) serves as a supplementary absolute threshold. The dataset composition follows a specific domain-specific adaptation ratio: approximately 60% is TCM medical case analysis data (approximately 95,000 entries, including approximately 55,000 disease / syndrome diagnoses and approximately 40,000 syndrome diagnoses), approximately 20% is TCM physician licensing exam questions (approximately 2,000 entries, including multiple-choice and clinical case analysis questions), and approximately 20% is general reasoning dialogue data (approximately 99,000 entries, used to introduce reasoning behavior patterns, not involving TCM content). The ratio of TCM domain data to general data is approximately 4:1, higher than the 3:1 ratio commonly seen in general reasoning model training. This ratio is designed to ensure that TCM domain knowledge is not diluted by general data while introducing general reasoning behavior patterns—the higher proportion of domain data strengthens the model's depth of understanding of TCM gynecological diagnosis knowledge. The preprocessed training data totaled approximately 126M tokens (M represents millions, i.e., approximately 126 million tokens) and approximately 196,000 data entries.
[0116] (3) Offline supervision and fine-tuning enables capability transfer.
[0117] Using the BianCang TCM model as the base model—which has completed incremental pre-training on TCM classics and clinical texts and possesses sufficient knowledge reserves in the TCM field—the GRPO-like dataset was constructed in step two. Standard supervised fine-tuning is then performed. The training objective jointly optimizes the following three dimensions:
[0118] (1) Accuracy of answer ( ): Calculate the cross-entropy loss between the response segment output by the model and the response segments of high-dominance samples in the dataset to ensure that the TCM diagnostic conclusions and professional expressions generated by the model are consistent with the selected high-quality outputs.
[0119] (2) Quality of reasoning process ( ): The cross-entropy loss between the thinking segment output by the model and the thinking segment of the high-dominance sample in the dataset is calculated to ensure that the model learns the structured reasoning behavior pattern of combining the four diagnostic methods → etiology and pathogenesis → syndrome induction, rather than just imitating the surface expression.
[0120] (3) Output distribution alignment ( ): Calculate the KL divergence between the student model output probability distribution and the GRPO-like data distribution to prevent the model from deviating from the selected high-quality behavior distribution during fine-tuning.
[0121] The trained model is named BianCang-Reasoner-7B-Instruct (i.e., the expert dialectical reasoning model deployed in the expert reasoning generation engine, referred to as the student model relative to the teacher model DeepSeek-R1 in this training method). The entire training process requires no online interaction, no policy gradient sampling, and no reward model design—the reinforcement learning signal from GRPO has been completely "offlineized" into high-quality supervised data through the data screening step (step two). The model has approximately 7 billion parameters, about one-tenth the number of parameters in the teacher model DeepSeek-R1, and can be deployed locally on a regular server using the vLLM inference framework, meeting the computational constraints and data privacy requirements of primary healthcare institutions.
[0122] The model trained using this method performed excellently in the evaluation of the TCM physician licensing examination: the F1 score (harmonic mean of precision and recall) for multiple-choice questions was 87.09%, and the average score for clinical case analysis was 8.64 / 10 (out of 10), which was significantly better than the general model (Qwen2.5-7B-Instruct) and the TCM model without inference enhancement (BianCang, Sunsimiao) of the same parameter magnitude.
[0123] Compared with online GRPO, this offline training method has the following advantages: (1) No need to design an automatic reward function for the quality of TCM diagnosis - the correctness of TCM diagnosis conclusions is highly dependent on context and expert judgment, and it is difficult to automatically score with simple rules, so online RL is essentially not feasible - this invention replaces reward scoring with data screening, fundamentally avoiding this problem; (2) The training process is stable, the convergence speed is fast, and the hyperparameter tuning is simple - avoiding the inherent problems of high variance sampling and unstable policy gradient in online RL; (3) Achieving the dual goals of knowledge inheritance and enhanced reasoning ability - the student model not only retains the TCM domain knowledge of the base model, but also learns the diagnosis reasoning behavior pattern of the teacher model.
[0124] Component Six: Controllable Inference Length Mechanism.
[0125] A controllable inference length mechanism is introduced in the expert inference generation stage. During the dataset construction stage of the aforementioned offline optimization training method, general inference data is filtered according to the upper limit of the number of output tokens, retaining only samples with output lengths within the specified range. This allows the model to learn the ability to express concisely during fine-tuning. In the inference stage, two inference modes are distinguished through system prompt templates:
[0126] (a) Standard reasoning mode: Output complete diagnostic thinking, etiology and pathogenesis analysis, syndrome summary, prescription suggestions, medication precautions and lifestyle regulation suggestions.
[0127] (b) Concise reasoning mode: Only outputs the core dialectical conclusion and brief treatment points.
[0128] The two modes maintain consistency in diagnostic conclusions, differing only in the level of detail in the explanation. Users can switch modes via system configuration based on the application scenario: use the standard mode in scenarios requiring detailed explanations (such as doctor review and teaching demonstrations); and use the simplified mode in scenarios that do not require detailed explanations (such as rapid pre-screening), significantly reducing output token consumption and response latency.
[0129] Component 7: Generation of structured constraints and output of evidence chain.
[0130] The structured evidence output by the knowledge graph reasoning engine (first engine, self-developed symbolic reasoning component, not an existing model) is used as a hint constraint and input into the expert reasoning generation engine (second engine). The two engines interact with each other through a clearly defined structured intermediate representation protocol.
[0131] The structured constraint context consists of the following eight information elements. The aggregation of each element is completed directly in the code through string formatting (without going through the large AI model to ensure the determinism and traceability of the constraint context):
[0132] (1) Final diagnosis conclusion – determined when the consultation ends in step S7, i.e. the candidate diagnosis with the highest confidence score at the time of termination.
[0133] (2) Candidate disease set and its score ranking - calculated after each symptom status update in step S5. All candidate diseases are arranged in descending order of confidence score, including disease name and corresponding score.
[0134] (3) Mapping relationship and matching similarity of each input symptom to the standard symptom node - In step S3 (symptom semantic alignment and standardization), the system performs vector matching on each input symptom in the corresponding type subspace and returns a structured result containing the input text, matching standard node, symptom type and cosine similarity score.
[0135] (4) The confirmed set of symptoms and their associated diseases are gradually accumulated throughout the entire process of steps S4-S7. Initial confirmation comes from marking the high-confidence standard symptoms as present in step S4; follow-up confirmation comes from the status update when the user answers "yes" in each round of follow-up questions. The associated diseases are obtained through Neo4j's Cypher query.
[0136] (5) Set of symptoms that have been confirmed to not exist - In the follow-up questions in steps S6-S7, symptoms for which the user answers "no" are marked as confirmed to not exist.
[0137] (6) Set of symptoms that are not asked but belong to typical symptoms - When step S7 ends, all the associated typical symptoms of the final disease are obtained by obtaining the "accompanying" association between the final disease and symptoms in the graph database, and the difference set is obtained by taking the difference set with the set of symptoms that have been asked. The judgment criteria for "typical symptoms" are: for the final diagnosed disease d_final, its typical symptoms are defined as all symptoms associated with the final disease through the "accompanying" edge (d_final→s) in the graph. Whether a symptom is "typical" is determined by two dimensions: (1) existence of association - whether the symptom has an "accompanying" edge with the final disease in the graph; (2) strength of association - the weight w(d_final→s) of the accompanying edge represents the typicality of the symptom in the clinical manifestation of the disease. The higher the weight, the more typical. The weight is assigned according to the classification standard of "main symptoms", "secondary symptoms" and "concurrent symptoms" of the disease in the TCM gynecology textbook. During the diagnostic phase, symptoms in the typical symptom set that the user answered "yes" were categorized as "confirmed to exist," those that the user answered "no" were categorized as "confirmed not to exist," and those that were not followed up were categorized as "typical symptoms not inquired about."
[0138] (7) Basic treatment recommendations for the final disease-symptom association in the knowledge graph - obtained from the graph database in step S8. Treatment methods (such as "tonifying qi and nourishing blood") are obtained by associating treatment methods with the "treatment" of the disease in the graph database; representative prescriptions (such as "Gui Pi Tang") are obtained by associating prescriptions in the graph database and matching detailed information (including prescription name, source, indications, prescription, and contraindications) by prescription name according to the prescription data in the local prescription data.
[0139] (8) Complete question and answer trajectory record - recorded step by step throughout the entire process from step S1 to S7, including the content of each round of questions, user answers (yes / no / skip) and corresponding symptom status updates.
[0140] The core function of the constraint protocol is to define the information boundaries usable by the expert reasoning generation engine (second engine): the output conclusions of the expert reasoning generation engine (second engine) do not exceed the scope already determined by the knowledge graph reasoning engine (first engine). The responsibility of the expert reasoning generation engine (second engine) is to organize language and supplement medical common sense suggestions within the boundaries of the confirmed evidence, rather than independently making new diagnostic judgments. This mechanism strictly limits the generated results to the scope supported by the knowledge graph evidence chain, facilitating rapid review by doctors and auditing record keeping.
[0141] Component 8: Interactive Presentation Layer Construction. The front-end interface provides functions such as visualization of diagnostic progress, dynamic sorting and display of candidate disease scores, symptom matching details and question-and-answer trajectory backtracking, and generation of final diagnostic reports, supporting doctors and patients to fully understand and review the diagnostic process.
[0142] Furthermore, the above technical solution can be implemented in the following steps:
[0143] Step S1: Multimodal Disease Data Acquisition. The system receives user input through an interactive interface. For general symptom text, it supports both free text description and structured form completion; for tongue image information, it supports both image upload and text description, and the two input methods can coexist or be used selectively according to a strategy; for pulse image information, it supports text description input. The system performs integrity verification and format preprocessing on the input data.
[0144] Step S2: Symptom Extraction by Type. The collected multimodal disease information is processed according to type. For ordinary symptom text, the large language model qwen-max (temperature=0.0) deployed on Alibaba Cloud is invoked, without special prompts, to extract general symptom phrases. For tongue image information, the system supports the coexistence and merging of two input methods. The tongue image is input into the locally deployed visual language model HuatuoGPT-Vision-Refresh (full name HuatuoGPT-Vision-7B-Qwen2.5VL-Refresh), deployed on port 8001 through the vLLM inference framework. The input is a photo of the patient's tongue (JPEG / PNG format, Base64 encoded and passed as a data URL). The model is guided by predefined prompts to detect the following 8 tongue features: pale tongue, red tongue tip and sides, spots on the tongue surface, blood stasis spots on the tongue surface, tongue cracks, thick tongue coating, teeth marks on the tongue sides, and yellow tongue coating. Only existing features are output (non-existent features are ignored). Meanwhile, users can manually input tongue description text (e.g., "pale red tongue, thin white coating") via a text box. The two tongue information sources are merged using the following strategy: a checkbox is provided on the interface (checked by default). When checked, the model-recognized description and the user's manual description are combined into a single text using line breaks and sent to the subsequent symptom extraction process. When unchecked, only the user's manually input tongue text is used, ignoring the model's recognition results. The merged text is then uniformly processed by qwen-max to extract tongue symptom phrases using tongue-specific prompts. The prompts state, "Please focus on extracting symptoms related to the tongue appearance, such as tongue color, tongue shape, coating color, and coating texture." For pulse information, qwen-max is used to extract pulse symptom phrases using pulse-specific prompts. The prompts state, "Please focus on extracting symptoms related to the pulse, such as deep pulse, wiry pulse, and thready pulse." All extracted symptom phrases are explicitly tagged with type labels by the caller according to the input source during extraction: ordinary symptom text is tagged as "ordinary symptoms", tongue image input is tagged as "tongue image symptoms", and pulse image input is tagged as "pulse image symptoms". The type label is determined by the input end, and the extraction result naturally carries the type label when it is returned from the function. In subsequent step S3, the matching is searched in the corresponding subspace according to the type.
[0145] Step S3: Symptom Semantic Alignment and Standardization. The symptom phrases extracted in Step S2 are encoded into embedding vectors. The embedding model uses the pre-trained language model text-embedding-v4 deployed on Alibaba Cloud, with an output dimension of 2048. Cosine similarity calculation is performed between the encoded symptom vectors and the corresponding standard symptom vector subspaces. The standard symptom vector library is constructed as follows: symptom node names originate from standard symptom nodes manually annotated by domain experts in the Neo4j knowledge graph (covering three categories: common symptoms, tongue symptoms, and pulse symptoms). The 2048-dimensional vector representation of each node is automatically generated by text-embedding-v4 encoding the symptom name and cached locally in the files symptom_embeddings.npy and symptoms_list.csv. The vector library is divided into three independent subspaces according to symptom type. For each symptom to be matched, the system calculates the cosine similarity only within the corresponding subspace of its type label ("common symptom" / "tongue symptom" / "pulse symptom" determined in step S2) according to its type label (formula (3)), and selects the standard symptom node with the highest similarity according to formula (4). As the mapping target, limiting the search scope to the corresponding type subspace avoids mismatches between different types of symptoms (such as incorrectly mapping pulse symptoms to common symptoms). A confidence threshold of 0.85 is used for confidence determination: when the highest similarity is ≥0.85, the symptom is a high-confidence match and is directly mapped to the standard symptom node URI in the knowledge graph, entering the high-confidence standard symptom set in subsequent step S4; when the highest similarity is <0.85, the symptom is a low-confidence match, and the system displays the best match name and similarity score to the user through an interface warning component, prompting the user to confirm whether the match is correct, provide a more specific symptom description, or manually select the closest standard symptom from the candidates. Here, "best match" refers to the standard symptom node with the highest cosine similarity to the input symptom in the same type of standard symptom subspace (even if the similarity does not reach the adoption threshold of 0.85), and "candidates" refers to the three standard symptom nodes in this subspace, ranked 1st to 3rd in similarity, arranged in descending order of cosine similarity. The low-confidence match does not directly enter the high-confidence standard symptom set to participate in subsequent reasoning, in order to avoid mismatches caused by semantic ambiguity polluting the knowledge graph reasoning link.
[0146] The matching results return structured data for each input symptom, including: the original input text (input), the URI of the matched standard symptom node (match), the symptom type (type), and the cosine similarity score (score).
[0147] Step S4: Candidate Disease / Symptom Initialization. The high-confidence standard symptom nodes confirmed in Step S3 are input into the knowledge graph reasoning engine (first engine). The knowledge graph is stored in the form of a graph database, containing a set of disease / symptom nodes and a set of symptom nodes. Nodes are connected by weighted directed or undirected edges, where edge weights represent the strength of the association or degree of support between the symptom and the disease / symptom. Based on the currently confirmed symptom set, the system retrieves all disease / symptom nodes in the graph that have associated edges with that symptom set, forming the initial candidate disease / symptom set. (Formula (2)).
[0148] Step S5: Disease / Symptom Score Calculation. For each disease / symptom node in the initial candidate disease / symptom set, its confidence score is calculated according to formula (1). That is, the weights w(s→d) of all "accompanying" edges corresponding to confirmed symptoms associated with the disease / symptom are summed. The weights are set according to the calculation rules described in Part 3 (the accompanying edge weights are based on the reciprocal normalization of the total number of disease / symptoms associated with the symptoms, and the accompanying edge weights are based on the classification of primary / secondary / concurrent symptoms in TCM textbooks), and are reviewed and calibrated by domain experts based on clinical experience. After the calculation is completed, all candidate diseases / symptoms are arranged in descending order of score.
[0149] Step S6: Dynamic follow-up selection. Check whether the current highest disease score has reached the dynamic cessation threshold. If the desired symptom is not met, the system needs to select the next symptom for follow-up inquiry. The symptom selection strategy is based on the principle of maximizing information gain, and the algorithm flow is as follows:
[0150] (a) Sort the candidate diseases in descending order of their current confidence scores, and take the top-ranked ones. This serves as a "collection of candidate diagnoses for the head". ",default .
[0151] (b) Traversal Each disease node in By querying "MATCH(d)-[r:accompaniment]-(s)RETURNs.uri,r.weight" using Cypher, we can obtain all associated symptoms and edge weights.
[0152] (c) Exclude symptoms that are already in the asked_symptoms set to obtain the unasked symptoms set. .
[0153] (d) Select the next question according to formula (5). This formula means: for each symptom not inquired about... Calculate its association weight with all candidate head diseases. Current confidence score of the corresponding disease / symptom The sum of the products of the two factors is used to select the symptom that maximizes the weighted sum as the next follow-up question. This strategy prioritizes symptoms that are strongly associated with the highest-scoring head symptom and whose associated symptom itself has high confidence, so that the follow-up questions can most effectively influence the score ranking of head symptoms and quickly widen the gap between candidates.
[0154] (e) If If all related symptoms of all diseases have been inquired about, then one symptom is randomly selected from the remaining uninquired symptoms of all candidate diseases (not just those of the head).
[0155] (f) The selected symptom name (such as "headache") is directly embedded into the fixed question template "Do you have the following symptoms: <symptom name?", forming a natural language question presented to the user. The user answers using three buttons: "Yes / No / Skip". The question is not generated by a large language model—the follow-up question strategy is determined by the symbolization algorithm of the knowledge graph reasoning engine (first engine), and the question expression is assembled by the front-end interaction layer template, ensuring the determinism of the follow-up question logic.
[0156] Step S7: Dynamic Termination. After each round of follow-up questioning, the disease score is recalculated and the dynamic termination threshold is updated. The threshold update is performed according to formula (6), and is adaptively adjusted based on the current highest score. When one of the termination conditions shown in formula (7) is met (the highest score reaches the threshold or the maximum number of follow-up questioning rounds is reached), the consultation process terminates. If the termination condition is not met, the process returns to step S6 to continue follow-up questioning.
[0157] Step S8: Structured Constraint Generation. After the consultation ends, the system summarizes the structured information generated throughout the consultation process and generates a structured constraint context. The summary is directly assembled using a string formatting template without processing by a large AI model to ensure the determinism of the constraint context. The structured constraint context contains the following 8 information elements and their source steps: (1) Final diagnosis conclusion - Source: Step S7. The candidate diagnosis with the highest confidence score at the time of termination. (2) Candidate diagnosis set and its corresponding score ranking - Source: Step S5. Recalculated after each symptom status update, all candidate diagnoses are ranked in descending order of score. (3) Mapping relationship and matching similarity between each input symptom and the standard symptom node - Source: Step S3. The system matches the three types of input symptoms in the corresponding standard symptom subspaces and returns a structured matching result containing the input text, matching standard node, symptom type, and cosine similarity score. (4) Confirmed symptom set and its associated disease syndrome - Source: Step S4 (initial high-confidence symptom automatic marking) and Steps S6-S7 (marking when the user answers "yes" during follow-up questions). The association with the disease syndrome is obtained through association query of the graph database. (5) Confirmed non-existent symptom set - Source: Steps S6-S7. When the user answers "no" during follow-up questions, it is marked as confirmed non-existent. (6) Symptom set that is not asked but belongs to typical symptoms - Source: Step S7. After termination, all typical symptoms are obtained through the "accompanying" association between the final disease syndrome and symptoms in the graph database, and the difference set is obtained by taking the difference set with the symptom set that has been asked. (7) Basic treatment suggestions for the final disease syndrome association in the knowledge graph - Source: Step S8. The treatment method is obtained through the "treatment" association between the treatment method and the disease syndrome in the graph database; the representative prescription is obtained through the prescription association in the graph database and the local prescription data by matching the prescription name with detailed information (including prescription name, source, indications, prescription, and contraindications). (8) Complete question and answer trajectory record - Source: entire process of steps S1-S7. Each round of questions, user answers and symptom status updates are recorded step by step in the conversation.
[0158] The assembly template format for this 8-element structured context is as follows:
[0159] "You are a senior TCM expert. Please complete the entire diagnosis process based on the following information:"
[0160] - Symptoms provided by the user: {Original text of the user's common symptoms}
[0161] - Tongue image: {Tongue image description text}
[0162] -Pulse characteristics: {Pulse description text}
[0163] - Key diseases recommended by the knowledge graph: {Final diagnosis / symptom conclusion}
[0164] -Other possible candidate diseases (including confidence levels): {Ranked list of candidate diseases}
[0165] -Recommended treatment methods: {List of treatment methods}
[0166] -Recommended prescription: {Prescription details}
[0167] - Typical symptoms: {List of typical symptom names}
[0168] The assembled structured constraint context serves as the input to the expert reasoning generation engine (second engine) in step S9.
[0169] Step S9: Expert Inference Output. The structured constraint context generated in Step S8 is formatted into prompt text according to the preset prompt template described in the previous step and input into the expert inference generation engine (second engine). The core model of the expert inference generation engine (second engine) is BianCang-Reasoner-7B-Instruct. This model is based on the BianCang TCM model (existing public work) and is obtained through inference enhancement training using the GRPO-like offline optimization training method described in Component Five of this invention. The model is deployed on a local server using the vLLM inference framework (API address: http: / / localhost:8000 / v1, model service name: "BianCang-Reasoner"), with inference parameters of temperature=0.95 and top_p=0.7, and supports streaming output. The input of the model is the structured constraint context generated in Step S8 (text formatted according to the preset prompt template), which may optionally include the complete dialogue history between the user and the system. The model outputs a TCM diagnostic explanation in natural language, including analysis of the diagnostic approach, explanation of etiology and pathogenesis, treatment suggestions (treatment principles, representative prescriptions, and drug modification strategies), medication precautions (contraindications, reminders for special populations, and decoction methods), and lifestyle management suggestions. It is important to note that the expert reasoning generation engine (the second engine) in this step is responsible for organizing natural language and supplementing the evidence boundaries already confirmed by the knowledge graph reasoning engine (the first engine) with common-sense medical advice. Its output conclusions do not exceed the scope already determined by the knowledge graph reasoning engine (the first engine) and do not independently make new diagnostic judgments. The process of generating diagnostic conclusions is entirely completed by the symbolic reasoning of the knowledge graph reasoning engine (the first engine), while the expert reasoning generation engine (the second engine) only organizes and refines the language expression within the information scope defined by the structured constraint protocol. This dual-engine decoupled architecture of "first engine discrimination → second engine interpretation" is the core inventive point of this invention: the first engine ensures the certainty, traceability, and consistency of evidence in the reasoning; the second engine provides flexible and natural expressive capabilities, and the two are coupled through a structured intermediate representation protocol to achieve a deterministic interface. The output supports switching between standard inference mode and simplified inference mode (controlled by the prompt template in the controllable inference length mechanism), which is determined by user or system configuration.
[0170] Formula (8): GRPO-like offline optimization training objective function
[0171] (8)
[0172] in, To answer the question of segment cross-entropy loss, For the cross-entropy loss of the inference segment, Output distribution for teacher model With student model output distribution The KL divergence between them. , , Weighting coefficients (default value: , , This formula is the optimization objective function of the GRPO offline optimization training method of this invention, which jointly optimizes three dimensions: (1) —The cross-entropy loss between the model output response segment and the response segments of high-dominance samples in the GRPO-like dataset ensures that the TCM diagnostic conclusions and professional expressions are consistent with the selected high-quality outputs; (2) —The cross-entropy loss between the model output thinking segment and the thinking segment of high-dominance samples ensures that the model learns the structured reasoning behavior pattern of combining the four diagnostic methods → etiology and pathogenesis → syndrome induction; (3) —The KL divergence between the model output probability distribution and the GRPO-like data distribution prevents the model from deviating from the selected high-quality behavior distribution during fine-tuning. Detailed steps and data composition of this training method are described in Part Five. The essential difference between this training method and standard knowledge distillation lies in the fact that the training dataset is not a simple collection of the teacher model's original output, but rather a GRPO-like dataset that has been filtered for high dominance and whose distribution approximates the high relative dominance output distribution in GRPO training—enabling standard SFT to approximate the optimization direction of the GRPO policy, achieving the transfer of TCM diagnostic reasoning ability without online sampling, reward models, or policy gradient updates.
[0173] Furthermore, the system modules can be divided into the following five functional modules:
[0174] Module 1: Multimodal Input Module. This module is responsible for receiving, validating, and preprocessing various user modal inputs, including text input boxes, image upload components, and multiple-choice questionnaires. It directly interfaces with the front-end interaction layer, providing input guidance and format validation functions.
[0175] Module 2: Symptom Standardization Module. This module is responsible for symptom extraction, embedding encoding, similarity matching, and confidence assessment. It comprises three sub-components: an embedding model service, a standard symptom vector library, and a symptom type manager.
[0176] Module 3: Knowledge Graph Reasoning Module. This module is responsible for maintaining the graph-structured knowledge base, performing disease and symptom scoring calculations, dynamic follow-up questioning and selection, and decision-making. Deployed on a graph database, this module supports configuring the candidate disease and symptom filtering range by disease category, and can flexibly adapt to different specialty scenarios.
[0177] Module 4: Expert Reasoning Generation Module. Responsible for generating TCM syndrome differentiation interpretations and treatment suggestions under structured constraints. This module includes two language model services deployed locally through the vLLM reasoning framework:
[0178] (a) Expert dialectical reasoning service: Runs the model BianCang-Reasoner-7B-Instruct (port 8000, service name "BianCang-Reasoner"), which is responsible for generating dialectical interpretation text and treatment suggestions under the guidance of structured constraint context, and supports switching between standard reasoning and simplified reasoning modes.
[0179] (b) Tongue Image Visual Understanding Service: The running model HuatuoGPT-Vision-7B-Qwen2.5VL-Refresh (port 8001, service name "HuatuoGPT-Vision-Refresh") is responsible for automatically extracting structured tongue image feature descriptions from tongue images.
[0180] It also includes an output policy controller, which is responsible for switching between standard inference mode and simplified inference mode based on user configuration.
[0181] Module 5: Diagnostic Orchestration and Presentation Module. This module coordinates the execution order of the preceding modules, manages session states, generates structured intermediate representations, and provides visualization of the diagnostic process, display of the chain of evidence, and final report output.
[0182] To meet the requirement of full disclosure, the specific versions and configuration information of the external models, tools, and key parameters used in this embodiment are listed below to enable those skilled in the art to reproduce the technical solutions of this invention:
[0183] (1) Large language model (symptom extraction): qwen-max, called through Alibaba Cloud Bailian platform API, temperature=0.0, base_url="https: / / dashscope.aliyuncs.com / compatible-mode / v1".
[0184] (2) Embedding model (symptom vector encoding and matching): text-embedding-v4, which is called through the Alibaba Cloud Bailian platform API and has an output dimension of 2048.
[0185] (3) Visual language model (tongue image recognition): HuatuoGPT-Vision-7B-Qwen2.5VL-Refresh, deployed locally through the vLLM inference framework (port 8001), temperature=0.95, top_p=0.7, input image format JPEG / PNG encoded with Base64.
[0186] (4) Expert dialectical reasoning model: BianCang-Reasoner-7B-Instruct, deployed locally through the vLLM inference framework (port 8000), temperature (sampling temperature) = 0.95, top_p (kernel sampling parameter) = 0.7, max_model_len (maximum context length) = 8192, dtype (data type) = bfloat16 (half-precision floating point), supports streaming output.
[0187] (5) Graph database: Neo4j Community Edition 5.20.0, Cypher query language, connected via py2neo driver. The relation types are "accompanying" (disease → symptoms) and "accompanying" (symptom → disease), and the edge weights are pre-labeled by domain experts based on TCM classics and clinical experience.
[0188] (6) Teacher model (for training only): DeepSeek-R1 series (DeepSeek-AI, 2025), not deployed in the final system.
[0189] (7) Evaluation model (only used in the training phase): Kimi K2-Instruct-0905 (Moonshot AI), used to automatically score the candidate outputs generated by the teacher model according to the preset scoring rules and select high-advantage samples. It is not deployed in the final system.
[0190] (8) Default values for key algorithm parameters: cosine similarity threshold 0.85, number of candidate diseases in the head Dynamic stopping threshold upper limit adjustment coefficient , Maximum number of follow-up questions Distillation loss weight , , .
[0191] (9) Front-end framework: Streamlit (Python), which provides multimodal input acquisition, diagnostic process visualization and evidence chain display functions.
[0192] The originality of this invention lies in:
[0193] 1. An offline optimization training method for the TCM field that bypasses online GRPO (GRPO-like offline optimization)
[0194] This method is based on the following observations and existing theories: the optimization effect of online RL methods such as GRPO mainly stems from their screening mechanism for high-quality outputs, rather than the complex online interaction process itself; existing theoretical research shows that SFT and GRPO share a unified gradient update structure. Therefore, this method proposes to construct a dataset whose sample distribution is highly similar to the distribution of high-relative-advantage outputs in GRPO training, so that the gradient update direction of standard SFT approximates the GRPO strategy.
[0195] Specifically, it includes three steps: (1) Using the teacher model DeepSeek-R1, multiple candidate outputs (including thinking segments and answer segments) are generated for TCM diagnosis questions, TCM test questions, and general reasoning questions; (2) High-dominance outputs are selected using a rule-based scoring function to construct a GRPO-like supervised dataset, in which TCM medical case diagnosis data accounts for about 60%, TCM test questions for about 20%, and general reasoning for about 20%, with the ratio of TCM domain data to general data being about 4:1; (3) Using the BianCang TCM foundation model as the initial model, standard supervised fine-tuning is performed on the GRPO-like dataset to jointly optimize the three dimensions of answer accuracy, reasoning quality, and output distribution alignment. The entire training process does not require online sampling, reward models, or policy gradient updates—the reinforcement learning signals of GRPO have been completely converted into high-quality supervised data offline through the data screening process. The BianCang-Reasoner-7B-Instruct obtained from the training has about 7 billion parameters, which is about one-tenth of the teacher model and can be deployed locally.
[0196] 2. (Enabling Technology): A follow-up question on asymmetric bidirectional edge weight KG and information gain maximization
[0197] In the knowledge graph, the "accompanying" edge from symptoms to syndromes encodes diagnostic specificity (the ability of symptoms to distinguish syndromes), and the "accompanying" edge from syndromes to symptoms encodes typicality (the degree of commonness of symptoms in syndromes). The weight values of the same pair of relationships are different in the two directions (see formula (1) and edge weight calculation rules for details).
[0198] The follow-up questioning strategy is based on the principle of maximizing information gain (see formula (5) for details): For each symptom not asked, calculate its relationship with the previous symptom. The strategy involves summing the association weights of each head candidate disease and the product of the corresponding disease's current confidence level, and selecting the symptom with the largest sum as the next follow-up target. This strategy employs a summation aggregation method—unlike existing schemes that aggregate based on maximum value—which considers the discriminative power of symptoms for all head candidate diseases, maintaining openness to multiple candidates and avoiding premature identification of a single disease.
[0199] 3. (Enabling Technology): Dynamic Threshold Determination Based on Adaptive Evidence Strength
[0200] The stopping threshold is a function of the highest confidence level (see formula (6)), which differs from the existing scheme based on the score difference (the difference between the first and second place scores). This invention judges whether convergence is based on absolute confidence level—when the highest confidence level is low, the threshold is kept high to avoid premature convergence, and when the highest confidence level increases and the evidence is sufficient, it is adjusted appropriately. This avoids the problem in the score difference-based scheme where "the difference between two low-scoring symptoms is large → misjudged as high confidence and stopped prematurely". The specific stopping conditions are shown in formula (7).
[0201] This invention provides a concept and method for a decoupled dual-engine-based intelligent auxiliary diagnostic system for traditional Chinese medicine. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.
Claims
1. A TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine architecture, characterized in that, The system comprises: a first engine, a knowledge graph reasoning engine, responsible for symbolic reasoning based on structured knowledge, completing symptom standardization, disease candidate screening, dynamic follow-up questioning, and decision-making, and outputting structured diagnostic results with confidence ranking; a second engine, an expert reasoning generation engine, responsible for generating natural language under the guidance of structured constraint context, and outputting explanatory text and treatment suggestions that conform to the diagnostic thinking of traditional Chinese medicine; the two engines interact with each other through a defined structured intermediate representation.
2. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 1, characterized in that, The information processing steps of this system include: Step 1: Receive and preprocess multiple modalities of patient condition information from the user; Step 2: Perform categorized symptom extraction on the inputs of different modalities to obtain the extraction results carrying categorization labels; Step 3: Encode each symptom phrase into a semantic vector to obtain a standard symptom vector library, which includes three independent type subspaces: common symptoms, tongue symptoms, and pulse symptoms. Step 4: Calculate the cosine similarity within the subspace and filter out standard symptom nodes using a confidence threshold determination mechanism; Step 5: Combine the set of standard symptom nodes selected in Step 4. Input the knowledge graph reasoning engine to retrieve all sets in the graph. The standard symptom nodes in the dataset contain disease nodes that are "accompanied" by associated edges, forming the initial candidate disease set. ; Step 6: For each disease node in the initial candidate disease set Calculate its confidence score Based on the principle of maximizing information gain, the top scorers are selected. One as a candidate disease symptom in the head ; Step 7: Determine whether the highest confidence score of the disease in the initial candidate disease set reaches the dynamic stopping threshold. If the condition is met, then stop asking further questions; otherwise, consider it a potential diagnosis. Fill in the symptoms in the template to form follow-up questions; Step 8: Summarize the structured information generated throughout the consultation process, generate a structured constraint context, convert it into prompt text, and input it into the expert reasoning generation engine to generate dialectical conclusions and explanatory text.
3. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 2, characterized in that, The knowledge graph inference engine corresponds to a knowledge graph containing nodes: disease nodes, symptom nodes, treatment nodes, and prescription nodes; the treatment nodes are connected to the corresponding disease nodes through "treatment" edges; the prescription nodes are connected to the corresponding disease nodes through "treatment" edges; the edge relationships include: "accompanied" edges, "accompanied" edges, and "treatment" edges.
4. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 3, characterized in that, The weight of the "accompanying" edge The calculation rule is: based on symptoms Distribution concentration among all related diseases: if It has a high ability to differentiate diseases when associated with only a very small number of symptoms. A broad association with a large number of diseases and syndromes results in low differentiation ability, that is, based on symptoms alone. The reciprocal of the total number of associated diseases and symptoms was determined after normalization, and then fine-tuned and calibrated by experts based on clinical experience; the weight of the "accompanying" edge. The values are assigned based on the numerical definitions of the "primary symptoms," "secondary symptoms," and "concurrent symptoms" of diseases and syndromes in TCM textbooks and clinical guidelines, and are then reviewed and adjusted by experts based on the actual frequency of occurrence in clinical cases.
5. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 4, characterized in that, The confidence threshold determination mechanism in step 4 is as follows: when the highest cosine similarity is less than the cosine similarity threshold, the symptom corresponding to the highest cosine similarity is marked as a low-confidence match. The system prompts the user with the name and similarity score of the best match through the interface, and suggests that the user confirm, supplement the description or manually select the closest option. This symptom does not directly enter the high-confidence standard symptom set to participate in subsequent inference.
6. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 3, characterized in that, The dynamic stopping threshold is adaptively and dynamically adjusted based on the highest confidence score of the current symptom. : in, Indicates the first Candidate disease syndrome The confidence score, Indicates the first The symptom cluster has been confirmed to exist in the round. Indicates symptoms To the disease symptoms The association weight is taken from the directed edge "accompanying". The weight value, Let t be the threshold for stopping the game in round t. The upper limit of the threshold, and For adjustment coefficients, Indicates the first Round all candidate diseases confidence score Take the maximum value, which is the highest confidence level.
7. The TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 1, characterized in that, The expert reasoning generation engine described in step 8 is constructed using an offline optimization training method that bypasses online reinforcement learning: Step 8-1: Use the teacher model to sample TCM syndrome differentiation questions in multiple rounds. For each question, generate multiple candidate outputs. Each candidate output contains a thinking segment reflecting the syndrome differentiation reasoning process and an answer segment reflecting the diagnostic conclusion. Step 8-2: Use the rule-based scoring function to evaluate the quality of each candidate output, select high-dominance samples, and construct a GRPO-like supervised dataset; Step 8-3: Using the base model that has completed incremental pre-training in the field of traditional Chinese medicine as the initial model, perform standard supervised fine-tuning on the GRPO-like supervised dataset. The optimization objectives include three dimensions: answer accuracy, reasoning quality, and output distribution alignment, to obtain a reasoning model with dialectical reasoning ability.
8. A TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 7, characterized in that, The accuracy of the answer is: the cross-entropy loss between the answer segment output by the model and the answer segment of the high-dominance sample in the dataset is calculated to ensure that the TCM diagnostic conclusions and professional expressions generated by the model are consistent with the selected high-quality outputs; the quality of the reasoning process is: the cross-entropy loss between the thinking segment output by the model and the thinking segment of the high-dominance sample in the dataset is calculated; the alignment of the output distribution is: the KL divergence between the probability distribution of the student model output and the distribution of GRPO-like data is calculated.
9. A TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 6, characterized in that, GRPO-like offline optimization training objective function: in, To answer the question of segment cross-entropy loss, For the cross-entropy loss of the inference segment, Output distribution for teacher model With student model output distribution KL divergence between them , , These are the weighting coefficients.
10. A TCM intelligent auxiliary diagnostic system based on a decoupled dual-engine according to claim 6, characterized in that, The expert reasoning generation stage introduces a controllable reasoning length mechanism: During the training stage, general reasoning data is filtered according to the upper limit of the number of output tokens, and only samples with output length within the specified range are retained; During the reasoning stage, two reasoning modes are distinguished by prompt templates: (a) Standard reasoning mode: outputs complete diagnostic ideas, etiology and pathogenesis analysis, syndrome induction, prescription suggestions, medication precautions and lifestyle regulation suggestions; (b) Concise reasoning mode: outputs only the core diagnostic conclusions and brief treatment points.
