Medical question answering method and device based on large language model

By constructing a binary graph of disease and disease characteristics in the intelligent dialogue system, determining the candidate diseases related to disease characteristics entered by the user and inputting them into a large language model, the problem of insufficient accuracy in medical consultation is solved, and the intelligent dialogue system is improved System adaptability and response accuracy.

CN118410156BActive Publication Date: 2024-11-05ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410888561.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-11-05
Estimated Expiration
2044-07-03

AI Technical Summary

Technical Problem

In the field of medical consultation, intelligent dialogue systems rely on static corpus knowledge, resulting in insufficient accuracy and low adaptability and response accuracy in answering complex or specific medical questions.

Method used

Using a binary graph-based method, by constructing the correlation relationship between disease and disease characteristics, feature extraction and probability calculation are performed, candidate diseases are determined, and the confirmed disease is input into a large language model to generate answers.

Benefits of technology

Improves the adaptability and responsiveness of the intelligent dialogue system, allowing it to combine generalized knowledge and specific knowledge when generating answers to provide more accurate medical consultation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410156B_ABST
    Figure CN118410156B_ABST
Patent Text Reader

Abstract

One or more embodiments of the present application provide a medical question-and-answer method and apparatus based on a large language model, the method comprising: obtaining a query text input by a user, and performing feature extraction on the query text to extract a query disease feature set from the query text; determining a set of candidate diseases related to the query disease feature set based on a bipartite graph used to represent the association between the disease and the disease feature, and calculating the probability of being diagnosed as each candidate disease when having the query disease feature; determining a confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease feature; inputting the confirmed disease into the large language model so that the large language model generates an answer text based on the confirmed disease, and outputting the answer text to the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present application relate to the field of artificial intelligence technology, and in particular, to a medical question-answering method and device based on a large language model. Background Art

[0002] Nowadays, intelligent dialogue systems are widely used in many fields such as customer service, legal aid, online education, medical consultation, etc. Taking the rapidly developing field of medical consultation as an example, intelligent dialogue systems have become a key tool for improving the quality and efficiency of medical services. Intelligent dialogue systems provide consulting services to patients by simulating human communication methods, including disease diagnosis, treatment recommendations, and drug instructions.

[0003] An intelligent dialogue system is an interactive system developed using artificial intelligence technology. It is designed to understand and answer questions raised by users in natural language and generate concise and clear answers. Intelligent dialogue systems are usually based on large language models (LLMs), which understand and answer questions raised by users and generate corresponding answers. Intelligent dialogue systems in the field of medical consultation mainly rely on the knowledge acquired by the large language model during the training process by learning static medical-related corpora. Due to the limitations of this knowledge, the system may appear to be inaccurate and unreliable when answering complex or specific medical questions. In other words, this reliance on static corpora limits the adaptability and response accuracy of intelligent dialogue systems. Summary of the invention

[0004] One or more embodiments of the present application provide the following technical solutions:

[0005] The present application provides a medical question answering method based on a large language model, the method comprising:

[0006] Obtaining a query text input by a user, and performing feature extraction on the query text to extract a query disease feature set from the query text;

[0007] Based on a bipartite graph, a set of candidate diseases related to the query disease feature set is determined, and the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set is calculated; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature;

[0008] Determining a confirmed disease from the set of candidate diseases based on the probability of being diagnosed as each candidate disease when having the query disease characteristics;

[0009] The confirmed disease is input into a large language model so that the large language model generates an answer text based on the confirmed disease, and the answer text is output to the user.

[0010] The present application also provides a medical question-answering device based on a large language model, the device comprising:

[0011] An extraction module, which obtains a query text input by a user and performs feature extraction on the query text to extract a query disease feature set from the query text;

[0012] A calculation module, based on a bipartite graph, determines a set of candidate diseases related to the query disease feature set, and calculates the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature;

[0013] A determination module, which determines a confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease characteristics;

[0014] A generating module inputs the confirmed disease into the large language model so that the large language model generates an answer text based on the confirmed disease, and outputs the answer text to the user.

[0015] The present application also provides an electronic device, comprising:

[0016] processor;

[0017] a memory for storing processor-executable instructions;

[0018] The processor implements the steps of any of the above methods by running the executable instructions.

[0019] The present application also provides a computer-readable storage medium having computer instructions stored thereon, which implement the steps of any of the above methods when executed by a processor.

[0020] In the above technical solution, a bipartite graph for representing the association relationship between diseases and disease features can be pre-constructed, the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set and a vertex subset corresponding to the disease feature set, the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set and the vertices corresponding to the target disease feature in the disease feature set, and the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature; subsequently, firstly, when the query text input by the user is obtained, feature extraction can be performed on the query text to extract the query disease feature set from the query text, and then based on the bipartite graph, a candidate disease set related to the query disease feature set can be determined, and the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set can be calculated, and then based on the calculated probability, a confirmed disease can be determined from the candidate disease set, and finally the confirmed disease can be input into a large language model, so that the large language model generates an answer text based on the confirmed disease, and the answer text is output to the user.

[0021] By adopting the above method, when answering questions raised by users, the intelligent dialogue system no longer relies solely on the knowledge acquired by the large language model in the training process by learning static corpus, but can also combine the knowledge retrieved in the bipartite graph used to represent the association between diseases and disease characteristics. That is, the confirmed disease determined by retrieving the bipartite graph for the disease characteristics contained in the query text input by the user can be integrated into the real input of the large language model, so that the large language model can consider its inherent generalized knowledge and the specific knowledge obtained from the bipartite graph when generating the answer text corresponding to the query text. Therefore, the adaptability and response accuracy of the intelligent dialogue system can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The following is a description of the accompanying drawings required for describing the exemplary embodiments, wherein:

[0023] Figure 1It is a schematic diagram of an intelligent dialogue system shown in an exemplary embodiment of the present application.

[0024] Figure 2 It is a flowchart of a bipartite graph construction method shown in an exemplary embodiment of the present application.

[0025] Figure 3 It is a schematic diagram of a bipartite graph shown in an exemplary embodiment of the present application.

[0026] Figure 4 It is a flowchart of a medical question-answering method based on a large language model shown as an exemplary embodiment of the present application.

[0027] Figure 5 It is a flowchart of another medical question-answering method based on a large language model shown as an exemplary embodiment of the present application.

[0028] Figure 6 It is a structural schematic diagram of a device shown in an exemplary embodiment of the present application.

[0029] Figure 7 It is a block diagram of a medical question-and-answer device based on a large language model, shown as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0030] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description relates to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present application. On the contrary, they are only examples consistent with some aspects of one or more embodiments of the present application.

[0031] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this application. In some other embodiments, the steps included in the method may be more or less than those described in this application. In addition, a single step described in this application may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this application may also be combined into a single step for description in other embodiments.

[0032] In the field of medical consultation, intelligent dialogue systems have become a key tool for improving the quality and efficiency of medical services. Intelligent dialogue systems provide consulting services to patients by simulating human communication methods, including disease diagnosis, treatment recommendations, and drug instructions.

[0033] An intelligent dialogue system is an interactive system developed using artificial intelligence technology. It is designed to understand and answer questions raised by users in natural language and generate concise and clear answers. Intelligent dialogue systems are usually based on a large language model, which understands and answers questions raised by users and generates corresponding answers.

[0034] A large language model is a deep learning model trained with a large amount of text data, which can be used to generate natural language text or understand the meaning of natural language text. A large language model can handle a variety of natural language tasks, such as text classification, named entity recognition, question answering, dialogue, etc., and is an important path to artificial intelligence.

