LLM-based medical knowledge answering method, apparatus and device, and medium

By generating entity-relational data in the LLM model and performing fuzzy search of knowledge graphs, combined with the fine-tuning technology of the QLoRA method, the problem of text generation errors and high computing power requirements in medical applications is solved, and safe and reliable medical knowledge is achieved Answer and reduce hardware requirements.

CN118885573APending Publication Date: 2024-11-01XIAMEN YILIANZHONG YIHUI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410535968.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-08-15
Filing Date
2024-04-30
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

Existing LLM models have "illusions" and false descriptions of facts from time to time in text generation in medical applications, resulting in potential risks and errors. Training and deployment requires a lot of data and computing power, which is difficult for individuals or ordinary institutions to bear huge amounts of data or computing power. Invest.

Method used

Using the LLM-based medical knowledge answer method, by obtaining the question text input by the user, calling the trained fine-tuned LLM model to generate entity-relational data, and fuzzy search in the preset knowledge graph knowledge base to generate question answers, using QLoRA The method fine-tunes the basic LLM model under the preset computing power, with the model parameters less than 10B, reducing the computing power demand.

Benefits of technology

Effectively avoid the "illusion" and inaccurate content of the LLM model in text generation, reduce potential risks and errors, reduce the data and computing power investment required for training and deployment, and realize efficient medical knowledge under limited computing power. answer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885573A_ABST
    Figure CN118885573A_ABST
Patent Text Reader

Abstract

The invention provides an LLM-based medical knowledge answering method and device, equipment and a medium, and the method comprises the steps: obtaining a question text inputted by a user, calling a trained fine-tuning LLM model to carry out the analysis processing of the question text, and generating entity-relation data, the entity-relation data comprises entity names and entity relation types corresponding to the entity names; performing retrieval processing in a preset knowledge graph knowledge base according to the entity-relational data, and generating knowledge content corresponding to the entity-relational data; and according to the knowledge content, generating a question answer. In addition, the existing LLM has the problems of huge investment, 'illusion 'and wrong description of facts, and potential risks and errors.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of LLM model medical knowledge answering, and in particular to a medical knowledge answering method, device, equipment and medium based on LLM. Background Art

[0002] Large Language Models (LLMs) refer to advanced artificial intelligence algorithms trained on large amounts of data. Natural language processing systems, which typically have more than 100 billion parameters, can be used for customized AI applications such as content generation, text summarization, chatbots, coding, and prediction of protein structure and biomolecular properties. They are currently very popular. General LLM training and deployment requires a large amount of data and computing power, but individuals or ordinary institutions can hardly afford the huge investment. And one of the problems with LLMs currently on the market is that "hallucinations" and misrepresentations of facts often appear in text generation. In medical applications, text generation that violates facts can lead to potential risks and errors.

[0003] In view of this, this application is filed. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a medical knowledge answering method, device, equipment and medium based on LLM, which can effectively reduce the computing power requirements of the LLM model during fine-tuning training and deployment, and can effectively avoid the impact of "hallucinations" and incorrect descriptions of facts that occasionally appear in the text generation of the LLM model on medical applications, thereby reducing potential risks and errors.

[0005] The present invention discloses a medical knowledge answering method based on LLM, comprising:

[0006] Obtaining a question text input by a user, and calling a trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name;

[0007] Performing retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data to generate knowledge content corresponding to the entity-relationship data;

[0008] Generate answers to questions based on the knowledge content.

[0009] Preferably, the entity name is a disease name, and the entity relationship type is a disease-related knowledge type corresponding to the disease name.

[0010] Preferably, before calling the trained fine-tuned LLM model to analyze and process the question text, the method further includes:

[0011] Automatically construct and process the preset knowledge graph knowledge base, preset multiple different questions for each relationship type of the disease name, and generate an instruction training data set;

[0012] Construct a basic LLM model, and use the QLoRA method to fine-tune the basic LLM model under a preset computing power, wherein the model parameter amount of the basic LLM model is less than 10B;

[0013] Fine-tune the basic LLM model according to the instruction training data set to generate a fine-tuned LLM model.

[0014] Preferably, before performing a search process in a preset knowledge graph knowledge base according to the entity-relationship data, the method further includes:

[0015] Acquire multiple sets of historical disease data, generate a knowledge base, and deploy the knowledge base on a graph database;

[0016] Use the "key-value" data format to store the data in the knowledge base to generate a knowledge graph knowledge base, wherein each piece of data in the knowledge base uses the disease name as the primary key and contains multiple relationship types and corresponding knowledge content;

[0017] Generate a correlation measure of all disease names and relationship type names in the knowledge graph knowledge base.

[0018] Preferably, the entity-relationship data is searched and processed in a preset knowledge graph knowledge base to generate knowledge content corresponding to the entity-relationship data, specifically:

[0019] Perform fuzzy search in the knowledge graph knowledge base according to the entity name, calculate the relevance measure of the entity name, and compare and score the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base respectively to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name;

[0020] Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

[0021] The present invention also discloses a medical knowledge answering device based on LLM, comprising:

[0022] An entity-relationship recognition unit, used to obtain a question text input by a user, and call a trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name;

[0023] A knowledge base fuzzy retrieval unit, used to perform retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data, and generate knowledge content corresponding to the entity-relationship data;

[0024] The answer generation unit is used to generate answers to questions based on the knowledge content.

[0025] Preferably, the knowledge base fuzzy retrieval unit is specifically used for:

[0026] Perform fuzzy search in the knowledge graph knowledge base according to the entity name, calculate the relevance measure of the entity name, and compare and score the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base respectively to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name;

[0027] Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

[0028] The present invention also discloses a medical knowledge answering device based on LLM, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a medical knowledge answering method based on LLM as described in any one of the above.

[0029] The present invention also discloses a readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the storage medium is located to implement a medical knowledge answering method based on LLM as described in any one of the above items.

[0030] In summary, the present embodiment provides a method, device, equipment and medium for answering medical knowledge based on LLM, which uses LLM to understand and analyze the question text, analyzes the subject (entity) and appeal (entity attributes or relationships) of the question, and then performs fuzzy search in the knowledge base based on the knowledge graph to find the answer to the question and answer it; therefore, the final answer to the question comes from the knowledge base content, and there will be no "illusion" and false content of LLM; the accuracy of the question analysis depends on the LLM's ability to understand the question text, and the quality of the answer depends on the content quality of the knowledge base. One of the problems that LLM is currently criticized for on the market is that "hallucinations" and misrepresentations of facts may appear from time to time in text generation. In medical applications, text generation that violates facts can lead to potential risks and errors. In this embodiment, when constructing a fine-tuned LLM model, the QLoRA method is used to fine-tune the basic LLM model under a preset computing power, wherein the model parameter amount of the basic LLM model is less than 10B (10 billion). This solves the problem that the LLM model in the prior art requires a large amount of data and computing power for training and deployment, and individuals or ordinary institutions can hardly afford the huge investment. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a flowchart of a medical knowledge answering method based on LLM provided in an embodiment of the present invention.

[0032] Figure 2 It is a module diagram of a medical knowledge answering device based on LLM provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0033] 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 in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0034] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0035] See also Figure 1The first embodiment of the present invention provides a medical knowledge answering method based on LLM, which can be executed by a medical knowledge answering device (hereinafter referred to as the answering device), and in particular, by one or more processors in the answering device to implement the following steps:

[0036] In this embodiment, the answering device may be a user terminal device (such as a smart phone, a smart computer or other smart devices), and the user terminal device may establish a communication connection with a cloud server to achieve data interaction.

[0037] Large language models are currently very popular. General LLM training and deployment requires a lot of data and computing power, but individuals or ordinary institutions can hardly afford such huge investments. In addition, one of the problems with LLM currently on the market is that "hallucinations" and misrepresentations of facts may appear from time to time in text generation. In medical applications, text generation that violates facts can lead to potential risks and errors.

[0038] S101, obtaining a question text input by a user, and calling a trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name;

[0039] Specifically, in this embodiment, the entity name is a disease name, and the entity relationship type is a disease-related knowledge type corresponding to the disease name.

[0040] In this embodiment, the user submits a question text, and the question-answering system answers the question based on the content of the question. The question type is to inquire about medical knowledge of a certain disease, for example: What medicine can be used to treat mercury poisoning? What is the probability of esophageal achalasia? What are the treatments for anterior spinal artery syndrome in children?

