Enhanced large language model medical question and answer method based on dual-view knowledge graph exploration

By exploring an enhanced large language model-based medical question answering method based on dual-perspective knowledge graphs, we have solved the problems of knowledge deficiency and path omission in complex medical reasoning by large-scale pre-trained language models, and achieved more efficient and accurate medical question answering.

CN122114173APending Publication Date: 2026-05-29SOUTHWEST JIAOTONG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTHWEST JIAOTONG UNIV
Filing Date
2026-02-27
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing large-scale pre-trained language models lack domain-specific medical knowledge injection and have fixed model parameters when facing question-answering tasks for complex medical reasoning, leading to hallucinations when answering complex medical questions. Existing knowledge graph retrieval methods suffer from problems such as omission of effective knowledge paths and redundancy in retrieval space within medical knowledge graphs.

Method used

We employ an enhanced large language model-based medical question answering method that utilizes dual-perspective knowledge graph exploration. By using entity linking and pruning algorithms, we identify core entities and potential core entities as exploration anchors, perform one-hop search and pruning, and construct a concise and reliable large language model for external knowledge input.

Benefits of technology

It improves the accuracy and efficiency of medical question answering, reduces computational complexity, minimizes irrelevant information interference, and enhances the answering ability of large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122114173A_ABST
    Figure CN122114173A_ABST
Patent Text Reader

Abstract

The application discloses an enhanced large language model medical question and answer method based on a dual-view knowledge graph exploration, relates to the technical field of retrieval enhancement, and comprises the following steps: a large language model is used to extract medical entities from a user question, and a three-step entity linking algorithm is used to link the medical entities with nodes in a knowledge graph; subsequently, based on the mapped entity set, core entities and potential core entities are identified in the knowledge graph as exploration anchors of the knowledge graph; then, one-hop search and fine-grained pruning are respectively performed on the two types of entities to obtain two reliable triple sets; finally, the triple sets are input into the large language model together with the question to guide the generation of an answer. The method can more efficiently retrieve more comprehensive knowledge in the knowledge graph, and provides simple and high-quality external knowledge for the large language model, thereby improving the accuracy and efficiency of the large language in answering medical questions, and having higher economic benefits.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of retrieval enhancement technology, and in particular to a medical question-answering method based on dual-perspective knowledge graph exploration and enhanced large language model. Background Technology

[0002] Obtaining accurate and easily understandable medical information is a core prerequisite for people to manage their own health and make reasonable health decisions. When experiencing discomfort or having questions about the pathogenesis or treatment of a disease, the general public often turns to convenient channels such as internet search engines or general language models to obtain relevant answers and reference information.

[0003] However, large-scale pre-trained language models suffer from significant limitations when faced with question-answering tasks involving complex medical reasoning: firstly, their training corpora consist mainly of general text, lacking sufficient input of domain-specific medical knowledge; secondly, the fixed model parameters prevent timely updates to medical knowledge. These two limitations often lead to illusions when answering complex medical questions. To overcome this bottleneck, knowledge graph-based retrieval enhancement is innovatively introduced into the complex reasoning tasks of large-scale models. Knowledge relevant to the question is retrieved from an external knowledge graph, and the retrieved knowledge is added to prompts. These enhanced prompts are then input into the large language model for reasoning. However, existing work on knowledge graph retrieval mainly employs two exploration paradigms: path-based and subgraph-based. Both have significant shortcomings: path-based methods rely excessively on path search strategies, making them difficult to adapt to the complex topological structure of medical knowledge graphs, and prone to missing effective knowledge paths and incomplete retrieval results; subgraph-based methods tend to traverse the entire subgraph of all entities mapped to the question, indiscriminately exploring the neighborhood information of all mapped entities, resulting in a large redundant retrieval space, low efficiency, and difficulty in implementation in medical question-answering applications. Furthermore, this retrieval method introduces a large number of triples irrelevant to the question, significantly increasing the difficulty of subsequent knowledge filtering. Therefore, there is an urgent need for a knowledge graph retrieval enhancement method that can effectively solve the above problems and provide concise and reliable high-quality external knowledge input for large models. Summary of the Invention

[0004] To overcome the shortcomings and deficiencies of existing technologies, this invention provides an enhanced large language model medical question answering method based on dual-perspective knowledge graph exploration.

