Medical consultation dialogue generation method and device based on knowledge graph retrieval enhancement

By constructing a medical knowledge graph and combining user input information to generate medical consultation dialogues, it solves the problem of insufficient knowledge in the medical field with traditional methods, improves the accuracy and relevance of dialogues, and provides patients with efficient, accurate and personalized services. Medical consulting services.

CN119336871APending Publication Date: 2025-01-21TIANJIN UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411398808.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-09
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The existing medical consultation dialogue generation methods are difficult to meet the depth and breadth of patients' needs for medical knowledge, and the lack of knowledge in traditional methods in the medical field leads to insufficient accuracy and relevance of dialogue.

Method used

By building a medical knowledge graph, relevant texts in the medical field are obtained for preprocessing, identifying medical entities in user input, and generating input text in a preset instruction format based on user input and information summary, and conducting medical consultation dialogues based on the input text.

Benefits of technology

The accuracy and correlation of dialogue generation have been achieved, and the problems of incomplete and insufficient user input information have been overcome, and more efficient, accurate and personalized medical consulting services are provided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336871A_ABST
    Figure CN119336871A_ABST
Patent Text Reader

Abstract

The invention relates to a medical consultation dialogue generation method based on knowledge graph retrieval enhancement. Comprising the steps of obtaining medical field related texts, and constructing a medical field knowledge graph after preprocessing; identifying a medical entity in user input, and determining an information summary of the medical entity in the medical domain knowledge graph; generating an input text in a preset instruction format according to the user input and the information summary; and performing a medical consultation dialogue based on the input text. According to the method, the accuracy and preciseness of question answering of the large model and the smoothness and rationality of medical question answering are further improved by using the local medical knowledge source.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of dialogue generation technology, and more specifically to a method and device for generating medical consultation dialogues based on knowledge graph retrieval enhancement. Background Art

[0002] In today's society, with the rapid development of artificial intelligence technology and the rapid growth of medical and health information, people's demand for personalized and precise medical consultation is growing. However, the uneven distribution of existing medical resources and the information asymmetry between doctors and patients make it difficult for many patients to obtain timely and professional medical consultation services. In this context, medical knowledge graphs, as a tool that can effectively integrate medical information and improve the accuracy and efficiency of medical consultation, have received widespread attention.

[0003] At present, although studies have confirmed the important role of medical knowledge graphs in medical consultation, there is still a lack of intelligent medical consultation dialogue systems with high real-time performance and high accuracy. Traditional medical consultation dialogue generation methods often rely on simple information retrieval and template matching, which is difficult to meet patients' needs for the depth and breadth of medical knowledge.

[0004] To this end, this study proposed a medical consultation dialogue generation method based on knowledge graph retrieval enhancement. Summary of the invention

[0005] In view of this, in order to at least partially solve the above-mentioned technical problems, the present invention provides a method and device for generating medical consultation dialogues based on knowledge graph retrieval enhancement, which aims to expand the query information of patient users by automatically constructing and expanding medical knowledge graphs, thereby providing richer input data for large-scale language models, so as to improve the response quality and information quantity of the model, and overcome the problem of inaccurate and insufficient information input by users.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] First, the present application provides a method for generating medical consultation dialogues based on knowledge graph retrieval enhancement, including:

[0008] Obtain medical-related texts, pre-process them and use them to build a medical knowledge graph;

[0009] Identify medical entities in user input and determine information summaries of the medical entities in the medical field knowledge graph;

[0010] Generate input text in a preset instruction format based on user input and information summary;

[0011] Conduct medical consultation dialogue based on input text.

[0012] Preferably, preprocessing includes data cleaning, word segmentation, named entity recognition and data labeling.

[0013] Preferably, a large language model is used to identify medical entities in user input, and the large language model is used to conduct a medical consultation dialogue based on the input text.

[0014] Preferably, the large language model is ChatGPT or Llama.

[0015] Preferably, a medical entity index is constructed through LlamaIndex to facilitate retrieval in the medical field knowledge graph.

[0016] Preferably, the preset instruction format is:

[0017] Input = {"Combining the following relevant materials"} + S + {"Answer the following questions in a professional, accurate and appropriate manner:"} + Q

[0018] Among them, S represents information summary and Q represents user input.