[0035] In the field of natural language processing, large-scale text data sets are usually referred to as corpuses. Corpuses can contain various types of text data, such as literary works, academic papers, legal documents, news reports, daily conversations, emails, online forum posts, etc. By learning the text data in the corpus, large language models can obtain and understand the laws and patterns of natural language, thereby achieving effective processing and generation of human language.

[0036] Large language models usually use the Transformer architecture, that is, large language models are usually deep learning models based on the Transformer architecture. Deep learning models based on the Transformer architecture are a type of neural network model that uses the Transformer architecture. This model performs well in fields such as natural language processing.

[0037] Transformer is a neural network model used for sequence-to-sequence modeling. Transformer does not need to rely on recursive structures, can parallelize training and reasoning, and speed up model processing. In deep learning models based on the Transformer architecture, a multi-layer Transformer encoder is usually used to extract features from the input sequence, and a Transformer decoder is used to convert the extracted features into an output sequence. At the same time, such models usually also use a self-attention mechanism to capture long-distance dependencies in the input sequence, and use residual connections and regularization methods to accelerate training and improve model performance.

[0038] A pre-trained model is a large language model that is pre-trained on large-scale unlabeled text data. A pre-trained model is a general model that is not designed and optimized for a specific task. In order to adapt the pre-trained model to specific application scenarios and task requirements, fine-tuning is required to improve the performance of the model on specific tasks. The large language model that is finally put into use is usually a model that is further fine-tuned on the basis of the pre-trained model and is a supervised learning model based on labeled text data. Pre-training and fine-tuning are complementary processes. Pre-training enables the model to have a wide range of language understanding capabilities, while fine-tuning makes the model more professional and accurate in specific tasks.

[0039] That is, the training process of a large language model can be divided into two stages: pre-training and fine-tuning. In the pre-training stage, unsupervised learning (e.g., self-supervised learning) can be used to perform pre-training on large-scale, unlabeled text data sets (e.g., online encyclopedias, online articles, books, etc.). Specifically, the missing part or the next word can be predicted based on the context, and statistical laws and language structures such as semantics and syntax can be learned. The prediction loss can be minimized through back-propagation and optimization algorithms (e.g., gradient descent), and model parameters can be iteratively updated to gradually improve the model's ability to understand language. In the fine-tuning stage, you can select corresponding supervised learning tasks (for example, text classification, named entity recognition, question-answering system, dialogue system, etc.) according to the specific application scenarios and task requirements, and prepare task-specific text datasets, so that you can use the pre-trained model as the starting point for fine-tuning, and use supervised learning to perform fine-tuning training on the task-specific text dataset. Specifically, you can perform the task based on the text dataset, and minimize the loss used to measure the performance of the model in processing specific tasks through back propagation and optimization algorithms (for example, gradient descent method), iteratively update the model parameters, and gradually improve the performance of the model on specific tasks.

[0040] It should be noted that the pre-trained large language model is usually called the base model of the large language model, and the fine-tuned large language model is called the service model of the large language. The language understanding ability learned by the large language model in the pre-training and fine-tuning stages enables the large language model to understand, analyze and integrate text information, perform logical inference, knowledge reasoning or problem solving when faced with complex problems or tasks. This ability is usually called the reasoning ability of the large language model.

[0041] Large language models usually perform specific tasks under the guidance of prompt text (which can be called prompt). Prompt text is an initial text or text fragment provided to the large language model, which is intended to stimulate the model to produce corresponding output. Through the prompt text, you can clearly tell the large language model what task you expect it to perform, such as: answering a question, simulating a conversation, writing an article, translating text, etc. At the same time, the prompt text can provide the large language model with the necessary background information and context, so that the large language model can understand the logic, style, theme or position that should be followed when generating content. In addition, the prompt text can also stimulate the large language model to show its inherent knowledge reserves or specific language capabilities, such as: explaining complex concepts, citing regulations, imitating the writing style of a specific writer, etc.

[0042] Intelligent dialogue systems in the field of medical consultation mainly rely on the knowledge acquired by the large language model during the training process by learning static medical-related corpus. Due to the limitations of this knowledge, the system may appear to be inaccurate and unreliable when answering complex or specific medical questions, that is, hallucination problems may occur. The hallucination problem refers to the fact that the content generated by the large language model looks very reasonable and coherent, and sometimes even imitates human emotions and thinking patterns, creating an illusion of "understanding" the input content, but in fact, this content is inaccurate or misleading. In other words, this reliance on static corpus limits the adaptability and response accuracy of the intelligent dialogue system.

[0043] In addition, large language models are good at one-to-one knowledge memory, for example: China's capital is Beijing, but not good at many-to-many knowledge memory, for example: a symptom may appear in multiple diseases, and a disease has multiple symptoms. The essential reason is that there are too many permutations and combinations of knowledge, the number and probability of co-occurrence of different knowledge are reduced, and the number and probability of co-occurrence of similar combinations are close, which makes it difficult for large language models to accurately infer the answer to the question. When using intelligent dialogue systems in the field of medical consultation for diagnosis and treatment, due to the many-to-many relationship between diseases and symptoms, the hallucination problem will be more serious, resulting in further reduction of the adaptability and response accuracy of the intelligent dialogue system, which greatly affects the user experience of the intelligent dialogue system.

[0044] One or more embodiments of the present application provide a technical solution for medical question answering based on a large language model, in which a bipartite graph for representing the association relationship between diseases and disease features can be pre-constructed, the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set and a vertex subset corresponding to the disease feature set, the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set and the vertices corresponding to the target disease feature in the disease feature set, the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed with the target disease when having the target disease feature; subsequently, first, after obtaining the target disease feature, In the case of a query text input by a user, feature extraction is performed on the query text to extract a query disease feature set from the query text, and then a candidate disease set related to the query disease feature set can be determined based on the bipartite graph, and the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease features in the query disease feature set is calculated, and then based on the calculated probabilities, a confirmed disease can be determined from the candidate disease set, and finally the confirmed disease can be input into a large language model, so that the large language model can generate an answer text based on the confirmed disease, and the answer text is output to the user.

[0045] By adopting the above method, when answering questions raised by users, the intelligent dialogue system no longer relies solely on the knowledge acquired by the large language model in the training process by learning static corpus, but can also combine the knowledge retrieved in the bipartite graph used to represent the association between diseases and disease characteristics. That is, the confirmed disease determined by retrieving the bipartite graph for the disease characteristics contained in the query text input by the user can be integrated into the real input of the large language model, so that the large language model can consider its inherent generalized knowledge and the specific knowledge obtained from the bipartite graph when generating the answer text corresponding to the query text. Therefore, the adaptability and response accuracy of the intelligent dialogue system can be improved.

[0046] Please refer to Figure 1 , Figure 1 It is a schematic diagram of an intelligent dialogue system shown in an exemplary embodiment of the present application.

[0047] like Figure 1 As shown, the above intelligent dialogue system may include a server and at least one client accessing the server through any type of wired or wireless network.

[0048] Among them, the above-mentioned server can correspond to a server including an independent physical host, or it can be a server cluster composed of multiple independent physical hosts; or it can correspond to a virtual server, cloud server, etc. carried by a host cluster.

[0049] The above-mentioned client may correspond to terminal devices such as smart phones, tablet computers, laptops, desktop computers, PCs (Personal Computers), PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), smart car devices or game consoles.

[0050] The user can use the intelligent question-and-answer service provided by the intelligent dialogue system through the client; the client and the server can implement the user-oriented intelligent question-and-answer service through data interaction between each other.