[0005] The technical solution adopted in this invention is an enhanced large language model medical question answering method based on dual-view knowledge graph exploration, comprising the following steps: S1. Obtain the medical knowledge graph, and use the vector embedding model to embed the entities in the medical knowledge graph to obtain the vector representation of the entities; S2 extracts medical entity information from user questions using a large language model to obtain a set of medical entities; S3 uses a three-step entity linking algorithm to map the entities in the medical entity set in S2 to the nodes in the knowledge graph; S4, based on the set of entities that have been mapped in S3, determines the exploration anchor entities of the knowledge graph, including core entities and potential core entities; S5, perform a one-hop search on the core entity and potential core entity to obtain their one-hop subgraph neighborhoods respectively; S6, prune the one-hop subgraph neighborhood of the core entity to obtain the core entity triplet set; S7, prune the one-hop subgraph neighborhood of the potential core entity to obtain the set of potential core entity triples; S8 inputs the core triple set and potential core entity triple set obtained from S6 and S7, along with the user question, into the large language model for answering.

[0006] Furthermore, the three-step entity linking algorithm in S3 includes the following steps: S301, Collection of Medical Entities Each entity With the set of node entities in the knowledge graph Perform exact matching, and add successfully matched entities to the mapped entity set. The formula is expressed as: , in, Represents a set of mapped entities. Represents the medical entities extracted from the problem. The set, This represents the set of nodes in a knowledge graph. Indicates an exact match operation; S302, for all entities that did not match precisely in S301. The system approximates the matching of all node entities in the graph node set based on semantic embedding vectors. If the cosine similarity score between the two is greater than a threshold, the matched graph node entity is considered a valid match. Add to the mapping entity collection The formula is expressed as: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. Represents an embedded model. This indicates the calculation of cosine similarity. Indicates the preset threshold. Indicates entities that did not match exactly. This represents the matched graph node entities; S303, for the remaining entities that have not been matched after S301 and S302. , and the set of graph nodes Perform subsequence matching, and match the graph node entities. Add to the mapping entity collection The formula is expressed as: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. This indicates a subsequence matching operation.

[0007] Furthermore, the anchor point entity of S4 is divided into core entities. and potential core entities The steps to determine this are as follows: S401, Select the entity with the entity type "Disease" as the core entity. ; S402, the set of mapped entities obtained from S3 For each entity, perform a one-hop search and count the number of times entities with the same type as the core entity appear in the search results; S403: After traversing all entities in the mapped entity set, select the entity that appears most frequently as the potential core entity. If multiple potential core entities have the same frequency, generate semantic embedding vectors for these candidate entities and the question using an embedding model, calculate the cosine similarity between the vectors, and select the entity with the highest similarity as the final potential core entity. The above steps can be formalized as follows: , in, Indicates a potential core entity. This represents a set of potential core entities composed of multiple candidate entities. This indicates a user issue. This indicates the calculation of cosine similarity. The logical AND symbol represents "and".

[0008] Furthermore, the pruning in S6 includes the following steps: S601, filter out triples that have already appeared in the question text within the one-hop neighborhood of the core entity, and obtain the set of core entity one-hop neighborhood triples retained after filtering. The set is represented as: , in, This represents the set of all triples in the one-hop neighborhood of the core entity. Indicates the relationship between entities. Represents a set of mapped entities; S602, the set of one-hop neighborhood triples retained after filtering The input is a large language model, which then selects the set of triples needed to answer the user's question, forming the core triple set. , , in, Representing a large language model, To indicate a problem, This represents the set of one-hop neighborhood triples retained after filtering the core entity.

[0009] Furthermore, the pruning in S7 includes the following steps: S701, in the one-hop subgraph neighborhood of potential core entities, the binary pairs Semantic embedding vectors are generated for each question using an embedding model. S701, Calculate binary pairs By using cosine similarity with the problem, pairs with semantic similarity values ​​exceeding a preset threshold are filtered out and further mined to ultimately obtain a set of potential core entity triples. The formula is expressed as: , in, Represents an embedded model. To indicate a problem, Represents the cosine similarity score. Indicates the preset threshold. Indicates a potential core entity. It represents the relationship between entities.