[0041] After the user submits the question, first, the input text is input into the fine-tuned LLM model to analyze the text and obtain the disease name (entity) in the question text and the disease-related knowledge type (entity relationship type) asked. Therefore, the LLM model "plays" an "entity-relationship" recognition model here to achieve the "entity-relationship" recognition task.

[0042] S102, performing a search process in a preset knowledge graph knowledge base according to the entity-relationship data to generate knowledge content corresponding to the entity-relationship data;

[0043] Specifically, step S102 includes: performing fuzzy retrieval in the knowledge graph knowledge base according to the entity name, calculating the relevance measure of the entity name, and comparing and scoring the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base, respectively, to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name;

[0044] Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

[0045] S103: Generate answers to questions based on the knowledge content.

[0046] Specifically, in this embodiment, the identified entity name is used to perform fuzzy search in the knowledge base. After the corresponding disease is retrieved, the identified entity relationship type is used to retrieve the corresponding knowledge content and return it as the answer. Overall process: question text, LLM model identification of "entity-relationship", knowledge base fuzzy search, question answer.

[0047] In this embodiment, the necessity of fuzzy search is that the disease name input by the user may not completely match the disease name in the knowledge base, and fuzzy search needs to be performed based on the text extracted by the LLM model; because the LLM model has the ability to generate text, even after fine-tuning the instruction training, the result returned by the model may not be the original text in the input text, and will be expanded or changed to a certain extent, and even the "illusion" that LLM is often criticized for. For example, the input question: Input: The probability of pneumonia being cured? The actual return of the model has multiple possibilities (Response represents a model output), which is mainly reflected in the difference in disease names:

[0048] Response:"Pneumonia_cure rate is"

[0049] Response: Type 2 serotonin receptor antibody deficiency syndrome pneumonia - probability of cure

[0050] Response:1NF6 Pneumonia_Probability of cure

[0051] Response: Pneumonia_The cure rate is...

[0052] The fuzzy retrieval method is based on the text relevance algorithm, and the process is as follows: when creating the knowledge base, the relevance measures of all disease names (primary keys) and relationship type names in the knowledge base are pre-generated; when the model returns the recognized disease names and relationship type names, the relevance measures are calculated for the recognition results, and compared and scored with the relevance of the disease names and relationship type names in the knowledge base respectively. The items with the highest scores are considered to be the content closest to the user's question; using the disease names and relationship type names with the highest scores, the corresponding knowledge content is retrieved in the knowledge base and returned as the answer to the question.

[0053] The text relevance algorithm is: the optional text relevance algorithms include TF-IDF, BM25, N-gram, and algorithms based on vector distance; the medical knowledge answering method based on LLM uses the BM25 algorithm. For example, the following are the results returned by the model 3 times:

[0054] Response:"Pneumonia_cure rate is"

[0055] Response: Type 2 serotonin receptor antibody deficiency syndrome pneumonia - probability of cure

[0056] Response: Pneumonia_The cure rate is...

[0057] After BM25 calculation and matching, it can be matched as: Pneumococcal pneumonia_cure rate

[0058] In this embodiment, the LLM-based medical knowledge answering method uses LLM to understand and analyze the question text, analyzes the subject (entity) and appeal (entity attributes or relationships) of the question, and then performs a fuzzy search in the knowledge base based on the knowledge graph to find the answer to the question and answer it. Therefore, the final answer to the question comes from the content of the knowledge base, and there will be no "illusion" and inaccurate content of LLM. The accuracy of the question analysis depends on the LLM's ability to understand the question text, and the quality of the answer depends on the content quality of the knowledge base.

[0059] In a possible embodiment of the present invention, before calling the trained fine-tuned LLM model to analyze and process the question text, the method further includes:

[0060] Automatically construct and process the preset knowledge graph knowledge base, preset multiple different questions for each relationship type of the disease name, and generate an instruction training data set;

[0061] Construct a basic LLM model, and use the QLoRA method to fine-tune the basic LLM model under a preset computing power, wherein the model parameter amount of the basic LLM model is less than 10B;

[0062] Fine-tune the basic LLM model according to the instruction training data set to generate a fine-tuned LLM model.