[0051] For example, the client can output a corresponding user interface to the user, so that the user can perform operations such as inputting query text (which can be called Query) and uploading documents or pictures used to assist in query in the user interface, so as to ask questions to the intelligent dialogue system and use the intelligent question-and-answer service provided by the intelligent dialogue system. The client can send the query text input by the user to the server, and the server will generate a corresponding answer text (which can be called Answer) for the query text and output the answer text to the user, that is, return the answer text to the client, and the client will display the answer text to the user through the user interface so that the user can view the corresponding answer generated by the intelligent dialogue system, thereby realizing a user-oriented intelligent question-and-answer service.

[0052] Specifically, the server can be equipped with a large language model, and the intelligent dialogue system can be based on the large language model, and the large language model can understand and answer the query text input by the user and generate an answer text corresponding to the query text. It should be noted that the large language model at this time can refer to the service model of the large language model.

[0053] In practical applications, the constructed large language model can be pre-trained on a large-scale, unlabeled text dataset using an unsupervised learning approach to obtain a basic model of the large language model. Furthermore, the dialogue task can be used as a supervised learning task during fine-tuning training, and a text dataset specific to the dialogue task can be prepared, so that the basic model of the large language model can be used as the starting point for fine-tuning, and fine-tuning training can be performed on a text dataset specific to the dialogue task using a supervised learning approach to obtain a serving model of the large language model.

[0054] In addition, the above-mentioned server can also be equipped with other functional components or functional subsystems, such as feature extraction components, bipartite graph retrieval components, prompt text generation components, etc. These components or subsystems can work together with the large language model installed on the server to jointly generate answer text corresponding to the query text input by the user.

[0055] In order to improve the adaptability and response accuracy of the above intelligent dialogue system, the above server can also be equipped with a bipartite graph. The bipartite graph can be used to represent the relationship between diseases and disease characteristics (for example, symptoms, patient gender, patient age, etc.); the bipartite graph is external knowledge relative to the large language model installed on the server, that is, it is not the knowledge acquired by the large language model through learning during the training process, but serves as auxiliary data in the reasoning process of the large language model, assisting the large language model to generate the answer text corresponding to the query text input by the user.

[0056] The following describes the medical question-answering method based on a large language model provided by this application from two aspects: constructing a bipartite graph and combining the bipartite graph for diagnosis and treatment.

[0057] Construct a bipartite graph:

[0058] A bipartite graph, also known as a bipartite graph or an even graph, is a special model in graph theory. In graph theory, a graph is a structure composed of vertices and edges. A bipartite graph is a special type of graph with the following characteristics: the vertex set of a bipartite graph can be divided into two non-intersecting vertex subsets; in a bipartite graph, the two vertices connected by each edge must come from these two different sets, that is, no edge connects two vertices in the same set. In mathematical representation, if the vertex set V of a graph G can be divided into two non-intersecting vertex subsets U and W, that is, V = U∪W and U∩W = , and every edge (u,v) in the graph G satisfies u∈U and v∈W, or u∈W and v∈U, then the graph G is a bipartite graph.

[0059] It should be noted that an edge in a bipartite graph can represent that the two vertices connected by the edge are related to each other. Therefore, the association relationship between multiple diseases and multiple disease features can be represented by constructing a bipartite graph. That is, a bipartite graph for representing the association relationship between diseases and disease features can be constructed based on a disease set containing a certain number of diseases and a disease feature set containing a certain number of disease features. Among them, diseases are usually referred to by disease names (for example, prostate hyperplasia, kidney stones, ureteral stones, urinary tract infections, etc.); disease features can include not only symptoms closely related to the disease (specifically, symptom descriptions, such as frequent urination, urgency, dysuria, urinary pain, low back pain, etc.), but also gender (for example, male, female), age (specifically, the age group to which the age belongs), and other information that will affect the diagnosis of the disease to a certain extent. For example, men have a prostate, while women do not have a prostate. Therefore, when a male patient has the two symptoms of frequent urination and urgency, he may be diagnosed with prostate hyperplasia, but when a female patient has the two symptoms of frequent urination and urgency, he cannot be diagnosed with prostate hyperplasia. Therefore, gender will affect the diagnosis of prostate hyperplasia. In addition, according to actual needs, information such as medical history and examination reports can also be used as disease characteristics, and this application does not impose any special restrictions on this.

[0060] Specifically, when constructing a bipartite graph based on a disease set and a disease feature set, the vertex set consisting of the vertices corresponding to each disease in the disease set and the vertex set consisting of the vertices corresponding to each disease feature in the disease feature set can be used as two non-intersecting vertex subsets of the bipartite graph, and these two vertex subsets together constitute the vertex set of the bipartite graph; an edge in the bipartite graph can connect the vertex corresponding to a disease in the disease set and the vertex corresponding to a disease feature in the disease feature set.

[0061] It should be noted that the above-mentioned bipartite graph can be an undirected graph, that is, the edges in the bipartite graph have no directionality, and an undirected edge in the bipartite graph simply connects the vertex corresponding to a disease in the above-mentioned disease set and the vertex corresponding to a disease feature in the above-mentioned disease feature set. Alternatively, the bipartite graph can also be a directed graph, that is, the edges in the bipartite graph have directionality. In this case, the directed edges in the bipartite graph can be grouped, and a group of directed edges connecting the vertices corresponding to a disease in the above-mentioned disease set and the vertices corresponding to a disease feature in the above-mentioned disease feature set can include two directed edges, one of which points from the vertex corresponding to the disease to the vertex corresponding to the disease feature, and the other directed edge points from the vertex corresponding to the disease feature to the vertex corresponding to the disease.

[0062] Furthermore, each edge in the above bipartite graph may have its weight. In the bipartite graph, for the edge used to connect the vertices corresponding to a disease in the above disease set and the vertices corresponding to a disease feature in the above disease feature set, its weight may include a sub-weight for indicating the probability of being diagnosed with the disease when having the disease feature; in addition, its weight may also include a sub-weight for indicating the probability of having the disease feature when being diagnosed with the disease. In mathematical representation, for disease Di and disease feature Fj, the conditional probability P(Di|Fj) can be used as the probability of being diagnosed with disease Di when having disease feature Fj, that is, the probability of the event of being diagnosed with disease Di under the condition of the event of having disease feature Fj; and the conditional probability P(Fj|Di) can be used as the probability of having disease feature Fj when being diagnosed with disease Di, that is, the probability of the event of having disease feature Fj under the condition of the event of being diagnosed with disease Di.

[0063] It should be noted that, in an undirected bipartite graph, for an undirected edge connecting a vertex corresponding to a disease in the above disease set and a vertex corresponding to a disease feature in the above disease feature set, the weight of this undirected edge may include two sub-weights, namely, a sub-weight indicating the probability of being diagnosed with the disease when having the disease feature, and a sub-weight indicating the probability of having the disease feature when being diagnosed with the disease. In a directed bipartite graph, for a group of directed edges connecting a vertex corresponding to a disease in the above disease set and a vertex corresponding to a disease feature in the above disease feature set, the weight of this group of directed edges may include two sub-weights, in this group of directed edges, the weight of the directed edge from the vertex corresponding to the disease to the vertex corresponding to the disease feature may be the sub-weight indicating the probability of being diagnosed with the disease when having the disease feature, and the weight of the directed edge from the vertex corresponding to the disease feature to the vertex corresponding to the disease may be the sub-weight indicating the probability of having the disease feature when being diagnosed with the disease.

[0064] Please refer to Figure 2 , Figure 2 It is a flowchart of a bipartite graph construction method shown in an exemplary embodiment of the present application.

[0065] like Figure 2 As shown, the above bipartite graph construction method may include the following steps:

[0066] Step 202: Obtain a medical sample and input the medical sample into a large language model, and the large language model performs feature extraction on the medical sample to extract a disease set and a disease feature set from the medical sample.

