An image report generation method and system based on a knowledge graph and visual feedback
By employing dynamic retrieval and structured knowledge graph injection methods, combined with a visual feedback mechanism, the problem of insufficient knowledge constraints in existing systems is solved, enabling high-quality generation of medical imaging reports and ensuring the accuracy and credibility of the reports.
Patent Information
- Application Number
- CN202611635316.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-21
- Publication Date
- 2026-11-20
AI Technical Summary
In existing medical image report generation systems, the combination of knowledge graphs and visual language models lacks dynamic retrieval and online injection mechanisms, resulting in insufficient knowledge constraints, low consistency and reliability of generated reports, and a tendency to deviate, especially when encountering complex pathological or anatomical relationships. Furthermore, confidence assessment is independent of the generation process, limiting the calibration effect.
By acquiring visual features from chest X-ray images, knowledge subgraphs in the radiology knowledge graph are dynamically retrieved and converted into structured medical facts, which are then injected into the visual language model. The decoding parameters are iteratively adjusted using Wasserstein distance, and hallucination states are detected using visual perturbations, forming a closed-loop feedback mechanism to ensure the accuracy and credibility of the reported medical facts.
It ensures adherence to medical fact boundaries in each round of report generation, improving the factual accuracy, structural integrity, terminology standardization, and logical consistency of the reports, providing credibility assessment, and enhancing the reliability and consistency of the generated reports.
Smart Images

