Method for generating medical reports based on self-learning
By constructing a self-learning medical report generation method and utilizing document parsing intelligence and dynamic prompts from a large language model, the accuracy and efficiency issues of medical report generation in existing technologies are solved, achieving efficient, accurate, and adaptive report generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2026-02-27
- Publication Date
- 2026-06-12
AI Technical Summary
Existing medical report generation technologies suffer from problems such as outdated knowledge, insufficient accuracy, output of fictitious information, lack of contextual information in search results, low search efficiency, and inability to adapt to cross-departmental tasks.
A self-learning-based medical report generation method is constructed. A reference feature database is built through a document parsing intelligent agent, context feature fields and self-learning parameters are added, dynamic prompt words are generated using a fine-tuned large language model, batch constraint comparison and rewriting are performed, self-learning optimization is carried out, and the final report is generated.
It improves the accuracy of reports and their ability to adapt to complex tasks, reduces fictitious information, enhances retrieval efficiency and the real-time nature of report generation, and adapts to the needs of different departments and report types.
Smart Images

Figure CN122201711A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and more particularly to a method for generating medical reports based on self-learning. Background Technology
[0002] With the deep application of generative artificial intelligence technology in the medical field, methods for automatically generating text-based medical reports have become an important tool for alleviating the paperwork burden on medical staff and improving the efficiency of medical information technology. These methods rely on the powerful text generation capabilities of large-scale models to quickly generate medical reports that meet format requirements based on input patient diagnosis and treatment data, significantly reducing the paperwork writing time for medical staff.
[0003] However, large models rely on contextual stimulation during the inference phase to inject knowledge into the pre-training stage. This leads to problems such as outdated knowledge, insufficient output accuracy, and the presence of fabricated information when handling knowledge-intensive tasks in the medical field. Specifically, this manifests as fabricating unexecuted diagnostic and treatment procedures, incorrectly associating symptoms with causes, omitting key diagnostic indicators, and fabricating patient vital signs data. For example, in generating postoperative medical records, the model might fabricate a false figure of 50ml of postoperative drainage; in generating discharge summaries, it might incorrectly associate hypertension with pneumonia. This misleading information not only interferes with the accuracy of clinical decision-making but may also lead to medical disputes and harm patients' rights.
[0004] To address this, the industry has widely adopted Search Enhancement Generation (RAG) technology, attempting to provide accurate knowledge support for large models by retrieving information from authoritative external medical knowledge bases. This aims to reduce generation illusions and improve the professionalism of medical report output. However, existing medical report generation technologies still have many shortcomings and struggle to meet actual clinical needs: First, the search results obtained by existing technologies are usually abstracts or slices of the original text, easily losing contextual information, leading to inconsistent terminology interpretations and missing conditions, thus reducing the accuracy of report generation. Second, the time required for segmenting the retrieved documents constitutes a major portion of system latency, affecting report generation efficiency. Third, the search methods lack self-learning capabilities; the search process is limited by the knowledge content of the relevant department and cannot be dynamically optimized in actual tasks, making it difficult to adapt to clinical tasks involving multiple departments.
[0005] Therefore, how to construct a medical report generation solution that combines accuracy, efficiency, and adaptability to complex tasks, and solve the core pain points of existing technologies, has become a key issue in promoting the clinical application of automatic medical report generation methods. Summary of the Invention
[0006] The purpose of this invention is to provide a self-learning-based medical report generation method. This method effectively solves the problems of missing contextual information and insufficient accuracy in search results, significantly improving search capabilities, thereby enhancing report accuracy and the method's adaptability to complex tasks, while also meeting the real-time requirements of medical report generation.
[0007] To solve the above-mentioned technical problems, the present invention, more specifically, provides a self-learning-based medical report generation method, which includes the following steps: S1. A document parsing intelligent agent is used to construct a reference feature database based on medical references; an updatable context feature field and self-learning parameters are added to each data in the reference feature database to form a constraint library.
[0008] S2. Using the finely tuned large language model as the generation model, construct dynamic prompt words; fill the dynamic prompt words with the case context and put them into the generation model to generate the initial report to be reviewed.
[0009] Dynamic prompts include task descriptions, case context information, and reserved insertion points for restrictive statements.
[0010] S3. Compare and review the constraints in the constraint library batch by batch with the initial reports to be reviewed, obtain the violation judgment results for each batch, record the constraint identifiers and corresponding evidence information that are judged to be in violation, and adjust the review scope of subsequent batches based on historical statistical information, current review results and budget conditions.
[0011] S4. Generate corresponding restriction statements based on the identified violation constraints, inject the restriction statements into dynamic prompt words, and rewrite the initial report to be reviewed in a targeted manner to obtain a rewritten report.
[0012] S5. Review the rewrite report, compare the changes in the review results regarding the violation constraints before and after the rewrite, and obtain the review results for this task.
[0013] S6. Based on the results of the batch review, the restricted statement injection records, and the review results, update the trigger history statistics and repair statistics of each constraint, calculate the estimated benefit score of each constraint, and write it into the statistical fields of the constraint library.
[0014] S7. In subsequent tasks, the constraint library is sorted according to the estimated scores of the benefits of each constraint. The constraint statements corresponding to the top few constraints are selected for pre-generation injection according to the sorting results. During the review stage, the constraints are selected in batches according to the sorting results and compared with the report to be reviewed. When the upper bound of the benefits of the remaining unreviewed constraints is lower than the threshold, the subsequent review batches of the current task are stopped. Finally, the final medical report is generated by generating a large model.
[0015] Preferably, the document parsing agent in step S1 includes a context parsing module and a knowledge point extraction module. The context parsing module uses a large document parsing model to understand the document paragraph structure and integrate the paragraph heading information into the paragraphs. The knowledge point extraction module uses a large medical model to extract diagnostic criteria, original treatment plans, and terminology explanations from clinical medical guidelines.
[0016] Beneficial effects of this invention: 1. High accuracy in report generation, solving the problem of missing context in review basis: This invention constructs a constraint library offline, performs full context extraction and structured parsing of clinical medical guideline data, and fully preserves the terminological associations, logical chain implicit knowledge points and hidden conditions in diagnostic basis and treatment plan. This avoids the problems of inconsistent terminological interpretation and ambiguous hidden conditions caused by the original text abstract / slice search results of existing technologies, so that the review basis has complete contextual support.
[0017] 2. This invention extracts independent knowledge points from authoritative references to form a constraint library. During operation, it relies on trigger statistics and repair statistics formed by a closed loop of review, rewriting, and re-review to perform self-learning updates. It does not require the pre-construction of complex and detailed tag systems for different tasks or the manual design of retrieval rules for a specific task, thus making it easier to migrate to application environments of different departments, different report types, or different model versions.
[0018] 3. This invention, through full-stage self-learning, can continuously learn which constraints are more likely to be violated by the current generation model and are more likely to be corrected through the injection of constraint statements. It completes the model capability modeling at the task level and sorts the constraint library accordingly. In subsequent tasks, the constraint statements corresponding to the top few constraints are selected according to the sorting results for pre-generation injection. During the review stage, constraints are selected in batches according to the sorting results for comparison and review. This reduces unnecessary review calls and prompt word length overhead while ensuring the error correction effect, thereby reducing the overall inference cost and latency. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the method. Detailed Implementation
[0020] like Figure 1 As shown, to make the technical solution of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. The self-learning-based medical report generation method specifically includes the following steps: S1. A document parsing agent is used to extract independent knowledge points from medical references and their corresponding original paragraphs to construct a reference feature database. An updatable context feature field and self-learning parameters are added to each data in the reference feature database to form a constraint library.
[0021] S2. Using the finely tuned large language model as the large generation model, construct dynamic prompt words containing routine task descriptions, case context information, and reserved restricted sentence insertion points; fill the dynamic prompt words with case context and put them into the large generation model to generate the initial report to be reviewed.
[0022] S3. In the form of batch review, the constraints in the constraint library are compared and reviewed with the initial report to be reviewed in batches to obtain the violation judgment results of each batch, record the constraint identifiers and corresponding evidence information that are judged to be in violation, and adjust the review scope of subsequent batches based on historical statistical information, current review results and budget conditions.
[0023] S4. Generate corresponding restriction statements based on the identified violation constraints, inject the restriction statements into dynamic prompt words, and rewrite the initial report to be reviewed in a targeted manner to obtain a rewritten report.
[0024] S5. Review the rewrite report, compare the changes in the review results regarding the violation constraints before and after the rewrite, and obtain the review results for this task.
[0025] S6. Based on the results of the batch review, the restricted statement injection records, and the review results, update the trigger history statistics and repair statistics of each constraint, calculate the estimated benefit score of each constraint, and write it into the statistical fields of the constraint library.
[0026] S7. In subsequent tasks, the constraint library is sorted according to the estimated scores of the benefits of each constraint. The constraint statements corresponding to the top few constraints are selected for pre-generation injection according to the sorting results. During the review stage, the constraints are selected in batches according to the sorting results and compared with the report to be reviewed. When the upper bound of the benefits of the remaining unreviewed constraints is lower than the threshold, the subsequent review batches of the current task are stopped. Finally, the final medical report is generated by generating a large model.
[0027] As a preferred option in the above aspects, the authoritative medical references in step S1 should include: the examination and testing items corresponding to the disease name, and clinical medical guidelines.
[0028] As a preferred embodiment of the above, the document parsing agent in step S1 includes a context parsing module and a knowledge point extraction module. The context parsing module utilizes a large-scale document parsing model to understand the document's paragraph structure and integrates the paragraph heading information into the paragraphs. The knowledge point extraction module uses a large-scale medical model to extract diagnostic criteria, original treatment plans, and terminology explanations from clinical medical guidelines, ensuring the internal logic of each data entry is complete and free of unmentioned context.
[0029] As a preferred embodiment of the above, each piece of data in the constraint library in step S1 includes at least a constraint identifier, constraint text, original text index information, context feature fields, and self-learning parameters; the context feature fields include at least department information and text task type information; the self-learning parameters include at least review count, trigger count, injection count, and repair count, which are used for subsequent benefit estimation updates.
[0030] As a preferred embodiment of the above, in step S1, the knowledge points extracted by the document parsing agent are deduplicated and conflict detected; deduplication can be achieved based on semantic consistency or structured field consistency, and conflict detection is used to identify mutually exclusive constraints under the same conditions and record conflict relationships.
[0031] As a preferred embodiment of the above, the dynamic prompt in step S2 includes at least a task instruction segment, a case context segment, an output format segment, and a restriction statement insertion segment. The restriction statement insertion segment is located at a preset position of the prompt, so that the restriction statements can be directly concatenated during the rewriting and pre-injection stages and maintain a stable prompt structure.
[0032] As a preferred embodiment of the above, in step S2, the model identifier and prompt word version identifier used in this generation are recorded and associated with the task log for aggregation and updating of self-learning statistics.
[0033] As a preferred approach, step S3 involves batch review, controlling the number of constraints or the length of prompts in each batch based on budget constraints, and adding the violation constraints to the violation set after each batch review. The review output includes at least the violation determination result and evidence index information, which includes at least one of the following: cited original text index, report location fragment, or explanatory text. The review scope of subsequent batches is dynamically updated based on historical statistics and the results of the current round of review. Historical statistics include the cumulative number of reviews and triggers for each constraint, while the results of the current round of review include the number of violations triggered in the current batch and the distribution of violation types.
[0034] As a preferred embodiment of the above, the constraint statement in step S4 includes medical knowledge from a certain constraint and can be directly used in the prompts for generating the large model, allowing the generated model to directly correct violations during rewriting. In one implementation, the constraint statement generation process is formally represented as a constraint statement generation operator: in For violations of regulations, For medical reports pending review, For the context of the case, For restricting statements; the restricting statement generation operator is generated by the review model.
[0035] As a preferred embodiment of the above, step S5 involves reviewing at least each constraint in the violation set and outputting the state change of each violation constraint before and after rewriting, which is used to form repair observations. In one implementation, the change in violation state before and after rewriting is quantified as an error reduction observation: in For this mission, This is the set of violation constraints triggered by this task. The initial draft was deemed to be in violation of regulations. This is a violation determination after rewriting.
[0036] As a preferred approach, step S6 includes at least the number of times the constraint was reviewed and the number of times it was triggered in the initial draft; the repair statistics include at least the number of times the constraint was triggered and injected and the number of times it was successfully repaired. Based on the trigger history statistics and repair statistics, a weighted summation is performed to calculate the estimated benefit score of the constraint. The estimated benefit score reflects both the tendency for the constraint to be triggered and violated in the current task and the effectiveness of eliminating violations after the restriction statement is injected. The estimated benefit score is written into the constraint library statistics field and continuously updated as the task loop closes, driving the pre-injection before generation and the sorting and selection during the review stage.
[0037] As a preferred approach, in step S7, before generation, the pre-injection selects the reserved position for inserting the corresponding restriction statement of the previous constraint into the dynamic prompt word based on the constraint library sorting result before generating the initial draft. This allows the model to avoid frequently learned violations in advance during the generation stage. During the review stage, constraints are selected in batches according to the same sorting result for comparison and review, and the constraint library statistics fields are updated after each batch review. A potential upper bound for the remaining unreviewed constraint set is defined. When the potential upper bound for the potential benefit is lower than the threshold, the review of subsequent batches is terminated to reduce invalid review calls.
[0038] Example: This embodiment uses the generation of final reports for common cardiology diseases as the target scenario to fully demonstrate the entire implementation process of the method of this invention, and experimentally verifies the effectiveness of the method in terms of accuracy, efficiency, and adaptive optimization. The large-scale generation model used in this embodiment is a medical-specific large-scale model fine-tuned based on Qwen2.5-32B, and the large-scale review model is GPT-5.2. Token calculation uses the Tokenizer library released by OpenAI. The maximum input length of the large-scale generation model is 8192 tokens, and the large-scale review model is set according to the OpenAI technical report, with a maximum input of 272K and a maximum output of 128K. The experimental environment for this embodiment is: 4 Tesla T4 graphics card, Ubuntu 22.04.5 LTS, CUDA 12.4, Python 3.11, NVIDIA Driver 550.163.01 S1. Select authoritative medical texts and use a small-parameter document parsing OCR model to convert PDF and Word documents into Markdown format. Store the text in blocks according to chapter, recommendation level, evidence description, applicable premises, and contraindications, retaining the original text index. Then, use a large language model to extract conditions for each block, creating a context-complete reference feature database. Add contextual information and self-learning features to each entry in the reference feature database to form a constraint library.
[0039] It should be noted that in step S1 of this invention, the small parameter document OCR model and the large language model used for parsing can be selected from a variety of closed-source and open-source models, as long as they match the task of this invention and can understand the document context, such as MinerU2.5 or other OCR-related models that can understand the document image document structure. The large language model can be Qwen-3max or other models with strong instruction following ability.
[0040] The following is a brief explanation of the specific process of Markdown document segmentation and reference feature database. Markdown format features are used to add upper-level heading descriptions to each subsection title, and the documents are stored in segments according to chapter, recommendation level, evidence description, applicable premises, and contraindications, while retaining the original text index to achieve segmented storage.
[0041] For each segment, a large language model is used to explain terms, extract explicit knowledge points, and extract implicit conditions. In this step, the prompt requires that each output data is internally consistent and that the information and logical chains are complete, resulting in a structured reference feature database with context completion.
[0042] The following steps follow those in S1, using 64-bit hash values and a shema index table to implement the original text indexing process. All features of each constraint are modeled and stored in the database, which is then placed into MySQL.
[0043] The initial text to be reviewed is generated using the finely tuned Qwen2.5-32B as the large model. Dynamic prompt words are constructed, and the large model is generated by concatenating the case context with the dynamic prompt words. The medical report to be reviewed is obtained by strictly controlling the statement token to not exceed 10% of the maximum input length of the large model (including the rewriting stage).
[0044] The finely tuned Qwen2.5-32B model incorporates cardiology doctor-patient communication techniques, the Think deep thinking model, and cardiology specialty knowledge.
[0045] The specific fine-tuning method in this embodiment is briefly described as follows: in 4 On a T4 GPU (16GB) graphics card, QLoRA fine-tuning was performed on Qwen 2.5-32B. The data construction was divided into four sources, with general data: from Qwen-3-max distillation, original Chinese CoT, but all of them were stripped in this embodiment. <think>Used as general knowledge QA without reasoning; Mathematical data: retains the mathematical reasoning text, without adding... <think>Tags are used to enhance the learning ability of inference structures; medical inference data: derived from open source plus local large model inference distillation, with the inference chain uniformly packaged in... <think>The tags are used to improve real-world diagnostic reasoning capabilities; medical non-reasoning data: through distillation of Qwen-3-max data, pure medical QA data with doctor-patient communication context and independent medical knowledge is used to improve the model's robustness in scenarios where reasoning is not required. Finally, general data, mathematical data, and mixed medical data are mixed in a 2:2:1 ratio and uniformly converted to messages.v1 format. The final fine-tuned model is first merged with the QLora optimizer and then quantized in GPTQ to int4 format, and deployed for inference in llama-server.
[0046] By constructing an experimental environment containing six months of operational data, the review performance of the method of this invention was compared at four time points: cold start phase (no historical data), one month of iterative optimization, three months of iterative optimization, and six months of iterative optimization, thus verifying the effectiveness of the self-learning optimization mechanism and the long-term adaptive capability of the method.
[0047] In this embodiment, the hyperparameter N is set to 5. Based on multiple experiments, the total number of statement tokens is limited to no more than 10% of the maximum input length of the current generated large model.
[0048] (I) Experimental Setup Experimental setup: A dataset of 1000 real "final diagnosis" reports from the cardiology department of a tertiary hospital over the past three years was selected as the basic dataset. Each report contained complete patient contextual information (initial diagnosis information, examination and test results, clinical background, etc.) and a standardized diagnostic conclusion. Manual review was conducted by qualified clinical experts through sampling verification and consistency arbitration. Error correction feedback included key information such as the type of hallucination and suggested corrections.
[0049] Hallucination Insertion Design: For high-risk clinical scenarios (such as missing diagnostic evidence, non-compliant treatment plans, fabricated key indicators, etc.), high-risk hallucination data were manually inserted, resulting in 1000 test samples containing high-risk hallucinations. Specific hallucination types and their distribution: 300 fabricated core diagnostic bases; 250 recommendations for first-line treatments outside of guidelines; 200 fabricated key examination data; 150 incorrect associations between etiology and symptoms; and 100 omitted high-risk monitoring indicators. Experimental grouping: Divided into 4 groups based on the cumulative amount of historical data: Group A (Cold Start): 0 historical data entries; Group B (1 month of iterative optimization): 2500 historical data points; Group C (3 months of iterative optimization): 7500 historical data points; Group D (6 months of iterative optimization): 15,000 historical data points.
[0050] Experimental environment: 4 Tesla T4 graphics card, Ubuntu 22.04.5 LTS, CUDA=12.4, python=3.11, NVIDIA Driver=550.163.01.
[0051] Evaluation indicators: Constraint accuracy = Number of manually approved constraints / Total number of constraint statements output by the method; Constraint detection violation rate = Number of violations judged by the method and manually confirmed / Total number of manually confirmed violations; Review time = Average end-to-end review time per report (seconds, statistics on P50 and P95); High-risk hallucination detection rate = Number of high-risk hallucinations detected by the method / Total number of high-risk hallucinations actually inserted in the test sample.
[0052] Evaluation process: 1000 test samples were input into the method of this invention and the ReAct, CoV, and ThoT methods respectively, and the number of high-risk hallucinations detected by each method was counted; the method of this invention was tested according to the iteration stage (Group A cold start, Group B 1 month, Group C 3 months, Group D 6 months). (II) Comparison Results Table 1. Performance Comparison of Methods at Different Iteration Stages (Example statistics are averages; time consumption is also given within the range of page 95).
[0053] The following key conclusions can be drawn from Table 1: The existing technologies ReAct, CoV, and ThoT do not output restrictive statements and only count the detection rate of high-risk hallucinations. Therefore, the accuracy rate of restrictive conditions and the violation rate of constraint detection are marked as 'no data'.
[0054] Self-learning optimization significantly improves the accuracy and coverage of the review: With the accumulation of historical data, the accuracy rate of constraint conditions, the rate of detection of violations of constraints, and the rate of manual option 1 have continued to improve; indicating that self-learning error correction feedback can effectively guide the system to focus on key risk points and reduce missed detections.
[0055] Method efficiency is continuously optimized: Although the cold start review takes significantly longer than existing methods, the review speed can surpass existing methods after self-learning. Group A (cold start phase) has no historical data support and needs to fully verify 1200 constraint data in the constraint library, so the review takes a long time. As historical data accumulates, the routing sorting and early stopping mechanism gradually take effect, high confidence constraint conditions are inserted in advance, invalid group reviews are reduced, and the accuracy of constraint unit adaptation is improved, reducing the cost of repeated comparisons.
[0056] High-risk hallucination detection rate: Although the detection rate does not improve significantly with self-learning, the high-risk hallucination detection rate is significantly better than existing methods due to the refinement of knowledge points and logical relationships in the external knowledge base by the constraint distillation stage and the control of the maximum input length by the review stage.
[0057] As illustrated in Example 1, the self-learning-based medical report generation method provided by this invention provides a basis for the report review process by constructing a low-ambiguity constraint database with complete context, comprehensive original text index, and unified terminology, thereby improving review accuracy. Furthermore, it injects review results into dynamic prompts to correct medical reports through knowledge injection, achieving interpretability and accuracy in medical report generation. Through a self-learning tagging mechanism, it dynamically optimizes the usage scenario of each constraint data point in specific tasks, constructing constraint data groupings oriented towards task type and large model model, thus improving method efficiency. This method can achieve verifiable review results and engineerable real-time performance in clinical medical report AI generation quality control scenarios, providing reliable support for the safe implementation of large model medical report generation methods.
[0058] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.< / think> < / think> < / think>
Claims
1. A self-learning-based medical report generation method, characterized in that, Includes the following steps: S1. A constraint library is constructed for medical references using a document parsing intelligent agent; S2. Using the finely tuned large language model as the large generation model, construct dynamic prompt words, fill the dynamic prompt words with the case context, and put them into the large generation model to generate the initial report to be reviewed. S3. Compare and review the constraints in the constraint library with the initial report to be reviewed to obtain the violation judgment result, generate the corresponding restriction statement, and rewrite the initial report to be reviewed in a targeted manner to obtain the rewritten report. S4. Review the rewrite report, compare the changes in the review results on the violation constraints before and after the rewrite, and obtain the review results of this task. S5. Based on the review results, restricted statement injection records, and re-review results, update the trigger history statistics and repair statistics of each constraint, calculate the estimated benefit score of each constraint, and write it into the statistical fields of the constraint library. S6. Sort the constraint library according to the estimated scores of each constraint benefit, select the first few constraints and their corresponding restriction statements for pre-generation injection, and generate the final medical report by generating a large model.
2. The self-learning-based medical report generation method according to claim 1, characterized in that, The specific implementation of step S1 is as follows: using a document parsing agent to extract independent knowledge points from medical references and their corresponding original paragraphs of the medical references to construct a reference feature database, and adding updatable context feature fields and self-learning parameters to each data in the reference feature database to form a constraint library.
3. The self-learning-based medical report generation method according to claim 2, characterized in that, The medical references include: disease names and corresponding examination and testing items, and clinical medical guidelines; The document parsing intelligent agent includes a context parsing module and a knowledge point extraction module; the context parsing module uses a large document parsing model to understand the document paragraph structure and integrate the document paragraph title information into the paragraph. The knowledge extraction module uses a large medical model to extract diagnostic criteria, original treatment plans, and terminology explanations from clinical medical guidelines.
4. The self-learning-based medical report generation method according to claim 3, characterized in that, Step S1 further includes deduplication and conflict detection of the knowledge points extracted by the document parsing agent; deduplication can be achieved based on semantic consistency or structured field consistency, and conflict detection is used to identify mutually exclusive constraints under the same conditions and record conflict relationships.
5. The self-learning-based medical report generation method according to claim 4, characterized in that, In step S2, the dynamic prompt words include a task instruction segment, a case context segment, an output format segment, and a restriction statement insertion segment. The restriction statement insertion segment is located at a preset position of the prompt words, so that the restriction statements can be directly concatenated during the rewriting and pre-injection stages and maintain a stable prompt structure.
6. The self-learning-based medical report generation method according to claim 5, characterized in that, Step S2 also includes recording the model identifier and prompt word version identifier used in this generation, and associating them with the task log for aggregation and updating of self-learning statistics.
7. The self-learning-based medical report generation method according to claim 6, characterized in that, The specific implementation process of step S3 is as follows: S3.
1. In the form of batch review, the constraints in the constraint library are compared and reviewed with the initial report to be reviewed in batches to obtain the violation judgment results of each batch, record the constraint identifiers and corresponding evidence information that are judged to be in violation, and adjust the review scope of subsequent batches according to historical statistical information, current review results and budget conditions. S3.
2. Generate corresponding restriction statements based on the identified violation constraints, inject the restriction statements into dynamic prompt words, and rewrite the initial report to be reviewed in a targeted manner to obtain a rewritten report.
8. The self-learning-based medical report generation method according to claim 7, characterized in that, In step S3.1, the batch review controls the number of constraints or the length of prompts in each batch based on budget conditions, and adds the violation constraints to the violation set after each batch review. The review output includes violation judgment results and evidence index information, which includes one of the following: the original text index, the report location fragment, or the explanatory text. The review scope of subsequent batches is dynamically updated based on historical statistics and the results of the current round of review. The historical statistics include the cumulative number of reviews and the cumulative number of triggers for each constraint, and the results of the current round of review include the number of violations triggered in the current batch and the distribution of violation types. In step S3.2, the restriction statement contains medical knowledge from the constraints and is directly used in the prompt words for generating the large model, so that the generated model can correct the violations when it is rewritten.
9. The self-learning-based medical report generation method according to claim 8, characterized in that, In step S4, the review verifies each constraint in the violation set and outputs the state change of each violation constraint before and after rewriting. This is used to form repair observations, quantifying the change in violation state before and after rewriting as an error reduction observation. : in For this mission, This is the set of violation constraints triggered by this task. The initial draft was deemed to be in violation of regulations. This is a violation determination after rewriting.
10. The self-learning-based medical report generation method according to claim 9, characterized in that, The trigger history statistics include the number of times the constraint was reviewed and the number of times the initial draft was triggered; The repair statistics include the number of times the system was triggered and injected, and the number of times the repair was successful. Based on the historical trigger statistics and the repair statistics, the estimated benefit score of the constraint is calculated by weighted summation. The estimated benefit score is written into the constraint library statistics field and continuously updated as the task loop closes. It is used to drive the pre-injection before generation and the sorting and selection during the review stage.
11. The self-learning-based medical report generation method according to claim 10, characterized in that, Step S6 includes sorting the constraint library according to the estimated benefit scores of each constraint, selecting the first few constraints corresponding to the constraint statements for pre-generation injection according to the sorting results, and selecting constraints in batches according to the sorting results to compare and review them with the report to be reviewed. When the upper bound of the benefit of the remaining unreviewed constraints is lower than the threshold, the subsequent review batches of the current task are stopped.