[0067] In order to construct the above bipartite graph, a certain number of medical samples can be obtained. It should be noted that these medical samples usually record the disease characteristics of the patient and the disease diagnosed by the patient; for example, these medical samples can be open-source and anonymized medical records.

[0068] When the above-mentioned medical samples are obtained, feature extraction can be performed on each medical sample to extract diseases and disease features from each medical sample, and the extracted diseases constitute a disease set, and the extracted disease features constitute a disease feature set.

[0069] Specifically, each medical sample can be input into a large language model, and the large language model extracts diseases and disease features from each medical sample, and the extracted diseases form a disease set, and the extracted disease features form a disease feature set. It should be noted that the large language model at this time can refer to the service model of the large language model.

[0070] In practical applications, the above-mentioned large language model can be pre-trained on a large-scale, unlabeled text dataset using an unsupervised learning method to obtain a basic model of the large language model; further, the feature extraction task can be used as a supervised learning task during fine-tuning training, and a medical text dataset specific to the feature extraction task can be prepared, so that the basic model of the large language model can be used as the starting point for fine-tuning, and a supervised learning method can be used to perform fine-tuning training on a medical text dataset specific to the feature extraction task to obtain a service model of the large language model.

[0071] Take the medical record shown in Table 1 below as an example:

[0072] Table 1

[0073]

[0074] The diseases extracted from the medical records shown in Table 1 may include "pneumonia" and "chronic obstructive pulmonary disease", and the extracted disease features may include "male", "69 years old", "cough", "sputum", "shortness of breath", etc. Further, "69 years old" may be adjusted to "age range (60,70]".

[0075] Step 204: Count a first number of medical samples having the target disease characteristics among the medical samples; count a second number of medical samples diagnosed with the target disease among the medical samples; and count a third number of medical samples having the target disease characteristics among the medical samples and diagnosed with the target disease.

[0076] When the above-mentioned disease set and the above-mentioned disease feature set are extracted from the above-mentioned medical samples, for a certain disease in the disease set (which may be referred to as the target disease) and a certain disease feature in the disease feature set (which may be referred to as the target disease feature), the number of medical samples having the target disease feature among these medical samples (which may be referred to as the first number) may be counted, and the number of medical samples diagnosed as the target disease among these medical samples (which may be referred to as the second number) may be counted, and the number of medical samples having the target disease feature and diagnosed as the target disease among these medical samples may also be counted (which may be referred to as the third number).

[0077] Continuing with the medical record shown in Table 1 as an example, the medical record shows that the corresponding patient has disease characteristics such as "male", "age group (60,70]", "cough", "sputum", and "shortness of breath", and the patient is diagnosed with two diseases, "pneumonia" and "chronic obstructive pulmonary disease".

[0078] Step 206: Determine the ratio of the third number to the first number as the probability of being diagnosed with the target disease when having the target disease characteristics, and determine the ratio of the third number to the second number as the probability of having the target disease characteristics when being diagnosed with the target disease.

[0079] Subsequently, the ratio of the third number to the first number can be determined as the probability of being diagnosed with the target disease when having the target disease characteristics, and the ratio of the third number to the second number can be determined as the probability of having the target disease characteristics when being diagnosed with the target disease.

[0080] For example, for disease Di and disease feature Fj, CNT represents the total number of the above medical samples, CNT(Fj) represents the number of medical samples with disease feature Fj among these medical samples, CNT(Di) represents the number of medical samples diagnosed with disease Di among these medical samples, and CNT(DiFj) represents the number of medical samples with disease feature Fj and diagnosed with disease Di among these medical samples. Then: the probability of being diagnosed with disease Di when having disease feature Fj is P(Di|Fj) = P(DiFj) / P(Fj) = (CNT(DiFj) / CNT) / (CNT(Fj) / CNT) = CNT(DiFj) / CNT(Fj); the probability of being diagnosed with disease Di when having disease feature Fj is P(Fj|Di) = P(DiFj) / P(Di) = (CNT(DiFj) / CNT) / (CNT(Di) / CNT) = CNT(DiFj) / CNT(Di).

[0081] Step 208: construct the bipartite graph based on the disease set, the disease feature set, the probability of being diagnosed with the target disease when having the target disease feature, and the probability of having the target disease feature when being diagnosed with the target disease.

[0082] When the above-mentioned disease set, the above-mentioned disease feature set, the probability of being diagnosed with the above-mentioned target disease when having the above-mentioned target disease features, and the probability of having the above-mentioned target disease features when being diagnosed with the above-mentioned target disease are obtained, referring to the above-mentioned description of the bipartite graph, a bipartite graph for representing the association relationship between diseases and disease features can be constructed based on these data.

[0083] It should be noted that an offline calculation method can be used to complete the construction of a bipartite graph for representing the association relationship between diseases and disease characteristics.

[0084] Please refer to Figure 3 , Figure 3 It is a schematic diagram of a bipartite graph shown in an exemplary embodiment of the present application.

[0085] like Figure 3 As shown, the vertex set of the bipartite graph may include a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set. The disease set may include diseases such as "prostatic hyperplasia", "kidney stones", "ureteral stones", and "urinary tract infection", and the disease feature set may include disease features such as "age group X", "male", "dysuria", "painful urination", and "low back pain". The bipartite graph may be a directed graph, and a set of directed edges in the bipartite graph may connect a vertex corresponding to a disease in the disease set and a vertex corresponding to a disease feature in the disease feature set. The set of directed edges may include a directed edge from a vertex corresponding to the disease to a vertex corresponding to the disease feature, and a directed edge from a vertex corresponding to the disease feature to a vertex corresponding to the disease. Taking the edge in the bipartite graph used to connect the vertices corresponding to a disease in the disease set (which may be called the target disease) and the vertices corresponding to a disease feature in the disease feature set (which may be called the target disease feature) as an example, the target edge may essentially be a set of directed edges, in which the weight of the directed edge pointing from the vertex corresponding to the target disease to the vertex corresponding to the target disease feature may be a sub-weight indicating the probability of being diagnosed with the target disease when having the target disease feature, and the weight of the directed edge pointing from the vertex corresponding to the target disease feature to the vertex corresponding to the target disease may be a sub-weight indicating the probability of having the disease feature when diagnosed with the disease.

[0086] Combined with bipartite graph for diagnosis and treatment:

[0087] Please refer to Figure 4 , Figure 4 It is a flowchart of a medical question-answering method based on a large language model shown as an exemplary embodiment of the present application.

[0088] like Figure 4 As shown, the above-mentioned medical question answering method based on a large language model may include the following steps:

[0089] Step 402: Obtain the query text input by the user, and perform feature extraction on the query text to extract a query disease feature set from the query text.

[0090] In this embodiment, the user can enter a query text and expect to obtain an answer text corresponding to the query text. It should be noted that the query text entered by the user can be a text written by the user to describe the question that needs to be answered, or it can be a text included in a document uploaded by the user that needs to be explained or interpreted, etc. Specifically, the query text entered by the user can be a query text related to the diagnosis and treatment scenario, for example: a text for asking the cause of certain symptoms, a text for inquiring what disease a person with certain symptoms may be diagnosed with, etc.

[0091] In this case, the query text input by the user can be obtained, and feature extraction can be performed on the query text to extract disease features (which may be called query disease features) from the query text, and the extracted query disease features constitute a query disease feature set.

[0092] It should be noted that the method of extracting features for the above-mentioned query text can be the same as the method of extracting features for the above-mentioned medical samples, so as to ensure that the disease features extracted from the query text can match the disease features corresponding to the vertices in the above-mentioned bipartite graph constructed, so that the diseases related to the disease features extracted from the query text can be determined by searching the bipartite graph.