[0010] Beneficial Effects: This invention proposes an enhanced large language model medical question-answering method based on dual-perspective knowledge graph exploration. It addresses the problems of existing path-based knowledge graph retrieval methods, which over-rely on path search strategies, struggle to adapt to the complex topology of medical knowledge graphs, and are prone to missing effective knowledge paths; and subgraph-based retrieval methods, which perform indiscriminate global traversal of all mapped entities, resulting in a large redundant retrieval space, low efficiency, and the introduction of numerous irrelevant triples. This invention effectively overcomes these technical shortcomings by constructing a dual-perspective knowledge graph exploration framework with "core entities" and "potential core entities" as exploration anchors. Simultaneously, it designs two efficient knowledge filtering mechanisms to provide concise yet reliable external knowledge for the large language model, resulting in higher average accuracy and greater economic benefits in answering medical questions. Specifically, it includes: (1) By distinguishing between core entities and potential core entities, this invention redetermines the anchor position of knowledge graph retrieval, avoids the excessive reliance of a single path strategy on local paths, and makes the exploration process not limited to a single chain path structure, thereby reducing the risk of missing effective knowledge due to path selection bias in complex medical knowledge graphs and improving the completeness of retrieval results.

[0011] (2) By limiting the exploration scope to the core entity and its associated potential core entity neighborhood, the present invention avoids indiscriminate traversal of all mapped entities in the subgraph, significantly reduces the search space size, reduces computational complexity, and improves retrieval efficiency, making the method more suitable for online application scenarios of actual medical question answering systems.

[0012] (3) The present invention further designs two knowledge filtering mechanisms to perform relevance screening and problem redundancy elimination on the retrieved triples, effectively eliminating tail entity noise and duplicate information that are irrelevant to the problem, shortening the context length of the input large language model while ensuring knowledge relevance, and reducing model inference interference. Attached Figure Description

[0013] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention. Figure 2 This is a flowchart illustrating the steps of an embodiment of the present invention. Detailed Implementation

[0014] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0015] like Figure 1 As shown, this invention provides an enhanced large language model medical question answering method based on dual-view knowledge graph exploration, including the following steps: S1. Obtain the medical knowledge graph, and use the vector embedding model to embed the entities in the medical knowledge graph to obtain the vector representation of the entities; S2 extracts medical entity information from user questions using a large language model to obtain a set of medical entities; S3 uses a three-step entity linking algorithm to map entities in the medical entity set to nodes in the knowledge graph. The three-step entity linking algorithm is as follows: S301, Collection of Medical Entities Each entity With the set of node entities in the knowledge graph Perform exact matching, and add successfully matched entities to the mapped entity set. The formula is as follows: , in, Represents a set of mapped entities. Represents the medical entities extracted from the problem. The set, This represents the set of nodes in a knowledge graph. Indicates an exact match operation; S302, for all entities that did not match precisely in S301. The system approximates the matching of all node entities in the graph node set based on semantic embedding vectors. If the cosine similarity score between the two is greater than a threshold, the matched graph node entity is considered a valid match. Add to the mapping entity collection The formula is as follows: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. Represents an embedded model. This indicates the calculation of cosine similarity. Indicates the preset threshold. Indicates entities that did not match exactly. This represents the matched graph node entities; S303, for the remaining entities that have not been matched after S301 and S302. , and the set of graph nodes Perform subsequence matching, and match the graph node entities. Add to the mapping entity collection The formula is as follows: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. This indicates a subsequence matching operation.

[0016] S4 determines the exploration anchor entities of the knowledge graph based on the set of entities already mapped in S3, including core entities. and potential core entities The specific steps for determining this are as follows: S401, Select the entity with the entity type "Disease" as the core entity. ; S402, the set of mapped entities obtained from S3 For each entity, perform a one-hop search and count the number of times entities with the same type as the core entity appear in the search results; S403: After traversing all entities in the mapped entity set, select the entity that appears most frequently as the potential core entity. If multiple potential core entities have the same frequency, generate semantic embedding vectors for these candidate entities and the question using an embedding model, calculate the cosine similarity between the vectors, and select the entity with the highest similarity as the final potential core entity. The above steps can be formalized as follows: , in, Indicates a potential core entity. This represents a set of potential core entities composed of multiple candidate entities. This indicates a user issue. This indicates the calculation of cosine similarity. The logical AND symbol represents "and".

