A method for enhancing the reasoning ability of large models for intelligent triage in oral medicine
By constructing a high-quality medical record data instruction set and a two-stage fine-tuning method, the reasoning ability and output stability of the large model in intelligent triage in oral medicine have been improved. This solves the problems of insufficient domain expertise and difficulty in meeting the needs of evidence-based medicine in existing technologies, and achieves more reliable medical assistance support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies in intelligent triage in oral medicine suffer from insufficient domain expertise, difficulty in meeting the needs of evidence-based medicine, and lack of targeted optimization, resulting in limited reasoning capabilities of general-purpose large models in specific medical scenarios.
By acquiring medical record data, a high-quality instruction dataset is constructed. LoRA is used for supervised fine-tuning, and the direct preference optimization algorithm is combined to improve the inference ability and output stability of the large model. This includes clustering of medical record data, semantic similarity filtering, and rule matching, and optimizing model parameters to adapt to the needs of oral medicine.
It significantly improves the reasoning ability and output stability of large models in the intelligent triage scenario of oral medicine, ensuring that the model output conforms to clinical practice and provides more reliable medical decision support.
Smart Images

Figure CN120221014B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to natural language processing technology, specifically to a method for enhancing the reasoning ability of large models for intelligent triage in oral medicine. Background Technology
[0002] In recent years, with the rapid development of artificial intelligence technology, intelligent triage technology in oral medicine has also evolved, forming three main technical solutions. These solutions each have their own characteristics, but also certain limitations.
[0003] The first type of technical solution is rule-based expert systems. These systems manually construct decision trees (e.g., using the International Classification of Diseases (ICD)) to establish a rule base mapping symptom keywords to disease types, and then perform matching through hard coding. In structured consultation scenarios, rule-based expert systems exhibit high stability and reliability, but their scalability and adaptability are poor, making it difficult to meet the needs of modern intelligent healthcare.
[0004] The second category of technical solutions is intelligent triage methods based on traditional machine learning models. These methods primarily employ a supervised learning paradigm, using classic classification algorithms such as Support Vector Machines (SVM), Random Forest, and XGBoost, combined with structured data (e.g., pain type, mouth opening degree) for classification. Some improved solutions also incorporate natural language processing techniques, performing simple feature extraction on the patient's complaint text and adding it to the input of the classification algorithm. Compared to rule-based expert systems, traditional machine learning methods offer greater flexibility but struggle to meet the demands of real-world triage scenarios.
[0005] The third type of technical solution is the intelligent triage method based on generative large models. In recent years, generative large models (such as GPT-4 and DeepSeek) have made breakthrough progress in the field of natural language processing, and their powerful language understanding and generation capabilities have provided new possibilities for intelligent triage. Existing solutions typically utilize untuned general-purpose large models directly, achieving dialogue generation and triage suggestion output solely through prompt engineering. However, despite the excellent performance of general-purpose large models in natural language understanding, their application in triage within the field of oral medicine still faces the following challenges:
[0006] 1. Insufficient domain expertise: The knowledge system of the general large model mainly comes from publicly available data on the Internet and lacks in-depth professional knowledge in the field of oral medicine, resulting in limited reasoning ability in specific medical scenarios.
[0007] 2. The need for evidence-based medicine is difficult to meet: The reasoning logic of general large models is usually driven by training with code and mathematical data. However, in the medical field, diagnostic and treatment decisions need to be based on rigorous evidence-based medicine, which general large models cannot fully meet.
[0008] 3. Lack of targeted optimization: Existing solutions usually only adjust the model output through prompt word engineering, without performing domain-specific fine-tuning, resulting in insufficient analytical capabilities of the model in the field of oral medicine. Summary of the Invention
[0009] To address the aforementioned shortcomings in existing technologies, the present invention provides a method for enhancing the reasoning ability of large models for intelligent triage in oral medicine, which solves the problem of insufficient reasoning ability in intelligent triage scenarios.
[0010] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:
[0011] A method for enhancing the reasoning ability of a large model for intelligent triage in oral medicine is provided, comprising the following steps:
[0012] S1. Obtain several medical record data and select the medical record data that meets the preset conditions as the medical record dataset;
[0013] S2. Use an open-source inference model to transform the medical record data in the medical record dataset into instruction data containing the inference process, and filter the instruction data that meets the preset rule conditions.
[0014] S3. Based on all instruction data, LoRA is used to perform supervised fine-tuning of the large model, and the original large model is used as a reference model to maintain general knowledge, thereby training to obtain a large oral medicine model with enhanced reasoning ability.
[0015] Furthermore, the method for enhancing the reasoning ability of the large model used for intelligent triage in oral medicine also includes step S4, which uses the direct preference optimization algorithm to align and optimize the output of the large oral medicine model to obtain the final large oral medicine model.
[0016] Furthermore, step S4 further includes:
[0017] S41. Obtain multiple medical record data, use a large oral medicine model to generate multiple different response data for each medical record data, and calculate the semantic similarity between the predicted diagnosis and the actual diagnosis in each response.
[0018] S42. When the semantic similarity is greater than the first preset similarity, the response is marked as a positive sample; when the semantic similarity is less than or equal to the second preset similarity, the response is marked as a negative sample.
[0019] S43. Filter out medical records that include both positive and negative samples from multiple medical record datasets, and use all the filtered medical record datasets to form a preference dataset.
[0020] S44. Apply the direct preference optimization algorithm to the preference dataset to adjust the model parameters of the large oral medicine model to optimize its generation strategy and obtain the final large oral medicine model.
[0021] Furthermore, when using the direct preference optimization algorithm to adjust the large-scale oral medicine model, the expression for its optimization objective is:
[0022]
[0023] in, To optimize the objective; For the preference dataset; Δ(x,y1,y2)=logP θ (y1|x)―logP θ (y2|x) is the log ratio of the generation probabilities of positive and negative samples; P θ (·) represents the probability that the model generates a specific response y given an input x; y1 is a positive sample response; y2 is a negative sample response; x is the instruction given to the model; σ is the expected value on the preference dataset, which means that the calculation is an average over the entire preference dataset; σ(·) is the sigmoid function.
[0024] Furthermore, step S1 further includes:
[0025] S11. Obtain several medical record data and input them into a pre-trained language model for quality scoring, then select the medical record data with the highest quality score from the first preset quantity.
[0026] S12. Cluster all medical record data, and select the second preset number of medical record data that have not been selected and have the highest quality score in each cluster;
[0027] S13. Merge all selected medical record data to create a high-quality and diverse medical record dataset.
[0028] Furthermore, methods for clustering all medical record data include:
[0029] Initialize a candidate cluster number range k∈[k min ,k max ], where k min and k max These are the preset minimum and maximum number of clusters, respectively;
[0030] Initialize each medical record data as a cluster and calculate the similarity between clusters. Iteratively merge the two most similar clusters until the number of clusters is reduced to k, thus dividing the medical record data into k clusters.
[0031] Calculate the silhouette coefficient for each cluster:
[0032] s k (i)=[b k (i)―a k (i)] / max{a k (i),b k (i)}
[0033] Where S(k) is the silhouette coefficient of the k-th cluster; N is the total number of medical records in the k-th cluster; a k (i) represents the average distance from medical record data i in the k-th cluster to other medical record data in the same cluster; b k (i) represents the average distance from medical record data i in the k-th cluster to all samples in the nearest other clusters;
[0034] Iterate through all candidate cluster numbers k, and select the k that maximizes S(k) as the final cluster number k. opt =argmax k S(k), and divide all medical record data into k. opt Clusters.
[0035] Furthermore, step S2 further includes:
[0036] S21. Input the medical record data in the medical record dataset into the open-source reasoning model to obtain the reasoning process and predicted diagnosis of the medical record data, and select the medical record data that meets the preset logical rules based on the reasoning process.
[0037] S22. Use a pre-trained word embedding model to convert the predicted diagnosis and the actual diagnosis corresponding to the medical record data selected in step S21 into high-dimensional semantic vectors.
[0038] S23. Based on the high-dimensional semantic vectors of the predicted diagnosis and the actual diagnosis corresponding to the medical record data, calculate the semantic similarity between the two, and filter out the medical record data with semantic similarity greater than a preset threshold.
[0039] S24. Take the current medical history and actual diagnosis of the medical record data selected in step S23 as input, and the reasoning process and predicted diagnosis corresponding to the medical record data as output, and use the input and output to form instruction data.
[0040] Furthermore, in step S3, the expression for the training objective of supervised fine-tuning is:
[0041]
[0042] in, For training objectives; Let λ be the average cross-entropy loss function; λ is a hyperparameter. The KL divergence loss is represented by T, where T is the length of the instruction data; w is the length of the instruction data. t w is the t-th word in the instruction data. <t For the historical context of the first t-1 words; P θ (w t |w <t P represents the predicted word probability distribution under model parameters θ; ref (w t |w <t ) represents the probability distribution predicted by the reference model.
[0043] Furthermore, the formula for calculating semantic similarity sim is:
[0044]
[0045] Among them, v true The high-dimensional semantic vector corresponding to the actual diagnosis; v pred is the high-dimensional semantic vector for prediction and diagnosis; ||·|| is the modulo length symbol.
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0047] 1. In order to construct high-quality instruction data using medical record data, this solution first generates instruction data of varying quality through an open-source large model, and then uses rule matching to filter instruction data that meets preset rule conditions, thereby selecting high-quality instruction data. This method efficiently transforms the original medical record data into high-quality instruction data, providing a foundation for the subsequent model fine-tuning stage.
[0048] 2. To enhance the reasoning ability and output stability of large-scale intelligent triage scenarios, this solution proposes a two-stage fine-tuning method. Through supervised fine-tuning and the introduction of a reference model, the model's reasoning ability in intelligent triage scenarios is improved while maintaining its original knowledge. Subsequently, direct preference optimization is used to increase the probability of the large model generating correct reasoning results, thereby further improving the reliability of the triage results. Attached Figure Description
[0049] Figure 1 A flowchart for a method to enhance the reasoning capabilities of large models used in intelligent triage in oral medicine.
[0050] Figure 2 This is a detailed flowchart of the process for obtaining medical record datasets. Detailed Implementation
[0051] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0052] refer to Figure 1 , Figure 1 A flowchart is shown for a method to enhance the reasoning capabilities of large models for intelligent triage in oral medicine; such as Figure 1 As shown, the method S includes steps S1 to S3.
[0053] In step S1, several medical record data are acquired, and medical record data that meet preset conditions are selected as the medical record dataset; for example... Figure 2 As shown, in implementation, the preferred step S1 of this solution further includes:
[0054] S11. Obtain several medical record data sets, input them into a pre-trained language model for quality scoring, and select the medical record data sets with the highest quality scores from a first preset number of n1 sets. The fine-tuning process of the pre-trained language model includes:
[0055] Professional doctors score the quality of a randomly sampled portion of medical record data. Then, a language model is used as the backbone of the scoring model. After replacing its last layer with a linear layer, the language model is fine-tuned to align with expert preferences, using medical record data as input and doctor scores as output, to obtain a pre-trained language model. The pre-trained language model is then used to score the quality of all medical record data.
[0056] S12. Cluster all medical record data, and select the medical record data with the highest quality score that has not been selected in the second preset number n2 in each cluster.
[0057] S13. Merge all selected medical record data to create a high-quality and diverse medical record dataset.
[0058] During implementation, this scheme preferably uses the following steps to cluster all medical record data:
[0059] Initialize a candidate cluster number range k∈[k min ,k max ], where k min and k max These are the preset minimum and maximum number of clusters, respectively;
[0060] Initialize each medical record data as a cluster and calculate the similarity between clusters. Iteratively merge the two most similar clusters until the number of clusters is reduced to k, thus dividing the medical record data into k clusters.
[0061] Calculate the silhouette coefficient for each cluster:
[0062] s k (i)=[b k (i)―a k (i)] / max{a k (i),b k (i)}
[0063] Where S(k) is the silhouette coefficient of the k-th cluster; N is the total number of medical records in the k-th cluster; a k (i) represents the average distance from medical record data i in the k-th cluster to other medical record data in the same cluster; b k (i) represents the average distance from medical record data i in the k-th cluster to all samples in the nearest other clusters;
[0064] Iterate through all candidate cluster numbers k, and select the k that maximizes S(k) as the final cluster number k. opt =argmax k S(k), and divide all medical record data into k. opt Clusters.
[0065] In step S2, an open-source inference model is used to transform the medical record data in the medical record dataset into instruction data containing the inference process, and instruction data that meets the preset rule conditions is filtered.
[0066] In implementation, step S2 of this solution preferably further includes:
[0067] S21. Input the medical record data in the medical record dataset into an open-source inference model, such as DeepSeek-R1, to obtain the inference process and predicted diagnosis of the medical record data, and select the medical record data that meets the preset logical rules based on the inference process.
[0068] The pre-defined logical rules specifically refer to defining a set of core medical keywords and phrases that must appear ("symptom analysis", "differential diagnosis", "evidence of exclusion"), and designing logical rules to ensure that the generated content follows a logical order. That is, first analyze the correlation between symptoms and diseases, then compare differential diagnoses, and finally list the evidence for excluding other possibilities. Then, relevant content is extracted from the generated text using regular expressions. Only text content containing all keywords and conforming to the logical order is accepted, thus ensuring that intermediate steps contain the required content and comply with medical reasoning norms.
[0069] S22. Use a pre-trained word embedding model to convert the predicted diagnosis and the actual diagnosis corresponding to the medical record data selected in step S21 into high-dimensional semantic vectors.
[0070] S23. Based on the high-dimensional semantic vectors of the predicted diagnosis and the actual diagnosis corresponding to the medical record data, calculate the semantic similarity between the two, and filter out medical record data with a semantic similarity greater than a preset threshold; the formula for calculating the semantic similarity sim can be:
[0071]
[0072] Among them, v true The high-dimensional semantic vector corresponding to the actual diagnosis; v pred is the high-dimensional semantic vector for prediction and diagnosis; ||·|| is the modulo length symbol.
[0073] S24. Take the current medical history and actual diagnosis of the medical record data selected in step S23 as input, and the reasoning process and predicted diagnosis corresponding to the medical record data as output, and use the input and output to form instruction data.
[0074] In step S2, instruction data of varying quality is first generated using an open-source large model. Then, rule matching and word vector cosine similarity distribution are used to quantify the accuracy of the reasoning process and diagnostic results, thereby filtering out high-quality instruction data. This method efficiently transforms the original medical record data into high-quality instruction data, providing a foundation for the subsequent model fine-tuning stage.
[0075] Because real-world oral medicine medical records contain a wealth of symptoms, diagnoses, and interdepartmental information, they hold great potential for improving the intelligent triage capabilities of models. However, these records lack intermediate reasoning processes and cannot be directly used to fine-tune the inference model. Therefore, this solution filters data in steps S1 and S2 to improve overall data quality while maintaining diversity. The filtered medical record data is then fed into an open-source inference model. Using this model and a semantic similarity-based scoring algorithm, oral medicine instruction data that can be directly used for training is generated.
[0076] In step S3, based on all instruction data, LoRA is used to perform supervised fine-tuning of the large model, using the original large model as a reference model to maintain general knowledge, and training to obtain a large oral medicine model with enhanced reasoning ability.
[0077] In step S3, LoRA simulates the effect of a full parameter update by introducing a low-rank factorization matrix (i.e., an adapter). During training, the model's core weights (i.e., the weights of the original model) remain frozen, and only the adapter parameters are updated. Since the model's core weights remain unchanged, if the adapter is temporarily disabled (i.e., the adapter parameters are not used) during LoRA training, the model's output is equivalent to the original model's output. In this way, the predicted distribution of the reference model can be obtained directly without loading a complete original model, thus avoiding increased GPU memory usage, as only one set of model weights needs to be stored throughout the entire process.
[0078] In one embodiment of the present invention, the expression for the training objective in step S3, which involves supervised fine-tuning, is:
[0079]
[0080] in, For training objectives; Let λ be the average cross-entropy loss function; λ is a hyperparameter. The KL divergence loss is represented by T, where T is the length of the instruction data; w is the length of the instruction data. t w is the t-th word in the instruction data. <t For the historical context of the first t-1 words; P θ (w t |w <t P represents the predicted word probability distribution under model parameters θ; ref (w t |w <t ) represents the probability distribution predicted by the reference model.
[0081] Through optimization This goal can significantly improve the model's performance on basic medical reasoning tasks. Meanwhile, to avoid overriding the model's original general knowledge capabilities, this approach uses the original model as a reference model and adds a KL divergence between the probability distribution of the current model predicting the next word and the probability distribution of the reference model predicting the next word. As a constraint, it can significantly improve the model's reasoning ability.
[0082] In one embodiment of the present invention, the method for enhancing the large model inference capability of this solution further includes step S4, which uses a direct preference optimization algorithm to align and optimize the output of the large oral medicine model to obtain the final large oral medicine model; the detailed implementation process of this step includes:
[0083] S41. Obtain multiple medical record data, use a large oral medicine model to generate multiple different response data for each medical record data, and calculate the semantic similarity between the predicted diagnosis and the actual diagnosis in each response.
[0084] S42. When the semantic similarity is greater than the first preset similarity, the response is marked as a positive sample; when the semantic similarity is less than or equal to the second preset similarity, the response is marked as a negative sample.
[0085] S43. Filter medical record data that includes both positive and negative samples from multiple medical record data, and use all the filtered medical record data to form a preference dataset to exclude samples in which the model responds correctly or incorrectly multiple times.
[0086] S44. Apply the direct preference optimization algorithm to the preference dataset to adjust the model parameters of the large oral medicine model to optimize its generation strategy and obtain the final large oral medicine model.
[0087] This approach applies the direct preference optimization algorithm to the preference dataset, adjusting the model parameters to optimize its generation strategy. By maximizing the generation probability of positive samples while minimizing the generation probability of negative samples, the quality and stability of the model output can be improved.
[0088] In implementation, this scheme preferably uses the direct preference optimization algorithm to adjust the large-scale oral medicine model. The expression for its optimization objective is:
[0089]
[0090] in, To optimize the objective; For the preference dataset; Δ(x,y1,y2)=logP θ (y1|x)―logP θ (y2|x) is the log ratio of the generation probabilities of positive and negative samples; P θ (·) represents the probability that the model generates a specific response y given an input x; y1 is a positive sample response; y2 is a negative sample response; x is the instruction given to the model; σ is the expected value on the preference dataset, which means that the calculation is an average over the entire preference dataset; σ(·) is the sigmoid function.
[0091] This solution minimizes... The model can better align with user preferences, improving its stability and reliability in medical scenarios.
[0092] In summary, this approach constructs an instruction dataset using real medical records for model fine-tuning. Compared to manually constructing prompts, this method better ensures that the output of the oral medicine model aligns with clinical practice. The design incorporates a two-stage fine-tuning method with supervised and direct preference optimization, which effectively enhances the model's reasoning ability and output stability in intelligent triage scenarios, providing more reliable support for medical decision-making.
Claims
1. A method for enhancing the reasoning ability of a large model for intelligent triage in oral medicine, characterized in that, Including the following steps: S1. Obtain several medical record data and select the medical record data that meets the preset conditions as the medical record dataset; S2. Use an open-source inference model to transform the medical record data in the medical record dataset into instruction data containing the inference process, and filter the instruction data that meets the preset rule conditions. S3. Based on all instruction data, LoRA is used to perform supervised fine-tuning of the large model, and the original large model is used as a reference model to maintain general knowledge, thereby training to obtain a large oral medicine model with enhanced reasoning ability. Step S1 further includes: S11. Obtain several medical record data and input them into a pre-trained language model for quality scoring, then select the medical record data with the highest quality score from the first preset quantity. S12. Cluster all medical record data, and select the second preset number of medical record data that have not been selected and have the highest quality score in each cluster; S13. Merge all selected medical record data to create a high-quality and diverse medical record dataset. In step S3, the expression for the training objective of supervised fine-tuning is: , in, For training objectives; The average cross-entropy loss function; For hyperparameters; KL divergence loss; T is the length of the instruction data; For the first in the instruction data One word; The historical context of the first t-1 words; For model parameters The probability distribution of the predicted words; This is the probability distribution predicted by the reference model.
2. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 1, characterized in that, It also includes step S4, which uses the direct preference optimization algorithm to align and optimize the output of the large oral medicine model in order to obtain the final large oral medicine model.
3. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 2, characterized in that, Step S4 further includes: S41. Obtain multiple medical record data, use a large oral medicine model to generate multiple different response data for each medical record data, and calculate the semantic similarity between the predicted diagnosis and the actual diagnosis in each response. S42. When the semantic similarity is greater than the first preset similarity, the response is marked as a positive sample; when the semantic similarity is less than or equal to the second preset similarity, the response is marked as a negative sample. S43. Filter out medical records that include both positive and negative samples from multiple medical record datasets, and use all the filtered medical record datasets to form a preference dataset. S44. Apply the direct preference optimization algorithm to the preference dataset to adjust the model parameters of the large oral medicine model to optimize its generation strategy and obtain the final large oral medicine model.
4. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 3, characterized in that, When using the direct preference optimization algorithm to adjust a large-scale oral medicine model, the expression for its optimization objective is: in, To optimize the objective; For preference datasets; The log ratio of the probabilities generated for positive and negative samples; To generate a specific response for a given input x. The probability of; The response was a positive sample. The response is a negative sample; x is the instruction given to the model. This represents the expected value on the preference dataset. This is the sigmoid function.
5. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 1, characterized in that, Methods for clustering all medical record data include: Initialize a range of candidate clusters ,in and These are the preset minimum and maximum number of clusters, respectively; Initialize each medical record as a cluster and calculate the similarity between clusters. Iteratively merge the two most similar clusters until the number of clusters is reduced to a certain value. Divide medical record data into A cluster; Calculate the silhouette coefficient for each cluster: , in, is the silhouette coefficient of the k-th cluster; N is the total number of medical records in the k-th cluster; For the medical record data in the k-th cluster The average distance to other medical records in the same cluster; For the medical record data in the k-th cluster The average distance to all samples in the nearest other cluster; Traverse all candidate clusters , choose to The largest As the final cluster number And divide all medical record data into Clusters.
6. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 1, characterized in that, Step S2 further includes: S21. Input the medical record data in the medical record dataset into the open-source reasoning model to obtain the reasoning process and predicted diagnosis of the medical record data, and select the medical record data that meets the preset logical rules based on the reasoning process. S22. Use a pre-trained word embedding model to convert the predicted diagnosis and the actual diagnosis corresponding to the medical record data selected in step S21 into high-dimensional semantic vectors. S23. Based on the high-dimensional semantic vectors of the predicted diagnosis and the actual diagnosis corresponding to the medical record data, calculate the semantic similarity between the two, and filter out the medical record data with semantic similarity greater than a preset threshold. S24. Take the current medical history and actual diagnosis of the medical record data selected in step S23 as input, and the reasoning process and predicted diagnosis corresponding to the medical record data as output, and use the input and output to form instruction data.
7. The method for enhancing the reasoning ability of large models for intelligent triage in oral medicine according to claim 2 or 6, characterized in that, semantic similarity The calculation formula is: in, This is the high-dimensional semantic vector corresponding to the actual diagnosis; For predicting diagnosis, a high-dimensional semantic vector is used. The symbol for taking the modulus.
Citation Information
Patent Citations
Thinking chain data generation method and device, medical record diagnosis method and device and electronic equipment
CN117219264A
Model updating method and device based on artificial intelligence, equipment and medium
CN119416861A
Medical treatment guide model training method and system, terminal and medium
CN119578497A