[0093] As mentioned above, each medical sample can be input into a large language model, and the large language model can extract diseases and disease features from each medical sample. In this case, the query text can also be input into the large language model, and the large language model can extract the query disease features from the query text.

[0094] Step 404: Based on the bipartite graph, determine a set of candidate diseases related to the query disease feature set, and calculate the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature.

[0095] In this embodiment, the method of constructing the above-mentioned bipartite graph can refer to the above-mentioned content, and this application will not repeat it here. In the case of obtaining the above-mentioned query disease feature set, the diseases (which can be called candidate diseases) related to each query disease feature in the query disease feature set can be determined based on the bipartite graph, and the determined candidate diseases constitute a candidate disease set. Specifically, each query disease feature in the query disease feature set can be retrieved in the bipartite graph, and the edges connecting the vertices corresponding to each query disease feature can be filtered out, and then the vertices corresponding to the disease connected by the filtered edges can be determined. At this time, the disease corresponding to the determined vertex can be used as a candidate disease. Further, as mentioned above, the weight of the above-mentioned target edge in the bipartite graph can include a sub-weight for indicating the probability of being diagnosed as the above-mentioned target disease when having the above-mentioned target disease feature, the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set can be calculated based on the bipartite graph.

[0096] Let Fj(j∈[1,m]) represent a query disease feature in the query disease feature set, and Di(i∈[1,n]) represent a candidate disease in the candidate disease set. Then the query disease feature set can be represented as F={F1,F2,…,Fm}, and the candidate disease set can be represented as D={D1,D2,…,Dn}. At this time, based on the above bipartite graph, the weight P(Di|Fj) of the edge connecting the vertex corresponding to the disease Di and the vertex corresponding to the disease feature Fj can be obtained. P(Di|Fj) can represent the probability of being diagnosed with disease Di when having disease feature Fj. Therefore, 1-P(Di|Fj) can represent the probability of not being diagnosed with disease Di when having disease feature Fj. It can represent the probability of not being diagnosed with disease Di when having the query disease features in the query disease feature set, then It can represent the probability of being diagnosed as disease Di when having the query disease feature in the query disease feature set. Thus, the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set can be calculated.

[0097] Step 406: Determine a confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease characteristics.

[0098] In this embodiment, when the probability of being diagnosed as each candidate disease when having the query disease characteristics is calculated, a confirmed disease can be determined from the candidate disease set based on the calculated probability.

[0099] Step 408: Input the confirmed disease into a large language model so that the large language model generates an answer text based on the confirmed disease, and outputs the answer text to the user.

[0100] In this embodiment, when the above-mentioned confirmed disease is determined, the confirmed disease can be input into the large language model, so that the large language model can make inferences based on the confirmed disease to generate an answer text (usually referring to the generated answer text containing the confirmed disease), and the answer text can be output to the user, so that the user can obtain the answer text corresponding to the query text; for example, based on the confirmed disease, a prompt text can be constructed to stimulate the large language model to use the confirmed disease to perform the task, and the prompt text can be input into the large language model, so that the large language model can make inferences based on the confirmed disease under the guidance of the prompt text to generate an answer text, and the answer text can be output to the user. In this way, the above-mentioned bipartite graph can be retrieved to assist the above-mentioned large language model in generating an answer text corresponding to the query text input by the user, that is, the confirmed disease determined by retrieving the above-mentioned bipartite graph for the disease features contained in the query text input by the user is integrated into the real input of the above-mentioned large language model, so that the large language model can simultaneously consider its inherent generalized knowledge and the specific knowledge obtained from the bipartite graph when generating the answer text corresponding to the query text. It should be noted that the large language model at this time may refer to a serving model of the large language model, and the serving model of the large language model is obtained by fine-tuning based on the dialogue task.

[0101] In the present application, the large language model used to perform the dialogue task and the large language model used to perform the feature extraction task can be the same large language model or two different large language models, and the present application does not impose any special restrictions on this.

[0102] Specifically, the feature extraction component in the intelligent dialogue system (the feature extraction component may be other components other than the large language model in the intelligent dialogue system, or may be the large language model itself, and the present application does not impose any special restrictions on this) may obtain the query text input by the user, and perform feature extraction on the query text to extract the query disease feature from the query text. The bipartite graph retrieval component in the intelligent dialogue system may determine the candidate disease set related to the query disease feature set based on the above bipartite graph, and calculate the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set, and it may also determine the confirmed disease from the candidate disease set based on the calculated probability. The prompt text generation component in the intelligent dialogue system may construct a prompt text for stimulating the large language model in the intelligent dialogue system to use the confirmed disease to perform the dialogue task based on the confirmed disease, and input the prompt text into the large language model, so that the large language model, under the guidance of the prompt text, performs reasoning based on the confirmed disease to generate an answer text, and outputs the answer text to the user.

[0103] For the confirmed disease output to the user through the answer text, the confirmed disease can be considered as a disease that the user may suffer from, so that the confirmed disease can be used as auxiliary information for disease diagnosis to assist doctors or medical professionals in diagnosing the disease for the user.

[0104] In some embodiments, in order to make the answer text generated by the large language model more relevant to the query text input by the user, a prompt text can be constructed based on the query text and the confirmed disease to stimulate the large language model to use the confirmed disease to answer the question raised by the user through the query text, and the prompt text can be input into the large language model, so that the large language model, under the guidance of the prompt text, can infer based on the query text and the confirmed disease to generate an answer text containing the confirmed disease for answering the question described in the query text, and output the answer text to the user.

[0105] Further, in some embodiments, the above-mentioned large language model can not only use the above-mentioned query text and the above-mentioned confirmed disease when generating the above-mentioned answer text, but also use additional context. That is, the first large language model can be based on the query text, the confirmed disease and the additional context for reasoning to generate an answer text corresponding to the query text. Among them, the additional context can refer to all relevant background knowledge, environmental information, context clues and additional instructions that help to understand and answer the query more comprehensively and accurately, in addition to the text information directly related to the above-mentioned query text. These additional contexts can help the above-mentioned first large language model better follow the intention, meet the needs, and ensure the accuracy and coherence of the answer when generating the answer text. In practical applications, these additional contexts can be query document contexts, historical question and answer records, user personal information, additional information explicitly provided by the user, domain knowledge, spatiotemporal background, implicit social and cultural common sense, etc.

[0106] Please refer to Figure 5 , Figure 5 It is a flowchart of another medical question-answering method based on a large language model shown as an exemplary embodiment of the present application.

[0107] like Figure 5 As shown, the above-mentioned medical question answering method based on a large language model may include the following steps:

[0108] Step 502: Obtain the query text input by the user, and perform feature extraction on the query text to extract a query disease feature set from the query text.

[0109] Step 504: Based on the bipartite graph, determine a set of candidate diseases related to the query disease feature set, and calculate the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature; the weight of the target edge also includes a sub-weight for indicating the probability of having the target disease feature when being diagnosed as the target disease.

[0110] Step 506: Determine whether a preset confirmation condition is met.

[0111] Step 508: If the confirmation condition is met, based on the probability of being diagnosed as each candidate disease when having the query disease characteristics, the candidate disease with the highest probability in the candidate disease set is determined as the confirmed disease.

[0112] In some embodiments, in order to improve the accuracy of the confirmed diseases determined from the above-mentioned candidate disease set, one or more confirmation conditions can be pre-set, for example: the number of query disease features in the above-mentioned query disease feature set does not exceed a preset threshold, the calculated maximum value of the probability of being diagnosed as each candidate disease when having the above-mentioned query disease features does not exceed a preset probability threshold, or the number of candidate diseases whose probability reaches the preset probability threshold reaches a preset threshold, etc., and when the set confirmation conditions are met, the candidate disease determined from the candidate disease set is used as a confirmed disease. That is, when determining the confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease features, it can be specifically determined whether the preset confirmation conditions are met. If the confirmation conditions are met, the candidate disease with the highest probability in the candidate disease set can be determined as a confirmed disease based on the probability of being diagnosed as each candidate disease when having the query disease features.