[0019] Secondly, the present application provides a medical consultation dialogue generation device based on knowledge graph retrieval enhancement, which applies the medical consultation dialogue generation method based on knowledge graph retrieval enhancement as described above, including:

[0020] The knowledge graph construction unit is used to obtain medical field related texts and construct the medical field knowledge graph after preprocessing;

[0021] An information summary determination unit, used to determine the information summary of the identified medical entity in the medical field knowledge graph;

[0022] The consultation dialogue generation unit is used to identify the medical entity according to the user input; and to generate the input text according to the preset instruction format according to the user input and the information summary, and to conduct the medical consultation dialogue based on the input text.

[0023] Preferably, the information summary determination unit constructs a medical entity index through LlamaIndex and searches in the medical field knowledge graph.

[0024] Preferably, the preset instruction format is:

[0025] Input = {"Combining the following relevant materials"} + S + {"Answer the following questions in a professional, accurate and appropriate manner:"} + Q

[0026] Among them, S represents information summary and Q represents user input.

[0027] Again, the present application discloses a processing device, comprising: a processor, suitable for executing each program code; and a data storage device, suitable for storing multiple program codes; wherein the program code is suitable for being loaded and executed by the processor to implement the medical consultation dialogue generation method based on knowledge graph retrieval enhancement as described in any of the above items.

[0028] Through the above technical solutions, it can be known that the present invention discloses a method and device for generating medical consultation dialogues based on knowledge graph retrieval enhancement. Through data preprocessing, medical knowledge graph construction, retrieval enhancement technology, medical entity detection and information summary, special instruction format setting and other steps, the intelligent generation of medical consultation dialogues is realized, solving the problems of uneven distribution of medical resources and improving patient satisfaction.

[0029] Compared with the prior art, the beneficial effects of the present invention include:

[0030] 1. A method for generating medical consultation dialogues based on knowledge graph retrieval enhancement. Under the natural language processing framework, the rich information of the medical knowledge graph is fully utilized. Through the graph database retrieval technology, the relevant triples of the entities in the patient's question in the knowledge graph are retrieved, and this is used as the prior knowledge for dialogue generation. This method not only effectively overcomes the problem of insufficient knowledge in the medical field of traditional dialogue systems, but also improves the accuracy and relevance of dialogues. At the same time, by introducing the reasoning ability of the knowledge graph, the present invention can better understand the complex relationship between diseases and symptoms, drugs and treatments, and thus provide more accurate and personalized medical advice in dialogues.

[0031] 2. The present invention combines the retrieval of knowledge graphs with dialogue generation, which not only helps to identify potential health problems of patients, but also can provide customized health advice based on the specific conditions of patients. In addition, the knowledge graph retrieval mechanism of the present invention can continue to evolve with the updating of medical knowledge, ensuring the timeliness and scientific nature of medical consultation. In this way, the present invention not only provides patients with more efficient and convenient medical consultation services, but also assists medical professionals in considering more possible factors when making diagnoses and treatments, thereby improving the overall quality of medical services. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0033] Figure 1 Generate a flow chart of the method for medical consultation dialogue enhancement based on knowledge graph retrieval;

[0034] Figure 2 Schematic diagram of the flow of the method for generating medical consultation dialogues based on knowledge graph retrieval enhancement. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] The embodiment of the present invention discloses a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement, which mainly utilizes the theories and technologies of natural language processing and knowledge graph, takes the medical knowledge graph as the basis, and introduces two kinds of prior knowledge information: the semantic information of the patient's query and the association relationship of medical entities. The present invention does not consider the misunderstanding caused by unclear language expression, and is based on the following two assumptions: (1) the entities in higher-level categories in the medical knowledge graph have more generalized meanings; the entities in lower-level categories have more specific meanings; (2) the content of the patient's query is mapped to different entities on the knowledge graph according to semantic relevance, which reveals the association between the query content and medical knowledge, and is crucial for generating accurate and relevant medical consultations.

[0037] Therefore, this application builds a dialogue generation model, and in the specific solution process, enriches the medical-related information input by the user, thereby improving the accuracy of dialogue generation and overcoming the problem of insufficient medical knowledge in the user's questions. In this way, the present invention can provide patients with more efficient, accurate and personalized medical consulting services, which helps to improve the service quality and patient satisfaction in the medical and health field, and at the same time overcome the problem of insufficient medical knowledge in user query statements, the doctor's answers tend to be colloquial or specialized and difficult for patients to understand, and the general large language model itself lacks medical knowledge.