[0017] S5, perform a one-hop search on the core entity and potential core entity to obtain the one-hop subgraph neighborhood respectively; S6, prune the one-hop subgraph neighborhood of the core entity to obtain the core entity triplet set. The specific pruning steps are as follows: S601, filter out triples that already appear in the question text within the one-hop neighborhood, and obtain the set of one-hop neighborhood triples retained after filtering. The set is represented as follows: , in, This represents the set of all triples in the one-hop neighborhood of the core entity. Indicates the relationship between entities. Represents a set of mapped entities; S602, the set of one-hop neighborhood triples retained after filtering The input is a large language model, which then selects the set of triples needed to answer the user's question, forming the core triple set. ; , in, Representing a large language model, To indicate a problem, This represents the set of one-hop neighborhood triples retained after filtering the core entity.

[0018] S7, prune the one-hop subgraph neighborhood of potential core entities to obtain a set of potential core entity triples. The specific pruning steps are as follows: S701, in the neighborhood of a one-hop subgraph, the binary tuples Semantic embedding vectors are generated for each question using an embedding model. S701, Calculate binary pairs By using cosine similarity with the problem, pairs with semantic similarity values ​​exceeding a preset threshold are filtered out and further mined to ultimately obtain a set of potential core entity triples. The formula is expressed as follows: , in, Represents an embedded model. To indicate a problem, Represents the cosine similarity score. Indicates the preset threshold. Indicates a potential core entity. Indicates the relationship between entities; S8 inputs the core triple set and potential core entity triple set obtained from S6 and S7, along with the user question, into the large language model for answering.

[0019] like Figure 2The diagram shown is a flowchart of an embodiment of the present invention. This embodiment uses the user's question, "I experience hot palms and soles in the afternoon and evening, itchy all over, have stomatitis, and frequent mouth ulcers. How can I treat and regulate this condition? I don't have lower back pain or weak legs. I have a dry mouth, but not bitter. I have mouth ulcers for about half a month. How can I treat this? What should I do in my daily life? What foods should I avoid?" as an example to illustrate the execution flow of this method: S1: First, obtain the medical knowledge graph, and then use the bge-m3 embedding model to embed all entities in the graph to obtain their vector representations.

[0020] S2: Medical Entity Extraction. This invention suggests that a large language model extracts medical entities such as diseases, symptoms, and drugs from user questions, for example... Figure 2 As shown, the set of medical entities extracted by the large language model. ={hot palms and soles, itchy, stomatitis, mouth ulcers, dry mouth}.

[0021] S3: Entity Linking. First, perform character-level exact matching on the entities in the medical dataset. Successfully matched entities are added to the mapped entity set. Then, perform similarity matching on the unmatched entities; that is, use the bge-m3 embedding model to embed the remaining entities to generate semantic vectors, calculate the cosine similarity between the entity and the question vector, and add entities with a score greater than 0.9 to the mapped entity set. Finally, perform subsequence matching on the remaining entities and nodes in the graph; that is, check if the entity name can be considered a subsequence of the node name. If so, the match is successful. Successfully matched entities are added to the mapped entity set. For example... Figure 2 As shown, the medical entity set of S2, after undergoing a three-step entity linking algorithm, yields a mapped entity set. ={stomatitis,hot hands and feet,dry mouth,itchy} S4: Based on the mapping to the entity set in S3, determine the core and potential core entities in the knowledge graph. Medical knowledge graphs are typically built around the entity "disease," so entities of type "disease" in the mapped entity set are taken as core entities, such as "mouth ulcers." For potential core entities, first perform a one-hop search on each entity in the mapped entity set, then count the occurrences of entities of type "disease" in the search results, and finally, after traversing all entities in the set, select the entity with the highest occurrence as the potential core entity. For example... Figure 2 In the analysis, the entity "yin deficiency" appears most frequently in the one-hop neighborhoods of "hot hands and feet" and "dry mouth," so "yin deficiency" is selected as the potential core entity.