[0113] In practical applications, the top N (i.e., TOP N, N is a natural number) candidate diseases in the candidate disease set that are sorted from high to low in probability can be determined as confirmed diseases, and the candidate diseases in the candidate disease set whose probabilities reach a preset probability threshold can also be determined as confirmed diseases.

[0114] Step 510: Input the confirmed disease into a large language model so that the large language model generates an answer text based on the confirmed disease, and outputs the answer text to the user.

[0115] Step 512: If the confirmation condition is not met, determine a set of candidate disease features related to the set of candidate diseases based on the bipartite graph.

[0116] Step 514: Based on the bipartite graph and the probability of being diagnosed as each candidate disease when having the query disease feature, calculate the inverse weight corresponding to each remaining disease feature; wherein the remaining disease features are the disease features in the candidate disease feature set except the query disease feature.

[0117] Step 516: Determine the inverse disease feature from the remaining disease features based on the inverse weights corresponding to the respective remaining disease features.

[0118] Step 518: Output the anti-disease feature to the user, so that the user can input a query supplementary text indicating whether the anti-disease feature exists.

[0119] Step 520: Obtain the query supplementary text, and determine whether the query supplementary text has the anti-question disease characteristics based on the query supplementary text.

[0120] Step 522: If the inverse disease feature is present, the inverse disease feature is added as a query disease feature to the query disease feature set to update the query disease feature set, and, based on the bipartite graph, a candidate disease set related to the updated query disease feature set is determined again, and the probability of being diagnosed with each candidate disease in the candidate disease set when the query disease feature in the updated query disease feature set is present is calculated.

[0121] Step 524: If the reverse question disease feature is not present, an updated reverse question disease feature is determined from the remaining disease features, and the updated reverse question disease feature is output to the user so that the user can input a query supplementary text indicating whether the updated reverse question disease feature is present.

[0122] However, in some embodiments, if the above confirmation conditions are not met, it is considered that the disease that the user may suffer from cannot be confirmed based solely on the above query disease characteristics in the query text input by the user. Therefore, the user can be prompted to supplement one or more disease characteristics by asking a question in return, and the supplemented disease characteristics can be used together with the original query disease characteristics as new query disease characteristics to confirm the disease that the user may suffer from based on the new query disease characteristics.

[0123] Specifically, if the above confirmation conditions are not met, then firstly, based on the above bipartite graph, a candidate disease feature set related to the above candidate disease set can be determined. Similar to the above determination of the candidate disease set related to the above query disease feature set, each candidate disease in the candidate disease set can be retrieved in the bipartite graph, and the edges connecting the vertices corresponding to each candidate disease can be screened out, and then the vertices corresponding to the disease features connected by the screened edges can be determined, and at this time, the disease features corresponding to the determined vertices can constitute the candidate disease feature set.

[0124] Then, based on the remaining disease features in the candidate disease feature set except the query disease features in the query disease feature set (i.e., the original query disease features), the rhetorical disease features can be determined from the remaining disease features, and the rhetorical disease features can be output to the above-mentioned user, so that the user can input a query supplementary text indicating whether the rhetorical disease features are present, thereby prompting the user to supplement the original query disease features. For example, assuming that the determined rhetorical disease features include "male", the disease feature "male" can be output to the user, and after viewing the disease feature "male", the user can input "male" to confirm that the disease feature is present, or input "female" to deny the disease feature. It should be noted that when the rhetorical disease features include multiple rhetorical disease features, the user can input a query supplementary text indicating which of the rhetorical disease features are present and which of the rhetorical disease features are not present.

[0125] In this case, the query supplementary text input by the user can be obtained, and based on the query supplementary text, it can be determined whether the rhetorical disease feature is present. If the rhetorical disease feature is present, the rhetorical disease feature can be added to the query disease feature set as a query disease feature to update the query disease feature set, that is, the rhetorical disease feature and the original query disease feature together constitute a new query disease feature set. Subsequently, a new set of candidate diseases related to the new query disease feature set can be determined based on the above-mentioned bipartite graph, and the probability of being diagnosed as each candidate disease in the new candidate disease set when having the query disease feature in the new query disease feature set can be calculated; if the above-mentioned confirmation condition is met at this time, the confirmed disease can be determined from the new candidate disease set based on the recalculated probability, and the confirmed disease can be output to the above-mentioned user; if the above-mentioned confirmation condition is still not met at this time, the user can be asked a rhetorical question again; and so on.

[0126] However, in some embodiments, if the above-mentioned anti-question disease feature is not present, the anti-question disease feature can be re-determined from the above-mentioned remaining disease features to obtain a new anti-question disease feature, and the new anti-question disease feature can be output to the user, so that the user can input a new query supplementary text to indicate whether the new anti-question disease feature is present, and then the new query supplementary text is processed; and so on.

[0127] In some embodiments, in order to ensure that the above-mentioned rhetorical disease features are disease features that are more critical for the diagnosis of the disease, reduce the content and rounds of rhetorical questions, and thus improve the response efficiency of the intelligent dialogue system, when determining the above-mentioned rhetorical disease features from the above-mentioned remaining disease features, since, as mentioned above, the weight of the above-mentioned target edge in the above-mentioned bipartite graph can also include a sub-weight indicating the probability of having the above-mentioned target disease features when diagnosed as the above-mentioned target disease, the probability of having each remaining disease feature when diagnosed as a candidate disease in the above-mentioned candidate disease feature set can be calculated based on the bipartite graph.

[0128] Let Di(i∈[1,n]) represent a candidate disease in the above candidate disease set, and Fj(j∈[1,m]) represent a remaining disease feature in the above remaining disease features, then the candidate disease set can be represented as D={D1,D2,…,Dn}, and these remaining disease feature sets can be represented as F={F1,F2,…,Fm}. At this time, based on the above bipartite graph, the weight P(Fj|Di) of the edge connecting the vertex corresponding to the disease Di and the vertex corresponding to the disease feature Fj can be obtained. P(Fj|Di) can represent the probability of having the disease feature Fj when diagnosed with disease Di, and P(Di) can represent the probability of being diagnosed with disease Di when having the query disease feature in the above query disease feature set. Therefore, it can be used represents the inverse weight corresponding to the disease feature Fj. Thus, the inverse weight corresponding to each remaining disease feature can be calculated.

[0129] In the case where the anti-question weights corresponding to the respective remaining disease features are calculated, the anti-question disease features can be determined from the above-mentioned remaining disease features based on the calculated anti-question weights. Specifically, the N remaining disease features ranked in the front (i.e., TOP N, N is a natural number) after the anti-question weights among these remaining disease features are sorted from large to small can be determined as anti-question disease features, and the remaining disease features among these remaining disease features whose anti-question weights reach a preset weight threshold can also be determined as anti-question disease features, and the present application does not impose any special restrictions on this. Accordingly, if it is determined based on the above-mentioned query supplementary text input by the user that the anti-question disease feature is not present, the anti-question disease feature can be excluded from these remaining disease features, and based on the anti-question weight, a new anti-question disease feature can be re-determined from the remaining disease features from which the anti-question disease feature has been excluded.