[0038] In one embodiment, the medical consultation dialogue generation method based on knowledge graph retrieval enhancement provided by the present application is as follows: Figure 1 As shown, including,

[0039] Obtain medical-related texts, pre-process them and use them to build a medical knowledge graph;

[0040] Identify medical entities in user input and determine information summaries of the medical entities in the medical field knowledge graph;

[0041] Generate input text in a preset instruction format based on user input and information summary;

[0042] Conduct medical consultation dialogue based on input text.

[0043] In this embodiment, Figure 2 As shown in the figure, professional books related to the medical field are collected to build a medical text vector database, and then preprocessed. The preprocessing includes cleaning the data to remove irrelevant information, such as format errors, extra spaces, punctuation marks, etc.; using the nltk library for word segmentation, named entity recognition and data annotation; the label format is the disease name, site of onset, and symptoms, and finally generating structured data in a unified format. In addition, medical-related professional book files are collected, and pre-trained language models (such as BERT, ChatGPT, Llama, etc.) are used to convert the text into vector representations, and the vector representations are stored in a medical text vector database, such as Faiss or Annoy.

[0044] Further, the obtained structured data is used to construct the medical field knowledge graph G, that is, a script is written, which performs the following functions: the structured data is written into the graph database Neo4j in a label format to generate the required medical field knowledge graph G. In one embodiment, entity recognition and relationship extraction are performed by training a large model fine-tuned by medical data, and medical knowledge is automatically extracted from a large amount of medical structured data and combined with the medical-related knowledge it possesses during fine-tuning to supplement and construct the knowledge graph G. Or the medical large model is used through retrieval enhancement generation technology to retrieve the relevant knowledge of each entity node in the knowledge graph from the medical text vector database in step 1 through similarity retrieval, and data cleaning and fusion are performed, and further supplemented to the knowledge graph to expand the knowledge of the knowledge graph G.

[0045] Secondly, the medical entities in the user input are identified, and the information summary of the medical entities in the medical field knowledge graph is determined.

[0046] In this embodiment, the big model is used to detect the medical entity E in the user input, and the big model connection and retrieval tool uses the knowledge graph retrieval method based on the keyword entity E to retrieve the information summary S of the tree structure of entity E in the knowledge graph. The entity E is taken as the root node and the most relevant answer is taken as the leaf node to form a tree structure. The information summary S contains various information related to the entity E, such as the definition, cause, treatment method, preventive measures, etc. of the disease. S is presented in a tree structure, which is convenient for users to understand and obtain the required information.

[0047] In an exemplary embodiment, for a question Q input by a user, a large language model LLM such as ChatGPT or Llama is used to identify the medical entity E in the question Q, and a tool such as LlamaIndex is used to connect and retrieve external data sources, and a knowledge graph retrieval method R based on the keyword entity E is used to search for and summarize the relevant triple information in the knowledge graph G. The entity extraction and relevant triple information summary retrieval formula is as follows:

[0048] E=LLM(Q),S=R(E,G)

[0049] Q represents the question input by the user, LLM represents the large language model, E represents the medical entity extracted by the large language model LLM from the user question Q, S represents the information summary of the knowledge graph tree structure, which is constructed recursively with the medical entity E as the root node and the most relevant answer as the leaf node, and R represents the knowledge graph retrieval method based on the keyword entity E using the tool to connect and retrieve external data sources.

[0050] Then, the input text is generated according to the preset instruction format based on the user input and the information summary; and the medical consultation dialogue is conducted based on the input text. In this application, the obtained information summary S is combined with the user input question Q to generate the model input text Input; that is, the information summary S is used as additional supplementary material for the user input question Q, and the instruction format is set, and together with the user input question Q, it is used as the model input text Input of the large model. The instruction format template is as follows:

[0051] Input = {"Combining the following relevant materials"} + S + {"Answer the following questions in a professional, accurate and appropriate manner:"} + Q

[0052] Furthermore, the large language model is used to obtain the answer based on the generated input data; the formula is expressed as:

[0053] Answer = LLM (Input)

[0054] Answer represents the output of the large language model LLM for the input Input.

[0055] Optimally, the answer Answer output by the large language model LLM is preferably fed back to the user.

