A medical relation extraction method based on multi-agent debate and knowledge enhancement
Patent Information
- Application Number
- CN202611166535.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-03
- Publication Date
- 2026-10-23
AI Technical Summary
[0007]针对现有技术中的上述不足,本发明提供的一种基于多智能体辩论与知识增强的医学关系抽取方法解决了如何克服现有大语言模型在医学关系抽取中因缺乏多源权威证据支撑、缺乏多角度交叉验证机制以及缺少错误模式对比学习,而导致易产生事实幻觉和确认偏误的问题
[0021]为通过差异化赋权与量化共识得分,该机制将定性的辩论争议转化为明确的终止阈值判断,既保证了在达成充分共识前持续迭代修正,又避免了无限制辩论带来的计算冗余。这为医学关系抽取系统在实际临床辅助场景中的高效、稳定运行提供了可靠保障。
Smart Images

Figure CN122964257A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of natural language processing and medical information extraction technology, and in particular to a medical relation extraction method based on multi-agent debate and knowledge enhancement. Background Technology
[0002] Medical relation extraction aims to automatically identify semantic relationships between entities in unstructured medical texts, and is a key technology for constructing medical knowledge graphs and supporting clinical auxiliary diagnosis and intelligent question-answering systems. With the development of medical informatization, electronic medical records, clinical guidelines, and medical literature are experiencing explosive growth, creating an urgent need for automated knowledge extraction technologies. However, the complex terminology, implicit semantic expressions, and frequent cross-sentence reasoning requirements in medical texts present challenges far greater for medical relation extraction than those in general domains.
[0003] To address these challenges, existing technologies have explored direct reasoning methods based on large language models, retrieval-enhanced generation methods, and multi-agent collaborative methods. However, these technologies still have the following shortcomings: First, the reasoning process lacks verifiable evidence. Existing methods based on large language models mostly generate relational results directly from internal parameterized knowledge, making the reasoning chain untraceable. When faced with complex medical texts, the models are prone to producing illusory outputs that are inconsistent with the facts, such as misjudging the co-occurrence relationship between diseases and drugs as a treatment relationship, which makes it difficult to meet the high reliability requirements of medical applications.
[0004] Secondly, there is a lack of multi-angle cross-validation mechanisms. Existing large-scale model relation extraction typically employs a single-generation or unidirectional reasoning paradigm, which tends to reinforce initial prediction beliefs and makes it difficult to overcome confirmation bias. While some multi-agent methods introduce interaction, they are mostly based on surface semantics and lack deep interaction involving dynamic debate and consensus accumulation, making it impossible to proactively identify and correct logical conflicts during the reasoning process.
[0005] Secondly, knowledge retrieval strategies are passive and simplistic. Existing retrieval enhancement methods mostly employ passive keyword matching strategies for external knowledge retrieval, lacking proactive awareness of reasoning needs; moreover, the retrieved knowledge is often directly injected into the prediction process, lacking explicit verification mechanisms.
[0006] Finally, there is a lack of a structured error pattern comparison learning mechanism. Existing methods mostly only retain correct examples for context learning, failing to explicitly encode and guide the model to avoid high-frequency error patterns caused by relationship type confusion, entity boundary deviation, etc. in medical relationship extraction, resulting in the recurrence of similar errors. Summary of the Invention
[0007] To address the aforementioned shortcomings in existing technologies, this invention provides a medical relation extraction method based on multi-agent debate and knowledge enhancement. This method solves the problem of existing large language models being prone to factual illusions and confirmation biases in medical relation extraction due to the lack of multi-source authoritative evidence support, the lack of multi-angle cross-validation mechanisms, and the lack of error pattern comparison learning.
[0008] To achieve the aforementioned objectives, the present invention employs the following technical solution: a medical relation extraction method based on multi-agent debate and knowledge enhancement, comprising: S1: Based on medical text training data, we use an object-oriented structured approach to model and analyze the relational instances in unstructured medical texts, resulting in a coding style medical case library that includes a comparative analysis of correct and incorrect relations. S2: Based on the coding style medical case library and the input medical sentence to be processed, a semantic coding algorithm is used to perform unified semantic coding and calculate cosine similarity. The top specified number of cases most relevant to the medical sentence to be processed are retrieved to obtain the case retrieval results. S3: Based on the medical sentence to be processed, the initial prediction result is obtained by using a large language model to perform initial relation prediction. Based on the initial prediction result, a query statement is generated to call the medical literature database to retrieve relevant medical literature. The search results are then subjected to relevance screening and evidence extraction to obtain external medical knowledge. S4: Integrate the medical sentences to be processed, case retrieval results, and external medical knowledge, and conduct multiple rounds of collaborative debate using supporter agents, opponent agents, audience agents, and judge agents. During this process, a memory module is used to store structured information, and the prediction results of the previous round are iteratively corrected based on a consensus judgment mechanism. When the preset termination conditions are met, the final medical relationship extraction result is obtained, and the medical relationship extraction is completed.
[0009] The beneficial effects of this invention are as follows: This invention provides a medical relation extraction method based on multi-agent debate and knowledge enhancement, the beneficial effects of which are mainly reflected in the following three aspects: (1) By constructing and retrieving a coding style medical case library, medical relation instances are transformed into an object-oriented structure, which also includes a comparative analysis of correct and incorrect relations. This enables the large language model to better understand different relation types, effectively guides the large language model to identify high-frequency error patterns in medical relation extraction, and enhances its ability to discriminate complex semantic relations.
[0010] (2) By not relying on passive keyword matching, but automatically generating query statements based on initial prediction results to retrieve medical literature databases, key evidence fragments are extracted to obtain external medical knowledge. This proactive query generation strategy realizes knowledge acquisition driven by reasoning needs, providing traceable and verifiable external authoritative medical evidence support for relation judgment.
[0011] (3) By utilizing four intelligent agents—supporters, opponents, audience, and judges—to conduct multi-round collaborative debates, and combining this with a memory module to store structured content, the mechanism finally performs iterative corrections through a consensus-based judgment mechanism. This mechanism enables a multi-faceted and in-depth examination of candidate relationships, effectively overcoming the confirmation bias of one-way reasoning and ensuring the accuracy of the final medical relationship extraction results.
[0012] Further, S1 includes: Based on medical text training data, we use an object-oriented structured approach to abstractly model relation classes and entity classes, and extract medical relation instances and entity type constraint definitions. Based on medical relationship examples, an initial prediction is made using a large language model. Samples that are predicted incorrectly are output as negative cases, and samples that are predicted correctly are output as positive cases. Based on positive and negative cases and entity type constraints, a large language model is used to perform error analysis and generate analysis text. The original input sentence, correct relation results, incorrect relation results and analysis text are combined to obtain a coding style medical case library containing comparative analysis of correct and incorrect relations.
[0013] By explicitly comparing correct and incorrect predictions in the training samples and analyzing the causes of errors, the constructed case library provides the model with prior references for high-frequency error types. This enables the model to actively avoid common extraction errors such as reversed relation direction and mismatched entity types during inference, effectively enhancing the model's ability to distinguish easily confused relations.
[0014] Further, S2 includes: Based on the coding style medical case library and the input medical sentences to be processed, a semantic coding algorithm is used for unified processing to obtain a vector index library composed of semantic vectors of each case and the sentence semantic vector corresponding to the medical sentences to be processed. Based on the vector index library and sentence semantic vectors, cosine similarity is calculated and relevance is ranked to retrieve the top specified number of cases most relevant to the medical sentence to be processed, thus obtaining the case retrieval results.
[0015] To accurately locate the most relevant comparative cases to the current input context through semantic similarity retrieval, these cases not only provide correct extraction templates but also reveal typical misjudgment paths that may exist in similar contexts. This provides highly targeted reference for the subsequent debate and verification process, thereby effectively suppressing erroneous extraction caused by contextual bias.
[0016] Further, S3 includes: Based on the medical sentences and case retrieval results to be processed, an initial relation prediction was performed using a large language model to obtain the initial prediction results. Based on the initial prediction results and the medical sentences to be processed, a large language model is used to generate query statements and call the medical literature database retrieval interface to search for candidate medical literature. Based on candidate medical literature, relevance screening and key evidence extraction operations are performed to obtain external medical knowledge.
[0017] This proactive query strategy overcomes the limitations of traditional passive retrieval, automatically obtaining direct evidence from authoritative literature for the current candidate relationship, ensuring that every relationship determination is verifiable. This fundamentally solves the factual errors caused by reliance on outdated or static parameterized knowledge in medical extraction tasks, making the extraction results clinically traceable and verifiable.
[0018] Further, S4 includes: By utilizing the medical sentences to be processed, case retrieval results, external medical knowledge, and predefined relationship and entity type definitions, an initial memory module with a shared context is obtained through data fusion processing. Based on the initial memory module, the supporter agent, opponent agent, audience agent, and judge agent respectively perform supporting viewpoint generation, hard verification rebuttal based on entity type constraints, evidence chain review, and viewpoint summary processing to obtain the debate viewpoints of each agent, and output the debate viewpoints in a structured summary as the updated current round memory module. Based on the current round's memory module and the debate viewpoints of each agent, structured information is stored and consensus scores are calculated according to preset differentiated role weights. It is then determined whether the preset consistency conditions have been met. If not, the updated prediction result of the judge agent after iterative correction of the previous round's prediction result is output and the next round of debate continues. In response to either the judgment result meeting the preset consistency condition or reaching the maximum number of debate rounds, the debate process is terminated, the final medical relationship extraction result of the judge's intelligent agent is obtained, and the medical relationship extraction is completed.
[0019] By assigning four agents to perform the roles of evidence presentation, questioning, review, and adjudication, a comprehensive review of candidate relationships and cross-validation of the evidence chain are achieved. This mechanism effectively overcomes the confirmation bias that is easily generated in unidirectional reasoning of a single model, ensuring that even when faced with complex long sentences or multi-entity cross-contexts, the final extracted results have undergone sufficient logical argumentation and conflict resolution, greatly improving the robustness of the extracted results.
[0020] Furthermore, the step of calculating a consensus score based on preset differentiated role weights and determining whether a preset consensus condition has been met includes: The expression for the consensus score is: ; The expression for the consistency condition determination result is: ; in, This represents the consensus score in the t-th round of debate. This represents the total number of agents participating in the debate. Indicates the sequence number of the intelligent agent. Represented as the first Each agent has a pre-defined differentiated role weight. This represents a summary of the viewpoints of all parties in the current round, based on the output of the judge's intelligent agent. Indicates based on The extracted first Summary of the statements of each agent. Indicates the judgment of the first A function determines whether an agent agrees to retain the original answer. The function outputs 1 if it decides not to modify the result, and 0 otherwise. This indicates the result of the judgment on whether the current round has met the preset consistency conditions. This indicates that the consistency condition has been met. This indicates that the consistency condition has not been met. This represents the consistency score threshold based on prior settings.
[0021] To achieve differentiated weighting and quantified consensus scores, this mechanism transforms qualitative debates into explicit termination thresholds. This ensures continuous iterative corrections before reaching full consensus while avoiding computational redundancy caused by unrestricted debate. This provides a reliable guarantee for the efficient and stable operation of the medical relationship extraction system in real-world clinical support scenarios. Attached Figure Description
[0022] This specification will be further described by way of exemplary embodiments, which will be described in detail with reference to the accompanying drawings. These embodiments are not limiting; in these embodiments, the same reference numerals denote the same structures, wherein: Figure 1 This is an exemplary flowchart illustrating a medical relationship extraction method based on multi-agent debate and knowledge enhancement, according to some embodiments of this specification. Detailed Implementation
[0023] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0024] Example Figure 1 This is an exemplary flowchart illustrating a medical relationship extraction method based on multi-agent debate and knowledge enhancement, according to some embodiments of this specification. Figure 1 As shown, the process includes the following steps. In some embodiments, the process may be executed by a processor.
[0025] S1: Based on the medical text training set data, we use an object-oriented structured approach to model and analyze the relational instances in unstructured medical texts, resulting in a coding style medical case library that includes a comparative analysis of correct and incorrect relations.
[0026] Medical text training datasets are collections of basic medical text corpora and their annotation information used to train and build case libraries. For example, medical text training datasets may include publicly available Chinese medical relation extraction datasets, such as CMeIE-V2 and CMedCausal, which contain a large number of electronic medical record fragments, clinical guideline sentences, and correctly annotated entity and relation triples in these sentences.
[0027] In some embodiments, the processor can extract text fragments containing known entity associations and corresponding tags by collecting publicly available datasets in the medical field or by cleaning and de-identifying historical electronic medical record systems of medical institutions, thereby obtaining medical text training set data.
[0028] Unstructured medical text refers to medical information records that lack a predefined data model or are not organized in a predefined manner. During processing, these records need to be abstracted into relational classes and entity classes with entity type constraints. For example, unstructured medical text might include a doctor's handwritten natural language description in a medical record: "Patients with acute appendicitis should be given lactated Ringer's solution for intravenous rehydration." This text does not possess a table or graph structure that can be directly read by machines.
[0029] In some embodiments, the processor can receive original paragraphs of medical literature input from an external system, or read scanned paper medical documents using optical character recognition technology, and then perform sentence segmentation and text cleaning to obtain unstructured medical text.
[0030] The Coding Style Medical Case Library is organized in an object-oriented, structured manner, and includes a reference dataset containing positive and negative cases and corresponding error pattern descriptions. For example, the Coding Style Medical Case Library may include thousands of records, each consisting of an original input sentence, the correct relation result converted into a Python relation class object, the incorrect relation result with type or direction deviations, and a textual description comparing the differences between the two.
[0031] In some embodiments, the processor can combine the original input sentence, the correct and incorrect relation results obtained after initial prediction by the large language model and manual review and correction, and the analysis text generated by the large language model for positive and negative differences, and store all these combined items in a unified object-oriented structure to obtain a coding-style medical case library.
[0032] In some embodiments, the processor can use an object-oriented structured approach to abstractly model relation classes and entity classes based on medical text training data, extracting medical relation instances and entity type constraint definitions; based on the medical relation instances, it can use a large language model to make initial predictions, outputting incorrectly predicted samples as negative cases and correctly predicted samples as positive cases; based on the positive and negative cases and entity type constraint definitions, it can use a large language model to perform error analysis to generate analysis text, and combine the original input sentence, correct relation results, incorrect relation results and analysis text to obtain a coding style medical case library containing comparative analysis of correct and incorrect relations.
[0033] Medical relation instances are specific manifestations of the semantic relationships between two or more medical entities in medical text. For example, a medical relation instance may include specific triples such as "acute appendicitis, drug treatment, lactated Ringer's solution" extracted from a particular sentence, or objects instantiated as Python relation classes.
[0034] In some embodiments, the processor can identify pairs of medical entities in the text and their semantic dependencies by sampling and extracting from the medical text training set data, thereby obtaining medical relationship instances.
[0035] Entity type constraints are mandatory rules that specify the exact categories to which the subject and object entities in a medical relation must belong. For example, an entity type constraint definition might require that, when defining a clinical manifestation relation, the subject must be an entity class of the disease type, and the object must be an entity class of the symptom type; violation of this rule would be considered a type mismatch.
[0036] In some embodiments, the processor can receive object-oriented class definition code pre-written by domain experts, parse the declarations regarding inheritance relationships and type hints, extract the entity base class restrictions allowed by different relationship classes, and obtain entity type constraint definitions.
[0037] Negative cases are relation result samples generated by the model during the prediction process that contain incorrect relation types or incorrect entity boundaries. For example, negative cases may include erroneous Python relation class objects that misclassify a co-occurrence relationship between a disease and a drug as a pathogenic relationship, generated in large-scale misprediction, along with records of the error type.
[0038] In some embodiments, the processor can make initial predictions on medical relationship instances in the training set using a large language model, and then compare the prediction results with the standard answers in the training set to extract samples with high prediction error rates and obvious logical or factual errors, and record them as negative cases.
[0039] Positive cases are samples of completely correct relational results generated by the model during the prediction process, or correct relational results derived from the standard answers in the training set itself. For example, positive cases may include the originally correct "cold, cause, fever" triples in the training set data, which are transformed into corresponding Python relational objects and used as a reference benchmark for the correct pattern.
[0040] In some embodiments, the processor can extract manually labeled, absolutely correct relation triples from medical text training data and convert them into Python relation class objects that conform to predefined classes using a large language model or rules to obtain positive cases.
[0041] The analytical text explains the differences between positive and negative cases, pointing out the core errors and their causes. For example, the analytical text might include a detailed explanation of the reasons, such as, "The current erroneous result misclassifies the drug treatment relationship as a complication relationship because it confuses the entity type constraints of the subject and object; lactated Ringer's solution is a drug, not a disease."
[0042] In some embodiments, the processor can receive positive and negative cases as input prompts using a large language model, compare the structural differences between the two and generate an error reason description, and then the text is corrected and finalized by a manual review module to obtain the analysis text.
[0043] S2: Based on the coding style medical case library and the input medical sentence to be processed, a semantic coding algorithm is used to perform unified semantic coding and calculate cosine similarity. The top specified number of cases most relevant to the medical sentence to be processed are retrieved to obtain the case retrieval results.
[0044] The medical sentences to be processed are natural language medical phrases or complete sentences that the system needs to perform entity recognition and relation extraction on. For example, the medical sentences to be processed may include a description entered by the user in the consultation system: "The patient experienced severe stomach discomfort after taking aspirin yesterday," and this sentence contains the causal and medication relationships to be extracted.
[0045] In some embodiments, the processor can obtain the medical sentences to be processed by receiving a text stream input by the end user or by using natural language processing technology to segment sentences according to punctuation marks from a batch of uploaded electronic medical record documents.
[0046] Cosine similarity measures the cosine of the angle between two multidimensional vectors in a given direction, and is used to evaluate the semantic relevance of an input sentence to cases in a case library. For example, a cosine similarity of 0.85 indicates that the semantic feature vector of the sentence to be processed is highly consistent in direction with the semantic feature vector of a case containing similar medication descriptions in space.
[0047] In some embodiments, the processor can extract the sentence semantic vector and the case semantic vector, calculate the dot product of the two vectors, and then divide by the product of the magnitudes of the two vectors to obtain the cosine similarity. The expression for cosine similarity is: ; in, This indicates the medical sentence to be processed and the first... Cosine similarity of each case This indicates a medical sentence to be processed. The first in the coding style medical case library One case, This represents the sentence semantic vector corresponding to the medical sentence to be processed, based on... Feature extraction is achieved using a pre-trained semantic encoder. Indicates the first The case semantic vector corresponding to each case is based on the Feature extraction is achieved using a pre-trained semantic encoder. This represents the magnitude of the semantic vector of the sentence. This represents the magnitude of the semantic vector of the case.
[0048] The case retrieval results are a set of historical reference data selected from the case library based on semantic similarity to guide the extraction of the current relation. For example, the case retrieval results may include the top 10 complete comparative case records containing correct and incorrect relations extracted from a case library containing thousands of records, sorted from high to low by cosine similarity.
[0049] In some embodiments, the processor can calculate the similarity between the semantic vector of the medical sentence to be processed and all vectors in the vector index library, sort the calculation results in descending order, and extract the first specified number of corresponding records with the highest ranking to obtain the case retrieval results.
[0050] In some embodiments, the processor can perform unified processing using a semantic coding algorithm based on a coding style medical case library and the input medical sentence to be processed, to obtain a vector index library composed of semantic vectors of each case and a sentence semantic vector corresponding to the medical sentence to be processed; based on the vector index library and the sentence semantic vector, the processor calculates the cosine similarity and sorts the cases by relevance, retrieves the top specified number of cases most relevant to the medical sentence to be processed, and obtains the case retrieval results.
[0051] A vector index is a structured storage system containing semantic vectors of all cases, used to support fast online semantic similarity matching calculations. For example, a vector index may include a dense vector matrix of fixed dimensions (such as 384 dimensions), where each row of the matrix corresponds to the deep semantic features of a specific case in a coded-style medical case library.
[0052] In some embodiments, the processor can call a semantic encoding algorithm during the initialization phase to vectorize all complete cases in the coding style medical case library one by one, and store the generated semantic embedding vectors uniformly and establish a retrieval index to obtain a vector index library.
[0053] Sentence semantic vectors are dense numerical representations of medical sentences in a continuous high-dimensional semantic space, capable of capturing the underlying medical semantic relationships behind words. For example, a sentence semantic vector may include an array of 384 floating-point numbers that show similar spatial positions in terms of numerical features for synonyms or near-synonyms such as "acute appendicitis" and "appendicitis".
[0054] In some embodiments, the processor can input the medical sentence to be processed into a pre-trained Sentence-BERT semantic encoding model, use the self-attention mechanism inside the model to perform encoding calculations, and output a fixed-dimensional semantic embedding representation to obtain a sentence semantic vector.
[0055] In some embodiments, Table 1 shows the experimental results of the impact of the number of cases on system performance, illustrating the F1 score performance of the system on three public datasets when retrieving different numbers of cases. The experimental data shows that as the number of cases K increases from 0 to 10, the performance of each dataset shows an upward trend; when K continues to increase to 20, 30, or even 40, the performance improvement tends to plateau or even slightly decrease, indicating that too many cases introduce redundant noise. Therefore, in this embodiment of the invention, the preferred number is 10, which achieves the best balance between providing sufficient reference information in the comparative case library and controlling the computational overhead of inference.
[0056] Table 1. Experimental Results on the Impact of the Number of Cases on System Performance
[0057] S3: Based on the medical sentence to be processed, an initial prediction result is obtained by using a large language model to perform initial relation prediction. Based on the initial prediction result, a query statement is generated to call the medical literature database to retrieve relevant medical literature. The search results are then subjected to relevance screening and evidence extraction to obtain external medical knowledge.
[0058] Large language models are large-scale pre-trained deep neural network models with deep natural language understanding, reasoning, and generation capabilities. For example, a large language model could include the DeepSeek-Chat model with hundreds of billions of parameters, which can generate initial relation prediction triples based on the input medical context, or allow agents playing different roles to engage in adversarial debates.
[0059] In some embodiments, the processor can load pre-trained model weight files into local computing resources for inference deployment, or call the large-scale language model service API interface provided by the cloud by sending a network request containing input prompt words to obtain the response output and processing capabilities of the large language model.
[0060] The initial prediction results are preliminary relational determinations made by the large model based on context and historical cases for the current sentence before formally searching external literature and engaging in debate. For example, the initial prediction results may include a preliminary list of candidate Python relation classes, such as speculating that there may be a relationship between disease A and treatment plan B in the sentence, but this has not yet been subject to mandatory verification by authoritative literature and logical rules.
[0061] In some embodiments, the processor can construct a prompt word context by concatenating the medical sentence to be processed with the retrieved case search results, input it into a large language model for inference generation, and output candidate relation objects for the current sentence to obtain an initial prediction result.
[0062] A query is a specific formatted search expression or question used to request relevant medical literature from an external database. For example, a query may include a Boolean search expression such as "acute appendicitis AND lactated Ringer's AND treatment", or a question that can be directly understood by a natural language search engine, such as "Is lactated Ringer's solution used to treat acute appendicitis?".
[0063] In some embodiments, the processor can extract keywords by inputting entity pairs from the initial prediction results and the original context of the medical sentence to be processed into the query generation function of the large language model, and concatenating and transforming them according to the grammatical rules of the external database to obtain the query statement.
[0064] Relevant medical literature is a collection of documents initially returned from external medical databases based on a query, without in-depth relevance filtering. For example, relevant medical literature may include the abstracts and titles of the top 5 medical journal articles returned by a Boolean query in the PubMed database, which may involve the application of lactated Ringer's solution in various clinical scenarios.
[0065] In some embodiments, the processor can send automatically generated query statements to the official retrieval interface of an external medical literature database, such as an API, and receive a list of documents containing titles, abstracts, and metadata returned by the interface, extract the top-ranked documents, and obtain relevant medical literature.
[0066] External medical knowledge refers to fragments of medical evidence and factual support extracted from relevant medical literature that are highly relevant to the current relationship prediction task. For example, external medical knowledge may include a core conclusion sentence filtered from a long paper abstract: "Clinical trials have shown that early use of lactated Ringer's solution to rehydrate patients with acute appendicitis can significantly improve prognosis," which can serve as a strong basis for subsequent arguments.
[0067] In some embodiments, the processor can input candidate relevant medical literature, medical sentences to be processed, and initial prediction results into the retrieval agent, and use a large language model to filter, reorganize, and extract core summaries of the literature information based on the current candidate relationships, remove irrelevant background descriptions, and obtain external medical knowledge.
[0068] In some embodiments, the processor can use a large language model to perform initial relation prediction based on the medical sentence to be processed and the case retrieval results to obtain initial prediction results; based on the initial prediction results and the medical sentence to be processed, the processor can use the large language model to generate query statements and call the medical literature database retrieval interface to search to obtain candidate medical literature; based on the candidate medical literature, the processor can perform relevance screening and key evidence fragment extraction operations to obtain external medical knowledge.
[0069] Medical literature databases are authoritative external information storage systems that contain a large number of peer-reviewed medical journal articles, clinical guidelines, and biomedical reports. For example, medical literature databases may include the globally recognized PubMed biomedical knowledge base, which has an index structure of tens of millions of medical documents covering professional discussions in areas such as disease mechanisms and drug interactions.
[0070] In some embodiments, the processor can obtain access and retrieval permissions to a medical literature database by establishing a secure network connection with a specific remote server cluster, sending data request messages conforming to specific interface specifications, such as API call specifications, via the HTTP protocol, and receiving responses.
[0071] Candidate medical literature is a subset of documents initially returned after querying a medical literature database, ready for screening and evidence extraction by an intelligent agent. For example, candidate medical literature may include five specific medical papers obtained after limiting the number of returns in a word search operation. These five papers have the highest keyword matching degree, but their actual supporting power for the current specific entity relationship has not yet been determined.
[0072] In some embodiments, the processor can submit a query to a medical literature database to perform a retrieval operation, set a threshold for the number of returned results, and cache the complete document content corresponding to the top-ranked results locally to obtain candidate medical literature.
[0073] S4: Integrate the medical sentences to be processed, case retrieval results, and external medical knowledge, and conduct multiple rounds of collaborative debate using supporter agents, opponent agents, audience agents, and judge agents. During this process, a memory module is used to store structured information, and the prediction results of the previous round are iteratively corrected based on a consensus judgment mechanism. When the preset termination conditions are met, the final medical relationship extraction result is obtained, and the medical relationship extraction is completed.
[0074] Supporter agents are virtual role models specifically designed to find positive evidence from known cases and external knowledge during the debate process to prove the reasonableness of the current candidate relation prediction. For example, a supporter agent could include a large language model instance assigned specific cue words that would say in the debate: "Based on evidence fragments from external medical knowledge, it is clear that the current syntactic structure expresses the correct drug treatment relation, and it is recommended to retain it." In some embodiments, the processor can assign supporter role instruction labels to a large language model, and input the medical sentence to be processed, the relevant memory module context, and the initial candidate relation into it, instructing it to generate a logical chain of text that affirms and supports the current prediction conclusion based on the thought chain, thereby obtaining the supporter agent and its output results.
[0075] The opposing agent is a virtual role model responsible for examining candidate relationships from the opposite perspective during the debate, using medical entity definitions and logical conflicts to find potential errors. For example, the opposing agent could include a model instance assigned a specific role, stating in its statement: "Hard validation has predicted the entity type of the object to be 'drug,' but the predefined requirement is that the object of this relationship must be 'symptom,' which is a clear type mismatch. I suggest blocking it." In some embodiments, the processor can assign an opponent role instruction label to a large language model, input predefined entity type constraint rules and candidate relations to be refuted, instruct it to perform structured verification and find evidence text that contradicts the candidate relations, thereby obtaining the opponent agent and its rebuttal viewpoint.
[0076] The audience agent is a virtual role model that maintains an objective and neutral stance during the debate, focusing on examining the completeness of the evidence chain and the consistency of facts in the statements of supporters and opponents. For example, the audience agent may include a model instance for independent evaluation, which evaluates in its output: "The supporters' views over-infer the semantics of the original sentences and fail to provide clear original references from PubMed literature as support, resulting in an incomplete evidence chain." In some embodiments, the processor can assign the role instruction label of "objective reviewer" to the large language model and simultaneously input the output viewpoints and relevant memory contexts of the supporter agent and the opponent agent into it, instructing them to perform quantitative or textual evaluation according to dimensions such as entity anchoring and source integrity, to obtain the audience agent and its evaluation results.
[0077] A judge agent is a virtual core role model responsible for summarizing the statements of all parties, recording the core disputes, and ultimately deciding the relationship prediction results during multiple rounds of debate. For example, a judge agent may include a model instance that coordinates decision-making and outputs at the end of each round: "Based on the supporters' assessment and the flaws pointed out by the audience, the prediction in this round is directionally incorrect and the candidate relationship needs to be deleted. The core disputed points are now recorded in the updated memory." In some embodiments, the processor can assign role instruction labels of "judge and summarizer" to the large language model, summarize the opinions of all other agents in the current round of debate, instruct it to extract important reasoning conclusions in a structured manner, and give the final decision output of the current round according to the divergence state, so as to obtain the judge agent and its summary decision information.
[0078] A memory module is a shared data structure used to dynamically store and maintain input context, retrieved cases, external knowledge, and historical debate summaries during multi-round agent debates. For example, a memory module may include a JSON data object or in-memory data structure with multiple fields, including a list of core points of contention, excerpts of key medical evidence cited, resolved and unresolved logical conflicts, and a historical trajectory of error corrections.
[0079] In some embodiments, the processor can fuse the medical sentences to be processed, case retrieval results, external medical knowledge, and predefined relationship types, and receive a structured summary extracted by the judge's agent after each round of debate. It can then use data splicing and field update operations to cover historical redundant records to obtain a dynamically updated memory module.
[0080] The final medical relation extraction result is a finalized list of medical relation objects output after multiple rounds of agent debate, cross-validation, and iterative correction, reaching consensus or meeting termination conditions. For example, the final medical relation extraction result may include a set of structured data: [(Patient A, suffers from, acute appendicitis), (acute appendicitis, drug treatment, lactated Ringer's solution)], which has a complete chain of evidence and conforms to the constraints of the medical class definition.
[0081] In some embodiments, the processor can monitor the debate process and, when it determines that the consensus score has reached a preset consistency condition or the cumulative number of debates in the system has reached the maximum number of debate rounds limit, directly extract the list of valid relationship objects that the judge agent ruled and retained in the last round to obtain the final medical relationship extraction result.
[0082] In some embodiments, Table 2 shows the experimental results on the impact of the number of debate rounds on system performance, illustrating the effect of setting different maximum debate rounds on relation extraction performance. The experiments show that as the number of debate rounds increases from 1 to 3, system performance continuously improves and reaches its optimum at 3 rounds; when the number of debate rounds increases to 4 rounds, the performance improvement slows down and occasionally declines. This demonstrates that setting the maximum number of debate rounds to 3 rounds effectively avoids redundant viewpoints and logical confusion introduced by excessively long debates, achieving the best balance between reasoning depth and computational efficiency.
[0083] Table 2. Experimental results showing the impact of debate rounds on system performance.
[0084] In some embodiments, the processor can utilize the medical sentences to be processed, case retrieval results, external medical knowledge, and predefined relationship and entity type definitions to obtain an initial memory module with shared context through data fusion processing. Based on the initial memory module, supporter agents, opponent agents, audience agents, and judge agents respectively perform supporting viewpoint generation, hard verification rebuttal based on entity type constraints, evidence chain review, and viewpoint summary processing to obtain the debate viewpoints of each agent. The debate viewpoints are then output as a structured summary as the updated current round memory module. Based on the current round memory module and the debate viewpoints of each agent, structured information is stored, and a consensus score is calculated according to the preset differentiated role weights. It is then determined whether the preset consistency condition has been met. If not, the updated prediction result of the judge agent after iterative correction of the previous round prediction result is output, and the next round of debate continues. In response to the judgment result being either the preset consistency condition or the maximum number of debate rounds, the debate processing is terminated, and the final medical relationship extraction result decided by the judge agent is obtained, completing the medical relationship extraction.
[0085] Predefined relationships are relationships that are manually defined and solidified into code or rule constraints before system initialization, based on medical expertise and ontology structure. For example, predefined relationships may include specific Python relationship classes such as "DrugTreatment" or "ClinicalManifestation" declared in an object-oriented manner, with clear directional and legal requirements for these relationships.
[0086] In some embodiments, the processor can obtain the predefined relationships required for system operation by reading the configuration file or the script code file initially loaded by the system, parsing the base class and subclass structures defined therein, as well as related comments or type declaration information.
[0087] Entity type definitions are standardized declarations of the basic attribute categories and hierarchical relationships between various objective things in medical texts, such as diseases, drugs, and symptoms. For example, an entity type definition may include code snippets declaring that "lactated Ringer's solution" is a subclass of the entity base class "Drug," while "fever" belongs to the class "Symptom."
[0088] In some embodiments, the processor can obtain entity type definitions by parsing the code of various medical entity subclasses (such as class Disease, class Treatment, etc.) that are entered into the system during the development phase and inherit from the general base class "class Entity".
[0089] The initial memory module is a contextual data base constructed from the original input and retrieved information before the first round of debate officially begins, and does not yet contain any debate speaking history. For example, the initial memory module may include a long text or dictionary object composed of the original medical sentence text, error analysis paragraphs of the most relevant cases returned by the retrieval, fragments of external knowledge from PubMed, and predefined relational constraints fixed by the system.
[0090] In some embodiments, the processor can extract the medical sentences to be processed, the case retrieval results returned after performing retrieval operations, and external medical knowledge before the first initiation of multi-agent collaboration, and combine them with predefined relationship and entity type definitions according to a fixed format template and data fusion to obtain an initial memory module.
[0091] Debate opinions are specific text outputs generated by each agent based on its assigned role, targeting the current candidate relationship. These outputs include logical reasoning chains, supporting or rebuttal opinions, and objective evaluation results. For example, a debate opinion might include rebuttal text from the opposing agent with a clear error type: "Hard rule conflict found, entity type constraint mismatch, prediction error, accompanied by relevant retrieved medical knowledge text as refutation evidence."
[0092] In some embodiments, the processor can instantiate a role-based large language model assigned different system instructions, inject the relational data to be evaluated and related contextual memory into it, trigger the model's autoregressive text generation calculation process, extract the logic chain text and conclusion paragraph generated by the model, and obtain the argumentative viewpoints.
[0093] The current round memory module stores the core information after the latest round of debate, refined and updated by the judge's agent based on all statements made in that round. For example, the current round memory module may include a newly added structured record by the judge's agent: "First round of debate: The opponent proposed a reversal of the relationship direction; the audience believed the evidence was sufficient; the judge ruled to delete the erroneous relationship, pending confirmation of the remaining missing associations," to guide the reasoning in the next round.
[0094] In some embodiments, the processor can extract the speech outputs of the supporters, opponents, and audience agents in the current round, and then have the judge agent use a summary extraction function to extract the core points of contention, key medical evidence, and error correction information. Subsequently, these summaries are used to replace or add to the memory module data structure of the previous round to obtain the memory module of the current round.
[0095] In some embodiments, the process of using a memory module to structurally store the core content of a multi-round collaborative debate is described by the expression of the memory module for the current round: ; in, Indicates the first The current round memory module after the update. This represents the memory update function, obtained based on a logical processing algorithm that performs structured concatenation, history replacement, and summary extraction on the input parameters. This represents the memory state data from the previous round, specifically, when At that time, it represents the initial memory module obtained by fusing data such as the medical sentences to be processed, case retrieval results, and external medical knowledge. This represents a summary of the viewpoints of all parties in the current round, based on the output of the judge's intelligent agent, including the core points of contention and key medical evidence. This indicates the result of the previous round of predictions.
[0096] The consensus score is a numerical value quantified by assigning different weights to the opinions of different roles and summing them up at the end of a debate or during a round. For example, a consensus score of 0.8 could be generated by summing the judge's agreement (weight 0.35), the audience's agreement (weight 0.25), and the supporters' agreement (weight 0.20), reflecting the high degree of acceptance of the current answer within the system.
[0097] In some embodiments, the processor can obtain a consensus score by statistically analyzing the final decision function results output by the four agents—judge, audience, supporter, and opponent—in the current round (reserving 1 for agreement and 0 for otherwise), multiplying each result by the pre-assigned differential weights for each role, and finally summing the products.
[0098] The consensus condition is a hard threshold at which the system determines that the predictions made by multiple agents regarding the current candidate relationship are sufficiently stable and reliable, thus allowing the debate cycle to end early. For example, the consensus condition could include a preset score threshold of 0.66. When the consensus score is greater than or equal to 0.66, the condition is considered met, indicating that there is no need for further unnecessary repeated debates and corrections.
[0099] In some embodiments, the processor can determine a score comparison threshold and a corresponding logical judgment operator, such as greater than or equal to, by receiving system configuration parameters or setting hyperparameters based on prior experimental data, and encapsulate it into a set of logical rules for conditional branching to obtain a consistency condition.
[0100] The updated prediction results are a set of relationships formed by the judge agent through dynamic addition, deletion, and modification operations after the debate reveals flaws in the initial or previous round of predictions. For example, the updated prediction results may include a new list of candidate Python relation classes generated after removing erroneous causal relationships with confirmed entity type conflicts and supplementing them with omitted complication relationships jointly discovered by multiple agents, based on the previous round.
[0101] In some embodiments, the processor can obtain an updated prediction result by acquiring a copy of the data object after the judge agent performs logical correction operations such as deletion, adjustment of relationship direction, or supplementation of omissions on the previous round's relationship set based on the disputed relationships and logical conflict information exposed in the current round.
[0102] In some embodiments, a consensus score is calculated based on preset differentiated role weights to determine whether a preset consensus condition has been met, including: The expression for the consensus score is: ; The expression for the consistency condition determination result is: ; in, This represents the consensus score in the t-th round of debate. This represents the total number of agents participating in the debate. Indicates the sequence number of the intelligent agent. Represented as the first Each agent has a pre-defined differentiated role weight. This represents a summary of the viewpoints of all parties in the current round, based on the output of the judge's intelligent agent. Indicates based on The extracted first Summary of the statements of each agent. Indicates the judgment of the first A function determines whether an agent agrees to retain the original answer. The function outputs 1 if it decides not to modify the result, and 0 otherwise. This indicates the result of the judgment on whether the current round has met the preset consistency conditions. This indicates that the consistency condition has been met. This indicates that the consistency condition has not been met. This represents the consistency score threshold based on prior settings.
[0103] In some embodiments, to ensure a balance between system retrieval efficiency, inference stability, and computational overhead, the present invention sets preferred value ranges for the constant parameters involved in the formulas and processing steps. Specifically: when retrieving the specified number of cases most relevant to the medical sentence to be processed, the specified number... The K value in Top-K ranges from 1 to 40, preferably 10. This preferred value provides a comparative reference with sufficient information density while avoiding the introduction of redundant noise. When acquiring external medical knowledge, the maximum number of candidate medical documents returned by the medical literature database is set to 5 to balance the richness of medical evidence with the processing overhead of the large language model's context window. When using the large language model to perform operations such as retrieval filtering and generating debate viewpoints, the model temperature parameter is set to range from 0.5 to 0.9, preferably 0.7. The maximum generation length is preferably set to 4096 tokens to ensure the logical stability of text generation and the diversity of reasoning content. During multi-round collaborative debate, the maximum number of debate rounds is set to range from 1 to 4, preferably uniformly set to 3 rounds, thus achieving the best balance between the depth of reasoning and preventing logical confusion caused by lengthy debates. When calculating the consensus score based on preset differentiated role weights, the weight of the judge agent... The preferred value is 0.35, which represents the weight of the audience agent. The preferred value is 0.25, representing the weight of the supporting agent. Weights of opposing intelligent agents The preferred value is 0.20; simultaneously, the score threshold used to determine whether the preset consistency condition has been met... The preferred setting is 0.66, or two-thirds, which ensures that all parties involved in the debate have reached a consensus on conclusions with high medical reliability.
[0104] In some embodiments, as shown in Table 3, the ablation comparison results of the impact of a single module on system performance are presented, demonstrating the performance decline of the system on various indicators after removing the multi-round debate mechanism, coding style, comparative case library, and PubMed external literature retrieval mechanism, respectively. The data clearly indicate that removing any core module leads to a significant decrease in the F1 score. In particular, removing case retrieval and multi-round debate has a huge impact on causal logic discrimination, fully demonstrating the irreplaceable synergistic effect of the dual-source knowledge enhancement mechanism and multi-angle cross-validation mechanism proposed in this invention in overcoming model confirmation bias and reducing hallucination output.
[0105] Table 3. Ablation Comparison Results of the Impact of a Single Module on System Performance
[0106] Table 4 shows the comparison results between the present invention and other existing methods, demonstrating the comprehensive performance comparison of the present invention's method with several mainstream baseline models such as DeepSeek-ICL and ChatIE on three Chinese medical relation extraction datasets. The results show that the present invention's method achieves F1 scores of 52.45%, 47.01%, and 43.72% on the DiaKG, CMeIE-V2, and CMedCausal datasets, respectively, all significantly outperforming the existing best baseline methods. This data-driven verification demonstrates the high reliability and accuracy of the present invention in medical relation extraction tasks.
[0107] Table 4 Comparison of the present invention with other existing methods
Claims
1. A medical relation extraction method based on multi-agent debate and knowledge enhancement, characterized in that, include: S1: Based on medical text training data, we use an object-oriented structured approach to model and analyze the relational instances in unstructured medical texts, resulting in a coding style medical case library that includes a comparative analysis of correct and incorrect relations. S2: Based on the coding style medical case library and the input medical sentence to be processed, a semantic coding algorithm is used to perform unified semantic coding and calculate cosine similarity. The top specified number of cases most relevant to the medical sentence to be processed are retrieved to obtain the case retrieval results. S3: Based on the medical sentence to be processed, the initial prediction result is obtained by using a large language model to perform initial relation prediction. Based on the initial prediction result, a query statement is generated to call the medical literature database to retrieve relevant medical literature. The search results are then subjected to relevance screening and evidence extraction to obtain external medical knowledge. S4: Integrate the medical sentences to be processed, case retrieval results, and external medical knowledge, and conduct multiple rounds of collaborative debate using supporter agents, opponent agents, audience agents, and judge agents. During this process, a memory module is used to store structured information, and the prediction results of the previous round are iteratively corrected based on a consensus judgment mechanism. When the preset termination conditions are met, the final medical relationship extraction result is obtained, and the medical relationship extraction is completed.
2. The medical relationship extraction method based on multi-agent debate and knowledge enhancement according to claim 1, characterized in that, S1 includes: Based on medical text training data, we use an object-oriented structured approach to abstractly model relation classes and entity classes, and extract medical relation instances and entity type constraint definitions. Based on medical relationship examples, an initial prediction is made using a large language model. Samples that are predicted incorrectly are output as negative cases, and samples that are predicted correctly are output as positive cases. Based on positive and negative cases and entity type constraints, a large language model is used to perform error analysis and generate analysis text. The original input sentence, correct relation results, incorrect relation results and analysis text are combined to obtain a coding style medical case library containing comparative analysis of correct and incorrect relations.
3. The medical relationship extraction method based on multi-agent debate and knowledge enhancement according to claim 1, characterized in that, S2 includes: Based on the coding style medical case library and the input medical sentences to be processed, a semantic coding algorithm is used for unified processing to obtain a vector index library composed of semantic vectors of each case and the sentence semantic vector corresponding to the medical sentences to be processed. Based on the vector index library and sentence semantic vectors, cosine similarity is calculated and relevance is ranked to retrieve the top specified number of cases most relevant to the medical sentence to be processed, thus obtaining the case retrieval results.
4. The medical relationship extraction method based on multi-agent debate and knowledge enhancement according to claim 1, characterized in that, S3 includes: Based on the medical sentences to be processed and the case retrieval results, an initial relation prediction was performed using a large language model to obtain the initial prediction results. Based on the initial prediction results and the medical sentences to be processed, a large language model is used to generate query statements and call the medical literature database retrieval interface to search for candidate medical literature. Based on candidate medical literature, relevance screening and key evidence fragment extraction are performed to obtain external medical knowledge.
5. The medical relationship extraction method based on multi-agent debate and knowledge enhancement according to claim 1, characterized in that, S4 includes: By utilizing the medical sentences to be processed, case retrieval results, external medical knowledge, and predefined relationship and entity type definitions, an initial memory module with shared context is obtained through data fusion processing. Based on the initial memory module, the supporter agent, opponent agent, audience agent, and judge agent respectively perform supporting viewpoint generation, hard verification rebuttal based on entity type constraints, evidence chain review, and viewpoint summary processing to obtain the debate viewpoints of each agent, and output the debate viewpoints in a structured summary as the updated current round memory module. Based on the current round's memory module and the debate viewpoints of each agent, structured information is stored and consensus scores are calculated according to preset differentiated role weights. It is then determined whether the preset consistency conditions have been met. If not, the updated prediction result of the judge agent after iterative correction of the previous round's prediction result is output and the next round of debate continues. In response to either the judgment result meeting the preset consistency condition or reaching the maximum number of debate rounds, the debate process is terminated, the final medical relationship extraction result of the judge's intelligent agent is obtained, and the medical relationship extraction is completed.
6. The medical relationship extraction method based on multi-agent debate and knowledge enhancement according to claim 5, characterized in that, The step of calculating a consensus score based on preset differentiated role weights and determining whether preset consistency conditions have been met includes: The expression for the consensus score is: ; The expression for the consistency condition determination result is: ; in, This represents the consensus score in the t-th round of debate. This represents the total number of agents participating in the debate. Indicates the ordinal number of the intelligent agent. Represented as the first Each agent has pre-defined differentiated role weights. This represents a summary of the viewpoints of all parties in the current round, based on the output of the judge's intelligent agent. Indicates based on The extracted first Summary of the statements of each agent. Indicates the judgment of the first A function determines whether an agent agrees to retain the original answer. The function outputs 1 if it decides not to modify the result, and 0 otherwise. This indicates the result of the judgment on whether the current round has met the preset consistency conditions. This indicates that the consistency condition has been met. This indicates that the consistency condition has not been met. This represents the consistency score threshold based on prior settings.