[0130] In some embodiments, when the above-mentioned rhetorical question disease feature is output to the above-mentioned user, the rhetorical question disease feature can be specifically input into the aforementioned large language model for performing the dialogue task, so that the large language model can perform inference based on the rhetorical question disease feature to generate a rhetorical question text (usually referring to the generated rhetorical question text containing the rhetorical question disease feature), and output the rhetorical question text to the user, so that the user can view the rhetorical question text, and answer the rhetorical question text to confirm whether it has the rhetorical question disease feature; for example, based on the rhetorical question disease feature, a prompt text can be constructed to stimulate the large language model to use the rhetorical question disease feature to perform the dialogue task, and the prompt text can be input into the large language model, so that the large language model can perform inference based on the rhetorical question disease feature under the guidance of the prompt text to generate a rhetorical question text, and output the rhetorical question text to the user.

[0131] Similar to the aforementioned generation of the answer text, in addition to the above-mentioned rhetorical disease feature, a prompt text for stimulating the large language model to use the rhetorical disease feature to ask the user a rhetorical question regarding the question raised by the user through the query text can be constructed based on the query text and / or additional context.

[0132] In some embodiments, the above confirmation conditions can be set according to actual needs. For example, the above confirmation conditions may include one or more of the following conditions: the number of query disease features in the query disease feature set does not exceed a preset first threshold; the number of candidate disease features in the candidate disease feature set does not exceed a preset second threshold; the maximum value of the probability of being diagnosed as each candidate disease when having the query disease feature does not exceed a preset third threshold, or the number of candidate diseases whose probability reaches a preset fourth threshold reaches a preset fifth threshold.

[0133] It should be noted that the diagnosis and treatment based on the above-mentioned bipartite graph is usually achieved through online calculation.

[0134] In the above technical solution provided in the present application, a bipartite graph for representing the association relationship between diseases and disease features can be pre-constructed, the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set and a vertex subset corresponding to the disease feature set, the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set and the vertices corresponding to the target disease features in the disease feature set, and the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease features; subsequently, firstly, when the query text input by the user is obtained, feature extraction can be performed on the query text to extract the query disease feature set from the query text, and then based on the bipartite graph, a candidate disease set related to the query disease feature set can be determined, and the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease features in the query disease feature set can be calculated, and then based on the calculated probability, a confirmed disease can be determined from the candidate disease set, and finally the confirmed disease can be input into a large language model, so that the large language model generates an answer text based on the confirmed disease, and the answer text is output to the user.

[0135] By adopting the above method, when answering questions raised by users, the intelligent dialogue system no longer relies solely on the knowledge acquired by the large language model in the training process by learning static corpus, but can also combine the knowledge retrieved in the bipartite graph used to represent the association between diseases and disease characteristics. That is, the confirmed disease determined by retrieving the bipartite graph for the disease characteristics contained in the query text input by the user can be integrated into the real input of the large language model, so that the large language model can consider its inherent generalized knowledge and the specific knowledge obtained from the bipartite graph when generating the answer text corresponding to the query text. Therefore, the adaptability and response accuracy of the intelligent dialogue system can be improved.

[0136] Corresponding to the aforementioned method embodiments, the present application also provides device embodiments.

[0137] Please refer to Figure 6 , Figure 6It is a structural diagram of a device shown in an exemplary embodiment of the present application. At the hardware level, the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, and of course may also include other required hardware. One or more embodiments of the present application can be implemented based on software, such as the processor 602 reading the corresponding computer program from the non-volatile memory 610 into the memory 608 and then running it. Of course, in addition to the software implementation, one or more embodiments of the present application do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic module, but can also be hardware or logic devices.

[0138] Please refer to Figure 7 , Figure 7 It is a block diagram of a medical question-and-answer device based on a large language model, shown as an exemplary embodiment of the present application.

[0139] The above-mentioned medical question-answering device based on large language model can be applied to Figure 6 The device shown is used to implement the technical solution of the present application. The device includes:

[0140] The extraction module 702 obtains the query text input by the user and performs feature extraction on the query text to extract a query disease feature set from the query text;

[0141] The first calculation module 704 determines, based on a bipartite graph, a set of candidate diseases related to the query disease feature set, and calculates the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature;

[0142] A first determination module 706, determining a confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease feature;

[0143] The generating module 708 inputs the confirmed disease into the large language model so that the large language model generates an answer text based on the confirmed disease, and outputs the answer text to the user.

[0144] In some embodiments, the determining of a confirmed disease from the candidate disease set based on the probability of being diagnosed as each candidate disease when having the query disease feature comprises:

[0145] Determine whether the preset confirmation conditions are met;

[0146] If the confirmation condition is met, based on the probability of being diagnosed as each candidate disease when having the query disease feature, the candidate disease with the highest probability in the candidate disease set is determined as the confirmed disease.

[0147] In some embodiments, the apparatus further comprises:

[0148] A second determination module, if the confirmation condition is not met, determines a candidate disease feature set related to the candidate disease set based on the bipartite graph;

[0149] A third determination module determines a rhetorical disease feature from the remaining disease features, and outputs the rhetorical disease feature to the user, so that the user can input a query supplementary text indicating whether the rhetorical disease feature exists; wherein the remaining disease features are disease features in the candidate disease feature set except the query disease feature;

[0150] A fourth determination module, obtaining the query supplementary text, and determining whether the query supplementary text has the anti-question disease characteristics based on the query supplementary text;

[0151] A first updating module, if the inverse disease feature is present, adds the inverse disease feature as a query disease feature to the query disease feature set, so as to update the query disease feature set;

[0152] The first calculation module 704 is also used to: re-determine a set of candidate diseases related to the updated query disease feature set based on the bipartite graph, and calculate the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease features in the updated query disease feature set.

[0153] In some embodiments, the third determination module is also used to: if the anti-question disease feature is not present, re-determine the anti-question disease feature from the remaining disease features to update the anti-question disease feature, and output the updated anti-question disease feature to the user, so that the user can input a query supplementary text indicating whether the updated anti-question disease feature is present.

[0154] In some embodiments, the step of outputting the anti-disease feature to the user so that the user can input a query supplementary text indicating whether the anti-disease feature exists comprises:

[0155] The rhetorical question disease feature is input into the large language model, so that the large language model generates a rhetorical question text based on the rhetorical question disease feature, and the rhetorical question text is output to the user.

[0156] In some embodiments, the weight of the target edge further includes a sub-weight for indicating the probability of having the target disease characteristics when diagnosed with the target disease;

[0157] The step of determining the counter-question disease characteristics from the remaining disease characteristics comprises:

[0158] Based on the bipartite graph and the probability of being diagnosed as each candidate disease when having the query disease feature, calculating the inverse question weight corresponding to each remaining disease feature;

[0159] Based on the inverse weights corresponding to the respective remaining disease features, inverse disease features are determined from the remaining disease features.

[0160] In some embodiments, the extraction module 702 is further used to: obtain a medical sample, and input the medical sample into a large language model, so that the large language model performs feature extraction on the medical sample to extract a disease set and a disease feature set from the medical sample;

[0161] The step of performing feature extraction on the query text to extract a query disease feature set from the query text includes:

[0162] The query text is input into the large language model, and the large language model performs feature extraction on the query text to extract a query disease feature set from the query text.

[0163] In some embodiments, the apparatus further comprises:

[0164] A statistical module, for counting a first number of medical samples having the target disease characteristics among the medical samples;

[0165] The statistical module is further used to: count a second number of medical samples diagnosed with the target disease in the medical samples;

[0166] The statistical module is further used to: count a third number of medical samples in the medical samples that have the target disease characteristics and are diagnosed with the target disease;

[0167] A second calculation module determines a ratio of the third number to the first number as a probability of being diagnosed with the target disease when having the target disease characteristics, and determines a ratio of the third number to the second number as a probability of having the target disease characteristics when being diagnosed with the target disease;

