A method and system for dynamic alignment optimization of clinical large models for heart failure
Patent Information
- Application Number
- CN202610810923.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-05
- Publication Date
- 2026-08-18
AI Technical Summary
[0005]针对现有技术的不足,本发明提供了一种面向心力衰竭的临床大模型动态对齐优化方法及系统,用于解决现有通用大预言模型存在难以适配心力衰竭高危诊疗场景,无法保障模型输出循证性与安全性的技术问题
本发明通过对目标基座模型进行心力衰竭领域预训练与临床问答监督微调,以注入专业知识并构建诊疗逻辑;采用分组相对策略优化的强化学习对齐,以格式与医疗知识双轨奖励引导模型建立安全红线意识;结合指南知识库的检索增强校验,修正生成偏差;经训练与推理端优化,在保障诊疗性能的同时提升部署效率,以为心力衰竭临床应用提供可靠支撑。
Smart Images

Figure CN122599077A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and smart healthcare, and in particular to a dynamic alignment optimization method and system for a large clinical model of heart failure. Background Technology
[0002] With the continuous integration of artificial intelligence technology and smart healthcare, large language models have been gradually applied to the clinical diagnosis and treatment of cardiovascular diseases. Heart failure, as the end stage of cardiovascular disease, is characterized by high heterogeneity of disease, high diagnosis and treatment risks, and strict medication guidelines. Clinically, there is a high demand for evidence-based, safe, and standardized auxiliary decision-making systems, and large model optimization solutions for heart failure have broad application scenarios.
[0003] Existing general-purpose large language models typically use a single supervised fine-tuning approach for vertical domain adaptation. They rely on general pre-training data and conventional fine-tuning processes to generate medical texts, but only perform surface-level sentence structure and content fitting on clinical content. They do not construct a knowledge system, safety constraints, and training mechanism that match the requirements of heart failure specialty diagnosis and treatment.
[0004] Existing general-purpose large language models, with their single-supervised fine-tuning approach, can only achieve superficial fitting of clinical texts, failing to achieve deep internalization of medical knowledge, rigid adherence to clinical safety rules, and the systematic construction of evidence-based diagnosis and treatment logic. Due to the open-ended generation logic and the lag in the timeliness of pre-trained knowledge, existing general-purpose large language models are prone to errors such as deviations from clinical facts, incompatibility with the latest guidelines, and insufficient identification and control of diagnostic and treatment risks, making it difficult to meet the professional and safety requirements of heart failure diagnosis and treatment. Therefore, existing technologies suffer from technical problems in adapting to high-risk heart failure diagnosis and treatment scenarios and failing to guarantee the evidence-based and safe nature of model outputs. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a dynamic alignment optimization method and system for large clinical models for heart failure, which solves the technical problem that existing general-purpose large predictive models are difficult to adapt to high-risk diagnosis and treatment scenarios of heart failure and cannot guarantee the evidence-based and safe output of the models.
[0006] The technical means employed in this invention are as follows:
[0007] In a first aspect, embodiments of the present invention provide a dynamic alignment optimization method for a large clinical model of heart failure, comprising: Select a predetermined number of large language models, evaluate the predetermined number of large language models, and determine the target base model; Based on medical text data on heart failure, the target base model is pre-trained to obtain the trained model; Based on standardized clinical question-and-answer data for heart failure, the trained model was subjected to supervised fine-tuning to obtain the fine-tuned model. A grouping relative strategy is used to optimize the reinforcement learning alignment method, and the fine-tuned model is trained by reinforcement learning to obtain the aligned model. Based on the heart failure guidelines knowledge base and evidence-based database, the aligned model is enhanced by retrieval and validated to obtain the validated model. The validated model is then optimized at both the training and inference ends to obtain the target large-scale clinical model.
[0008] Furthermore, the step of evaluating a preset number of large language models to determine the target base model includes: evaluating the preset number of large language models in the clinical professional dimension and the NLP literal dimension to obtain model evaluation scores, and determining the target base model based on the model evaluation scores.
[0009] Furthermore, the clinical professional dimension includes indicators for standardized medication use, safety warning, guideline compliance, structural integrity, dietary accuracy, and F1 score for key medical entities; the NLP literal dimension includes indicators for 4-tuple precision, longest common subsequence similarity, and semantic similarity. The medication adherence index is used to evaluate the fit between the drug treatment plan output by the large language model and the clinical expert annotation benchmark. The calculation formula for the medication adherence index is as follows:
[0010] in, The drug use standardization indicators are scored, with Number of Correctly Recalled Drugs representing the number of drugs correctly recalled by the large language model, and Number of Standard Drugs representing the number of drugs labeled by clinical experts. The safety early warning index is used to evaluate the ability of the large language model to identify and warn of high-risk situations. The calculation formula for the safety early warning index is as follows:
[0011] Among them, Risk Safety is the safety warning indicator score, Number of Correctly Prompted Risks is the number of high risks and emergency response suggestions correctly identified and standardized by the large language model, and Number of Standard Risks is the number of high-risk risks that clinical experts judged based on the patient's medical records and that need to be highlighted. The guideline compliance index is used to assess the degree of fit between the treatment plan output by the large language model and the heart failure guidelines. The formula for calculating the guideline compliance index is as follows:
[0012] Wherein, Guideline Score is the guideline compliance index score, m is the number of treatment recommendations in the large language model output that involve the guideline, and Q is the number of recommendations. k Let G be the retrieval vector corresponding to the k-th diagnosis and treatment suggestion in the large language model. k is the text vector of the corresponding diagnosis and treatment guidelines in the heart failure guidelines, and Sim(·) is the cosine similarity; The structural integrity index is used to evaluate the degree of structured standardization of the diagnostic and treatment plan output by the large language model. The formula for calculating the structural integrity index is as follows:
[0013] Wherein, Section Completeness is the structural integrity index score, Number of CompletedSections is the number of structured modules output by the large language model, and Number of standard Sections is the total number of structured modules; The dietary accuracy index is used to evaluate the degree of fit between the dietary guidance output by the large language model and the requirements of clinical guidelines for heart failure. The formula for calculating the dietary accuracy index is as follows:
[0014] Among them, Diet Accuracy is the score of the dietary accuracy index, Number of Correct DietItems is the number of dietary recommendations that meet the requirements of the guidelines and are correctly output by the large language model, and Number of Standard DietItems is the number of standard dietary recommendations marked by clinical experts. The key medical entity F1 index is used to improve the accuracy of the large language model in identifying and extracting core medical entities in heart failure. The calculation formula for the key medical entity F1 index is as follows:
[0015] Among them, Med_Key_F1 is the F1 score of key medical entities, Precision is the accuracy of medical entity identification, and Recall is the recall rate of medical entity identification. The 4-tuple precision metric is used to evaluate the degree of n-gram overlap between the output of the large language model and the expert-annotated text. The formula for calculating the 4-tuple precision metric is as follows:
[0016] Wherein, BLEU-4 is the precision index score for 4-tuples, Igen I is the length of the diagnostic text generated by the large language model. ref The length of the standard reference medical text annotated by experts, P n For the accuracy of n-grams, This is a length penalty factor; The longest common subsequence similarity index is used to evaluate the sequence matching degree between the output of the large language model and the expert-annotated text. The calculation formula for the longest common subsequence similarity index is as follows:
[0017] Where ROUGE-L is the longest common subsequence similarity score, LCS(gen,ref) is the length of the longest common subsequence between the text generated by the large language model and the text annotated by experts, and I gen I is the length of the diagnostic text generated by the large language model. ref The length of the standard reference medical text annotated by experts; The semantic similarity index is used to evaluate the semantic fit between the output of the large language model and the expert-annotated text. The formula for calculating the semantic similarity index is as follows:
[0018] Wherein, Semantic Similarity is the semantic similarity score, V gen V is the vector representation of the diagnostic text generated by the large language model. ref Vector representation of standard reference medical texts annotated by experts.
[0019] Furthermore, the step of supervising the fine-tuning of the trained model based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model includes: supervising the fine-tuning of the trained model based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model including a disease assessment module, a diagnostic conclusion module, a drug treatment guidance module, a non-drug treatment suggestion module, and an individualized nursing order module.
[0020] Furthermore, the step of optimizing the reinforcement learning alignment method using a grouping relative strategy and training the fine-tuned model with reinforcement learning to obtain the aligned model includes: constructing a dual-track reward mechanism including format reward and medical knowledge fusion reward, and training the fine-tuned model with reinforcement learning based on the dual-track reward mechanism to obtain the aligned model; The calculation formula for the dual-track reward mechanism is as follows:
[0021] in, For the total reward, and These are the weighting coefficients. For format rewards, Rewards for integrating medical knowledge.
[0022] Furthermore, the step of performing retrieval enhancement generation verification on the aligned model based on the heart failure guideline knowledge base and evidence-based database to obtain a verified model includes: constructing the heart failure guideline knowledge base and evidence-based database through retrieval enhancement generation; converting the output of the aligned model into a query vector; calculating the matching degree between the query vector and the knowledge vectors in the heart failure guideline knowledge base and evidence-based database using a cosine similarity algorithm; and performing evidence-based verification on the diagnostic output of the aligned model based on the matching degree results to obtain a verified model.
[0023] Furthermore, the optimization of the training and inference ends of the verified model to obtain the target clinical model includes: optimizing the memory fragmentation control of the training end of the verified model and optimizing the memory anti-explosion of the inference end of the verified model to obtain the target clinical model.
[0024] Secondly, embodiments of the present invention also provide a dynamic alignment optimization system for a large clinical model of heart failure, comprising: The base model selection module is used to select a preset number of large language models, evaluate the preset number of large language models, and determine the target base model; The pre-training module is used to pre-train the target base model based on medical text data of heart failure to obtain the trained model; The supervised fine-tuning module is used to perform supervised fine-tuning on the trained model based on standardized clinical question-and-answer data of heart failure, so as to obtain the fine-tuned model. The reinforcement learning alignment module is used to optimize the reinforcement learning alignment method using a grouping relative strategy, and to perform reinforcement learning training on the fine-tuned model to obtain the aligned model. The retrieval enhancement generation verification module is used to perform retrieval enhancement generation verification on the aligned model based on the heart failure guidelines knowledge base and evidence-based database to obtain the verified model. The system optimization module is used to optimize the training and inference ends of the validated model to obtain the target clinical large model. Thirdly, embodiments of the present invention also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a dynamic alignment optimization method for a large clinical model of heart failure according to any one of the first aspects.
[0025] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements a dynamic alignment optimization method for a large clinical model of heart failure according to any one of the first aspects.
[0026] Compared with the prior art, the present invention has the following advantages: This invention injects professional knowledge and constructs diagnostic and treatment logic by pre-training the target base model in the field of heart failure and fine-tuning it with clinical question-and-answer supervision; it adopts reinforcement learning alignment optimized by grouping relative strategy, and guides the model to establish a safety red line awareness with dual-track rewards of format and medical knowledge; it combines the retrieval of the guideline knowledge base to enhance verification and correct generation bias; through optimization of the training and inference ends, it improves deployment efficiency while ensuring diagnostic and treatment performance, so as to provide reliable support for the clinical application of heart failure.
[0027] Based on the above reasons, this invention can be widely applied in fields such as artificial intelligence and smart healthcare. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a dynamic alignment optimization method for a large clinical model of heart failure according to the present invention. Figure 2 A bar chart of comprehensive indicators for a large language model; Figure 3 A comprehensive heatmap of all indicators for a large language model; Figure 4 Rose diagram of clinical indicators for large language models; Figure 5 Rose diagram of NLP metrics for large language models. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "comprising" and "having" and any variations thereof in this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.
[0032] The embodiments of the present invention will now be described with reference to the accompanying drawings.
[0033] Please see Figure 1 , Figure 1 This is a flowchart of a dynamic alignment optimization method for a large clinical model of heart failure according to the present invention.
[0034] This application provides an embodiment of the present invention that offers a dynamic alignment optimization method for a large clinical model of heart failure, comprising the following steps: Step 101: Select a predetermined number of large language models and evaluate them to determine the target base model. By conducting a cross-sectional evaluation of the predetermined number of large language models, a base model suitable for the clinical scenario of heart failure can be selected. This can effectively reduce the training cost of model-domain adaptation and ensure the model's understanding and generation capabilities in the clinical scenario of heart failure.
[0035] In some embodiments, evaluating a preset number of large language models to determine a target base model includes: evaluating the preset number of large language models in the clinical professional dimension and the NLP literal dimension to obtain model evaluation scores, and determining the target base model based on the model evaluation scores.
[0036] Specifically, five large language models can be selected, such as the currently mainstream open-source large language models Baichuan2-7B, DeepSeekLLM-7B, GLM-4-9B, Qwen3-8B, and LLaMA-3.1-8B. A comparative evaluation is conducted using conventional low-rank adaptive (LoRA) fine-tuning. Numerical accuracy is set to bfloat16 format, with core parameters configured as lora_rank=8 and lora_alpha=32, and the target module set to all-linear. The evaluation training environment can be built using the Swift toolchain, employing a Warmup-Cosine Decay learning rate scheduling strategy with a learning rate η. t The calculation formula is:
[0037] in, Let be the learning rate corresponding to the t-th training step; This is the peak learning rate; The minimum learning rate after decay; t is the current training step number; t warmup The total number of steps in the learning rate warm-up phase can be 5% of the total training steps; t total This represents the total number of training steps.
[0038] This evaluation and training environment provides unified and controllable fine-tuning and comparison conditions for each candidate large language model, effectively eliminating the differences in environmental variables between different models during the training process, improving the fairness and reliability of the evaluation results, and ensuring that the final selected target base model can adapt to the training needs of the clinical scenario of heart failure.
[0039] The evaluation system is a dual-track quantitative assessment system with clinical professional dimensions and NLP literal dimensions. It takes clinical practicality as the core orientation, uses the clinical professional dimension as the core consideration indicator, and uses the NLP literal dimension as an auxiliary reference. Through weighted fusion, it realizes the quantitative assessment of the comprehensive performance of the large language model, so as to ensure that the assessment results not only meet the real clinical needs, but also have the characteristics of being quantifiable and reproducible for scientific research.
[0040] The formula for calculating the model's overall evaluation score is as follows:
[0041] Among them, S total The overall evaluation score for the model; , These are weighting coefficients, which can be 0.8 and 0.2 respectively; S clinical For the clinical professional dimension score, S nlp The scores for the NLP literal dimension, clinical professional dimension, and NLP literal dimension were all standardized to within [0,1] to ensure the comparability of the assessment results.
[0042] In some embodiments, the clinical professional dimension includes indicators of standardized medication use, safety warning indicators, guideline compliance indicators, and structural integrity indicators.
[0043] The clinical professional dimension focuses on the clinical needs of heart failure diagnosis and treatment, including indicators for medication adherence, safety warnings, guideline compliance, structural integrity, dietary accuracy, and F1 scores for key medical entities. The scores for each indicator are weighted and summed to obtain the clinical professional dimension assessment score. The calculation formula is as follows:
[0044] Among them, S clinical is the comprehensive evaluation score of the large language model in the clinical professional dimension; i is the index number under the clinical professional dimension; i takes values from 1 to 4 for the drug application standardization index, safety warning index, guideline compliance index, and structural integrity index, respectively; w i S is the preset weighting coefficient for the i-th indicator; iThis represents the individual score of the large language model under the i-th metric.
[0045] The clinical professional dimension evaluation system quantifies the professional capabilities of the model in key aspects of heart failure diagnosis and treatment through a weighted summation method. It provides a unified and quantifiable clinical suitability assessment standard for different candidate large language models, ensuring that the selected target base model can meet the standardization and safety requirements of clinical diagnosis and treatment of heart failure.
[0046] Medication adherence indicators are used to assess the fit between the drug treatment regimens output by the large language model and the clinical expert-annotated benchmarks, in order to measure the recall completeness of GDMT quadruple therapy and corresponding indication anticoagulants. The formula for calculating the medication adherence indicators is as follows:
[0047] in, The drug use standardization index is scored, with a value range of [0,1]. The higher the score, the stronger the integrity of the drug use plan of the large language model. The Number of Correctly Recalled Drugs is the number of drugs correctly recalled by the large language model. The Number of Standard Drugs is the number of drugs labeled by clinical experts.
[0048] Safety warning indicators are used to evaluate the ability of large language models to identify and warn of high-risk conditions, such as bleeding, hypotension, and electrolyte imbalance. The formula for calculating safety warning indicators is as follows:
[0049] Among them, Risk Safety is a safety warning index score with a value range of [0,1], reflecting the clinical safety red line awareness of the large language model; Number of Correctly Prompted Risks is the number of high-risk risks and emergency response suggestions correctly identified and standardized by the large language model; Number of Standard Risks is the number of high-risk risks that clinical experts determine, based on the patient's medical records, require special attention.
[0050] The guideline compliance index is used to assess the degree of fit between the treatment plan output by the large language model and the heart failure guidelines. It is calculated based on the matching degree between the RAG knowledge base search results and the original guideline text. The formula for calculating the guideline compliance index is as follows:
[0051] Wherein, Guideline Score is the guideline compliance index score, with a value range of [0,1]. A higher score indicates stronger evidence-based efficacy of the large language model's diagnostic and treatment plan; m is the number of diagnostic and treatment recommendations in the large language model output that are based on the guideline; Qk G is the retrieval vector corresponding to the k-th diagnosis and treatment suggestion in the large language model; k is the text vector of the corresponding diagnosis and treatment guidelines in the heart failure guidelines; Sim(·) is the cosine similarity.
[0052] The structural integrity index is used to evaluate the degree of structured standardization of the diagnostic and treatment plans output by the large language model. It focuses on five modules: disease assessment, diagnostic conclusion, drug treatment, non-drug treatment, and nursing orders. The formula for calculating the structural integrity index is as follows:
[0053] Among them, Section Completeness is the structural integrity index score, with a value range of [0,1]. The higher the score, the more the output of the large language model conforms to the standard requirements of clinical workflow. Number of Completed Sections is the number of structured modules output by the large language model, and Number of standard Sections is the total number of structured modules.
[0054] The dietary accuracy index is used to evaluate the consistency between the dietary guidance output by the large language model and the requirements of clinical guidelines for heart failure. It focuses on assessing the accuracy of core dietary principles such as salt restriction, water restriction, and calorie control. The formula for calculating the dietary accuracy index is as follows:
[0055] Diet Accuracy is a score indicating the accuracy of dietary information, with a value range of [value missing]. The higher the score, the stronger the standardization of the dietary guidance. The number of correct diet items is the number of dietary recommendations that the large language model correctly outputs and meet the requirements of the guidelines. The number of standard diet items is the number of standard dietary recommendations marked by clinical experts.
[0056] The key medical entity F1 index is used to improve the accuracy of the large language model in identifying and extracting core medical entities in heart failure. It covers four types of entities: disease name, drug name, test indicators, and symptoms and signs. The calculation formula for the key medical entity F1 index is as follows:
[0057] Med_Key_F1 is the F1 score for key medical entities, with a value range of [value range missing]. Precision is the accuracy of medical entity recognition, which is the proportion of correctly recognized entities to the total number of entities recognized by the model; Recall is the recall rate of medical entity recognition, which is the proportion of correctly recognized entities to the total number of standard entities.
[0058] The NLP literal dimension is used to evaluate the literal fit between the output text of a large language model and the text annotated by clinical experts. It serves as a supplementary check to the clinical expertise dimension, preventing reliance solely on literal similarity while neglecting the safety and evidence-based nature of clinical diagnosis and treatment. The NLP literal dimension includes a 4-tuple precision metric, a longest common subsequence similarity metric, and a semantic similarity metric. The scores of each metric are standardized and then weighted and summed to obtain the NLP literal dimension evaluation score.
[0059] The formula for calculating the NLP literal dimension evaluation score is:
[0060] Among them, S nlp is the evaluation score of the large language model in the NLP literal dimension; j is the index of the metric in the NLP literal dimension, with values from 1 to 3 corresponding to the 4-tuple precision metric, the longest common subsequence similarity metric, and the semantic similarity metric, respectively; v j T is the preset weight coefficient for the j-th indicator. j is the standardized score of the large language model under the j-th metric.
[0061] The 4-tuple precision metric is used to evaluate the n-gram overlap between the output of a large language model and expert-annotated text, and to measure the recall completeness of GDMT quadruple therapy and corresponding anticoagulant drugs. The formula for calculating the 4-tuple precision metric is as follows:
[0062] Wherein, BLEU-4 is the precision index score for 4-tuples, with a value range of [0,1]; I gen The length of the diagnostic text generated for the large language model; I ref The length of the standard reference medical text annotated by experts; P n For n-gram accuracy; This is a length penalty factor to avoid high score bias caused by large language models generating excessively short texts.
[0063] The longest common subsequence similarity index is used to evaluate the sequence matching degree between the output of a large language model and the expert-annotated text. The formula for calculating the longest common subsequence similarity index is as follows:
[0064] Wherein, ROUGE-L is the longest common subsequence similarity index score, with a value range of [0,1], used to reflect the overall fit of the text sequence; LCS(gen,ref) is the length of the longest common subsequence between the text generated by the large language model and the text annotated by experts; I genThe length of the diagnostic text generated for the large language model; I ref The length of the standard reference medical text annotated by experts.
[0065] The semantic similarity metric is used to evaluate the semantic fit between the output of a large language model and expert-annotated text. It employs vector cosine similarity calculation, consistent with RAG retrieval. The formula for calculating the semantic similarity metric is:
[0066] Among them, Semantic Similarity is a semantic similarity index score, with a value range of [0,1], used to compensate for the limitation that literal similarity cannot reflect semantic consistency; V gen Vector representation of diagnostic texts generated by a large language model; V ref Vector representation of standard reference medical texts annotated by experts.
[0067] Please see Figure 2 , Figure 2 This is a bar chart of comprehensive indicators for a large language model.
[0068] Figure 2 A direct comparison was made of the comprehensive scores of five mainstream open-source large language models participating in the selection and evaluation, focusing on clinical professional dimensions and natural language processing dimensions. The results show that the preferred base model of this invention, while maintaining a basic or slightly better general language processing capability, has significantly better clinical professional adaptability than other comparative models. Its absolute score in the clinical professional dimension exceeds the 0.7 threshold, verifying the effectiveness of the dual-track quantitative evaluation system and proving that the preferred model already possesses deeper medical knowledge potential and clinical semantic affinity even without specific task fine-tuning.
[0069] Please see Figure 3 , Figure 3 A heatmap providing a comprehensive overview of all indicators for a large language model.
[0070] Figure 3 A heatmap was used to summarize the performance of each candidate model across nine subdivided quantitative indicators (the redder the color, the higher the score). The graph clearly shows that the preferred base model of this invention excels in core medical indicators such as drug recall rate, accuracy of dietary recommendations, and risk and safety warnings. In contrast, conventional general-purpose models generally exhibit significant shortcomings in these core medical indicators. Furthermore, traditional NLP evaluation metrics based on word surface matching cannot effectively characterize the alignment degree of core medical logic, fully highlighting the necessity and technical value of this invention in conducting specific dynamic alignment optimization for high-risk heart failure diagnosis and treatment scenarios.
[0071] Please see Figure 4 and Figure 5 , Figure 4Rose plot of clinical indicators for large language models. Figure 5 Rose diagram of NLP metrics for large language models.
[0072] Figure 4 and Figure 5 The Nightingale rose diagram was used to illustrate the multidimensional performance of the candidate models in both core clinical capabilities and general NLP capabilities. The length and area of the sector extending outward from the radius correspond to the absolute performance score of that dimension. The charts show that the base model selected by the evaluation system of this invention exhibits balanced performance across key clinical dimensions without significant performance dips. Furthermore, it does not sacrifice general text structuring and semantic expression capabilities. It demonstrates optimal robustness and boundary adaptability in key clinical decision-making dimensions such as high-risk identification of heart failure and structured output of individualized treatment plans, laying a solid foundation for subsequent precise fine-tuning and safe alignment training.
[0073] Step 102: Based on the medical text data of heart failure, pre-train the target base model to obtain the trained model.
[0074] High-quality, unlabeled medical text data in the field of heart failure is input into the target base model for continuous pre-training (CPT) to obtain the trained model. This expands the model's underlying medical vocabulary for heart failure and constructs a professional knowledge system, enabling the model to establish a basic understanding of the heart failure field.
[0075] The parameter configuration for continuous pre-training is optimized in conjunction with the characteristics of unlabeled text data. The core parameter is set as follows: learning rate 1×10. 4 The training round consists of 1 round, and the batch size is 8.
[0076] Step 103: Based on standardized clinical question-and-answer data for heart failure, supervised fine-tuning is performed on the trained model to obtain the fine-tuned model.
[0077] Supervised fine-tuning of the trained model was performed using standardized clinical question-and-answer data for heart failure. This positive guidance enabled the model to build a question-and-answer framework adapted to the clinical diagnosis and treatment pathway of heart failure, while simultaneously standardizing and normalizing the format of the diagnostic and treatment output. By establishing the basic logical framework for generating clinical diagnosis and treatment plans from the model, the model's ability to transition from theoretical knowledge to preliminary clinical application was realized.
[0078] In some embodiments, the trained model is supervised and fine-tuned based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model, including: supervising and fine-tuning the trained model based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model including a disease assessment module, a diagnostic conclusion module, a drug treatment guidance module, a non-drug treatment suggestion module, and an individualized nursing order module.
[0079] The supervised fine-tuning (SFT) uses bfloat16 numerical precision, and the training parameters can be set to: a learning rate of 1×10⁻⁶. 4 The training consists of 8 rounds and a batch size of 4. The standardized clinical Q&A data for heart failure has been reviewed and verified by clinical cardiovascular specialists. It includes a preset number of high-quality Q&A pairs and is stored in JSON / JSONL format. Each data entry contains a complete doctor-patient Q&A scenario and standardized diagnosis and treatment references.
[0080] The model's clinical treatment protocol can include five structured modules: disease assessment module, diagnostic conclusion module, drug treatment guidance module, non-drug treatment suggestion module, and individualized nursing care order module. The drug treatment module covers the standardized usage and dosage of GDMT quadruple therapy core drugs such as sacubitril / valsartan and dapagliflozin. The individualized nursing care order module includes standardized content for the entire process, such as diet, exercise, and disease monitoring, to provide clear and practical clinical reference standards for model training.
[0081] Step 104: Optimize the reinforcement learning alignment method using a grouping relative strategy, and train the fine-tuned model using reinforcement learning to obtain the aligned model.
[0082] In some embodiments, a grouping relative strategy is used to optimize the reinforcement learning alignment method, and the fine-tuned model is trained by reinforcement learning to obtain an aligned model. This includes: constructing a dual-track reward mechanism that includes format rewards and medical knowledge fusion rewards, and training the fine-tuned model by reinforcement learning based on the dual-track reward mechanism to obtain an aligned model.
[0083] By introducing a reinforcement learning mechanism through grouped relative strategy optimization (GRPO) reinforcement learning alignment, a dual-track reward mechanism that meets the clinical diagnosis and treatment requirements of heart failure is constructed. Through closed-loop training with targeted rewards and punishments, the model develops a strong awareness of clinical safety red lines, solving the problems of smoothness in large model regeneration and low diagnostic and treatment safety.
[0084] The Grouped Relative Policy Optimization (GRPO) reinforcement learning alignment adopts a 4-card parallel computing strategy, sets the maximum input and output length to 2048, and standardizes the length boundary of the model diagnosis output to 1024.
[0085] The specific meaning of the dual-track reward mechanism is: for a single input sample, the total reward of the model-generated sequence is the weighted sum of the two rewards. The calculation formula for the dual-track reward mechanism is:
[0086] in, Total reward; and These are weighting coefficients, which can be 0.3 and 0.7 respectively. By setting the weights, the priority of medical professionalism and safety can be highlighted. For format rewards, Rewards for integrating medical knowledge.
[0087] The format reward focuses on the structured and standardized nature of the model's output, strictly requiring the model to use a 1-5 point list format to complete the diagnosis and treatment plan output, in order to adapt to the reading habits and workflows of clinicians. Its scoring rules are as follows:
[0088] in, The format is used to award points.
[0089] Medical knowledge fusion reward is a core module of Group Relative Policy Optimization (GRPO) reinforcement learning alignment, and its calculation formula is as follows:
[0090] Among them, R hf_fusion The score is awarded for integrating medical knowledge; w1, w2, and w3 are the weighting coefficients for each sub-item, corresponding to the three core clinical requirements of core drug standards, safety red line warnings, and guideline compliance, respectively, with values of 0.4, 0.4, and 0.2; R drug A reward of 1 point is given for matching core drugs. A perfect score is awarded for a model that fully covers the core drugs of GDMT quadruple therapy and their corresponding indications for anticoagulation. Points are deducted proportionally for any missing core drugs to ensure the completeness of the treatment regimen. safety A reward of 1 point is given for safety red line warnings. A model that fully includes warnings and emergency response suggestions for high-risk factors in heart failure diagnosis and treatment, such as bleeding, hypotension, and electrolyte imbalance, receives full marks. A lack of risk warnings results in severe point deductions, forcing the model to establish clinical safety awareness. guideline To reward adherence to guidelines, a maximum score of 1 point is awarded. Positive bonuses are given to model outputs that include core nursing orders recommended by guidelines, such as salt and water restriction, daily weight monitoring, and regular follow-up examinations, in order to guide the model outputs to strictly conform to clinical guidelines.
[0091] Step 105: Based on the heart failure guidelines knowledge base and evidence-based database, perform retrieval enhancement and generation verification on the aligned model to obtain the verified model. By performing retrieval enhancement and verification on the model output using the heart failure guidelines knowledge base and evidence-based database, potential non-evidence-based biases and clinical risks in the generated model content are effectively corrected. This ensures that the treatment plan strictly adheres to the latest heart failure guidelines, improves the evidence-based nature, accuracy, and clinical safety of the model output, and provides a reliable guarantee for the clinical application of the model.
[0092] In some embodiments, based on the heart failure guidelines knowledge base and evidence-based database, the aligned model is subjected to retrieval enhancement generation verification to obtain a verified model, including: constructing the heart failure guidelines knowledge base and evidence-based database through retrieval enhancement generation; converting the output of the aligned model into a query vector; using a cosine similarity algorithm to calculate the matching degree between the query vector and the knowledge vectors in the heart failure guidelines knowledge base and evidence-based database; and performing evidence-based verification on the diagnostic output of the aligned model based on the matching degree results to obtain a verified model.
[0093] The Heart Failure Guidelines Knowledge Base uses the latest clinical diagnosis and treatment guidelines for heart failure as its core data source. It employs a fixed sliding window strategy for fine-grained text segmentation, setting the segment size to 500. After segmentation, the text is vectorized and embedded using the BAAI / bge-m3 model, and the generated vectors are persistently stored in the ChromaDB vector database. During the retrieval phase, cosine similarity is used to calculate the matching degree between the user's query vector and the vectors of text blocks in the knowledge base. The cosine similarity calculation formula is:
[0094] Among them, Cosine(Q,V) k V is the cosine similarity between the user query vector and the k-th text block vector; Q is the vector corresponding to the user query text; V is the vector corresponding to the user query text. k Q is the vector corresponding to the k-th text block in the knowledge base; j For the user query vector Q, the j-th dimension component; V k,j V is the vector of the k-th text block in the knowledge base. k The j-th component; d is the output vector dimension of the bge-m3 model.
[0095] The search results are accurately sorted by cosine similarity calculation. The top three most similar text blocks are selected and injected into the model to generate context, which supports the evidence-based output of the diagnosis and treatment plan.
[0096] Step 106: Optimize the training and inference ends of the validated model to obtain the target clinical model. By optimizing the training and inference ends of the validated model, the computational resource consumption and inference latency of the model are effectively reduced without significantly sacrificing clinical diagnostic performance. This improves the feasibility and response efficiency of the model in clinical terminal environments, enabling the target clinical model to meet the application requirements of low latency and high stability in real-world heart failure diagnosis and treatment scenarios.
[0097] In some embodiments, the training and inference ends of the validated model are optimized to obtain the target clinical large model, including: optimizing the memory fragmentation control of the training end of the validated model and optimizing the memory explosion prevention of the inference end of the validated model to obtain the target clinical large model.
[0098] Training-side optimizations focus on addressing the memory fragmentation issue during model training by configuring CUDA memory allocation environment variables:
[0099] Enabling CUDA memory expandable segments and limiting the maximum size of a single memory block to 128MB can reduce invalid partitions caused by frequent small-granularity memory allocation and deallocation, thereby alleviating memory fragmentation. The formula for calculating memory fragmentation rate is:
[0100] Where MaxContiguousBlockSize is the maximum size of a contiguous block of available memory in the GPU, and TotalFreeMemory is the total free memory size of the GPU. Through the above optimization, the memory fragmentation rate Fmem during training can be stably controlled within 10%, significantly improving memory space utilization and effectively avoiding problems such as memory allocation failure and training interruption caused by memory fragmentation, thus ensuring the continuity and stability of the large model training process.
[0101] The inference end has been optimized to address the memory overflow (OOM) issue during concurrent execution of large model inference and vector model retrieval in a single-card 32GB VRAM environment. The specific optimization method is as follows: 1. When starting the vLLM inference engine, force the addition of the --enforce-eager parameter to disable CUDA Graph memory preemption to avoid unnecessary memory usage.
[0102] 2. Set the `--gpu-memory-utilization` parameter to 0.85 to define the GPU memory utilization cap (Umem) as follows:
[0103] Where Umem is the current GPU memory utilization; UsedMemory is the currently used video memory size; and TotalPhysicalMemory is the total physical video memory size of the GPU. A 15% video memory redundancy is reserved through hard constraints to avoid video memory overload during concurrent inference.
[0104] Third, the bge-m3 vector model, which is about 2GB in size, is completely isolated to run on the CPU, thus freeing up GPU memory space and making it dedicated to inference calculations for the LLaMA-3.1-8B model.
[0105] This invention also provides a dynamic alignment and optimization system for a large clinical model for heart failure, comprising: a base model selection module for selecting a preset number of large language models, evaluating these models, and determining a target base model; a pre-training module for pre-training the target base model based on heart failure medical text data to obtain a trained model; a supervised fine-tuning module for supervising fine-tuning the trained model based on standardized heart failure clinical question-and-answer data to obtain a fine-tuned model; a reinforcement learning alignment module for optimizing the reinforcement learning alignment method using a grouping relative strategy and training the fine-tuned model to obtain an aligned model; a retrieval enhancement generation and verification module for performing retrieval enhancement generation and verification on the aligned model based on a heart failure guideline knowledge base and evidence-based database to obtain a verified model; and a system optimization module for optimizing the training and inference ends of the verified model to obtain the target large clinical model. This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the above-described dynamic alignment optimization method for a large clinical model of heart failure.
[0106] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned dynamic alignment optimization method for a large clinical model of heart failure.
[0107] The same or similar parts among the various embodiments in this specification can be referred to mutually, and will not be repeated here.
[0108] This invention injects professional knowledge and constructs diagnostic and treatment logic by pre-training the target base model in the field of heart failure and fine-tuning it with clinical question-and-answer supervision; it adopts reinforcement learning alignment optimized by grouping relative strategy, and guides the model to establish a safety red line awareness with dual-track rewards of format and medical knowledge; it combines the retrieval of the guideline knowledge base to enhance verification and correct generation bias; through optimization of the training and inference ends, it improves deployment efficiency while ensuring diagnostic and treatment performance, so as to provide reliable support for the clinical application of heart failure.
[0109] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A dynamic alignment optimization method for a large clinical model of heart failure, characterized in that, include: Select a predetermined number of large language models, evaluate the predetermined number of large language models, and determine the target base model; Based on medical text data on heart failure, the target base model is pre-trained to obtain the trained model; Based on standardized clinical question-and-answer data for heart failure, the trained model was subjected to supervised fine-tuning to obtain the fine-tuned model. A grouping relative strategy is used to optimize the reinforcement learning alignment method, and the fine-tuned model is trained by reinforcement learning to obtain the aligned model. Based on the heart failure guidelines knowledge base and evidence-based database, the aligned model is enhanced by retrieval and validated to obtain the validated model. The validated model is then optimized at both the training and inference ends to obtain the target large-scale clinical model.
2. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 1, characterized in that, The step of evaluating a preset number of large language models to determine the target base model includes: evaluating the preset number of large language models in the clinical professional dimension and the NLP literal dimension, obtaining model evaluation scores, and determining the target base model based on the model evaluation scores.
3. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 2, characterized in that, The clinical professional dimension includes indicators for standardized medication use, safety warning, guideline compliance, structural integrity, dietary accuracy, and F1 score for key medical entities; the NLP literal dimension includes indicators for 4-tuple precision, longest common subsequence similarity, and semantic similarity. The medication adherence index is used to evaluate the fit between the drug treatment plan output by the large language model and the clinical expert annotation benchmark. The calculation formula for the medication adherence index is as follows: in, The drug use standardization indicators are scored, with Number of Correctly Recalled Drugs representing the number of drugs correctly recalled by the large language model, and Number of Standard Drugs representing the number of drugs labeled by clinical experts. The safety early warning index is used to evaluate the ability of the large language model to identify and warn of high-risk situations. The calculation formula for the safety early warning index is as follows: Among them, Risk Safety is the safety warning indicator score, Number of Correctly Prompted Risks is the number of high-risk risks and emergency response suggestions correctly identified and standardized by the large language model, and Number of Standard Risks is the number of high-risk risks that clinical experts judged based on the patient's medical records and that need to be highlighted. The guideline compliance index is used to assess the degree of fit between the treatment plan output by the large language model and the heart failure guidelines. The formula for calculating the guideline compliance index is as follows: wherein the Guideline Score is a guideline adherence index score, m is the number of diagnosis and treatment suggestions in the large language model output that involve the guideline basis, Q k is the search vector corresponding to the kth diagnosis and treatment suggestion of the large language model, G k is the text vector corresponding to the diagnosis and treatment specification in the heart failure guideline, and Sim(·) is the cosine similarity. The structural integrity index is used to evaluate the degree of structured standardization of the diagnostic and treatment plan output by the large language model. The formula for calculating the structural integrity index is as follows: Wherein, Section Completeness is the structural integrity index score, Number of Completed Sections is the number of structured modules output by the large language model, and Number of standard Sections is the total number of structured modules; The dietary accuracy index is used to evaluate the degree of fit between the dietary guidance output by the large language model and the requirements of clinical guidelines for heart failure. The formula for calculating the dietary accuracy index is as follows: Among them, Diet Accuracy is the score of the dietary accuracy index, Number of Correct DietItems is the number of dietary recommendations that meet the requirements of the guidelines and are correctly output by the large language model, and Number of Standard DietItems is the number of standard dietary recommendations marked by clinical experts. The key medical entity F1 index is used to improve the accuracy of the large language model in identifying and extracting core medical entities in heart failure. The calculation formula for the key medical entity F1 index is as follows: Among them, Med_Key_F1 is the F1 score of key medical entities, Precision is the accuracy of medical entity identification, and Recall is the recall rate of medical entity identification. The 4-tuple precision metric is used to evaluate the degree of n-gram overlap between the output of the large language model and the expert-annotated text. The formula for calculating the 4-tuple precision metric is as follows: Wherein, BLEU-4 is the precision index score for 4-tuples, I gen I is the length of the diagnostic text generated by the large language model. ref The length of the standard reference medical text annotated by experts, P n For the accuracy of n-grams, This is a length penalty factor; The longest common subsequence similarity index is used to evaluate the sequence matching degree between the output of the large language model and the expert-annotated text. The calculation formula for the longest common subsequence similarity index is as follows: Where ROUGE-L is the longest common subsequence similarity score, LCS(gen,ref) is the length of the longest common subsequence between the text generated by the large language model and the text annotated by experts, and I gen I is the length of the diagnostic text generated by the large language model. ref The length of the standard reference medical text annotated by experts; The semantic similarity index is used to evaluate the semantic fit between the output of the large language model and the expert-annotated text. The formula for calculating the semantic similarity index is as follows: Wherein, Semantic Similarity is the semantic similarity score, V gen V is the vector representation of the diagnostic text generated by the large language model. ref Vector representation of standard reference medical texts annotated by experts.
4. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 1, characterized in that, The process of supervising and fine-tuning the trained model based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model includes: supervising and fine-tuning the trained model based on standardized clinical question-and-answer data for heart failure to obtain a fine-tuned model including a disease assessment module, a diagnostic conclusion module, a drug treatment guidance module, a non-drug treatment suggestion module, and an individualized nursing order module.
5. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 1, characterized in that, The step of optimizing the reinforcement learning alignment method using a grouping relative strategy and training the fine-tuned model with reinforcement learning to obtain the aligned model includes: constructing a dual-track reward mechanism that includes format rewards and medical knowledge fusion rewards, and training the fine-tuned model with reinforcement learning based on the dual-track reward mechanism to obtain the aligned model. The calculation formula for the dual-track reward mechanism is as follows: in, For the total reward, and These are the weighting coefficients. For format rewards, Rewards for integrating medical knowledge.
6. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 1, characterized in that, The process of performing retrieval enhancement generation and verification on the aligned model based on the heart failure guidelines knowledge base and evidence-based database to obtain a verified model includes: constructing the heart failure guidelines knowledge base and evidence-based database through retrieval enhancement generation; converting the output of the aligned model into a query vector; calculating the matching degree between the query vector and the knowledge vectors in the heart failure guidelines knowledge base and evidence-based database using a cosine similarity algorithm; and performing evidence-based verification on the diagnostic output of the aligned model based on the matching degree results to obtain a verified model.
7. The dynamic alignment optimization method for a large clinical model of heart failure according to claim 1, characterized in that, The step of optimizing the training and inference ends of the validated model to obtain the target clinical model includes: optimizing the memory fragmentation control of the training end of the validated model and optimizing the memory anti-explosion of the inference end of the validated model to obtain the target clinical model.
8. A dynamic alignment optimization system for a large clinical model of heart failure, characterized in that, include: The base model selection module is used to select a preset number of large language models, evaluate the preset number of large language models, and determine the target base model; The pre-training module is used to pre-train the target base model based on medical text data of heart failure to obtain the trained model; The supervised fine-tuning module is used to perform supervised fine-tuning on the trained model based on standardized clinical question-and-answer data of heart failure, so as to obtain the fine-tuned model. The reinforcement learning alignment module is used to optimize the reinforcement learning alignment method using a grouping relative strategy, and to perform reinforcement learning training on the fine-tuned model to obtain the aligned model. The retrieval enhancement generation verification module is used to perform retrieval enhancement generation verification on the aligned model based on the heart failure guidelines knowledge base and evidence-based database to obtain the verified model. The system optimization module is used to optimize the training and inference ends of the validated model to obtain the target clinical large model.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements a dynamic alignment optimization method for a large clinical model of heart failure according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements a dynamic alignment optimization method for a large clinical model for heart failure according to any one of claims 1 to 7.