[0056] In one embodiment, the present application provides a medical consultation dialogue generation device based on knowledge graph retrieval enhancement, which applies the medical consultation dialogue generation method based on knowledge graph retrieval enhancement as described above, including:

[0057] The knowledge graph construction unit is used to obtain medical field related texts and construct the medical field knowledge graph after preprocessing;

[0058] An information summary determination unit, used to determine the information summary of the identified medical entity in the medical field knowledge graph;

[0059] The consultation dialogue generation unit is used to identify the medical entity according to the user input; and to generate the input text according to the preset instruction format according to the user input and the information summary, and to conduct the medical consultation dialogue based on the input text.

[0060] Preferably, the information summary determination unit constructs a medical entity index through LlamaIndex and searches in the medical field knowledge graph.

[0061] Preferably, the preset instruction format is:

[0062] Input = {"Combining the following relevant materials"} + S + {"Answer the following questions in a professional, accurate and appropriate manner:"} + Q

[0063] Among them, S represents information summary and Q represents user input.

[0064] In one embodiment, the present application also discloses a processing device, comprising: a processor, suitable for executing each program code; and a data storage device, suitable for storing multiple program codes; wherein the program code is suitable for being loaded and executed by the processor to implement the medical consultation dialogue generation method based on knowledge graph retrieval enhancement as described in any of the above items.

[0065] The present invention combines deep retrieval of medical knowledge graphs with natural language processing technology to achieve intelligent medical consultation dialogue generation, which is expected to improve the accuracy and efficiency of medical consultation, reduce the workload of doctors, and improve patient satisfaction.

[0066] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0067] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating medical consultation dialogue based on knowledge graph retrieval enhancement, characterized in that: Obtain medical-related texts, perform preprocessing, and construct a medical knowledge graph; Identify medical entities in user input and determine information summaries of the medical entities in the medical field knowledge graph; Generate input text in a preset instruction format based on user input and information summary; Conduct medical consultation dialogue based on input text.

2. According to claim 1, a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement is characterized in that: Preprocessing includes data cleaning, word segmentation, named entity recognition and data labeling.

3. According to claim 1, a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement is characterized in that: A large language model is used to identify medical entities in user input, and the large language model is used to conduct a medical consultation dialogue based on the input text.

4. According to claim 3, a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement is characterized in that: The large language model is ChatGPT or Llama.

5. According to claim 1, a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement is characterized in that: A medical entity index is built through LlamaIndex to facilitate retrieval in the medical field knowledge graph.

6. According to claim 1, a method for generating medical consultation dialogue based on knowledge graph retrieval enhancement is characterized in that: The default command format is: Input={"Combining the following relevant materials"}+S+{"Answer the following questions in a professional, accurate and appropriate manner:"}+Q Among them, S represents information summary and Q represents user input.

7. A medical consultation dialogue generation device based on knowledge graph retrieval enhancement, characterized in that: The method for generating medical consultation dialogue based on knowledge graph retrieval enhancement described in any one of claims 1 to 6 comprises: The knowledge graph construction unit is used to obtain medical field related texts and construct the medical field knowledge graph after preprocessing; An information summary determination unit, used to determine the information summary of the identified medical entity in the medical field knowledge graph; The consultation dialogue generation unit is used to identify the medical entity according to the user input; and to generate the input text according to the preset instruction format according to the user input and the information summary, and to conduct the medical consultation dialogue based on the input text.

8. The medical consultation dialogue generation device based on knowledge graph retrieval enhancement according to claim 7, characterized in that: The information summary determination unit constructs a medical entity index through LlamaIndex and searches in the medical field knowledge graph.

9. The medical consultation dialogue generation device based on knowledge graph retrieval enhancement according to claim 7, characterized in that: The default command format is: Input={"Combining the following relevant materials"}+S+{"Answer the following questions in a professional, accurate and appropriate manner:"}+Q Among them, S represents information summary and Q represents user input.

10. A processing device, comprising: a processor adapted to execute each program code; and a data storage device adapted to store a plurality of program codes; characterized in that: The program code is suitable for being loaded and executed by a processor to implement the medical consultation dialogue generation method based on knowledge graph retrieval enhancement as described in any one of claims 1-6.

Citation Information

Cited By

  • Agentic workflow-based scientific research team information question and answer agent construction method

    CN121766450A