[0168] A construction module is provided to construct the bipartite graph based on the disease set, the disease feature set, the probability of being diagnosed with the target disease when having the target disease feature, and the probability of having the target disease feature when being diagnosed with the target disease.

[0169] In some embodiments, the confirmation conditions include one or more of the following conditions:

[0170] The number of query disease features in the query disease feature set does not exceed a preset first threshold;

[0171] The number of candidate disease features in the candidate disease feature set does not exceed a preset second threshold;

[0172] The maximum value of the probability of being diagnosed as each candidate disease when having the query disease feature does not exceed a preset third threshold, or the number of candidate diseases whose probability reaches a preset fourth threshold reaches a preset fifth threshold.

[0173] For the device embodiment, it basically corresponds to the method embodiment, so the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the technical solution of the present application.

[0174] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0175] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0176] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0177] Computer readable media include permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0178] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0179] The above specific embodiments of the present application are described. Other embodiments are within the scope of the present application. In some cases, the actions or steps recorded in the present application can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0180] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings. The term "and / or" refers to and includes any or all possible combinations of one or more associated listed items.

[0181] The description of the terms "one embodiment", "some embodiments", "example", "specific example" or "an implementation method" etc. used in one or more embodiments of the present application means that the specific features or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present application. The schematic description of these terms is not necessarily for the same embodiment. Moreover, the specific features or characteristics described can be combined in a suitable manner in one or more embodiments of the present application. In addition, different embodiments and specific features or characteristics in different embodiments can be combined without contradicting each other.

[0182] It should be understood that, although the terms first, second, third, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determination".

[0183] The above description is merely a preferred embodiment of one or more embodiments of the present application and is not intended to limit one or more embodiments of the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of the present application shall be included in the scope of protection of one or more embodiments of the present application.

[0184] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

Claims

1. A medical question answering method based on a large language model, the method comprising: Obtaining a query text input by a user, and performing feature extraction on the query text to extract a query disease feature set from the query text; Based on a bipartite graph, a set of candidate diseases related to the query disease feature set is determined, and the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set is calculated; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature; Determine whether the preset confirmation conditions are met; If the confirmation condition is not met, based on the bipartite graph, determine a set of candidate disease features related to the candidate disease set, and determine a counter-question disease feature from the remaining disease features; wherein the remaining disease features are disease features in the candidate disease feature set other than the query disease feature; output the counter-question disease feature to the user, so that the user can input a query supplementary text indicating whether the counter-question disease feature is present; obtain the query supplementary text, and determine whether the counter-question disease feature is present based on the query supplementary text; if the counter-question disease feature is present, add the counter-question disease feature as a query disease feature to the query disease feature set to update the query disease feature set; re-determine a set of candidate diseases related to the updated query disease feature set based on the bipartite graph, and calculate the probability of being diagnosed with each candidate disease in the candidate disease set when the query disease feature in the updated query disease feature set is present; If the confirmation condition is met, based on the probability of being diagnosed as each candidate disease when having the query disease feature, determining the candidate disease with the highest probability in the candidate disease set as the confirmed disease; The confirmed disease is input into a large language model so that the large language model generates an answer text based on the confirmed disease, and the answer text is output to the user.

2. The method according to claim 1, further comprising: If the reverse question disease feature is not present, determining an updated reverse question disease feature from the remaining disease features; The updated anti-disease feature is output to the user again, so that the user can input a query supplementary text indicating whether the updated anti-disease feature is present.

3. The method according to claim 1, wherein the step of outputting the anti-disease feature to the user so that the user can input a query supplementary text indicating whether the anti-disease feature exists comprises: The rhetorical question disease feature is input into the large language model, so that the large language model generates a rhetorical question text based on the rhetorical question disease feature, and the rhetorical question text is output to the user.

4. The method according to claim 1, wherein the weight of the target edge further comprises a sub-weight for indicating the probability of having the target disease characteristics when diagnosed with the target disease; The step of determining the counter-question disease characteristics from the remaining disease characteristics comprises: Based on the bipartite graph and the probability of being diagnosed as each candidate disease when having the query disease feature, calculating the inverse question weight corresponding to each remaining disease feature; Based on the inverse weights corresponding to the respective remaining disease features, inverse disease features are determined from the remaining disease features.

5. The method according to claim 4, further comprising: Acquire a medical sample, and input the medical sample into a large language model, so that the large language model performs feature extraction on the medical sample to extract a disease set and a disease feature set from the medical sample; The step of performing feature extraction on the query text to extract a query disease feature set from the query text includes: The query text is input into the large language model, and the large language model performs feature extraction on the query text to extract a query disease feature set from the query text.

6. The method according to claim 5, further comprising: Counting a first number of medical samples having the target disease characteristics among the medical samples; Counting a second number of medical samples diagnosed with the target disease among the medical samples; Counting a third number of medical samples that have the target disease characteristics and are diagnosed with the target disease in the medical samples; Determine the ratio of the third number to the first number as the probability of being diagnosed with the target disease when having the target disease characteristics, and determine the ratio of the third number to the second number as the probability of having the target disease characteristics when being diagnosed with the target disease; The bipartite graph is constructed based on the disease set, the disease feature set, the probability of being diagnosed with the target disease when having the target disease feature, and the probability of having the target disease feature when being diagnosed with the target disease.

7. The method according to claim 1, wherein the confirmation condition comprises one or more of the following conditions: The number of query disease features in the query disease feature set does not exceed a preset first threshold; The number of candidate disease features in the candidate disease feature set does not exceed a preset second threshold; The maximum value of the probability of being diagnosed as each candidate disease when having the query disease feature does not exceed a preset third threshold, or the number of candidate diseases whose probability reaches a preset fourth threshold reaches a preset fifth threshold.

8. A medical question-answering device based on a large language model, the device comprising: An extraction module, which obtains a query text input by a user and performs feature extraction on the query text to extract a query disease feature set from the query text; A calculation module, based on a bipartite graph, determines a set of candidate diseases related to the query disease feature set, and calculates the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the query disease feature set; wherein the vertex set of the bipartite graph includes a vertex subset corresponding to the disease set, and a vertex subset corresponding to the disease feature set; the target edge in the bipartite graph connects the vertices corresponding to the target disease in the disease set, and the vertices corresponding to the target disease feature in the disease feature set; the weight of the target edge includes a sub-weight for indicating the probability of being diagnosed as the target disease when having the target disease feature; A determination module determines whether a preset confirmation condition is met; if the confirmation condition is not met, based on the bipartite graph, a candidate disease feature set related to the candidate disease set is determined, and a counter-question disease feature is determined from the remaining disease features; wherein the remaining disease features are disease features in the candidate disease feature set other than the query disease feature; the counter-question disease feature is output to the user so that the user can input a query supplementary text indicating whether the counter-question disease feature is present; the query supplementary text is obtained, and based on the query supplementary text, it is determined whether the counter-question disease feature is present; if Having the inverse disease feature, adding the inverse disease feature as the query disease feature to the query disease feature set to update the query disease feature set; re-determining a candidate disease set related to the updated query disease feature set based on the bipartite graph, and calculating the probability of being diagnosed as each candidate disease in the candidate disease set when having the query disease feature in the updated query disease feature set; if the confirmation condition is met, determining the candidate disease with the largest probability in the candidate disease set as the confirmed disease based on the probability of being diagnosed as each candidate disease when having the query disease feature; A generating module inputs the confirmed disease into the large language model so that the large language model generates an answer text based on the confirmed disease, and outputs the answer text to the user.

9. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 7 by running the executable instructions.

10. A computer-readable storage medium having computer instructions stored thereon, wherein the instructions are executed by a processor to implement the method according to any one of claims 1 to 7.