[0063] Specifically, in this embodiment, for the problem that LLM (Large Language Model 1) training and deployment require a large amount of data and computing power, and individuals or ordinary institutions can hardly afford the huge investment, the medical knowledge answering method based on LLM takes a different approach, using LLM with a smaller parameter amount (usually <1OB), and can use the QLoRA method to fine-tune the pre-trained LLM model under limited computing power (for example, GPU video memory <= 24GB), which can achieve specific tasks and can be deployed locally. In short, the LLM model fine-tuning requires that it can be carried out with limited computing power, and the GPU video memory is not greater than 24GB; the system deployment requires that it can be deployed locally, not relying on cloud models or services, and minimizing the hardware requirements for local deployment.

[0064] In this embodiment, the LLM basic model uses an open source Chinese pre-trained language model; in order to minimize the hardware requirements for local deployment, the target is set to an LLM model with a model parameter volume of less than 10 billion (10B). The optional models are: ChatGLM-6B, ChatGLM2-6B, Chinese-AI paca-7B, Baichuan-7B, BELLE-7B, etc.; the LLM-based medical knowledge answering method uses the Chinese-AI paca-7B Chinese pre-trained language model.

[0065] Model fine-tuning (Fi netune) here refers to retraining a pre-trained language model using a specific dataset to improve performance in a specific capability. Model fine-tuning itself is also model training. Traditional full parameter fine-tuning methods require the use of computing resources similar to those used for model pre-training. The computing power requirements for full parameter fine-tuning are usually relatively high. For example, fine-tuning a 65B-scale model requires more than 780GB of video memory and at least 10 A100 GPUs with 80GB of video memory (each A100 costs about $15,000). In order to reduce the computing power usage of model fine-tuning, a variety of parameter efficiency fine-tuning methods have been proposed.

[0066] There are two commonly used model fine-tuning methods. The first one, LoRA method, is an efficient fine-tuning method proposed by Microsoft. The basic principle is to freeze the pre-trained model weight parameters. When the original model parameters are frozen, additional network layers are added to the model and only the newly added network layer parameters are trained. Since the number of these newly added parameters is small, not only the cost of fine-tuning is significantly reduced, but also the effect similar to full model fine-tuning can be achieved.

[0067] The second method, QLoRA, is a fine-tuning method proposed by scholars from the University of Washington. While using the LoRA method, a low-precision storage data type (4-bit Normal Float) is used to compress the pre-trained language model, further reducing the computing cost of fine-tuning. For example, fine-tuning a 65B-scale model only requires 48GB of video memory. The LLM-based medical knowledge answering method uses the QLoRA method to fine-tune the model. Considering the batch_size during training and the maximum width of the input text, the GPU video memory does not exceed 24GB.

[0068] In a possible embodiment of the present invention, before performing a search process in a preset knowledge graph knowledge base according to the entity-relationship data, the method further includes:

[0069] Acquire multiple sets of historical disease data, generate a knowledge base, and deploy the knowledge base on a graph database;

[0070] Use the "key-value" data format to store the data in the knowledge base to generate a knowledge graph knowledge base, wherein each piece of data in the knowledge base uses the disease name as the primary key and contains multiple relationship types and corresponding knowledge content;

[0071] Generate a correlation measure of all disease names and relationship type names in the knowledge graph knowledge base.

[0072] Specifically, in this embodiment, the best deployment of the knowledge base should be deployed on a graph database (e.g. Neo4j), which can give full play to the convenience and data richness of graph-based entity-relationship retrieval. In the LLM-based medical knowledge answering method, in order to simplify the implementation, the "key-value" data format is used to store the knowledge base data. Each piece of data uses the disease name as the primary key and contains several relationship types and corresponding knowledge content. For example:

[0073] {

[0074] "Mercury poisoning": {

[0075] "Disease description": "Mercury is a white liquid metal that evaporates easily at room temperature. Chronic mercury poisoning is common and occurs mainly during production activities. It enters the human body through the respiratory tract in the form of vapor...",

[0076] "Prevention and treatment": "Mercury poisoning can be treated with drugs such as sodium dimercaptopropane sulfonate or sodium dimercaptosuccinate. Mild chronic mercury poisoning can be cured, and patients do not have to worry too much. Comprehensive preventive measures should be adopted to replace mercury with non-toxic or low-toxic raw materials...",

[0077] "Cause": "Because mercury is highly fluid and easily evaporates at room temperature, mercury poisoning is a common occupational poisoning. It mainly occurs from long-term inhalation of mercury vapor or mercury compound dust during production. Industrial poisoning is seen in mercury mining, amalgam smelting, gold and silver extraction, etc....",

[0078] "Symptoms": ["Face shock due to mercury toxicity", "diarrhea", "brown light reflex in the anterior chamber of the lens", "abdominal pain", "swollen gums", "dizziness", "nausea", "feeling drunken", "blushing"],

[0079] "Probability of illness": "0.003%",

[0080] "Susceptible population": "Workers who have a high chance of being exposed to mercury"

[0081] "Infectious": "Not Infectious",

[0082] "Complications": ["renal failure"],

[0083] "Department": ["Emergency Department"],

[0084] "Treatment" : ["drug therapy", "supportive care"],

[0085] "Treatment period": "10 days",

[0086] "Cure rate": "30%",

[0087] "Examination and testing": ["renal function test", "blood routine test", "serum mercury (Hg)", "biochemical test", "urine mercury (Hg)", "whole blood mercury"],

[0088] "Foods to eat": ["Sesame", "Pumpkin seeds", "Chestnuts (cooked)", "Sunflower seeds"],

[0089] "Taboo Food": ["White Lentils", "Lard", "Pork Ribs", "Pork Tenderloin"],

[0090] "Recommended recipes": ["Five-shred cabbage rolls", "Yuzhu cabbage", "Salted cabbage with tripe", "Salted cabbage with shredded radish", "Chrysanthemum, cabbage and tofu soup", "Stir-fried cabbage with dried shreds", "Salted cabbage with pork liver", "Painted cabbage"],

[0091] "Available drugs": ["Bumetanide tablets", "Eleven-flavor golden pills", "Bumetanide for injection", "Furosemide for injection", "Lidocaine hydrochloride injection", "Sodium thiosulfate for injection", "Dayuejing pills", "Renqingmangjue", "Rat nerve growth factor for injection", "Dexamethasone sodium phosphate injection"]

[0092] }

[0093] }

[0094] In this embodiment, the instruction training data set is used to fine-tune the basic model. The purpose of using "instructions" is to allow the fine-tuned model to respond to specific instructions as required. For example, in our question-answering process, we hope that the model can perform entity-relationship recognition according to instructions without directly answering questions. The format of the instruction training set is as follows. Among them: instruct i on is the instruction, and the instruction for each data is the same; input is the input question text; output is the result (entity name relationship type) expected to be returned by the model. Examples are as follows:

[0095] {

[0096] "i nstruct i on":"You are now in the medical problem entity relationship recognition model. You need to identify the disease entity name and relationship type in the problem. If there is a result, return 'Disease Name Relationship Type'. If there is no result, answer 'No'. Relationship types include: disease description, cause, prevention, symptom manifestation, susceptible population, infectiousness, probability of disease, complications, department, treatment method, treatment cycle, cure rate, examination and testing, available drugs, suitable food, taboo food, and recommended recipes.",

[0097] "i nput":"Question: What foods should not be eaten after suffering from mercury poisoning?",

[0098] "output":"Mercury poisoning_prohibited food"

[0099] }

[0100] The content of the instruction training data set is automatically constructed using the knowledge base. The method is: for each relationship type of the primary key (disease name), preset several different questions. For example, for "taboo food", you can preset questions: What food can't you eat after you get {disease name}? What are the dietary taboos for patients with {disease name}? After replacing {disease name} as the primary key, you can generate the corresponding questions as input; the primary key and the relationship type name are connected with an underscore "_" to form the output. For example: "Mercury poisoning_taboo food". Repeat the above for all primary keys and relationship types of the entire knowledge base, and you can construct the instruction training data set.

[0101] When fine-tuning the model, the instruction and input are concatenated as the model input, and the output of the trained model is the output. After the model is fine-tuned, during model inference, the content of the instruction is concatenated before the question text entered by the user as the model input, allowing the model to predict the output content.

[0102] The question-answering example of the medical knowledge answering method based on LLM is as follows, where Input is the input question; Response is the model return; MedKG Response is the answer returned by the knowledge base:

[0103] Question and answer example 1:

[0104] Input: What is the probability of pneumonia being cured?

[0105] Response: Pneumonia_The cure rate is...

[0106] MedKG Response: Klebsiella pneumonia cure rate: 68%

[0107] Question and answer example 2:

[0108] Input: What is the probability of getting pneumonia?

[0109] Response: Pneumonia_Possibility

[0110] MedKG Response: Probability of Klebsiella pneumonia: 0.0002%

[0111] Question and answer example 3:

[0112] I nput: What medicine should I take for pneumonia?

[0113] Response: Pneumonia_Medication"

[0114] MedKG Response: Pneumococcal pneumonia_Medications: Ampicillin capsules, Cefuroxime capsules, Tongxuan Lifei pills, Amoxicillin granules, Cefaclor granules, Levofloxacin hydrochloride capsules, Cephalexin capsules, Erythromycin tablets, Gekedingchuan pills, Acetylspiramycin tablets, Cefazolin sodium for injection, Cefixime granules, Cefixime dispersible tablets, Fluconazole capsules, Midecamycin tablets, Sparfloxacin dispersible tablets, Cefprozil dispersible tablets, Shedanchuanbei liquid, Cefuroxime dispersible tablets, Levofloxacin lactate tablets

[0115] Question and answer example 4:

[0116] Input: What foods should you not eat if you have pneumonia?

[0117] Response:12345678 Pneumonia-Taboo Food

[0118] MedKG Response: Foods that are contraindicated for Klebsiella pneumonia: Houttuynia cordata, onion, coriander, and chili peppers (green and pointed)

[0119] Question and answer example 5:

[0120] I nput:How to prevent gastroenteritis?

[0121] Response: Gastroenteritis - Prevention and Treatment

[0122] MedKG Response: Prevention and treatment of gastroenteritis: 1. Eat regularly, eat at regular times and in fixed quantities, and never overeat. 2. Pay attention to food hygiene, eat less irritating foods, and avoid drinking and smoking. 3. Keep a happy spirit.

[0123] In summary, the medical knowledge answering method based on LLM uses a medical knowledge question-and-answer system based on a large language model that minimizes hardware requirements, adopts a method of building an instruction training set based on a knowledge base, and a method of performing fuzzy retrieval on the knowledge base. Question answers are based on the knowledge base, and the answer content will not have the problem of LLM generating false content. The LLM model has a relatively good adaptability to question input. For example, different expressions of the same question can be recognized as the same return: How to treat influenza? How to treat influenza? How to treat influenza? The model returns: influenza_treatment method. At the same time, the medical knowledge answering method based on LLM can dynamically expand the content of the knowledge base and increase the number of questions answered. The hardware requirements for local deployment are minimized, and the computing power requirements for model fine-tuning are minimized.

[0124] See also Figure 2 The second embodiment of the present invention provides a medical knowledge answering device based on LLM, comprising:

[0125] The entity-relationship identification unit 201 is used to obtain the question text input by the user, and call the trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name;

[0126] A knowledge base fuzzy retrieval unit 202 is used to perform retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data to generate knowledge content corresponding to the entity-relationship data;

[0127] The answer generation unit 203 is used to generate an answer to the question according to the knowledge content.

[0128] Preferably, the knowledge base fuzzy retrieval unit 202 is specifically used for:

[0129] Perform fuzzy search in the knowledge graph knowledge base according to the entity name, calculate the relevance measure of the entity name, and compare and score the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base respectively to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name;

[0130] Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

[0131] The third embodiment of the present invention provides a medical knowledge answering device based on LLM, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a medical knowledge answering method based on LLM as described in any one of the above.

[0132] The fourth embodiment of the present invention provides a readable storage medium storing a computer program, wherein the computer program can be executed by a processor of a device where the storage medium is located to implement a medical knowledge answering method based on LLM as described in any one of the above.

[0133] Exemplarily, the computer program described in the third and fourth embodiments of the present invention can be divided into one or more modules, and the one or more modules are stored in the memory and executed by the processor to complete the present invention. The one or more modules can be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program in the medical knowledge answering device based on LLM. For example, the device described in the second embodiment of the present invention.