[0022] S5: Explore the one-hop neighborhood of the core entity "mouth ulcers" to obtain its one-hop subgraph neighborhood. Filter out triples that already appear in the question text, such as the triple "mouth ulcers->symptom->stomatitis," which already appears in the question and needs to be removed. Input the remaining filtered triples into the large language model, prompting the model to select the triples needed to answer the user's question from these triples, ultimately obtaining the core triple set, such as... Figure 2 The Zhongda language model filters out the relation "benificial_food", ultimately obtaining the core triple set. ={mouthulcers->need_drug->Rehmannia Pill with Coptis and Phellodendron; mouthulcers->forbid_food->White spirit,almonds, fried peanuts, red adzuki beans;mouth ulcers->cure_way->Oral endoscopy, salivary lysozyme, vitamin B2}.

[0023] S6: Explore the one-hop neighborhood of the potential core entity "yin deficiency". Generate semantic embedding vectors for the tuples {yin deficiency->symptom, yin deficiency->need_drug, yin deficiency->forbid_food} in the subgraph neighborhood and the question using the bge-m3 embedding model. Calculate the cosine similarity between the tuples and the question, and filter tuples with similarity values ​​exceeding 0.8 for further mining, ultimately obtaining a set of core entity triples. For example... Figure 2 As shown, the two pairs "yin deficiency->symptom" and "yin deficiency->need_drug" were filtered out, resulting in the final set of potential entities. ={yin deficiency->forbid_food->White spirit, chilipeppers, chili peppers, fennel}.

[0024] S7: Input the core triple set and potential core triple set obtained from S5 and S6, along with the question, into the large language model to guide it in answering the user's question based on this concise and reliable external medical knowledge. For example... Figure 2 In the text, the large language model answers the user's question based on external knowledge: "Your symptoms of hot palms and soles in the afternoon and evening, dry mouth, and frequent mouth ulcers are related to yin deficiency. You can take Rehmannia Pill with Coptis and Phellodendron to relieve mouth ulcers. Go for an oral endoscopy and use salivary lysozymeplus vitamin B2 supplements for care. In daily life, avoid white spirits, almonds, fried peanuts, red adzuki beans, chili peppers, and fennel." To verify that the method provided in this embodiment of the invention is superior to existing methods, the performance of this invention and similar cutting-edge methods in recent years are evaluated and compared on three datasets using evaluation metrics. The implementation process includes: This embodiment uses bge-m3 as the embedding model for all datasets. Evaluation metrics include BERTScore, LLM-Rating, and HJS. BERTScore quantifies the semantic similarity between the large language model's output answer and the standard answer. LLM-Rating ranks different outputs based on four criteria: comprehensiveness of the answer, accuracy of disease diagnosis, correctness of drug recommendation, and correctness of diagnostic irrelevance test recommendations. HJS is a self-defined illusion metric used to evaluate the proportion of true facts in the large language model's output answer. To calculate HJS, the key information of different output answers and the "golden answer" is first compiled into lists. and Then, each element in the list is encoded into a vector, and then the calculation is performed. Each element and The semantic similarity of all elements in the dataset; if the maximum similarity exceeds a threshold... , This will be added to the set. The final numerator is the total number of elements in the set, calculated using the following formula: , in, This represents the set of key information extracted from the output answer of a large language model. This represents a set of key information extracted from the best answer and the knowledge graph. Represents the coding model. This indicates a preset threshold.

[0025] For the entity linking algorithm across all datasets, the similarity matching threshold was set to 0.9, while the threshold for the hallucination evaluation metric HJS was set to 0.8. Two models, bert-base-uncased and bert-base-chinese, were used to calculate the BERT score. Llama 3.1-8b was selected as the backbone large language model for all basic experiments. Furthermore, DeepSeek-8b was used as the evaluation model in the LLM-Rating assessment.

[0026] The experimental results on the GenMedGPT-5K dataset are shown in Table 1: Table 1

