Big model-based double optimization method for hallucination suppression in discharge nodule
Through EMR-LLM instruction fine-tuning and Prompt hallucination inhibition strategies, the problem of model adaptability and information too long in the generation of discharge summary was solved, and high-quality discharge summary generation that meets medical standards was achieved.
Patent Information
- Application Number
- CN202510440048.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art discharge summary generation method in the medical field, there are problems such as lack of adaptability of the model, excessive information leads to hallucinations, and high difficulty for doctors to customize Prompt, resulting in the generated content not meeting medical standards and loss of information.
Using EMR-LLM instruction fine-tuning and Prompt hallucination suppression strategy, the input length is controlled by designing six instruction tasks, semantic segmentation and rule constraints, and combining logical combination templates and knowledge bases, the model is optimized to generate discharge summary.
Effectively inhibit model hallucinations and generate discharge summary that conforms to medical logic and standards, improves generation accuracy and consistency, and reduces the difficulty of doctor review.
Smart Images

Figure CN120376017A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, specifically to the technical field of text information summarization, and more specifically, provides a dual optimization method for hallucination suppression in discharge summaries based on large models. Background Art
[0002] The relation summarization task refers to extracting and summarizing key information from natural language texts, which has many downstream applications such as automatic summarization, information retrieval, and decision-making assistance. In the medical field, with the popularization of electronic medical record systems, the relation summarization task is used to extract important information such as patients' diagnosis and treatment information, disease development, treatment plans, and discharge summaries. Medical relation summarization aims to automatically generate concise and accurate summaries to help doctors quickly obtain patients' treatment histories and suggestions. This is an important text mining and knowledge discovery task that can be used in clinical decision support, medical record management, and medical research.
[0003] Electronic Medical Records (EMR) are key informatization tools for modern medical and clinical work, containing various detailed information such as patients' medical histories, treatment processes, and medical outcomes. As a systematic medical record, the EMR system not only improves communication among medical staff but also enhances the accuracy and accessibility of medical records. Therefore, EMR plays an important role in promoting medical data management, analysis, and public health research and has become a socio-economic pillar of medical services.
[0004] The discharge summary generation task refers to summarizing patients' diagnosis and treatment data during hospitalization from their EMR documents, covering admission records, treatment plans, diagnostic suggestions, etc., aiming to improve medical efficiency and quality. The EMR system records patients' medical histories, treatment processes, and results and has become the core tool for medical services. Optimizing the discharge summary writing process, especially in suppressing the generation of hallucination phenomena and improving content consistency, is the key to solving doctors' burdens and improving nursing quality.
[0005] Compared with the general medical field, the task of generating a patient's discharge summary requires more extensive and professional domain knowledge, which brings great challenges to medical relationship summarization. The main difficulties are: (1) Lack of a large medical model adapted to the discharge summary task: The existing general or large medical models are not optimized for this task, and it is difficult to accurately understand the logical relationship and key information in medicine, resulting in confusion in medical records, and even the generated content does not meet medical standards, which affects clinical reliability. (2) Excessive information leads to hallucinations: EMR text information is huge, and the content of hospitalization records, examination reports, and medical orders usually exceeds 5000-20000 tokens, far exceeding the processing window of general models. Traditional methods are difficult to effectively extract key information, resulting in semantic bias, numerical hallucinations, etc. (3) The challenge of customized prompts in doctors' use: The existing methods have high barriers to use, lack of sufficient customization, and difficulty in flexibly controlling the generated results. Doctors have diverse needs, and large model segmentation tasks require targeted customized prompts. Structured generation is more in line with doctors' habits.
[0006] At present, the methods for generating discharge summaries in the medical field can be mainly divided into three categories: methods based on traditional extraction and summarization, knowledge enhancement methods based on knowledge bases, and methods based on large language models (LLMs). Methods based on traditional extraction and summarization usually select relevant sentences through a recall-oriented extraction model, then remove duplicate information and adjust the order of sentences through post-processing to form a preliminary summary, and finally improve fluency through summarization methods. For example, a pipeline model combining extraction and summarization can be used to generate SOAP, i.e., chief complaint, objective examination, evaluation, and plan notes, which extracts information first and then summarizes it to improve readability. In addition, the Transformer model based on BERT and BART improves the authenticity of the summary and reduces medical terminology errors through restricted beam search. However, these methods have two main problems: 1) the extraction method has poor fluency; 2) the summarization method may cause information loss, and the generated content does not match the original data.
[0007] In order to alleviate these problems, many researchers have proposed knowledge enhancement methods based on knowledge bases. They introduce fact-checking mechanisms through reinforcement learning, extract medical entities and match them with existing knowledge bases, thereby enhancing the medical consistency of generated texts. At the same time, they explore the use of ontology retrieval and knowledge alignment techniques to improve the accuracy of patient guidance and make it easier to understand. However, these methods often increase computational complexity, rely too much on external knowledge bases, and ignore efficiency issues.
[0008] At present, the more common practice is to use LLM for fine-tuning to generate high-quality summaries, which saves time but still requires manual review to ensure accuracy. In summary, in view of the shortcomings of existing methods, it is urgent to design a new discharge summary generation method to solve these problems and improve the generation effect. Summary of the Invention
[0009] In view of this, the present invention provides a dual optimization method for hallucination suppression in discharge summaries based on large models. First, to alleviate the problem of insufficient fluency in the extraction method and information loss caused by the generalization method through EMR-LLM instruction fine-tuning, the present invention proposes EMR-GPT. As the first large model for multi-department clinical operations, it enhances the sensitivity of the LLM to numerical values by designing six instruction tasks, effectively suppressing model hallucinations. Second, to fully suppress length hallucinations and logical hallucinations in the generation of discharge summaries, the present invention proposes a Prompt hallucination suppression strategy to effectively suppress hallucinations in each module of the method.
[0010] The implementation form of the technical route of the present invention is as follows: First, adopt EMR-LLM instruction fine-tuning. By constructing a high-quality instruction dataset and combining the curriculum learning training method to suppress the forgetting phenomenon, enhance the model's understanding ability of the target task and sensitivity to key information. Specifically, using the discharge summaries written by doctors and the corresponding medical record data, design targeted instruction tasks to enable the model to better capture key information such as the patient's medical history and treatment plan. Second, introduce the Prompt hallucination suppression strategy, including length hallucinations and logical hallucinations. Specifically, input length control ensures that the input length is less than 8000 tokens through semantic segmentation, source retrieval, and rule constraints. First, semantic segmentation splits the medical record to make the model focus on key information. Second, source retrieval matches relevant paragraphs, and rule constraints verify the output according to medical standards to avoid semantic deviation and numerical hallucinations. At the same time, the logical combination template effectively combines five types of logical operators: extraction, summary, reasoning, judgment, and knowledge to process six core fields of the discharge summary, guiding the model to generate content that conforms to medical logic and suppressing hallucinations.
[0011] Taking the medical relationship summary as an example, the specific steps of the present invention are as follows:
[0012] S1. Model hallucination suppression: According to the relationship between the discharge summary and the medical record documents during hospitalization, and combining the curriculum learning training method to suppress the forgetting phenomenon, adopt EMR-LLM instruction fine-tuning to construct a high-quality instruction dataset. The EMR-LLM instruction fine-tuning refers to a method of integrating self-built medical datasets and open medical task data, unifying the format, and then mixing general domain data in a 1:3 ratio to obtain a multi-department fine-tuned business medical large model EMR-GPT;
[0013] S2. Input length hallucination suppression: Through semantic segmentation, source retrieval, and rule constraint strategies, obtain a more concise and accurate source document related to the discharge summary;
[0014] S3. Logical hallucination suppression: An effective combination of five types of logical operators, namely extraction, summarization, reasoning, judgment, and knowledge, is used to construct a logical combination template, which is used to process six core fields of the discharge summary, including the patient's basic information, discharge diagnosis, medical conditions during hospitalization, course of disease and treatment, condition at discharge, and medication advice after discharge;
[0015] S4. Design a reasonable Prompt. By combining the effective Prompt for the input length and the logical template, the hallucination phenomenon is suppressed, and a preliminary compliant discharge summary generation document is obtained, which can basically generate six core fields of the discharge summary;
[0016] S5. In the fine-tuning stage, train the multi-department fine-tuning business medical large model EMR-GPT. In the inference stage, design a Prompt hallucination suppression strategy. The dual optimization of the two improves the performance of the entire method, and a final compliant discharge summary generation document is obtained. It can not only generate six core fields of the discharge summary, but also the generation of each field conforms to the traceable document, and the content is consistent with the original electronic medical record document in terms of fact, integrity, and accuracy.
[0017] Furthermore, step S1 includes:
[0018] S11. Input the set of medical record documents D = [d1, d2,..., d n , including admission records, operation records, doctor's orders, etc. Further analyze the electronic medical record data structure and design specialized instruction tasks; for the digital information understanding ability, design tasks of "medical text index extraction and formatting" and "index consistency detection" to obtain the model's cross-modal numerical perception enhancement ability; for the medical record structure and semantic understanding ability, design tasks of "medical text structuring" and "medical text source field guessing" to obtain the model's hierarchical semantic parsing ability; combined with the actual medical scenario requirements, design tasks of "department guide" and "discharge summary generation", write basic prompts, processing strategies, and output formats for each task, and expand the prompt content through ChatGPT; analyze the source and target fields, develop a data conversion template, and directly extract the required fields from the structured data to obtain the input and output information of the task, and obtain the model's clinical decision support ability;
[0019] S12. Based on the continuously pre-trained model, instruction fine-tuning is implemented, and two key optimization measures are taken: data integration and format unification. The PromptClinicalTerm dataset is constructed, which is based on the ICD-10 and ICD-9-CM3 coding frameworks, designs tasks for term output, classification, standardization, and reasoning, and constructs conversion templates to improve the model's understanding of terms and relationships in clinical texts; the PromptEMR dataset is constructed, which contains key information such as medical records, nursing records, and test reports of real case data, covering eight core medical information types. Through the structure parsing framework, the original medical records are converted into a standardized JSON format, incorporating open data related to general medical tasks, including medical named entity recognition and medical text intent recognition. Since the annotation formats of data sources vary, special scripts are developed to unify the formats, and to prevent catastrophic forgetting, medical domain and general domain data are integrated in a 1:3 ratio to form the final instruction fine-tuning dataset;
[0020] S13. The autoregressive training method is adopted in the training strategy, enabling the model to consider all previous input information when generating outputs, effectively capturing long-range dependencies in the sequence; in the loss calculation link, masking processing is performed on the task description and input parts, and the LoRA method is introduced to achieve efficient parameter updates through low-rank matrix adaptation technology, while significantly improving the training speed; referring to the DMT method and innovatively proposing a curriculum learning training strategy to suppress forgetting, based on the ability analysis of PromptEMR, a progressive training method from simple to difficult is adopted to optimize the model performance in stages; in the first stage, general medical NLP tasks, department guidance, and medical text structuring are trained; in the second stage, focus on medical text index extraction and formatting, and medical text source field guessing; in the third stage, train index consistency detection and discharge summary generation; in the final stage, all medical-related and general data are mixed for comprehensive training, and a small amount of data from the previous stage is introduced in each iteration to prevent forgetting problems, and finally the business medical large model EMR-GPT with multi-department fine-tuning is obtained.
[0021] Further, step S2 includes:
[0022] S21. Input the JSON data of the electronic medical records after cleaning and standardization in the model pre-training stage. Based on the preliminary division and streamlining of the JSON electronic medical record fields by humans, through semantic segmentation technology, the structured fields and the words related to the discharge summary after human streamlining are further refined to obtain the source document mapping table of the fields required in the discharge summary;
[0023] S22. Based on the source document mapping table of the discharge summary fields, using the instruction dataset already constructed by EMR-LLM, for each subdivided field, the source retrieval method is adopted to sort and screen the relevance of all associated documents, and the occurrence times of each field in the electronic medical record documents are obtained;
[0024] S23. Screen according to the field that appears most frequently in the electronic medical record document, and screen out the most relevant source document of sub - content to ensure that the input content of each field closely revolves around the key information of the discharge summary;
[0025] Further, step S3 includes:
[0026] S31. For different content types of the discharge summary, formulate clear generation rules and constraints. Specifically, the generation logic of each field content of the discharge summary is divided into the following 5 categories, and corresponding optimization measures are formulated for each category:
[0027] ① Extractive generation directly extracts deterministic information from the medical record, such as name, hospital number, etc.;
[0028] ② Abstractive generation extracts key information from multiple documents, such as the progress record, the situation at discharge, etc.;
[0029] ③ Judgmental generation judges the input content according to clinical criteria, such as whether the test index is abnormal, whether there is surgery, etc.;
[0030] ④ Inferential generation integrates various aspects of information to infer the disease development or treatment effect, such as the discharge time, etc.;
[0031] ⑤ Knowledge - based generation combines the clinical knowledge base to generate advice - type information, such as the follow - up department, postoperative precautions, etc.;
[0032] S32. We have constructed a dedicated logic combination library for the medical field, which includes five types of logic modules: 6 extraction types, 3 summary types, 3 discriminant types, 2 reasoning types, and 1 knowledge type. The 6 extraction types include: (1) directly extracting information such as the patient's name, gender, age, hospital admission number, bed number, ward name, and admission date from medical records; (2) directly extracting the discharge diagnosis information based on the diagnosis description in medical documents; (3) extracting vital sign information and medical history content from medical records; (4) extracting key results from test and examination records according to predefined logic, such as retaining the latest results of normal tests and all results of abnormal tests; (5) for the situation after surgery, extracting relevant treatment information; (6) extracting the patient's medical history and chronic disease information. The 3 summary types include: (1) summarizing the vital sign information and medical history content obtained from medical records; (2) reading and analyzing physical examination records, extracting key information, and forming a summary; (3) summarizing the relevant treatment information obtained from the surgical situation during the treatment process. The 3 discriminant types include: (1) judging whether surgery has been performed during the treatment process; (2) judging the overall condition of the patient based on the patient's recovery situation and medical records; (3) judging whether the patient has chronic diseases based on the obtained patient's medical history and chronic disease information. The 2 reasoning types include: (1) reasoning about the overall situation at the time of discharge based on the patient's recovery situation and medical records; (2) reasoning about the discharge date and time by combining the discharge instructions and time in the doctor's advice. The 1 knowledge type is: based on the patient's medical history and chronic disease information, if there are chronic diseases, match them with the knowledge base to obtain medication suggestions; otherwise, there is no match.
[0033] S33. The system is based on the business medical large model EMR-GPT fine-tuned for multiple departments, and adopts a three-stage intelligent processing mechanism for any field: ① In the task parsing stage, 1-4 logical formulas are intelligently matched with the field in combination with semantic features Prompt; ② According to the dependence relationship of the diagnosis and treatment path, the execution path of the logical formula is constructed; ③ Structurally generate an ordered, reasonable, and smooth diagnostic logic Prompt composite instruction. Through the triple guarantee of intelligent matching - logic arrangement - semantic fusion, finally output a field logic combination template that not only conforms to medical specifications but also has a clear logical chain, realizing the automatic conversion from business instructions to accurate Prompt.
[0034] S34. The discharge summary includes six field tasks, namely patient basic information, discharge diagnosis, medical conditions during hospitalization, course and treatment, medication suggestions after discharge, and the situation at the time of discharge; for different content types of the discharge summary, logical combination templates are formulated. Due to different field information requirements, a single template or a collaborative method of multiple templates is adopted for optimization; the logical template combinations for the six field tasks are extraction + reasoning + summary, extraction, extraction, judgment + extraction + reasoning, summary, extraction + judgment + knowledge.
[0035] Further, step S4 includes:
[0036] S41. The specific sources of the six field tasks are: basic information comes from the admission notice-content-patient information, admission and discharge records within 24 hours-content-admission diagnosis, admission record-content-preliminary diagnosis, first course of illness record-content-preliminary diagnosis, attending physician's first ward round record-content-diagnosis, chief physician's first ward round record-content-diagnosis; discharge diagnosis comes from the first course of illness record after surgery-content-intraoperative diagnosis, surgical record sheet (trial)-content-intraoperative diagnosis, preoperative summary-content-preoperative diagnosis, admission and discharge records within 24 hours-content-discharge diagnosis; medical conditions during hospitalization come from examinations and tests; course of illness and treatment come from the first course of illness record-content-diagnosis and treatment plan, chief physician's first ward round record-content-supplementary medical history and characteristics, chief physician's first ward round record-content-analysis of the condition, chief physician's first ward round record-content-diagnosis and treatment opinions, attending physician's first ward round record-content-TM employee nameTM attending physician's ward round, attending physician's first ward round record-content-diagnostic basis and identification Analysis of diagnosis, attending physician's first ward round record - content - diagnosis and treatment plan, daily course of illness record - content, postoperative n-day record - content, death record - content, death medical record discussion - content, attending physician's daily ward round record - content, first postoperative course of illness record - content - postoperative treatment measures, chief physician's daily ward round record - content - diagnosis and treatment opinions, chief physician's daily ward round record - content - analysis of the condition, admission and discharge records within 24 hours - content - admission situation, stage summary - content - diagnosis and treatment process, stage summary - content - diagnosis and treatment plan, transfer department record - content - diagnosis and treatment process, transfer department record - content - transfer diagnosis and treatment plan; discharge situation comes from the senior physician's ward round record - content - diagnosis basis, attending physician's first ward round record - content - diagnosis, postoperative n-day record - content - observation record; medication recommendations after discharge come from admission record - past history, daily course of illness record, postoperative n-day record, examination, and doctor's advice; input the specific sources of the six field tasks, and design a concise and reasonable prompt with input length control;
[0037] S42. Prompt with reasonable design. Basic information is filled in with the patient's basic information based on the admission notice, ward rounds, first medical records, etc.; discharge diagnosis is extracted based on preoperative summary, intraoperative diagnosis, admission diagnosis, etc.; medical conditions during hospitalization are described based on examination and test results; the course of disease and treatment are combined with medical records, treatment plans, chief physician ward rounds, etc. to provide the patient's treatment history and main treatment measures; the discharge situation extracts information such as the ward rounds of senior physicians and attending physicians to describe the patient's condition at discharge; medication recommendations after discharge are provided based on postoperative medical records, doctor's orders, etc., and through the effective simplification of the six field tasks, the input length is effectively controlled, the illusion phenomenon is suppressed, and a preliminary discharge summary generation document is obtained, which can basically generate the six core fields of the discharge summary;
[0038] S43. Design a reasonable Prompt for the logical template combination of the six-field task. Patient's basic information: {Extraction: ['Extract the patient's name, gender, age, hospital number, bed number, ward name, admission date, body temperature, heart rate, respiration, blood pressure, etc. directly from the new admission assessment form, admission record, and admission notice;', 'Extract the admission diagnosis according to relevant admission diagnoses, admission records, preoperative summaries, etc.'], Reasoning: ['Reason out relevant information based on the discharge instructions, calculate the accurate discharge time through the date and content.'], Summary: ['Summarize the physical examination and brief medical history from the admission record.']}, Discharge diagnosis: {Extraction: ['Analyze the patient's diagnosis and medical record, extract the discharge diagnosis information, and the name should be the standard diagnosis term. If there is relevant descriptive information, note it in parentheses.']}, Medical conditions during hospitalization: {Extraction: ['Comprehensively analyze the patient's examination and test information, extract and display the key test and examination information without modifying the detailed report content and description.']}, Course of disease and treatment: {Judgment: ['Judge whether surgery was performed during the treatment process from the medical record.'], Extraction: ['For the situation after surgery, extract relevant treatment information, including the surgery date, anesthesia method, surgery name, intraoperative and postoperative pathological conditions, and postoperative medication.'], Reasoning: ['Analyze the patient's recovery situation according to the medical record, such as the status of the drainage tube and the discharge date, and reason out the overall situation at the time of discharge.']}, Condition at discharge: {Summary: ['Summarize the key information from the patient's medical record to clarify the overall health status at the time of discharge, such as mental status and physical recovery.']}, Medication advice after discharge: {Judgment: ['Judge whether the patient's report is complete according to the relevant pathological report.'], Extraction: ['Extract the discharge medication, follow-up visit, and medication change information for the patient according to the medical record.'], Knowledge: ['Match with the knowledge base based on the patient's past history and abnormal test information. If there are chronic diseases / abnormal tests, obtain the department follow-up advice.']}, Generate six core fields of the discharge summary document with finer granularity and logical combination based on the input length control.
[0039] Further, step S5 includes:
[0040] S51. In the fine-tuning stage, use source disassembly to structurally extract each field of the medical record for sample quality filtering, and combine reverse parsing and a general clinical knowledge base to enhance understanding and generate a discharge summary instruction dataset. Finally, obtain the multi-department fine-tuned business medical large model EMR-GPT through the design of EMR-LLM instruction fine-tuning;
[0041] S52. In the inference stage, design a Prompt hallucination suppression strategy to optimize the entire method;
[0042] S53. Solve the problem of excessive input length. Specifically, semantically segment the content and structure of the discharge summary, decompose the target into each sub-field, streamline the source documents of the input sub-fields, retain the key information, ensure that it does not exceed the predetermined length limit by reasonably controlling the input length, and finally design a reasonable Prompt to ensure the integrity of long text processing;
[0043] S54. On the basis of decomposing the target into each sub-field, use logical decomposition and a general clinical knowledge base to decompose the core reasoning operators, such as extraction, summarization, judgment, reasoning, knowledge, and then perform reasonable and effective logical combinations to form combined operators to achieve logical constraints. Finally, design a reasonable Prompt, and strengthen the output quality control through inverse parsing and constraint mechanisms to ultimately realize the generation of a discharge summary that resists hallucinations, and obtain the final generated document that conforms to the discharge summary. It can not only generate the six core fields of the discharge summary, but also the generation of each field conforms to the source document, and the content is consistent with the original electronic medical record document in terms of fact, integrity, and accuracy.
[0044] After adopting the above strategy, the positive effects of the present invention are:
[0045] (1) In the field of discharge summary generation, the present invention addresses the neglect of medical large models that lack adaptation to the discharge summary task, and proposes a dual optimization method for hallucination suppression in discharge summaries based on large models, combined with EMR-LLM instruction fine-tuning. As the first multi-department clinical business large model, EMR-GPT improves the sensitivity of the LLM to numerical values by designing six instruction tasks, effectively suppressing model hallucinations.
[0046] (2) For the dual optimization method for hallucination suppression in discharge summaries based on large models, the present invention proposes a Prompt hallucination suppression strategy, which suppresses length hallucinations and logical hallucinations by optimizing the input length by splitting sub-fields, fusing segmented constraint reasoning and logical templates, and enhancing reasoning consistency by combining the knowledge base and logical operators, effectively suppressing hallucinations caused by long text and logical combinations, and bringing a powerful performance improvement to this method. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flowchart of the dual optimization method for hallucination suppression in discharge summaries based on large models of the present invention;
[0048] Figure 2 is a schematic diagram of the principle of the dual optimization method for hallucination suppression in discharge summaries based on large models of the present invention;
[0049] Figure 3 is a schematic diagram of the process based on the combination of logical templates of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0050] To enable those skilled in the art to better understand the solution of the present invention and make the above-mentioned objects, technical solutions and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to embodiments and the accompanying drawings of the embodiments.
[0051] Please refer to Figure 2 , Figure 2 which is a dual optimization method for hallucination suppression in discharge summaries based on large models of the present invention. This method includes two core modules, namely A: solving the model ability problem, B1: solving the information focus input length problem, and B2: solving the technical threshold problem, jointly constructing a method for hallucination suppression in discharge summaries based on dual optimization. First, the A module aims to improve the model generation quality and reduce hallucinations. Specifically, first, the source is disassembled to structurally extract each field of the medical record for sample quality filtering to ensure the reliability of the input data, and combined with inverse parsing and a general clinical knowledge base to enhance the understanding and generate a discharge summary instruction dataset. Finally, the model is trained by instruction fine-tuning to make it more in line with clinical logic and suppress hallucination phenomena. Secondly, the B1 module mainly focuses on the optimization of the input length to ensure that the input length is controlled below 8000 tokens. Specifically, first, the content and structure of the discharge summary are segmented semantically, the target is disassembled into each sub-field, the source document of the input sub-field is streamlined, and the key information is retained. Then, by reasonably controlling the input length, it is ensured that it does not exceed the predetermined length limit. Finally, a reasonable Prompt is designed to ensure the integrity of long text processing. Finally, the B2 module aims at the problems of high technical threshold and difficult customization in medical text generation. Specifically, on the basis of disassembling each sub-field of the target, using logical disassembly and a general clinical knowledge base, the core inference operators are disassembled, such as extraction, summary, judgment, reasoning, knowledge, and then reasonable and effective logical combinations are made to form combined operators to achieve logical constraints. Finally, a reasonable Prompt is designed, and the output quality control is strengthened through inverse parsing and constraint mechanisms to finally realize a method for generating anti-hallucination discharge summaries, ensuring the organic integration of each part of the content and automatically generating high-quality discharge summaries that meet clinical standards. Overall, this method constructs a reliable and efficient intelligent generation scheme for discharge summaries through model ability optimization, input length control, and logical combination improvement.
[0052] Please refer to Figure 3 , Figure 3 which is a schematic flowchart of the present invention based on logical template combination. The specific steps include:
[0053] S1. Input the electronic medical record. For different content types of the discharge summary, clear generation rules and constraint conditions are formulated. Specifically, the generation logic of each field content of the discharge summary is divided into the following 5 categories, and corresponding optimization measures are formulated for each category;
[0054] S11. Extractive generation directly extracts deterministic information from medical records, such as name and hospital number, to ensure the accuracy of format and content;
[0055] S12. Summary generation extracts key information from multiple documents, such as progress notes, to generate a refined overview;
[0056] S13. Judgment generation judges the input content according to clinical criteria, such as whether the test indicators are abnormal, and outputs conclusions that conform to medical norms;
[0057] S14. Inferential generation integrates various aspects of information to infer the development of the disease or the treatment effect, such as the discharge time;
[0058] S15. Knowledge-based generation combines a clinical knowledge base to generate advice information, such as the follow-up department and postoperative precautions;
[0059] S2. We have constructed a special logic combination library for the medical field, which contains five types of logic modules: 6 extractive types, 3 summary types, 3 discriminative types, 2 inferential types, and 1 knowledge type;
[0060] S21. The system is based on a large model fine-tuned for multiple departments, and adopts a three-order intelligent processing mechanism for any field: ① In the task parsing stage, the field is intelligently matched with 1-4 logical formulas in combination with semantic features Prompt, ② According to the dependence relationship of the diagnosis and treatment path, construct the execution path of the logical formula, ③ Structurally generate an ordered, reasonable and smooth diagnosis and treatment logic Prompt composite instruction. Through the triple optimization of intelligent matching - logic arrangement - semantic fusion, finally output a field logic combination template that conforms to medical norms and has a clear logical chain, realizing the automatic conversion from business instructions to accurate Prompt;
[0061] S22. The discharge summary includes six field tasks, namely patient basic information, discharge diagnosis, medical conditions during hospitalization, course and treatment conditions, medication advice after discharge, and conditions at discharge. For different content types of the discharge summary, logical combination templates are formulated. Different field information has different requirements, so a single template or a collaborative method of multiple templates is used for optimization to give full play to the reasoning ability of the model while ensuring the reliability of medical information. Their logical template combinations are extraction + inference, extraction, extraction, judgment + extraction + summary, judgment + inference, extraction + judgment + knowledge + inference;
[0062] S3. Design reasonable Prompt, and through the effective combination of the input length and the logical template, suppress the hallucination phenomenon to obtain the final discharge summary generation document;
[0063] S31. Extraction: Directly extract information such as the patient's name, gender, age, hospital admission number, bed number, ward area name, admission date, etc. from the medical records; Extraction: Directly extract the discharge diagnosis information according to the diagnosis description in the medical documents; Extraction: Extract vital sign information and medical history content from the medical records; Extraction: Extract key results from the test and examination records according to the predefined logic, such as retaining the latest results of normal tests and all results of abnormal tests; Extraction: For the situation after surgery, extract relevant treatment information; Extraction: Extract the patient's medical history and chronic disease information;
[0064] S32. Summary: Summarize the vital sign information and medical history content obtained from the medical records; Summary: Read and analyze the physical examination records, extract key information and form a summary; Summary: Summarize the relevant treatment information obtained from the surgical situation during the treatment process;
[0065] S33. Judgment: Judge whether surgery has been performed during the treatment process; Judgment: Judge the overall condition of the patient according to the patient's recovery situation and medical records; Judgment: Judge whether the patient has chronic diseases according to the obtained patient's medical history and chronic disease information;
[0066] S34. Reasoning: Reason about the overall situation at the time of discharge according to the patient's recovery situation and medical records; Reasoning: Combine the discharge instructions and time in the doctor's advice to reason about the discharge date and time;
[0067] S35. Knowledge: According to the patient's medical history and chronic disease information, if there are chronic diseases, match them with the knowledge base to obtain medication suggestions; otherwise, there is no match;
[0068] In the above text, the specific embodiments of the present invention are described with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that various changes and substitutions can be made to the specific embodiments of the present invention without departing from the spirit and scope of the present invention. These changes and substitutions all fall within the scope defined by the claims of the present invention.
Claims
1. A dual optimization method for hallucination suppression in discharge summaries based on large models, characterized in that It includes the following steps: S1. Model hallucination suppression: According to the relationship between the discharge summary and the medical record documents during hospitalization, combined with the curriculum learning training method for suppressing forgetting phenomena, a high-quality instruction dataset is constructed by using EMR-LLM instruction fine-tuning. The EMR-LLM instruction fine-tuning refers to a method of integrating self-built medical datasets and open medical task data, which are uniformly formatted and then mixed with general domain data in a 1:3 ratio to obtain a multi-department fine-tuned business medical large model EMR-GPT; S2. Input length hallucination suppression: Through semantic segmentation, source retrieval, and rule constraint strategies, more concise and accurate source documents related to the discharge summary are obtained; S3. Logical hallucination suppression: A logical combination template is constructed by effectively combining five types of logical operators: extraction, summary, reasoning, judgment, and knowledge. The logical combination template is used to process six core fields of the discharge summary, including the patient's basic information, discharge diagnosis, medical conditions during hospitalization, course and treatment conditions, conditions at discharge, and medication recommendations after discharge; S4. Design a reasonable Prompt. By effectively combining the input length and the logical template in the Prompt, the hallucination phenomenon is suppressed, and a preliminary compliant discharge summary generation document is obtained, which can basically generate six core fields of the discharge summary; S5. In the fine-tuning stage, train the multi-department fine-tuned business medical large model EMR-GPT. In the inference stage, design a Prompt hallucination suppression strategy. The two are double-optimized to improve the performance of the entire method, and a final compliant discharge summary generation document is obtained, which can not only generate six core fields of the discharge summary, but also the generation of each field conforms to the source document, and the content is factually consistent, complete, and accurate with the original electronic medical record document.
2. The dual optimization method for hallucination suppression in discharge summaries based on large models according to claim 1, wherein The EMR-LLM instruction fine-tuning in step S1 specifically includes: S11. Input the set of medical record documents D = [d1, d2,..., d n during the patient's hospitalization, including admission records, operation records, doctor's orders, etc., and further analyze and design specialized instruction tasks for the electronic medical record data structure; for the digital information understanding ability, design tasks of "medical text index extraction and formatting" and "index consistency detection" to obtain the model's cross-modal numerical perception enhancement ability; for the medical record structure and semantic understanding ability, design tasks of "medical text structuring" and "medical text source field guessing" to obtain the model's hierarchical semantic parsing ability; combined with the actual medical scenario requirements, design tasks of "department guide" and "discharge summary generation", write basic prompts, processing strategies and output formats for each task, and expand the prompt content through ChatGPT; analyze the source and target fields, develop data conversion templates, and be able to directly extract the required fields from the structured data to obtain the input and output information of the tasks, and obtain the model's clinical decision support ability; S12. Based on the continuously pre-trained model, implement instruction fine-tuning and take two key optimization measures: data integration and format unification. Construct the PromptClinicalTerm dataset, which is based on the ICD-10 and ICD-9-CM3 coding frameworks, designs tasks for term output, classification, standardization, and reasoning, and constructs transformation templates to improve the model's understanding of terms and relationships in clinical texts; construct the PromptEMR dataset, which contains key information such as medical record documents, nursing records, and test reports of real cases, covering eight core medical information types. Through the structure parsing framework, the original medical records are converted into a standardized JSON format, and open data related to general medical tasks are incorporated, including medical named entity recognition and medical text intention recognition. Since the annotation formats of data sources are different, a special script is developed to unify the format, and to prevent catastrophic forgetting, integrate medical domain and general domain data, with a 1:3 ratio, to form the final instruction fine-tuning dataset; S13. The autoregressive training method is adopted in the training strategy, so that all previous input information can be considered when the model generates output, and the long-distance dependency in the sequence is effectively captured; in the loss calculation link, the task description and input part are masked, and the LoRA method is introduced to achieve efficient parameter update through low-rank matrix adaptation technology, while greatly improving the training speed; refer to the DMT method and innovatively propose a course learning training strategy that suppresses forgetting. Based on the capability analysis of PromptEMR, a progressive training method from simple to difficult is adopted to optimize the model performance in stages; the first stage trains general medical NLP tasks, department guidance and medical text structuring; the second stage focuses on the extraction and formatting of medical text indicators, and the guessing of medical text source fields; the third stage trains indicator consistency detection and discharge summary generation; the final stage mixes all medical-related and general data for comprehensive training, and introduces a small amount of data from the previous stage in each iteration to prevent forgetting problems, and finally obtains the EMR-GPT business medical large model fine-tuned by multiple departments.
3. The dual optimization method for hallucination suppression in discharge summaries based on large models according to claim 1, wherein The step S2 specifically includes: S21. Input the electronic medical record JSON data cleaned and standardized in the model pre-training stage. Based on the preliminary division and simplification of the JSON electronic medical record fields manually, the manually simplified structured fields and discharge summary related words are further refined through semantic segmentation technology to obtain the source document mapping table of the required fields in the discharge summary. S22. Based on the source document mapping table of discharge summary fields, using the instruction data set constructed by EMR-LLM, a source search method is used for each subdivided field to sort and screen all related documents by relevance, and the number of occurrences of each field in the electronic medical document is obtained; S23. Filter the electronic medical record documents according to the fields that appear most frequently, and select the most relevant sub-content source documents to ensure that the input content of each field is closely centered around the key information of the discharge summary.
4. The dual optimization method for hallucination suppression in discharge summaries based on large models according to claim 1, wherein The step S3 specifically includes: S31. Formulate clear generation rules and constraints for different content types of discharge summaries. Specifically, divide the generation logic of each field content of the discharge summary into the following five categories, and formulate corresponding optimization measures for each category: ① Extractive generation directly extracts deterministic information from medical records, such as name, hospital number, etc.; ② Summary generation extracts key information from multiple documents, such as medical records, discharge status, etc.; ③ Judgment formula generation judges the input content based on clinical standards, such as whether the test indicators are abnormal, whether surgery is required, etc.; ④ Inference-based generation integrates multiple aspects of information to infer the progression of the disease or the effect of treatment, such as discharge time; ⑤ Knowledge generation combines clinical knowledge base to generate advice information, such as follow-up departments, postoperative precautions, etc.; S32. We have built a special logic combination library for the medical field, which includes five types of logic modules: 6 extraction types, 3 summary types, 3 discriminant types, 2 reasoning types and 1 knowledge type. The 6 extraction types include (1) Extract the patient's name, gender, age, hospitalization number, bed number, ward name, admission date and other information directly from the medical records. (2) Directly extract the diagnosis information at discharge according to the diagnosis description in the medical document. (3) Extract the vital sign information and medical history content from the medical record. (4) Extract the key results from the test and examination records according to the predefined logic, such as retaining the latest results of normal tests and all results of abnormal tests. (5) For the situation after surgery, extract the relevant treatment information. (6) Extract the patient's medical history and chronic disease information. The three types of summaries are as follows: (1) Summarize the vital sign information and medical history content obtained from the medical record. (2) Read and analyze the physical examination record, extract the key information and form a summary. (3) Summarize the relevant treatment information obtained from the surgical situation during the treatment process. The three types of discriminants are as follows: (1) Determine whether surgery was performed during the treatment process. (2) Judge the overall condition of the patient according to the patient's recovery situation and medical records. (3) Determine whether the patient has chronic diseases according to the obtained patient's medical history and chronic disease information. The two types of inferences are as follows: (1) Infer the overall situation at discharge according to the patient's recovery situation and medical records. (2) Combine the discharge instructions and time in the doctor's advice to infer the discharge date and time. The one type of knowledge-based method is: according to the patient's medical history and chronic disease information, if there are chronic diseases, match them with the knowledge base to obtain medication advice; otherwise, there is no match. S33. The system is based on the business medical large model EMR-GPT fine-tuned for multiple departments, and adopts a three-order intelligent processing mechanism for any field: ② In the task parsing stage, the field is intelligently matched with 1-4 logical formulas in combination with semantic features Prompt. ② Construct the execution path of the logical formula according to the dependence relationship of the diagnosis and treatment path. ③ Structurally generate an ordered, reasonable and smooth diagnosis and treatment logic Prompt composite instruction. Through the triple guarantees of intelligent matching - logic arrangement - semantic fusion, finally output a field logic combination template that conforms to medical specifications and has a clear logical chain, realizing the automatic conversion from business instructions to accurate Prompt. S34. The discharge summary includes six field tasks, namely patient basic information, discharge diagnosis, medical conditions during hospitalization, course of disease and treatment, medication advice after discharge, and situation at discharge; for different content types of the discharge summary, formulate logical combination templates. Because the information requirements of different fields are different, a single template or a collaborative method of multiple templates is used for optimization; the logical template combinations of the six field tasks are extraction + inference + summary, extraction, extraction, judgment + extraction + inference, summary, extraction + judgment + knowledge.
5. The dual optimization method for hallucination suppression in discharge summaries based on large models according to claim 1, characterized in that, The specific steps of step S4 include: S41. The specific sources of the six field tasks are: basic information comes from the admission notice-content-patient information, admission and discharge records within 24 hours-content-admission diagnosis, admission record-content-preliminary diagnosis, first course of illness record-content-preliminary diagnosis, attending physician's first ward round record-content-diagnosis, chief physician's first ward round record-content-diagnosis; discharge diagnosis comes from the first course of illness record after surgery-content-intraoperative diagnosis, surgical record sheet (trial)-content-intraoperative diagnosis, preoperative summary-content-preoperative diagnosis, admission and discharge records within 24 hours-content-discharge diagnosis; medical conditions during hospitalization come from examinations and tests; course of illness and treatment come from the first course of illness record-content-diagnosis and treatment plan, chief physician's first ward round record-content-supplementary medical history and characteristics, chief physician's first ward round record-content-analysis of the condition, chief physician's first ward round record-content-diagnosis and treatment opinions, attending physician's first ward round record-content-TM employee nameTM attending physician's ward round, attending physician's first ward round record-content-diagnostic basis and identification Analysis of diagnosis, attending physician's first ward round record - content - diagnosis and treatment plan, daily course of illness record - content, postoperative n-day record - content, death record - content, death medical record discussion - content, attending physician's daily ward round record - content, first postoperative course of illness record - content - postoperative treatment measures, chief physician's daily ward round record - content - diagnosis and treatment opinions, chief physician's daily ward round record - content - analysis of the condition, admission and discharge records within 24 hours - content - admission situation, stage summary - content - diagnosis and treatment process, stage summary - content - diagnosis and treatment plan, transfer department record - content - diagnosis and treatment process, transfer department record - content - transfer diagnosis and treatment plan; discharge situation comes from the senior physician's ward round record - content - diagnosis basis, attending physician's first ward round record - content - diagnosis, postoperative n-day record - content - observation record; medication recommendations after discharge come from admission record - past history, daily course of illness record, postoperative n-day record, examination, and doctor's advice; input the specific sources of the six field tasks, and design a concise and reasonable prompt with input length control; S42. Prompt with reasonable design. Basic information is filled in with the patient's basic information based on the admission notice, ward rounds, first medical records, etc.; discharge diagnosis is extracted based on preoperative summary, intraoperative diagnosis, admission diagnosis, etc.; medical conditions during hospitalization are described based on examination and test results; the course of disease and treatment are combined with medical records, treatment plans, chief physician ward rounds, etc. to provide the patient's treatment history and main treatment measures; the discharge situation extracts information such as the ward rounds of senior physicians and attending physicians to describe the patient's condition at discharge; medication recommendations after discharge are provided based on postoperative medical records, doctor's orders, etc., and through the effective simplification of the six field tasks, the input length is effectively controlled, the illusion phenomenon is suppressed, and a preliminary discharge summary generation document is obtained, which can basically generate the six core fields of the discharge summary; S43. Design a reasonable Prompt for the logical template combination of six-field tasks. Patient's basic information: {Extraction: ['Directly extract information such as the patient's name, gender, age, hospital number, bed number, ward area name, admission date, body temperature, heart rate, respiration, high and low blood pressure, etc. from the newly admitted patient assessment form, admission record, and admission notice;', 'Extract the admission diagnosis according to relevant admission diagnoses, admission records, preoperative summaries, etc.'], Reasoning: ['Reason out relevant information based on the discharge order, calculate the accurate discharge time through the date and content.'], Summary: ['Summarize the physical examination and brief medical history from the admission record.']}, Discharge diagnosis: {Extraction: ['Analyze the patient's diagnosis and case records, extract the discharge diagnosis information, and the name should be the standard diagnosis term. If there is relevant descriptive information, note it in parentheses.']}, Medical conditions during hospitalization: {Extraction: ['Comprehensively analyze the patient's examination and test information, extract and display the key test and examination information, and do not modify the detailed report content and description.']}, Course of disease and treatment conditions: {Judgment: ['Judge whether surgery was performed during the treatment process from the medical records.'], Extraction: ['For the situation after surgery, extract relevant treatment information, including the surgery date, anesthesia method, surgery name, intraoperative and postoperative pathological conditions, and postoperative medication conditions.'], Reasoning: ['Analyze the patient's recovery situation based on the medical records, such as the status of the drainage tube and the date of discharge, and reason out the overall situation at the time of discharge.']}, Conditions at the time of discharge: {Summary: ['Summarize key information from the patient's medical records to clarify the patient's overall health status at the time of discharge, such as mental status and physical recovery.']}, Medication advice after discharge: {Judgment: ['Judge whether the patient's report is complete according to the relevant pathological report.'], Extraction: ['Extract the discharge medication, follow-up visit, and medication change information for the patient according to the medical records.'], Knowledge: ['If there are chronic diseases / abnormal tests and examinations based on the patient's past history and abnormal test information, match them with the knowledge base to obtain department follow-up advice.']}, Generate six core fields of a discharge summary document with finer granularity and logical combination based on the input length control.
6. The dual optimization method for hallucination suppression in discharge summaries based on large models according to claim 1, characterized in that, The specific steps of step S5 are as follows: S51. In the fine-tuning stage, use source disassembly to structurally extract each field of the medical record for sample quality filtering, and combine reverse parsing and a general clinical knowledge base to enhance understanding and generate a discharge summary instruction dataset. Finally, obtain the multi-department fine-tuned business medical large model EMR-GPT through the design of EMR-LLM instruction fine-tuning. S52. In the inference stage, design a Prompt hallucination suppression strategy to optimize the entire method. S53. Solve the problem of too long input length. Specifically, semantically segment the content and structure of the discharge summary, decompose the target into each sub-field, streamline the source documents of the input sub-fields, retain the key information, ensure that it does not exceed the predetermined length limit by reasonably controlling the input length, and finally design a reasonable Prompt to ensure the integrity of long text processing. S54. On the basis of disassembling each sub-field of the target, using logical disassembly and a general clinical knowledge base, disassemble the core inference operators, such as extraction, summarization, judgment, reasoning, and knowledge, and then perform reasonable and effective logical combinations to form combined operators to achieve logical constraints. Finally, design a reasonable Prompt, and strengthen the output quality control through inverse parsing and constraint mechanisms to ultimately realize the generation of an anti-hallucination discharge summary, obtaining a final discharge summary generation document that meets the requirements. It can not only generate the six core fields of the discharge summary, but also the generation of each field conforms to the traceable document, and the content is factually consistent, complete, and accurate with the original electronic medical record document.