Figure CN123142879A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of medical image analysis technology, and in particular to an image report generation method and system based on knowledge graph and visual feedback. Background Technology
[0002] With the increasing application of deep learning technology in the medical field, the automatic generation of medical image reports based on visual language models has become a research hotspot in the field of medical image analysis. Chest X-rays, as one of the most commonly used imaging examination methods in clinical practice, involve the comprehensive observation of thoracic anatomical structures (such as lung fields, cardiac silhouette, mediastinum, and pleura) and the accurate description of pathological findings (such as consolidation, ground-glass opacities, nodules, and pleural effusion) in report generation. This is a cognitive task highly dependent on professional knowledge. Automated medical image report generation systems can assist radiologists in improving report writing efficiency and reducing medical errors caused by repetitive work, thus possessing significant clinical application value.
[0003] Several technical approaches have emerged for the automatic generation of medical image reports. Among them, knowledge graph-based methods are one of the earliest explored directions in this field. These methods utilize natural language processing tools to extract entities and relationships from historical radiology reports, constructing structured radiology knowledge graphs to assist in report generation or downstream classification and detection tasks. Works represented by RadGraph and Chest ImaGenome have constructed large-scale chest X-ray radiology knowledge graphs and developed hierarchical multimodal knowledge graphs such as R2GenKG for large language model-driven radiology report generation. However, in these methods, the knowledge graph is used only as an independent external knowledge base, separated from the reasoning process of the visual language model. Knowledge is not injected into the model prompt text as online reasoning constraints, making it difficult to provide personalized knowledge guidance for the current input image, resulting in low utilization efficiency.
[0004] To achieve high-quality medical reasoning under limited computing power, researchers have proposed lightweight visual language model schemes based on reasoning distillation, such as LiteMedCoT-VL. These methods utilize large-scale visual language models (e.g., a teacher model with 235 parameters) to generate structured reasoning chains, and then distill the reasoning capabilities to smaller-scale visual language models (e.g., a student model with 2 parameters) using the LoRA low-rank adaptation method. This allows the smaller model to maintain reasoning efficiency while acquiring the ability to generate structured reasoning paths. However, the distillation process only learns the structured paths of the reasoning chains and does not introduce domain knowledge constraints. When encountering rare pathological findings or complex anatomical relationships, the distilled model may generate reasoning paths that do not conform to medical facts. The lack of external knowledge correction mechanisms leads to the risk of inaccurate medical facts in the generated reports.
[0005] Unlike the aforementioned approaches, the report optimization scheme based on game-theoretic decoding improves the quality of generated text through adversarial game theory between the generator and validator. This method extends game-theoretic decoding to visual language models for open-ended medical visual question answering tasks, using Wasserstein-1 distance instead of traditional lexical matching metrics as the convergence criterion. This allows the decoding process to converge based on semantic consensus among candidate answers, effectively improving the quality and semantic consistency of the generated text. However, the search space of game-theoretic decoding still lacks domain knowledge guidance, limiting iterative convergence efficiency. Furthermore, this type of scheme does not involve confidence calibration, resulting in a lack of credibility assessment in the generated reports. In addition, traditional confidence calibration methods (such as ordinal-preserving regression and Platt scaling) only monotonically transform the original confidence of the model output. Limited by the theoretical framework of monotonic calibration, there is an insurmountable lower bound on calibration error, and all are post-calibration methods that do not utilize the inference uncertainty characteristics of the model on specific inputs, making it difficult to accurately reflect the output reliability of the model in medical image report generation scenarios.
[0006] It can be seen that the construction and use of knowledge graphs in existing solutions often remain offline, lacking dynamic retrieval and online injection mechanisms for the current input image. This results in knowledge constraints failing to continuously play a role in the report generation process. The thought chain distillation model lacks domain knowledge correction, making its reasoning path prone to deviation when encountering complex pathological or anatomical relationships. The game-theoretic decoding method lacks knowledge guidance in its search space, leaving room for improvement in convergence efficiency and output quality. Furthermore, confidence assessment and report generation are independent processes, with calibration effects limited by the upper limits of traditional methods. In other words, an effective data flow and feedback mechanism has not yet been established between the above-mentioned stages, and independent optimization of each stage is unlikely to improve the overall system performance. Summary of the Invention
[0007] In view of this, this application provides an image report generation method and system based on knowledge graph and visual feedback to solve the problems of insufficient knowledge constraints, difficulty in detecting medical fact hallucinations, and inability to dynamically adjust generation parameters according to hallucination states in the existing medical image report generation process, which lead to low consistency and reliability of generated reports.
[0008] Specifically, this application is implemented through the following technical solution:
[0009] The first aspect of this application provides a method for generating image reports based on knowledge graphs and visual feedback, the method comprising:
[0010] Acquire a chest X-ray image to be processed, extract the visual features of the chest X-ray image, and retrieve a matching knowledge subgraph from a pre-constructed radiology knowledge graph based on the visual features;
[0011] The knowledge subgraph is converted into structured medical facts, and the structured medical facts are injected into the input prompts of the visual language model. Multiple candidate reports are generated based on the visual language model.
[0012] The quality of the multiple candidate reports is evaluated based on the structured medical facts, and the decoding parameters are iteratively adjusted according to the Wasserstein distance between the generator output distribution and the validator quality distribution to determine the target report.
[0013] Multiple visual perturbations are applied to the chest X-ray image, and reports corresponding to each perturbation image are obtained. The hallucination state is determined based on the consistency of medical facts between the original report and the perturbation report.
[0014] Adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and re-execute the knowledge subgraph retrieval, candidate report generation and report verification based on the adjusted parameters until the preset consistency condition is met, and output the target report and corresponding confidence level.
[0015] A second aspect of this application provides an image report generation system based on knowledge graphs and visual feedback, the system comprising:
[0016] The image feature extraction module is used to acquire the chest X-ray image to be processed and extract the visual features of the chest X-ray image;
[0017] The knowledge graph retrieval module is used to retrieve matching knowledge subgraphs from a pre-constructed radiology knowledge graph based on the visual features, and convert the knowledge subgraphs into structured medical facts;
[0018] The report generation module is used to inject the structured medical facts into the input prompts of the visual language model to generate multiple candidate reports;
[0019] The report verification module is used to evaluate the quality of the multiple candidate reports based on the structured medical facts, and iteratively adjust the report decoding parameters according to the Wasserstein distance between the generator output distribution and the verifier quality distribution to determine the target report;
[0020] The visual consistency detection module is used to apply various visual perturbations to the chest X-ray image, obtain reports corresponding to each perturbation image, and determine the hallucination state based on the consistency of medical facts between the original report and the perturbation report.
[0021] The feedback reconfiguration module is used to adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and call the knowledge graph retrieval module, report generation module and report verification module to re-execute the knowledge subgraph retrieval, candidate report generation and report verification until the preset consistency conditions are met, and output the target report and corresponding confidence level.
[0022] The image report generation method and system based on knowledge graphs and visual feedback provided in this application acquire the visual features of the chest X-ray image to be processed and retrieve matching knowledge subgraphs from a pre-constructed radiology knowledge graph. This ensures that each input image receives domain knowledge constraints that match its visual content, avoiding the computational burden and noise interference caused by indiscriminately inputting the entire knowledge graph into the model. Simultaneously, it provides subsequent report generation with medical factual knowledge, such as anatomical structures, pathological findings, and their relationships within the current image. Furthermore, the knowledge subgraph is converted into structured medical facts and injected into the visual language model as input prompts. These structured medical facts continuously play a role in the candidate report generation process, constraining the model to adhere to the boundaries of medical facts in each generation round, thereby reducing the probability of generated content contradicting medical knowledge. Further, the quality of candidate reports is evaluated based on structured medical facts, and decoding parameters are iteratively adjusted according to the Wasserstein distance between the generator output distribution and the validator quality distribution. The decoding parameters gradually converge towards the high-quality region recognized by the validator during the iterative game process. Simultaneously, structured medical facts are used to filter the search space of candidate reports, narrowing the game search space and improving convergence efficiency. This results in a target report with superior accuracy, structural integrity, terminology standardization, and logical consistency. Furthermore, by applying various visual perturbations to chest X-ray images and determining the hallucination state based on the medical factual consistency between the original report and the perturbated report, the credibility of the target report is quantitatively evaluated. Finally, at least one of the knowledge subgraph retrieval parameters and report decoding parameters is adjusted according to the hallucination state. Based on the adjusted parameters, knowledge subgraph retrieval, candidate report generation, and report verification are re-executed. This iterative process continues until the preset consistency condition is met, forming a closed-loop mechanism consisting of knowledge retrieval, report generation, quality evaluation, hallucination detection, and feedback adjustment. This allows the report generation parameters to adaptively adjust based on the hallucination detection results, thereby improving the medical factual accuracy and confidence reliability of the final output target report. Attached Figure Description
[0023] Figure 1 A flowchart of an embodiment of the image report generation method based on knowledge graphs and visual feedback provided in this application;
[0024] Figure 2This is a schematic diagram of the structure of Embodiment 2 of the image report generation system based on knowledge graphs and visual feedback provided in this application. Detailed Implementation
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0026] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used herein are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0027] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0028] Example 1
[0029] The following specific embodiments are given to illustrate the technical solution of this application in detail.
[0030] Figure 1 This is a flowchart of an embodiment of the image report generation method based on knowledge graphs and visual feedback provided in this application. This embodiment achieves the generation of a structured report from a chest X-ray image through the coordinated operation of four stages: knowledge graph retrieval, reasoning enhancement, game-theoretic decoding, and confidence calibration. Please refer to... Figure 1 The method provided in this embodiment may include:
[0031] S101. Obtain the chest X-ray image to be processed, extract the visual features of the chest X-ray image, and retrieve the matching knowledge subgraph from the pre-constructed radiology knowledge graph based on the visual features.
[0032] The process begins by acquiring the chest X-ray image to be processed. This image can come from a hospital image archiving and communication system (PACS) or a medical image database. After acquisition, the first step is to retrieve a knowledge subgraph related to the image from a pre-constructed radiology knowledge graph. It's important to note that a radiology knowledge graph is a structured representation of medical knowledge, containing specialized knowledge in the field of radiology, including anatomical structures, pathological findings, and their interrelationships. Because chest X-ray images involve diverse anatomical structures and pathological types, the knowledge requirements for different images vary. Indiscriminately inputting the entire knowledge graph into subsequent models would not only increase the computational burden but may also introduce irrelevant interference information. Therefore, it is necessary to dynamically retrieve a matching knowledge subgraph from the knowledge graph based on the visual content of the current image, ensuring that subsequent steps are constrained by the knowledge specific to the current image.
[0033] It should be noted that the radiology knowledge graph is constructed using a combination of offline construction and online retrieval. In the offline construction phase, entities and relationships are first extracted from historical radiology report corpora. Historical radiology report corpora can be, for example, the MIMIC-CXR dataset, which contains approximately 227K radiology reports. Entity extraction includes three categories: anatomical structure entities, pathological findings entities, and modifier entities. Anatomical structure entities cover more than 120 anatomical locations, including the left lung, right lung, left upper lobe, right lower lobe, heart, mediastinum, pleural angle, pleura, trachea, and hilum; pathological findings entities include common chest lesions such as consolidation, ground-glass opacity, nodules, pleural effusion, atelectasis, pneumothorax, emphysema, fibrosis, calcification, and cardiomegaly; modifier entities include severity (e.g., mild, moderate, severe), laterality (e.g., left, right, bilateral), temporality (e.g., new onset, stable, progressive), and certainty (e.g., definitive, possible, suspected). Building upon entity extraction, the types of relationships between entities are further defined, including the locational relationship (located_at), severity relationship (has_severity), and laterality relationship (has_laterality) between pathological findings and anatomical structures, as well as the co-occurrence association (associated_with) between pathological findings. The extracted entities and relationships are normalized and mapped to the RadLex radiology standard terminology system, forming a structured radiology knowledge graph to eliminate synonyms and ensure the standardization and consistency of knowledge representation.
[0034] During the online retrieval phase, for the currently input chest X-ray image, its visual features are extracted and matching knowledge subgraphs are retrieved, specifically including:
[0035] (1) Extract the visual feature vector corresponding to the chest X-ray image.
[0036] The chest X-ray image to be processed is input into a visual feature extraction network to obtain a global visual feature vector for the image. This visual feature extraction network can employ a pre-trained convolutional neural network or a visual Transformer model, outputting a fixed-dimensional feature vector that represents the overall visual semantic information of the image. In a specific embodiment, the visual feature extraction network can use a DenseNet-121 or Swin Transformer pre-trained on ImageNet, outputting a global feature vector with a dimension of 1024. This feature vector will serve as the query vector for subsequent knowledge retrieval, used to find knowledge subgraphs in the knowledge graph that are semantically related to the current image.
[0037] (2) Based on the semantic similarity between the visual feature vector and the candidate knowledge subgraphs in the radiology knowledge graph, the candidate knowledge subgraphs are matched and sorted.
[0038] During offline knowledge graph construction, each knowledge subgraph is pre-associated with a corresponding semantic vector representation. The visual feature vector extracted in step (1) is compared with the semantic vectors of each candidate knowledge subgraph using similarity calculations, such as cosine similarity or dot product similarity. A higher similarity indicates a stronger semantic association between the knowledge subgraph and the current input image. Based on the calculated similarity values, all candidate knowledge subgraphs are sorted in descending order.
[0039] (3) Select candidate knowledge subgraphs whose semantic similarity meets the preset matching conditions as knowledge subgraphs that match the chest X-ray image.
[0040] The preset matching conditions can be similarity threshold conditions or selection quantity conditions. For example, a similarity threshold can be set, and all candidate knowledge subgraphs with similarity exceeding the threshold can be selected; or a fixed quantity K can be set, and the top K candidate knowledge subgraphs can be selected. In one specific embodiment, both strategies are used simultaneously: first, candidate knowledge subgraphs with similarity exceeding the preset threshold are selected; if the number of subgraphs exceeding the threshold is insufficient, several top-ranked subgraphs are selected to ensure the quality and quantity of the search results. In one specific embodiment, the similarity threshold can be set to 0.7, and the selection quantity K can be set to 5. The selected knowledge subgraphs include anatomical structures, pathological findings, and their relationships related to the current chest X-ray image.
[0041] Through the aforementioned visual feature-driven dynamic retrieval method, each input image can obtain a knowledge subgraph that matches its visual content, thereby obtaining domain knowledge constraints that are highly relevant to the current image in subsequent report generation, while avoiding interference from irrelevant knowledge.
[0042] S102. The knowledge subgraph is converted into structured medical facts, and the structured medical facts are injected into the input prompts of the visual language model. Multiple candidate reports are generated based on the visual language model.
[0043] The knowledge subgraph retrieved in the previous steps contains anatomical structures, pathological findings, and their relationships related to the current chest X-ray image. However, this knowledge exists in the form of a graph structure and cannot be directly understood and used by the visual language model. Therefore, it is necessary to convert the knowledge subgraph into structured medical facts and inject them into the input prompts of the visual language model so that it can be constrained by medical domain knowledge when generating reports.
[0044] Specifically, the process of converting the knowledge subgraph into structured medical facts includes:
[0045] (1) Extract anatomical structure entities, pathological discovery entities and related relationships from the knowledge subgraph.
[0046] The knowledge subgraph contains several triples, each consisting of a head entity, a relation, and a tail entity. For example, the knowledge subgraph might contain a positional relation triple between the right lower lung (anatomical structure entity) and consolidation (pathological finding entity), and a severity relation triple between consolidation (pathological finding entity) and moderate (modifier entity). This step extracts all entities and their relationships from the knowledge subgraph one by one, serving as the foundational material for constructing structured medical facts.
[0047] (2) Normalize the medical terminology of the anatomical structure entities and pathological discovery entities, and construct the corresponding entity relationship facts based on the association relationship.
[0048] Medical reports from different sources may use different terminology to describe the same anatomical structure or pathological findings. For example, lung infection and pneumonia are semantically similar but are described differently; the right upper lobe and right upper lung refer to the same anatomical location. To avoid semantic ambiguity caused by inconsistent terminology, extracted entities can be mapped to standard medical terms, thus standardizing entity representation. Based on terminology normalization, entity pairs and their relationships are combined into entity relation facts according to the associations in the knowledge subgraph. For example, the entity relation fact "consolidation exists in the right lower lung" can be constructed from the triplet of the positional relationship between the right lower lung and consolidation, and "the severity of consolidation is moderate" can be constructed from the severity relationship between consolidation and moderate. Entity relation facts are expressed in natural language, which facilitates subsequent injection of prompt text into the visual language model.
[0049] (3) Encode the entity relationship facts into structured medical facts and inject the structured medical facts into the system prompts of the visual language model.
[0050] All entity relationship facts generated in step (2) are organized into a continuous structured text according to a preset format, serving as structured medical facts. These structured medical facts describe the anatomical structures, pathological findings, and their relationships related to the current chest X-ray image, such as: consolidation exists in the right lower lung, the severity of which is moderate, and the consolidation is co-occurring with pleural effusion. These structured medical facts are then injected into the system prompts of the visual language model as part of the system instructions. System prompts are global instructions received by the visual language model before output generation, used to set the model's generation goals and behavioral constraints. Placing the structured medical facts within the system prompts ensures their continuous role throughout the report generation process, constraining the model to adhere to the boundaries of medical facts in each generation round.
[0051] Before generating multiple candidate reports based on the visual language model, a reasoning ability distillation process is performed on the visual language model to impose knowledge constraints. The purpose of reasoning ability distillation is to enable a visual language model with a small parameter scale to maintain reasoning efficiency while possessing the reasoning ability and accuracy of a large parameter model. Specifically, the distillation includes:
[0052] (1) Use a large parameter visual language model to generate a structured inference chain from medical image training samples and construct inference chain training data.
[0053] A structured reasoning chain refers to the complete reasoning process from image observation to the final diagnostic conclusion. This reasoning chain specifically includes the following steps: (a) overall observation, describing the overall quality of the chest X-ray, the projection position, and whether there are any technical defects; (b) anatomical system examination, examining the trachea, lung fields, lung texture, cardiac silhouette, mediastinum, pleura, and bones one by one according to anatomical regions; (c) anomaly identification, describing the location, size, shape, density, margins, number, and severity of pathological findings; (d) diagnostic reasoning, forming a comprehensive diagnostic impression based on the identified anomalies and radiological knowledge; and (e) report generation, generating a structured radiological report text based on the above reasoning process. Large-parameter visual language models have powerful reasoning capabilities and can generate high-quality reasoning chains, but their large parameter count and slow reasoning speed make them unsuitable for direct deployment in practical applications. Therefore, a large-parameter visual language model (e.g., Qwen3-VL-235B) is used to generate structured reasoning chains from medical image training samples. Each training sample generates one or more reasoning chains, constructing a reasoning chain training dataset. Each data point in this dataset contains an input image and a corresponding structured inference chain text, which is used for subsequent distillation training.
[0054] (2) Input the inference chain training data into the small parameter visual language model to be trained, and inject the knowledge subgraph corresponding to the medical image training sample as a knowledge constraint into the small parameter visual language model to be trained.
[0055] Small-parameter visual language models (such as Qwen3-VL-8B-Instruct) serve as student models. They have fewer parameters and faster reasoning speed, but initially lack the reasoning ability of larger models. The training data of the reasoning chain constructed in step (1) is input into the student model, enabling it to learn and imitate the reasoning path of the larger model. Simultaneously, the knowledge subgraph corresponding to the current training sample is converted into structured medical facts, which are injected into the input of the student model as additional knowledge constraints. Specifically, in each training step of the distillation training, the knowledge subgraph of the corresponding input image is converted into structured medical facts and used as a prefix for the system prompts, constraining the student model to follow radiological co-occurrence rules and positional relationship constraints while learning the reasoning chain. For example, when the training sample involves the pathological finding of consolidation, the injected knowledge constraints will simultaneously include co-occurrence knowledge such as consolidation being common in lung consolidation areas and consolidation often co-occurring with pleural effusion, enabling the student model to simultaneously master these medical professional knowledge during the learning of the reasoning path.
[0056] (3) Update the parameters of the small-parameter visual language model to be trained according to the structured reasoning chain and the knowledge subgraph to obtain the visual language model.
[0057] Distillation training was performed using the LoRA low-rank adaptation method. LoRA is a parameter-efficient fine-tuning method that achieves model adaptation by superimposing a low-rank matrix on the weight matrix of the pre-trained model. It can adjust the model behavior by updating a small number of parameters while keeping most of the model parameters unchanged. The LoRA configuration was set to rank r=16, scaling factor alpha=32, and dropout=0.1, and only adapted the query matrix and projection matrix of the attention layer.
[0058] The training configuration for distillation training is as follows: the learning rate is set to 2e-4, the optimizer is AdamW (with decay rate β1=0.9 for first moment estimation, decay rate β2=0.999 for second moment estimation, and weight decay coefficient weight_decay=0.01), the learning rate scheduling uses a cosine annealing strategy with a warm-up step of 500 steps, the training epochs are 3, the batch size per GPU is 4, and the gradient accumulation steps are 8 (effective batch size is 4×2GPU×8=64). Distributed training is performed using DeepSpeed ZeRO-2, and the training precision format is bfloat16. The student model is initialized with Qwen3-VL-8B-Instruct (bfloat16 precision). The training data comes from the MIMIC-CXR dataset (approximately 227K radiology reports and corresponding chest X-rays), used for knowledge graph construction and distillation training. During training, the student model takes a structured reasoning chain as its target output and the injected knowledge subgraph as its input constraint. The LoRA parameters are updated by minimizing the cross-entropy difference between the model output and the reasoning chain. After multiple rounds of iterative training, the small-parameter visual language model, while maintaining reasoning efficiency, possesses structured reasoning capabilities and awareness of medical factual constraints, thus obtaining the aforementioned visual language model.
[0059] By injecting structured medical facts and distilling reasoning ability with knowledge constraints, the visual language model is simultaneously constrained by structured facts from the knowledge graph and by reasoning ability from the distillation of the reasoning chain when generating reports, thereby improving the accuracy of medical facts in the reports while ensuring generation efficiency.
[0060] S103. Based on the structured medical facts, evaluate the quality of the multiple candidate reports, and iteratively adjust the decoding parameters according to the Wasserstein distance between the generator output distribution and the validator quality distribution to determine the target report.
[0061] In step S102, the visual language model generates multiple candidate reports. While all these reports are constrained by structured medical facts, their quality may vary. For example, some candidate reports may perform well in factual accuracy but lack structural integrity; others may meet the requirements in terms of terminology but contain logical contradictions. Therefore, it is necessary to evaluate the quality of multiple candidate reports and select the highest quality report as the target report through iterative game theory. Simultaneously, during the iterative game process, the decoding parameters are dynamically adjusted based on the Wasserstein distance between the generator output distribution and the validator quality distribution, allowing the generator to gradually converge towards the high-quality region recognized by the validator. The validator quality distribution is a probability distribution obtained by normalizing the quality scores output by the validator for each candidate report, with the candidate report set as the support domain.
[0062] In the game-theoretic decoding process, the visual language model obtained in step S102 is used as a generator. Multiple decoding strategies are employed to generate a candidate report set R = {r1, r2, ..., r...} for the input chest X-ray that has been injected with the knowledge subgraph into the system prompts. k}, where k is the preset number of candidates, ranging from [5, 20], and in a specific embodiment k is set to 10. The multiple decoding strategies include at least one of the following three:
[0063] Beam Search: The beam width is set to 3 to 5, and in a specific embodiment, the beam width is set to 4 to generate multiple candidate sequences;
[0064] Sampling: A kernel sampling strategy is adopted, with the top-p sampling threshold set to 0.9, the top-k threshold set to 50, and the sampling temperature set to 0.7 to 1.0. In a specific embodiment, the sampling temperature is set to 0.85.
[0065] Contrastive Decoding: Introduces a contrastive search strategy to penalize duplicate generation in order to improve the diversity of candidate reports.
[0066] By combining the above-mentioned decoding strategies, the generator generates k candidate reports in the candidate search space, which are then used by the validator for quality evaluation and iterative game optimization.
[0067] Specifically, the quality evaluation of the multiple candidate reports based on the structured medical facts includes:
[0068] (1) Determine the medical fact constraints in the candidate report generation process based on the structured medical facts.
[0069] Structured medical facts originate from the anatomical entities, pathological findings, and their relationships extracted from the knowledge subgraph in step S102, such as "consolidation exists in the right lower lung," "the severity of consolidation is moderate," and "consolidation and pleural effusion co-occur." These facts constitute the constraints that candidate reports must adhere to at the medical content level; that is, descriptions of pathological findings, anatomical locations, and their relationships in candidate reports must not contradict these structured medical facts. For example, if the structured medical facts include "consolidation exists in the right lower lung," then the candidate report should not contain contradictory descriptions such as "no consolidation was found in the right lower lung" or "the consolidation is located in the left lower lung." In this step, the aforementioned structured medical facts are uniformly encoded into a set of medical fact constraints for subsequent quality evaluation of candidate reports.
[0070] (2) The search space in the candidate report generation process is filtered according to the medical fact constraints to obtain the candidate search space.
[0071] When a visual language model generates text, its decoding space is a set of all possible output sequences, which is extremely large. Searching the entire decoding space is not only computationally expensive but may also generate a large number of candidate reports that are irrelevant to or contradict medical facts. This step uses the medical fact constraints determined in step (1) to filter the original decoding search space: decoding paths that clearly violate the medical fact constraints are removed from the search space, and only candidate paths that satisfy the medical fact constraints are retained, thus obtaining the candidate search space. Each candidate path in this candidate search space satisfies the constraints of structured medical facts and will not generate report content that contradicts medical facts.
[0072] (3) Generate candidate reports within the candidate search space and update the candidate reports based on the iterative game between the generator and the verifier.
[0073] It should be noted that the generator is the visual language model obtained in step S102, used to generate candidate reports within the candidate search space. The validator is an independent quality assessment model, which can employ a scoring network based on a pre-trained language model. This network takes candidate reports and input images as input and outputs scores for each scoring dimension. In a specific embodiment, the validator uses a clinical BERT model pre-trained on the MIMIC-CXR report corpus as a text encoder, taking the candidate report text and the visual features of the input chest X-ray as dual-stream inputs, and outputting a four-dimensional scoring vector through a fully connected layer. The validator is trained on a report dataset labeled with expert scores, using mean squared error as the loss function. Specifically, after the generator generates multiple candidate reports within the candidate search space, the validator scores the quality of each candidate report, with scoring dimensions including factual accuracy, structural completeness, terminology standardization, and logical consistency. Factual accuracy refers to whether the medical descriptions in the candidate reports are consistent with the visual features of the input images; structural integrity refers to whether the candidate reports contain the necessary report structure, such as anatomical coverage, findings description, and conclusions; terminology standardization refers to whether the candidate reports use standard radiological terminology; and logical consistency refers to whether there are contradictions between the descriptions in the candidate reports. The validator assigns a quality score to each candidate report based on these four dimensions, reflecting the overall quality level of the candidate report. The generator adjusts its generation strategy based on the validator's score and regenerates candidate reports; the validator then scores the regenerated candidate reports again. This iterative process continues, with the generator and validator interacting continuously during the game. The generator adjusts its generation strategy based on the validator's quality evaluation results, gradually generating candidate reports of increasingly higher quality. Through this iterative game process, the quality of the candidate reports improves in each iteration. A maximum number of iterations is set in the game iteration process; in a specific embodiment, the maximum number of iterations is set to 5 to prevent infinite iterations in the event of non-convergence.
[0074] During the iterative game between the generator and the validator, the decoding parameters also need to be dynamically adjusted based on the Wasserstein distance between the generator output distribution and the validator quality distribution to ensure effective convergence of the game process. Specifically, this includes:
[0075] (1) Obtain the generation probability distribution formed by normalizing the output probability of the generator for each candidate report on the candidate report set, and the validator quality distribution formed by normalizing the quality score of the validator for each candidate report on the candidate report set.
[0076] When generating candidate reports, the generator outputs a probability distribution of the candidate reports in the text space, reflecting the generator's preference for different text sequences. After the validator assigns a quality score to each candidate report, it normalizes these scores over the candidate report set to obtain the validator quality distribution, which reflects the validator's quality preference for different candidate reports. By normalizing the generator's output probabilities for each candidate report over the candidate report set to obtain the generation probability distribution, the generation probability distribution and the validator quality distribution share the same candidate report set as the support domain, thus ensuring that the calculation of the Wasserstein-1 distance has a clear mathematical basis.
[0077] (2) Calculate the Wasserstein-1 distance between the output distribution and the quality distribution.
[0078] The Wasserstein-1 distance is a metric for measuring the difference between two probability distributions. Physically, it represents the minimum cost required to transform one distribution into another. Unlike traditional KL divergence or JS divergence, the Wasserstein-1 distance considers the geometry between the distributions and can provide meaningful gradient signals even if the support sets of the two distributions do not overlap. Therefore, it is more suitable for guiding iterative optimization between generators and validators. The formula for calculating the Wasserstein-1 distance is:
[0079] ;
[0080] Where P is the generation probability distribution with the candidate report set as the support domain, obtained by normalizing the generator's output probability for each candidate report on the candidate report set; Q is the validator quality distribution with the same candidate report set as the support domain, obtained by normalizing the validator's quality score for each candidate report on the candidate report set. Γ(P,Q) is the set of all joint distributions with P and Q as marginal distributions, inf denotes the infimum, and E[|xy|] represents the expected distance between x and y under the joint distribution. By defining P and Q on the same candidate report set, the two distributions share the same metric space and support domain, thus ensuring that the calculation of the Wasserstein-1 distance has a well-defined geometric meaning in mathematics. The Wasserstein-1 distance between the generator output distribution and the validator quality distribution is calculated, and this distance value reflects the degree of difference between the generator's current output and the validator's expected output. The smaller the Wasserstein-1 distance, the closer the quality distribution of the candidate reports output by the generator is to the high-quality distribution recognized by the validator; the larger the distance, the greater the gap between the candidate reports currently generated by the generator and the expectations of the validator.
[0081] (3) When the Wasserstein-1 distance is greater than the preset convergence threshold, the decoding parameters are adjusted according to the quality evaluation results of the verifier, and a candidate report is regenerated based on the adjusted decoding parameters.
[0082] Decoding parameters are the control parameters used by the generator when generating text, including the beam width of the beam search, sampling temperature, and top-p sampling threshold. These parameters directly affect the diversity and quality of the generated text. When the Wasserstein-1 distance is greater than the preset convergence threshold, it indicates that the difference between the generator's current output and the verifier's expectation is large and has not yet converged. At this time, the decoding parameters are adjusted according to the verifier's quality evaluation results. For example, when the verifier reports insufficient diversity of candidate reports, the sampling temperature can be increased or the top-p threshold can be decreased; when the verifier reports generally low quality of candidate reports, the beam width of the beam search can be increased. Based on the adjusted decoding parameters, the generator regenerates candidate reports, then returns to step (1) to reacquire the output distribution and quality distribution, and recalculates the Wasserstein-1 distance.
[0083] (4) When the Wasserstein-1 distance is less than or equal to the preset convergence threshold, the target report is determined from the candidate reports.
[0084] The preset convergence threshold is a small positive number. When the Wasserstein-1 distance is less than or equal to this threshold, it indicates that the difference between the generator's output distribution and the validator's quality distribution is sufficiently small, the quality of the candidate reports currently generated by the generator is close to the validator's expected level, and the game has reached a convergence state. In a specific embodiment, this preset convergence threshold can be set to 0.03. The value of the convergence threshold needs to strike a balance between convergence quality and iteration efficiency: a threshold that is too small (e.g., less than 0.01) will lead to too many iterations, reducing system efficiency; a threshold that is too large (e.g., greater than 0.05) may cause the game to stop before it has fully converged, reducing report quality. At this point, the candidate report with the highest validator score is selected from the current candidate report set as the target report. This selection process is expressed as:
[0085] ;
[0086] Where R is the set of candidate reports, r i For the i-th candidate report, Q(r) i ) is the validator's report on the candidate r i Quality rating, r * This is the selected target report. The target report achieved a high level of performance across multiple dimensions, including factual accuracy, structural completeness, terminology standardization, and logical consistency.
[0087] S104. Apply various visual perturbations to the chest X-ray image, obtain reports corresponding to each perturbation image, and determine the hallucination state based on the consistency of medical facts between the original report and the perturbation report.
[0088] It should be noted that the identified target report is a report optimized through knowledge constraints and game-theoretic decoding. This report achieves a high level of performance in terms of factual accuracy, structural completeness, terminology standardization, and logical consistency. However, the quality of the report itself alone cannot determine the reliability of the model's reasoning when generating the report. Visual language models may exhibit unstable reasoning behavior on certain inputs when generating reports. For example, when the input image contains uncommon pathological manifestations or has low image quality, the model may produce hallucinatory descriptions that do not match the image content, but the confidence level of the model's output remains high. Therefore, it is necessary to test the stability of the model's reasoning on input images to determine whether the target report is at risk of being unreliable. To this end, the stability of the model's reasoning is tested by applying various visual perturbations to the input image and observing the changes in the model's output before and after the perturbations. If the model can still maintain a medical factual description consistent with the original report after the perturbations, the reasoning is stable and reliable; if the output shows a significant difference after the perturbations, it indicates that the reasoning is at risk of being unreliable.
[0089] Specifically, the application of various visual perturbations to the chest X-ray image includes:
[0090] (1) Perform at least two visual perturbations, namely rotation, cropping, noise injection, brightness adjustment and contrast adjustment, on the chest X-ray image to obtain multiple perturbation images.
[0091] Rotation refers to rotating the image around its center by a certain angle, for example, the rotation angle can be set to multiple values within the range of -15° to 15°; cropping refers to randomly cropping a sub-region from the image, the cropping ratio can be set to, for example, 0.8 to 0.95; noise injection refers to adding Gaussian noise to the image, the noise intensity can be set to, for example, 0.01 to 0.05; brightness adjustment refers to changing the overall brightness of the image, the brightness factor can be set to, for example, 0.7 to 1.3; contrast adjustment refers to changing the contrast of the image, the contrast factor can be set to, for example, 0.8 to 1.2. At least two of the above perturbation types are applied to the original chest X-ray image, each perturbation can be applied multiple times with different parameter values, thereby generating multiple perturbed images. In one specific embodiment, each input image generates 24 perturbed versions, each version consisting of a randomly combined perturbation type. The reason for choosing multiple perturbation types instead of a single perturbation type is that a single perturbation type may only detect inference instability in a specific dimension. For example, rotation transformation mainly detects the model's sensitivity to spatial orientation, and pruning transformation mainly detects the model's dependence on local regions. In contrast, a combination of multiple perturbations can more comprehensively cover different types of inference instability.
[0092] (2) Using the visual language model, reports are generated for the chest X-ray image and each of the perturbation images to obtain the original report and multiple perturbation reports.
[0093] The original chest X-ray image is input into the visual language model, and a corresponding report is generated according to the procedures in S102 and S103, denoted as the original report. Each perturbed image is input into the same visual language model, and a corresponding report is generated according to the same procedure, denoted as the perturbed report. Each perturbed image corresponds to one perturbed report. Since the perturbed images introduce different degrees of visual changes based on the original images, if the model's inference about the original images is stable and reliable, then the perturbed reports corresponding to the perturbed images should maintain a high degree of consistency with the original reports in terms of medical content; conversely, if the model's inference about the original images relies on certain unstable visual features, then there may be significant differences between the perturbed reports and the original reports.
[0094] (3) Extract the medical facts from the original report and each of the disturbance reports, and determine the consistency between each disturbance report and the original report based on the semantic similarity between the corresponding medical facts.
[0095] Medical facts refer to the descriptive content in the report regarding anatomical structures, pathological findings, and their relationships, such as "consolidation exists in the right lower lung" or "the heart size is normal." Medical facts are extracted from the original report and each perturbation report, resulting in an original set of medical facts and a perturbation set of medical facts. For each perturbation report, its set of medical facts is compared with the set of medical facts in the original report, and the semantic similarity between the two is calculated. Semantic similarity can be measured using semantic representations based on pre-trained language models. In a specific embodiment, a ClinicalBERT model pre-trained on medical text can be used to extract semantic vectors from the report text and calculate cosine similarity. Semantic similarity is used instead of simple lexical matching because the same clinical finding can have multiple semantically equivalent expressions, and lexical matching would incorrectly classify them as inconsistent. Higher semantic similarity indicates greater consistency between the perturbation report and the original report in terms of medical content, and a more stable inference under that perturbation; lower semantic similarity indicates that the perturbation leads to instability in the model's inference.
[0096] Through the aforementioned visual perturbations and consistency calculations, the inference stability level of the model under various perturbations can be quantitatively obtained. Based on this, the hallucination state is further determined according to the consistency level. The hallucination state is a quantitative representation of whether the model exhibits unreliable inference behavior on the current input. The hallucination state includes a knowledge matching state and an output consistency state. The knowledge matching state characterizes the degree of matching between the knowledge subgraph and the current input image; the output consistency state characterizes the degree of quality consistency among the candidate reports output by the generator during the iterative game process.
[0097] Specifically, determining the hallucinatory state based on the consistency of medical facts between the original report and the disturbance report includes:
[0098] (1) Determine the average semantic similarity based on the semantic similarity between the original report and each of the disturbance reports, and determine the hallucination probability estimate based on the average semantic similarity.
[0099] The average semantic similarity is obtained by averaging the semantic similarities between each perturbation report and the original report. This average semantic similarity reflects the average level of the model's overall inference stability under various visual perturbations. Based on this average semantic similarity, a hallucination probability estimate is calculated. The formula for calculating the hallucination probability estimate is: the hallucination probability estimate equals 1 minus the average semantic similarity. Specifically:
[0100] ;
[0101] Where sim(·,·) is the semantic similarity measurement function, r0 is the original report, and r iLet be the i-th perturbation report, M be the number of perturbation reports, and h be the estimated probability of hallucination. When the average semantic similarity is high, it indicates that the model can maintain a consistent medical fact description with the original report under each perturbation, has good inference stability, and a low estimated probability of hallucination. When the average semantic similarity is low, it indicates that the model produces a medical fact description inconsistent with the original report under perturbation, has poor inference stability, a high estimated probability of hallucination, and the model output may contain hallucinations.
[0102] (2) Obtain the original confidence level corresponding to the target report, and input the hallucination probability estimate and the original confidence level into the confidence level calibration model to obtain the calibrated confidence level.
[0103] The raw confidence score is the confidence rating inherent in the visual language model when generating target reports, reflecting the model's confidence in its generated results. However, the raw confidence score of visual language models in medical image report generation often fails to accurately reflect the reliability of their output; the model may still assign a high confidence score even when generating erroneous reports. Therefore, it is necessary to calibrate the raw confidence score using hallucination probability estimates. The hallucination probability estimates, along with the raw confidence score, are input into a confidence calibration model, which employs an extended calibration method, using the hallucination probability estimates as an additional calibration feature. Specifically, the calibration formula for the calibration model is:
[0104] ;
[0105] Where c is the original confidence level, h is the estimated probability of hallucination, and α, β, and γ are learnable parameters, obtained by optimizing the out-of-sample validation set using the negative log-likelihood loss as the objective function and the gradient descent method. The optimization process minimizes the cross-entropy loss between the calibrated confidence level and the true correctness label on the validation set. calibrated This represents the calibrated confidence level. Unlike traditional univariate Platt scaling (using only c), this approach introduces h as an additional calibration feature. This allows the calibrated model to capture information about whether the model's reasoning regarding the current input is unreliable, thereby improving the confidence level's ability to represent the actual reliability of the report. The calibrated model outputs the calibrated confidence level, which integrates the model's own confidence assessment and the reliability detection results based on visual consistency.
[0106] (3) Determine the confidence level corresponding to the target report based on the calibrated confidence level.
[0107] The calibrated confidence level is used as the final confidence level output of the target report. Compared with the original confidence level, the calibrated confidence level can be appropriately reduced when the model is overconfident and can maintain a reasonable confidence level when the model inference is stable, thus providing users with a more reliable confidence assessment.
[0108] S105. Adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and re-execute the knowledge subgraph retrieval, candidate report generation and report verification based on the adjusted parameters until the preset consistency condition is met, and output the target report and corresponding confidence level.
[0109] When the hallucination state is high or the calibrated confidence level is lower than the preset confidence threshold, it indicates that the report generated under the current encrypted inference configuration is unreliable. The relevant parameters in the report generation process need to be adjusted, and the report generation should be re-executed based on the adjusted parameters until the preset consistency condition is met. Specifically, when the hallucination probability estimate h exceeds the preset hallucination threshold, the hallucination state is determined to be high; and / or when the calibrated confidence level C... calibrated When the report falls below a preset reliability threshold, it is determined that the current report is unreliable. In one specific embodiment, the preset hallucination threshold can be set to 0.15, and the preset reliability threshold can be set to 0.85. The values of the preset hallucination threshold and the preset reliability threshold are determined based on the average hallucination probability and calibration reliability distribution of the statistical model on the MIMIC-CXR validation set. The 95th percentile hallucination probability value of the correct report is used as the upper limit of the threshold, and the 5th percentile reliability value of the correct report is used as the lower limit of the threshold. This ensures that most correct reports pass the judgment, and only reports that significantly deviate from the normal distribution are reconfigured.
[0110] The unreliability of inference may stem from two main causes: first, the matching between the knowledge subgraph obtained during the knowledge retrieval stage and the current input image is inaccurate, leading to subsequent generation processes based on inaccurate knowledge constraints; second, improper decoding parameter settings during the report decoding stage prevent the generator from fully exploring high-quality report paths in the candidate search space. Different adjustment strategies can be adopted for these two different causes.
[0111] The step of adjusting at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state includes:
[0112] (1) Determine the corresponding feedback adjustment amount based on the hallucination state.
[0113] The hallucination state is characterized by a hallucination probability estimate calculated using average semantic similarity. This estimate reflects the instability of the model's inference on the current input. Based on the numerical range of the hallucination probability estimate, a corresponding feedback adjustment is determined. This feedback adjustment quantifies the magnitude of subsequent parameter adjustments. A higher hallucination probability estimate indicates a greater risk of unreliable inference, requiring a larger adjustment; conversely, a lower hallucination probability estimate indicates a lower risk of unreliable inference, requiring only a smaller adjustment.
[0114] (2) When the consistency of the knowledge subgraph corresponding to the hallucination state is lower than the preset consistency threshold, the knowledge subgraph retrieval parameters are adjusted, and the knowledge subgraph is retrieved again according to the adjusted knowledge subgraph retrieval parameters.
[0115] Knowledge subgraph matching consistency reflects the degree of matching between the retrieved knowledge subgraph and the current input image. When this consistency is lower than a preset consistency threshold, it indicates that the semantic association between the retrieved knowledge subgraph and the current chest X-ray image is not strong enough, potentially introducing knowledge noise unrelated to the current image, leading to interference from inaccurate knowledge constraints in subsequent report generation. In a specific embodiment, the preset consistency threshold can be set to 0.7 (corresponding to the similarity threshold for knowledge subgraph retrieval in S101). When the semantic similarity between the knowledge subgraph and the current image is lower than 0.7, the matching consistency is deemed insufficient. In this case, the knowledge subgraph retrieval parameters are adjusted, such as increasing the semantic similarity threshold, reducing the number of selected knowledge subgraphs, or adjusting the calculation weight of semantic similarity to make the retrieval conditions more stringent. Then, the knowledge subgraph retrieval is re-executed based on the adjusted retrieval parameters to obtain a knowledge subgraph that matches the current image more accurately. Based on the new knowledge subgraph, the subsequent candidate report generation and report verification are re-executed.
[0116] (3) When the consistency of the report output corresponding to the hallucination state is lower than the preset consistency threshold, the report decoding parameters are adjusted, and the candidate report generation and report verification are re-executed according to the adjusted report decoding parameters.
[0117] Output consistency reflects the quality consistency among candidate reports generated by the generator during the iterative game. When this consistency falls below a preset threshold, it indicates that the quality of candidate reports generated by the generator fluctuates significantly under the current decoding parameter settings, failing to consistently generate high-quality reports. This problem may stem from improper decoding parameter settings, such as an insufficient search space due to a too-small beam width in the beam search, excessively high sampling temperature leading to excessive randomness in the generation results, or an unreasonable top-p sampling threshold setting resulting in insufficient diversity of generated content. In this case, the report decoding parameters should be adjusted. For example, when candidate report diversity is insufficient, the sampling temperature can be increased or the top-p threshold can be decreased to increase generation diversity; when the quality of candidate reports is generally low, the beam width in the beam search can be increased to expand the search range. Then, candidate report generation and report verification are re-executed based on the adjusted decoding parameters to obtain target reports of higher quality.
[0118] (4) Update the target report and its corresponding confidence level based on the re-retrieved knowledge subgraph and the regenerated candidate report.
[0119] After completing the above parameter adjustments and re-execution, obtain the newly generated target report and its corresponding confidence level. Use the newly generated target report and its corresponding calibrated confidence level as the output of the current round, replacing the original target report and confidence level. Then, re-execute the visual perturbation consistency detection, determine the hallucination state and calibrate the confidence level of the newly generated target report, and verify again whether the preset consistency condition is met. The preset consistency condition refers to the hallucination probability estimate h being lower than a preset hallucination threshold (e.g., 0.15), and the calibrated confidence level C... calibrated If the confidence level is higher than the preset confidence threshold (e.g., 0.85), and both conditions are met simultaneously, it is determined that the preset consistency condition is met. If the condition is met, the iteration stops, and the current target report and corresponding confidence level are output; if the condition is not met, steps (1) to (4) are repeated until the preset consistency condition is met. In a specific embodiment, the preset maximum number of reconfiguration rounds can be set to 3.
[0120] It should be noted that the two adjustment strategies mentioned above are not mutually exclusive. When both the consistency of knowledge subgraph matching and the consistency of report output are lower than the preset threshold, the knowledge subgraph retrieval parameters and the report decoding parameters can be adjusted simultaneously to jointly optimize the report quality from both the knowledge source and the generation process dimensions.
[0121] The method provided in this embodiment first uses visual feature-driven dynamic knowledge subgraph retrieval to match relevant knowledge subgraphs from a pre-constructed radiology knowledge graph based on the visual content of the current input image. This ensures that each input image receives domain knowledge constraints that match its visual content, avoiding the computational burden and noise interference caused by indiscriminately inputting the entire knowledge graph into the model. Based on this, the retrieved knowledge subgraphs are converted into structured medical facts and injected into the system prompts of the visual language model. Simultaneously, a knowledge constraint-enhanced reasoning ability distillation method is employed, allowing the student model to be simultaneously enhanced during the learning of the reasoning chain. The report generation process is constrained by the co-occurrence rules of radiology and anatomical positional relationships, thus possessing both structured reasoning capabilities and accuracy constraints at the medical fact level. This overcomes the shortcomings of existing distillation schemes, which suffer from inconsistencies between reasoning paths and medical facts due to the lack of domain knowledge correction mechanisms. After report generation, the quality of candidate reports is evaluated through iterative game between the generator and the validator. The Wasserstein-1 distance is used to measure the semantic difference between the generator's output distribution and the validator's quality distribution, and this serves as the basis for adjusting decoding parameters. This allows the report quality to gradually improve during the iterative game process, while simultaneously utilizing structured medical facts to... The search space of candidate reports is filtered, narrowing the game search space and improving convergence efficiency. This overcomes the shortcomings of existing game decoding schemes, which suffer from excessively large search spaces and limited convergence speeds due to a lack of domain knowledge guidance. Furthermore, by applying various visual perturbations to chest X-ray images, the probability estimate of hallucinations is determined based on the consistency of medical facts between the original report and the perturbation report. This estimate is then used as an additional calibration feature to correct the original confidence score, enabling the calibration model to capture dimensional information about whether the model's reasoning about the current input is unreliable. This breaks through the theoretical upper limit of traditional monotonic calibration and obtains a more accurate confidence score assessment. Finally, based on... The knowledge subgraph retrieval parameters and report decoding parameters are dynamically adjusted based on the hallucination state. The knowledge subgraph retrieval, candidate report generation, and report verification are re-executed based on the adjusted parameters. This process is repeated iteratively until the preset consistency condition is met, forming a closed-loop mechanism consisting of knowledge retrieval, report generation, quality evaluation, hallucination detection, and feedback adjustment. This allows the report generation parameters to be adaptively adjusted according to the hallucination detection results, overcoming the shortcomings of existing solutions where the report generation process and reliability assessment are independent and the generation parameters cannot be dynamically adjusted according to the reliability assessment results. The final target report output achieves a superior level in terms of both the accuracy of medical facts and the reliability of confidence.
[0122] In one specific implementation, the specific configuration of the above embodiment is as follows:
[0123] The hardware setup consists of two NVIDIA RTX 4090 GPUs (24GB VRAM each), an Intel Xeon Gold 6133 CPU (40 cores, 80 threads), and 32GB of RAM.
[0124] The software environment is as follows: the operating system is Ubuntu 22.04 LTS, the deep learning framework is PyTorch 2.1.0 and Transformers 4.36.0, the distributed training is DeepSpeed 0.12.0, and the training precision format is bfloat16.
[0125] The datasets are configured as follows: the NIH ChestX-ray14 dataset contains 112,120 chest X-rays and 14 disease labels, used for zero-sample baseline assessment; the MIMIC-CXR dataset contains approximately 227,000 radiology reports and corresponding chest X-rays, used for knowledge graph construction and distillation training.
[0126] The model configuration is as follows: the teacher model uses Qwen3-VL-235B (bfloat16 precision, used only for inference to generate CoT chains), the student model uses Qwen3-VL-8B-Instruct (bfloat16 precision), and the LoRA configuration is rank r=16, scaling factor alpha=32, and dropout=0.1.
[0127] The training hyperparameters are as follows: learning rate 2e-4, optimizer AdamW (β1=0.9, β2=0.999, weight_decay=0.01), learning rate scheduling uses cosine annealing strategy with a warm-up step of 500, training epochs are 3, batch size per GPU is 4, and gradient accumulation steps are 8 (effective batch size is 4×2GPU×8=64).
[0128] The game decoding parameters are: number of candidates k=10, beam search beam width=4, sampling temperature t=0.85, top-p=0.9, top-k=50, convergence threshold ε=0.03, and maximum number of iterations=5. The convergence threshold ε is set to 0.03 because: a threshold that is too small (e.g., less than 0.01) will lead to too many iterations and reduced inference efficiency, while a threshold that is too large (e.g., greater than 0.05) may cause the game to stop before it has fully converged, reducing report quality. Experiments have shown that 0.03 strikes the optimal balance between report quality and iteration efficiency.
[0129] The confidence calibration parameters are: number of perturbations M=24, rotation angle range is ±15°, cropping ratio range is [0.85, 0.95], Gaussian noise intensity σ=0.03, luminance factor range is [0.8, 1.2], and contrast factor range is [0.8, 1.2].
[0130] Example 2
[0131] Corresponding to the aforementioned embodiment of an image report generation method based on knowledge graphs and visual feedback, this application also provides an embodiment of an image report generation system based on knowledge graphs and visual feedback.
[0132] Figure 2 This is a schematic diagram of the structure of Embodiment 2 of the image report generation system based on knowledge graphs and visual feedback provided in this application. Please refer to... Figure 2 The system provided in this embodiment includes:
[0133] The image feature extraction module is used to acquire the chest X-ray image to be processed and extract the visual features of the chest X-ray image;
[0134] The knowledge graph retrieval module is used to retrieve matching knowledge subgraphs from a pre-constructed radiology knowledge graph based on the visual features, and convert the knowledge subgraphs into structured medical facts;
[0135] The report generation module is used to inject the structured medical facts into the input prompts of the visual language model to generate multiple candidate reports;
[0136] The report verification module is used to evaluate the quality of the multiple candidate reports based on the structured medical facts, and iteratively adjust the report decoding parameters according to the Wasserstein distance between the generator output distribution and the verifier quality distribution to determine the target report;
[0137] The visual consistency detection module is used to apply various visual perturbations to the chest X-ray image, obtain reports corresponding to each perturbation image, and determine the hallucination state based on the consistency of medical facts between the original report and the perturbation report.
[0138] The feedback reconfiguration module is used to adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and call the knowledge graph retrieval module, report generation module and report verification module to re-execute the knowledge subgraph retrieval, candidate report generation and report verification until the preset consistency conditions are met, and output the target report and corresponding confidence level.
[0139] The system in this embodiment can be used to execute Figure 1 The steps of the method embodiment shown are similar in principle and process, and will not be repeated here.
[0140] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for generating image reports based on knowledge graphs and visual feedback, characterized in that, The method includes: Acquire a chest X-ray image to be processed, extract the visual features of the chest X-ray image, and retrieve a matching knowledge subgraph from a pre-constructed radiology knowledge graph based on the visual features; The knowledge subgraph is converted into structured medical facts, and the structured medical facts are injected into the input prompts of the visual language model. Multiple candidate reports are generated based on the visual language model. The quality of the multiple candidate reports is evaluated based on the structured medical facts, and the decoding parameters are iteratively adjusted according to the Wasserstein distance between the generator output distribution and the validator quality distribution to determine the target report. Multiple visual perturbations are applied to the chest X-ray image, and reports corresponding to each perturbation image are obtained. The hallucination state is determined based on the consistency of medical facts between the original report and the perturbation report. Adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and re-execute the knowledge subgraph retrieval, candidate report generation and report verification based on the adjusted parameters until the preset consistency condition is met, and output the target report and corresponding confidence level.
2. The method according to claim 1, characterized in that, The step of retrieving a matching knowledge subgraph from a pre-constructed radiology knowledge graph based on the visual features includes: Extract the visual feature vector corresponding to the chest X-ray image; Based on the semantic similarity between the visual feature vector and the candidate knowledge subgraphs in the radiology knowledge graph, the candidate knowledge subgraphs are matched and ranked. Candidate knowledge subgraphs whose semantic similarity meets preset matching conditions are selected as knowledge subgraphs that match the chest X-ray image.
3. The method according to claim 1, characterized in that, The process of converting the knowledge subgraph into structured medical facts includes: Extract anatomical structure entities, pathological findings entities, and related relationships from the knowledge subgraph; The anatomical structure entities and pathological findings entities are normalized using medical terminology, and corresponding entity relationship facts are constructed based on the association relationships. The entity relationship facts are encoded as structured medical facts, and these structured medical facts are injected into the system prompts of the visual language model.
4. The method according to claim 1, characterized in that, Before generating multiple candidate reports based on the visual language model, the method further includes distilling the reasoning ability of the visual language model under knowledge constraints, the distillation including: A large-parameter visual language model is used to generate structured inference chains from medical image training samples, and inference chain training data is constructed. The inference chain training data is input into the small parameter visual language model to be trained, and the knowledge subgraph corresponding to the medical image training sample is injected as a knowledge constraint into the small parameter visual language model to be trained. The parameters of the small-parameter visual language model to be trained are updated based on the structured reasoning chain and the knowledge subgraph to obtain the visual language model.
5. The method according to claim 1, characterized in that, The quality evaluation of the multiple candidate reports based on the structured medical facts includes: The medical fact constraints in the candidate report generation process are determined based on the structured medical facts described above; The search space in the candidate report generation process is filtered based on the aforementioned medical fact constraints to obtain the candidate search space; Candidate reports are generated within the candidate search space, and the candidate reports are updated based on the iterative game between the generator and the validator.
6. The method according to claim 1, characterized in that, The step of iteratively adjusting the decoding parameters based on the Wasserstein distance between the generator output distribution and the verifier quality distribution includes: Obtain the generator probability distribution formed by normalizing the generator's output probability for each candidate report on the candidate report set, and the validator quality distribution formed by normalizing the validator's quality score for each candidate report on the candidate report set. Calculate the Wasserstein-1 distance between the output distribution and the quality distribution; When the Wasserstein-1 distance is greater than a preset convergence threshold, the decoding parameters are adjusted according to the quality evaluation results of the verifier, and a candidate report is regenerated based on the adjusted decoding parameters. When the Wasserstein-1 distance is less than or equal to the preset convergence threshold, the target report is determined from the candidate reports.
7. The method according to claim 1, characterized in that, The application of various visual perturbations to the chest X-ray image includes: At least two visual perturbations, including rotation, cropping, noise injection, brightness adjustment, and contrast adjustment, are applied to the chest X-ray image to obtain multiple perturbation images; The visual language model is used to generate reports for the chest X-ray image and each of the perturbation images, resulting in an original report and multiple perturbation reports; Extract medical facts from the original report and each of the perturbation reports, and determine the consistency between each perturbation report and the original report based on the semantic similarity between the corresponding medical facts.
8. The method according to claim 1, characterized in that, The determination of hallucinatory states based on the consistency of medical facts between the original report and the disturbance report includes: The average semantic similarity is determined based on the semantic similarity between the original report and each of the disturbance reports, and the hallucination probability estimate is determined based on the average semantic similarity. Obtain the original confidence level corresponding to the target report, and input the hallucination probability estimate and the original confidence level into the confidence level calibration model to obtain the calibrated confidence level; The confidence level corresponding to the target report is determined based on the calibrated confidence level.
9. The method according to claim 1, characterized in that, The step of adjusting at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state includes: Determine the corresponding feedback adjustment amount based on the hallucination state; When the consistency of the knowledge subgraph corresponding to the hallucination state is lower than the preset consistency threshold, the knowledge subgraph retrieval parameters are adjusted, and the knowledge subgraph is retrieved again according to the adjusted knowledge subgraph retrieval parameters. When the consistency of the report output corresponding to the hallucination state is lower than the preset consistency threshold, the report decoding parameters are adjusted, and candidate report generation and report verification are re-executed according to the adjusted report decoding parameters; The target report and its corresponding confidence level are updated based on the re-retrieved knowledge subgraph and the regenerated candidate reports.
10. An image report generation system based on knowledge graphs and visual feedback, characterized in that, include: The image feature extraction module is used to acquire the chest X-ray image to be processed and extract the visual features of the chest X-ray image; The knowledge graph retrieval module is used to retrieve matching knowledge subgraphs from a pre-constructed radiology knowledge graph based on the visual features, and convert the knowledge subgraphs into structured medical facts; The report generation module is used to inject the structured medical facts into the input prompts of the visual language model to generate multiple candidate reports; The report verification module is used to evaluate the quality of the multiple candidate reports based on the structured medical facts, and iteratively adjust the report decoding parameters according to the Wasserstein distance between the generator output distribution and the verifier quality distribution to determine the target report; The visual consistency detection module is used to apply various visual perturbations to the chest X-ray image, obtain reports corresponding to each perturbation image, and determine the hallucination state based on the consistency of medical facts between the original report and the perturbation report. The feedback reconfiguration module is used to adjust at least one of the knowledge subgraph retrieval parameters and report decoding parameters according to the hallucination state, and call the knowledge graph retrieval module, report generation module and report verification module to re-execute the knowledge subgraph retrieval, candidate report generation and report verification until the preset consistency conditions are met, and output the target report and corresponding confidence level.