[0027] Experimental results on the GenMedGPT-5K dataset show that our method achieves a BERTScore of 0.6233 on the F1 scale, the highest among all compared methods. The most significant improvement is in recall, indicating that the dual-view knowledge graph exploration mechanism effectively reduces the omission of effective knowledge paths and improves the completeness of retrieval results. Furthermore, by designing a hierarchical knowledge filtering mechanism, our method controls noise introduction while maintaining improved recall, preventing a significant decrease in precision. In addition, the LLM-Rating comprehensively evaluates the model output from multiple dimensions, including answer comprehensiveness, diagnostic accuracy, drug recommendation correctness, and the rationality of irrelevant examination recommendations. Our method achieves superior ranking results, demonstrating that it provides more complete and high-quality diagnostic evidence for LLM, making the generated results more comprehensive and compliant with evaluation criteria. Simultaneously, it achieves the highest value on the HJS hallucination index, indicating that the provided external knowledge effectively constrains the model's reasoning process, significantly increasing the proportion of true medical facts in the output content and reducing the occurrence of hallucination phenomena in LLM.

[0028] The experimental results on the CMCQA dataset are shown in Table 2: Table 2

[0029] On the CMCQA dataset, the proposed method performs comparably to MindMap. This can be attributed to the fact that CMCQA includes realistic multi-turn dialogues with more complex semantics and contains a large amount of noisy text irrelevant to diagnosis and treatment. Therefore, knowledge graph-based retrieval methods often introduce too many triples, while LLM to some extent weakens the differences between these triples, leading to more consistent generated answers and making the overall performance of the two models similar. Nevertheless, the proposed method still shows certain advantages over MindMap, indicating that it can obtain more concise and reliable triples, allowing LLM to focus more on key triples when generating answers.

[0030] Table 3 shows the experimental results on the ExplainCPE dataset: Table 3

[0031] The method of this invention achieves an accuracy of 51.5%, the best performance among all compared methods. Compared with pure large language models Llama3.1:8b and DeepSeek-r1:7b, the accuracy is improved by 12.1% and 16.3% respectively, indicating that in multiple-choice question scenarios, relying solely on the model's internal knowledge is insufficient to complete complex medical causal and diagnostic reasoning, while introducing external knowledge enhancement mechanisms can significantly improve the accuracy of option judgment. Compared with traditional document retrieval methods, BM25Retriever and Embedding Retriever have accuracies of 47.7% and 48.5% respectively. Although these are significant improvements compared to pure LLM, they are still lower than the method of this invention. This is mainly because document-based retrieval methods often introduce relatively scattered or redundant textual evidence. In multiple-choice question scenarios, the model needs to make fine distinctions among multiple similar options. If the retrieved evidence lacks structured organization or includes irrelevant information, it can easily interfere with the final option judgment. In contrast, this invention employs a dual-perspective knowledge graph exploration mechanism. During the retrieval phase, it constructs a concise and clearly structured evidence subgraph using core entities and potential core entities as anchors. This effectively avoids missing valid knowledge paths and reduces interference from triples irrelevant to the options. In multiple-choice tasks, the model needs to make comparative judgments based on key medical causal relationships. Structured graph evidence can more clearly express the diagnostic associations between entities, thereby improving the ability to distinguish between options.

[0032] Compared to the Mindmap method (48.9%), the method of this invention further improves the accuracy to 51.5%, an increase of 2.6%. This indicates that in complex medical multiple-choice scenarios, relying solely on traditional subgraph or path exploration strategies may still result in redundant expansion or local path bias. This invention, by redefining retrieval anchor points and combining a dual filtering mechanism, can obtain more refined and highly relevant knowledge evidence, enabling the model to focus more on key diagnostic criteria when judging among multiple candidate options, thereby further improving accuracy.

[0033] This invention provides an enhanced large language model medical question answering method based on dual-perspective knowledge graph exploration. The invention systematically analyzes the location of answer entities in the medical knowledge graph, designs a dual-perspective knowledge graph exploration framework with core entities and potential core entities as exploration anchors, effectively avoids missing effective knowledge and improves retrieval efficiency. It also designs two efficient knowledge filtering mechanisms to provide concise yet reliable external knowledge for the large language model, resulting in higher average accuracy and greater economic benefits in answering medical questions.