[0134] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the medical knowledge answering method based on LLM, and uses various interfaces and lines to connect the various parts of the entire medical knowledge answering method based on LLM.

[0135] The memory can be used to store the computer program and / or module, and the processor realizes various functions of a medical knowledge answering method based on LLM by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, a text conversion function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, text message data, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Medical Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0136] Wherein, if the implemented module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0137] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0138] The above are only preferred implementations of the present invention. The protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention.

Claims

1. A medical knowledge answering method based on LLM, It is characterized in that include: Obtaining a question text input by a user, and calling a trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name; Performing retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data to generate knowledge content corresponding to the entity-relationship data; Generate answers to questions based on the knowledge content.

2. According to the medical knowledge answering method based on LLM described in claim 1, It is characterized in that The entity name is a disease name, and the entity relationship type is a disease-related knowledge type corresponding to the disease name.

3. According to the medical knowledge answering method based on LLM in claim 2, It is characterized in that Before calling the trained fine-tuned LLM model to analyze and process the question text, the method further includes: Automatically construct and process the preset knowledge graph knowledge base, preset multiple different questions for each relationship type of the disease name, and generate an instruction training data set; Construct a basic LLM model, and use the QLoRA method to fine-tune the basic LLM model under a preset computing power, wherein the model parameter amount of the basic LLM model is less than 10B; Fine-tune the basic LLM model according to the instruction training data set to generate a fine-tuned LLM model.

4. According to the medical knowledge answering method based on LLM in claim 2, It is characterized in that Before performing retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data, it also includes: Acquire multiple sets of historical disease data, generate a knowledge base, and deploy the knowledge base on a graph database; Use the "key-value" data format to store the data in the knowledge base to generate a knowledge graph knowledge base, wherein each piece of data in the knowledge base uses the disease name as the primary key and contains multiple relationship types and corresponding knowledge content; Generate a correlation measure of all disease names and relationship type names in the knowledge graph knowledge base.

5. According to the medical knowledge answering method based on LLM described in claim 4, It is characterized in that According to the entity-relationship data, a search process is performed in a preset knowledge graph knowledge base to generate knowledge content corresponding to the entity-relationship data, specifically: Perform fuzzy search in the knowledge graph knowledge base according to the entity name, calculate the relevance measure of the entity name, and compare and score the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base respectively to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name; Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

6. A medical knowledge answering device based on LLM, It is characterized in that include: An entity-relationship recognition unit, used to obtain a question text input by a user, and call a trained fine-tuned LLM model to analyze and process the question text to generate entity-relationship data, wherein the entity-relationship data includes an entity name and an entity relationship type corresponding to the entity name; A knowledge base fuzzy retrieval unit, used to perform retrieval processing in a preset knowledge graph knowledge base according to the entity-relationship data, and generate knowledge content corresponding to the entity-relationship data; The answer generation unit is used to generate answers to questions based on the knowledge content.

7. According to claim 5, a medical knowledge answering device based on LLM, It is characterized in that The knowledge base fuzzy retrieval unit is specifically used for: Perform fuzzy search in the knowledge graph knowledge base according to the entity name, calculate the relevance measure of the entity name, and compare and score the relevance measures of the disease name and the relationship type name in the knowledge graph knowledge base respectively to determine the disease corresponding to the entity name, wherein the item with the highest score value is the disease corresponding to the entity name; Retrieval processing is performed according to the entity relationship type and the determined disease to generate knowledge content corresponding to the entity-relationship data.

8. A medical knowledge answering device based on LLM, It is characterized in that It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements a medical knowledge answering method based on LLM as described in any one of claims 1 to 5.

9. A readable storage medium, It is characterized in that A computer program is stored, and the computer program can be executed by a processor of the device where the storage medium is located to implement a medical knowledge answering method based on LLM as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Medical text named entity identification method based on multipath recall

    CN111160023A

  • Cardiovascular and cerebrovascular knowledge map questioning and answering method based on electronic medical records

    CN112002411A

  • Medical question-answering system construction method based on language model and entity matching

    CN112667799A

  • Transform-based large model knowledge graph representation method

    CN115357728A

  • Disease question-answering method, system and device based on knowledge graph and storage medium

    CN115438162A