RAG system based on medical knowledge graph
Through the RAG system based on medical knowledge graph, the limitations of language model and information overload in biomedical information retrieval are solved, and higher retrieval accuracy and recall rate are achieved, as well as more accurate and comprehensive answer generation.
Patent Information
- Application Number
- CN202411749449.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-25
AI Technical Summary
Existing large language models have limitations in biomedical information retrieval, making it difficult to effectively identify and utilize rare but important knowledge points in the literature, and the information overload problem makes it difficult to quickly and accurately search.
The RAG system based on medical knowledge graph is adopted, which includes a knowledge graph construction module, a medical knowledge information extraction module, a search enhancement module and a generation module. The search accuracy and recall rate are improved by building a medical knowledge graph, identifying medical entities and relationships, generating structured queries and combining LLM to generate answers.
It improves the search accuracy and recall rate, can extract relevant information more effectively from a large number of literature, overcomes the lack of language models to ignore rare knowledge, solves the problem of information overload, and enhances the accuracy and comprehensiveness of answer generation.
Abstract
Description
Technical Field
[0001] The present invention is applied to the field of biomedical information retrieval, and specifically is a RAG system based on medical knowledge graph. Background Art
[0002] Large language models (LLMs) are changing the way information retrieval is done, summarizing and presenting a large amount of knowledge through natural language conversations. However, these models learn from a large amount of data during pre-training, but they tend to extract the most common information from the training data and ignore rare but potentially equally important knowledge points. In the field of biomedical research, the latest discoveries are crucial to researchers, doctors, and students, but this kind of latest research knowledge is often not present in the corpus of LLMs or is obscured by the growing literature base (information overload problem). Therefore, existing LLMs have limitations in handling long-tail knowledge. In addition, with the continuous growth of medical literature, the information overload problem is becoming increasingly serious, making it difficult to quickly and accurately retrieve relevant information from a large amount of literature. To address this problem, a system that can effectively retrieve and summarize knowledge from medical literature is needed, which should be able to identify and exploit entities and relations in the literature, as well as the interactions between them. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a RAG system based on medical knowledge graph in view of the deficiencies in the prior art.
[0004] In order to solve the above technical problems, the present invention provides a RAG system based on medical knowledge graph, comprising:
[0005] The knowledge graph construction module is used to extract medical knowledge information from medical literature and construct a medical knowledge graph;
[0006] Medical knowledge information extraction module, used to analyze user query data and identify medical knowledge information;
[0007] The retrieval enhancement module is used to retrieve relevant information from the medical knowledge graph based on the medical knowledge information recognition results and generate structured queries;
[0008] The generation module is used to combine the retrieved medical knowledge information and user query data to generate accurate and comprehensive answers through LLM.
[0009] As a possible implementation method, further, the knowledge graph construction module divides the medical knowledge information required by the knowledge graph into medical entities, medical attributes and medical relationships and defines them, and uses LLMs to construct extraction prompts based on medical entities, medical attributes and medical relationships.
[0010] As a possible implementation, further, the medical knowledge information extraction module performs medical entity recognition and medical relationship extraction.
[0011] As a possible implementation, further, the retrieval enhancement module includes:
[0012] The retrieval enhancement module implements enhanced prompts by inserting additional text blocks in the retrieval data and summarizing the user query data, while answering questions from knowledge that was not input during LLM pre-training;
[0013] Select the text block that is most similar to the user query data in the embedding space from the corpus, and use cosine similarity to calculate the top N texts in the M3E embedding space that are closest to the input question;
[0014] Knowledge graph-based IR methods map text chunks to nodes and edges in the graph and use entity recognition in the problem to retrieve text along the shortest path of recognized entities.
[0015] A RAG method based on medical knowledge graph specifically includes the following steps:
[0016] Select desired medical treatment and enter user query data;
[0017] Define the medical entities, medical attributes and medical relationships of the medical treatment, and the prompts of medical entities, medical attributes and medical relationships. Use LLM to extract key medical entities, medical attributes and medical relationships from medical literature and construct a medical knowledge graph.
[0018] Through the constructed prompt, LLM is used to perform medical entity recognition and medical relationship extraction on user query data;
[0019] The user query data is converted into a spatial vector through M3E, and the cosine similarity is calculated with the vector library of medical literature. The text of the literature with the highest similarity is extracted and added to the prompt.
[0020] The identified medical entities and medical entity relationships are searched through nodes and edges in the medical knowledge graph, and a series of candidate queries are generated for each identified medical entity. The candidate queries are added to the prompt.
[0021] The constructed prompt contains the known matched document information and knowledge graph information;
[0022] Generate answers using LLM.
[0023] As a possible implementation, further, the medical entity includes at least surgery, medicine, and part, and the medical attributes include the type of surgery of the relevant part and the individual tissues subdivided under the part.
[0024] The present invention adopts the above technical solution and has the following beneficial effects:
[0025] Improve retrieval precision and recall: By combining the medical knowledge graph, the system can identify specific entities and relationships in user queries and perform retrieval based on these entities and relationships, making the retrieval results more accurate. Especially when dealing with long-tail knowledge, it can more effectively extract relevant information from a large amount of literature, overcoming the shortcomings of LLMs that tend to ignore rare but important knowledge.
[0026] Solve the problem of information overload: With the continuous growth of biomedical literature, information overload has become one of the main challenges of retrieval. By structuring the entities and relationships in the literature and integrating them into the knowledge graph, the system can better sort out and present important information in the literature, reducing the pressure of users searching in a large amount of irrelevant literature.
[0027] Enhance the accuracy and comprehensiveness of answer generation: The retrieval-augmented generation (RAG) method integrates knowledge graphs and LLMs. The answers generated not only rely on pre-trained corpus, but also combine the latest medical research results to provide more accurate and comprehensive answers.
[0028] Dynamically update and expand the knowledge base: The knowledge graph can be continuously updated and expanded with new medical research progress, which enables the system to maintain the ability to track new knowledge and ensure that the system can utilize the latest scientific research results during information retrieval and generation.
[0029] Improve user experience: Through accurate entity recognition, relationship extraction and structured query, users can obtain search results that are closer to their actual needs, improving their efficiency and satisfaction when querying complex medical problems. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.
[0031] Example 1
[0032] A RAG system based on medical knowledge graph, comprising:
[0033] The knowledge graph construction module is used to extract medical knowledge information from medical literature and construct a medical knowledge graph; the knowledge graph construction module divides the medical knowledge information required by the knowledge graph into medical entities, medical attributes and medical relationships and defines them, and uses LLMs to construct extraction prompts based on medical entities, medical attributes and medical relationships.
[0034] The medical knowledge information extraction module is used to analyze user query data and identify medical knowledge information; the medical knowledge information extraction module identifies medical entities and extracts medical relationships.
[0035] The retrieval enhancement module is used to retrieve relevant information from the medical knowledge graph based on the medical knowledge information recognition results and generate structured queries; the work includes:
[0036] The retrieval enhancement module implements enhanced prompts by inserting additional text blocks in the retrieval data and summarizing the user query data, while answering questions from knowledge that was not input during LLM pre-training;
[0037] Select the text block that is most similar to the user query data in the embedding space from the corpus, and use cosine similarity to calculate the top N texts in the M3E embedding space that are closest to the input question;
[0038] Knowledge graph-based IR methods map text chunks to nodes and edges in the graph and use entity recognition in the problem to retrieve text along the shortest path of recognized entities.
[0039] The generation module is used to combine the retrieved medical knowledge information and user query data to generate accurate and comprehensive answers through LLM.
[0040] A RAG method based on medical knowledge graph specifically includes the following steps:
[0041] Select desired medical treatment and enter user query data;
[0042] Define the medical entities, medical attributes and medical relationships of the medical treatment, and the prompts of medical entities, medical attributes and medical relationships. Use LLM to extract key medical entities, medical attributes and medical relationships from medical literature and construct a medical knowledge graph.
[0043] Through the constructed prompt, LLM is used to perform medical entity recognition and medical relationship extraction on user query data;
[0044] The user query data is converted into a spatial vector through M3E, and the cosine similarity is calculated with the vector library of medical literature. The text of the literature with the highest similarity is extracted and added to the prompt.
[0045] The identified medical entities and medical entity relationships are searched through nodes and edges in the medical knowledge graph, and a series of candidate queries are generated for each identified medical entity. The candidate queries are added to the prompt.
[0046] The constructed prompt contains the known matched document information and knowledge graph information;
[0047] Generate answers using LLM.
[0048] As a possible implementation, further, the medical entity includes at least surgery, medicine, and part, and the medical attributes include the type of surgery of the relevant part and the individual tissues subdivided under the part.
[0049] Example 2
[0050] (1) Medical knowledge graph construction module, which is used to extract entities, relations and attributes from medical literature and construct knowledge graphs. This module first defines the entities, attributes and relations between entities required for knowledge graphs, and then uses LLMs to construct extraction prompts based on entities, attributes and relations.
[0051] (2) Entity recognition and relationship extraction module, which is used to analyze user queries and identify relevant medical entities;
[0052] (3) Retrieval enhancement module, which is used to retrieve relevant information from the medical knowledge graph based on entity recognition results and generate structured queries. The specific process is as follows:
[0053] A. Retrieval-augmentation: We augmented the prompt by inserting an extra text block in the prompt (retrieval) and summarizing the user question, allowing for question answering from knowledge not seen during LLM pre-training.
[0054] B. Common retrieval mechanisms include selecting the text block that is most similar to the user's question in the embedding space from the corpus, and using cosine similarity to calculate the top N texts in the M3E embedding space that are closest to the input question;
[0055] C. Knowledge graph-based IR methods map text chunks to nodes and edges in the graph and use entity recognition in the problem to retrieve the text along the shortest path of recognized entities.
[0056] (4) The generation module is used to combine the retrieved information and user queries to generate accurate and comprehensive answers through LLM.
[0057] Example 3
[0058] A RAG method based on medical knowledge graph,
[0059] (1) Define the entities, attributes, and relationships between oral surgery operations. Entities include surgery, drugs, and oral parts. Attributes include periodontal scaling, alveolar bone transplantation, jaw resection, hydroxyapatite, caries, wisdom teeth, etc. Construct prompts for extracting entities and relationships between entities, use LLM to extract key entities and relationships from oral medicine literature, and build an oral knowledge graph;
[0060] (2) Use LLM to perform entity recognition and relationship extraction on the query input by the user through the prompt constructed in (1);
[0061] (3) The query input by the user is converted into a spatial vector through M3E, and the cosine similarity is calculated with the vector library of oral medicine literature. The top five literature texts with the highest similarity are selected and added to the prompt. In addition, the entities and entity relationships identified in (2) are searched through the nodes and edges in the knowledge graph to generate a series of candidate queries for each identified entity, and the candidate queries are also added to the prompt;
[0062] (4) The final constructed prompt contains the known matched document information and knowledge graph information, and then uses LLM to generate the answer.
[0063] The above are embodiments of the present invention. For ordinary technicians in the field, according to the teachings of the present invention, all equivalent changes, modifications, substitutions and variations made within the scope of the patent application of the present invention without departing from the principles and spirit of the present invention should fall within the scope of the present invention.
Claims
1. A RAG system based on medical knowledge graph, characterized in that: include: The knowledge graph construction module is used to extract medical knowledge information from medical literature and construct a medical knowledge graph; Medical knowledge information extraction module, used to analyze user query data and identify medical knowledge information; The retrieval enhancement module is used to retrieve relevant information from the medical knowledge graph based on the medical knowledge information recognition results and generate structured queries; The generation module is used to combine the retrieved medical knowledge information and user query data to generate accurate and comprehensive answers through LLM.
2. A RAG system based on medical knowledge graph according to claim 1, characterized in that: The knowledge graph construction module divides the medical knowledge information required by the knowledge graph into medical entities, medical attributes and medical relationships and defines them, and uses LLMs to construct extraction prompts based on medical entities, medical attributes and medical relationships.
3. The RAG system based on medical knowledge graph according to claim 1, characterized in that: The medical knowledge information extraction module performs medical entity recognition and medical relationship extraction.
4. The RAG system based on medical knowledge graph according to claim 1, characterized in that: The work of the retrieval enhancement module includes: The retrieval enhancement module implements enhanced prompts by inserting additional text blocks in the retrieval data and summarizing the user query data, while answering questions from knowledge that was not input during LLM pre-training; Select the text block that is most similar to the user query data in the embedding space from the corpus, and use cosine similarity to calculate the top N texts in the M3E embedding space that are closest to the input question; Knowledge graph-based IR methods map text chunks to nodes and edges in the graph and use entity recognition in the problem to retrieve text along the shortest path of recognized entities.
5. A RAG method based on medical knowledge graph, characterized in that: The specific steps include: Select desired medical treatment and enter user query data; Define the medical entities, medical attributes and medical relationships of the medical treatment, and the prompts of medical entities, medical attributes and medical relationships. Use LLM to extract key medical entities, medical attributes and medical relationships from medical literature and construct a medical knowledge graph. Through the constructed prompt, LLM is used to perform medical entity recognition and medical relationship extraction on user query data; The user query data is converted into a spatial vector through M3E, and the cosine similarity is calculated with the vector library of medical literature. The text of the literature with the highest similarity is extracted and added to the prompt. The identified medical entities and medical entity relationships are searched through nodes and edges in the medical knowledge graph, and a series of candidate queries are generated for each identified medical entity. The candidate queries are added to the prompt. The constructed prompt contains the known matched document information and knowledge graph information; Generate answers using LLM.
6. The RAG method based on medical knowledge graph according to claim 5, characterized in that: The medical entity includes at least surgery, medicine, and part, and the medical attributes include the type of surgery for the relevant part and the individual tissues subdivided under the part.
Citation Information
Cited By
Mathematics ancient book information processing method based on KG-RAG collaborative enhancement
CN120562533A
Knowledge retrieval enhancement method and system based on biochemical knowledge graph
CN121009163A
Medical review and publishing quality control system based on deep learning and medical knowledge
CN121391142A