[0034] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A medical question-answering method based on dual-perspective knowledge graph exploration using an enhanced large language model, comprising the following steps: S1. Obtain the medical knowledge graph, and use the vector embedding model to embed the entities in the medical knowledge graph to obtain the vector representation of the entities; S2 extracts medical entity information from user questions using a large language model to obtain a set of medical entities; S3 uses a three-step entity linking algorithm to map the entities in the medical entity set in S2 to the nodes in the knowledge graph; S4, based on the set of entities that have been mapped in S3, determines the exploration anchor entities of the knowledge graph, including core entities and potential core entities; S5, perform a one-hop search on the core entity and potential core entity to obtain their one-hop subgraph neighborhoods respectively; S6, prune the one-hop subgraph neighborhood of the core entity to obtain the core entity triplet set; S7, prune the one-hop subgraph neighborhood of the potential core entity to obtain the set of potential core entity triples; S8 inputs the core triple set and potential core entity triple set obtained from S6 and S7, along with the user question, into the large language model for answering.

2. The medical question-answering method based on dual-perspective knowledge graph exploration using a large language model for enhanced retrieval, as described in claim 1, is characterized in that... The three-step entity linking algorithm in S3 includes the following steps: S301, Collection of Medical Entities Each entity With the set of node entities in the knowledge graph Perform exact matching, and add successfully matched entities to the mapped entity set. The formula is expressed as: , in, Represents a set of mapped entities. Represents the medical entities extracted from the problem. The set, This represents the set of nodes in a knowledge graph. Indicates an exact match operation; S302, for all entities that did not match precisely in S301. The system approximates the matching of all node entities in the graph node set based on semantic embedding vectors. If the cosine similarity score between the two is greater than a threshold, the matched graph node entity is considered a valid match. Add to the mapping entity collection The formula is expressed as: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. Represents an embedded model. This indicates the calculation of cosine similarity. Indicates the preset threshold. Indicates entities that did not match exactly. This represents the matched graph node entities; S303, for the remaining entities that have not been matched after S301 and S302. , and the set of graph nodes Perform subsequence matching, and match the graph node entities. Add to the mapping entity collection The formula is expressed as: , in, Represents a set of medical entities. This represents the set of nodes in a knowledge graph. This indicates a subsequence matching operation.

3. The medical question-answering method based on dual-perspective knowledge graph exploration using a large language model for retrieval enhancement, as described in claim 1, is characterized in that... The anchor point entity of S4 is divided into core entities. and potential core entities The steps to determine this are as follows: S401, Select the entity with the entity type "Disease" as the core entity. ; S402, the set of mapped entities obtained from S3 For each entity, perform a one-hop search and count the number of times entities with the same type as the core entity appear in the search results; S403: After traversing all entities in the mapped entity set, select the entity that appears most frequently as the potential core entity. If multiple potential core entities have the same frequency, generate semantic embedding vectors for these candidate entities and the question using an embedding model, calculate the cosine similarity between the vectors, and select the entity with the highest similarity as the final potential core entity. The above steps can be formalized as follows: , in, Indicates a potential core entity. This represents a set of potential core entities composed of multiple candidate entities. This indicates a user issue. This indicates the calculation of cosine similarity. The logical AND symbol represents "and".

4. The medical question-answering method based on dual-perspective knowledge graph exploration using a large language model for enhanced retrieval, as described in claim 1, is characterized in that... The pruning in S6 includes the following steps: S601, filter out triples that have already appeared in the question text within the one-hop neighborhood of the core entity, and obtain the set of core entity one-hop neighborhood triples retained after filtering. The set is represented as: , in, This represents the set of all triples in the one-hop neighborhood of the core entity. Indicates the relationship between entities. Represents a set of mapped entities; S602, the set of one-hop neighborhood triples retained after filtering The input is a large language model, which then selects the set of triples needed to answer the user's question, forming the core triple set. , , in, Representing a large language model, To indicate a problem, This represents the set of one-hop neighborhood triples retained after filtering the core entity.

5. The medical question-answering method based on dual-perspective knowledge graph exploration using a large language model for enhanced retrieval, as described in claim 1, is characterized in that... The pruning in S7 includes the following steps: S701, in the one-hop subgraph neighborhood of potential core entities, the binary pairs Semantic embedding vectors are generated for each question using an embedding model. S701, Calculate binary pairs By using cosine similarity with the problem, pairs with semantic similarity values ​​exceeding a preset threshold are filtered out and further mined to ultimately obtain a set of potential core entity triples. The formula is expressed as: , in, Represents an embedded model. To indicate a problem, Represents the cosine similarity score. Indicates the preset threshold. Indicates a potential core entity. It represents the relationship between entities.