Health question and answer method and system based on knowledge graph and large language model fusion
By combining health knowledge graphs and large-scale language models, the system analyzes user intent and generates personalized answers, solving the problems of insufficient accuracy and interactivity in existing systems when dealing with ambiguous questions, and realizing a highly accurate and naturally interactive intelligent health question-and-answer system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-03-13
AI Technical Summary
Existing intelligent health question-answering systems struggle to provide an accurate and natural interactive experience when dealing with uncovered, vague, or long-tailed questions.
By combining the structured facts of a personal health knowledge graph with the natural language processing capabilities of a large language model, the system can analyze the user's query intent, retrieve relevant contextual information, and generate answers under constrained instructions.
It achieves accuracy and personalization in answer content, while providing a smooth and natural interactive experience, improving the system's generalization ability and user satisfaction.
Smart Images

Figure CN121662349A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graph and large model technology, and in particular to a health question answering method and system based on the fusion of knowledge graph and large language model. Background Technology
[0002] With the increasing public awareness of health and the rapid development of artificial intelligence technology, intelligent health Q&A systems have become an important tool to assist users in managing their own health. Users expect to quickly and accurately obtain answers and suggestions related to their personal health status through natural language interaction.
[0003] Currently, the implementation of such intelligent health question-answering systems is mainly based on retrieval-based QA methods. This approach typically relies on a pre-built, structured knowledge base (e.g., a health knowledge graph or question-answer pair database). When a user question is received, the system first performs intent recognition and entity extraction, then transforms it into a structured query against the knowledge base (such as a SPARQL or Cypher query), and finally returns the retrieved facts or answers to the user.
[0004] However, in existing technologies, retrieval-based question answering has a poor interactive experience and weak generalization ability. For questions that are not covered in the knowledge base, are vague, or are long-tailed, such systems often have difficulty understanding and providing effective answers. Summary of the Invention
[0005] In view of this, the present invention provides a health question-answering method and system based on the fusion of knowledge graph and large language model. Through this method, the structured and highly credible facts of a personal health knowledge graph can be effectively combined with the powerful natural language processing capabilities of a large language model to achieve an intelligent health question-answering system that can ensure the accuracy and high personalization of the answers while providing a smooth and natural interactive experience.
[0006] A health question-answering method based on the fusion of knowledge graph and large-scale language model, the method comprising: Parse the user's query request to obtain the query intent related to the query content, wherein the query intent includes intent type and key entities; Retrieve contextual information related to the query intent from the user's associated health knowledge graph; Input the context information and query content into the preset prompt template. The prompt template contains constraint instructions for constraining the behavior of the first large language model. The constraint instructions are used to limit the response content of the first large language model to be only related to the context information. Input the prompt template into the first large language model to obtain the response content corresponding to the user's query request.
[0007] Optionally, in the above method, obtaining the query intent corresponding to the query request includes: The query content and the preset output format instruction are sent to the preset second large language model, and the second large language model outputs the query intent corresponding to the query request according to the content format specified by the output format instruction.
[0008] Optionally, in the above method, obtaining the query intent corresponding to the query request includes: The query content of the query request is analyzed using a pre-defined text classification model to determine the intent type that matches the query content in the pre-defined intent set. The pre-defined bidirectional long short-term memory network-conditional random field model is used to extract key entities related to the health knowledge graph from the query content.
[0009] Optionally, in the above method, querying contextual information related to the query intent from the user-associated health knowledge graph includes: Transform the query intent into a graph query statement; The graph query statement is sent to the user terminal through a pre-set encrypted channel to obtain the context information fed back by the user terminal based on the graph query statement; The user terminal is equipped with a health knowledge graph associated with the user. After obtaining a graph query statement, the user terminal queries the context information associated with the graph query statement from the health knowledge graph.
[0010] Optionally, in the above method, querying contextual information related to the query intent from the user-associated health knowledge graph includes: Transform the query intent into a graph query statement; Execute graph query statements on the health knowledge graph to obtain query results in the form of a graph structure; The query results are serialized into at least one natural language text, which is contextual information associated with the query intent.
[0011] Optionally, the above method may further include: If the query results are empty, retrieve the vector index corresponding to the pre-generated health knowledge graph; Transform query intent into query vector; The approximate nearest neighbor search is applied to find similar association information in the vector index that is similar to the query vector. The association information includes textual descriptions of graph entities and / or events. Convert related information into natural language text.
[0012] Optionally, in the above method, inputting the context information and query content into a preset prompt template includes: The context information and query content are converted into a semi-structured format, and prompts are added during the format conversion process. The prompts are used to guide the large model on the parsing method for the semi-structured format. Enter the context information for format conversion and the query content into the prompt template.
[0013] Optionally, in the above method, the step of inputting the prompt template into the first large-scale language model to obtain the response content corresponding to the user's query request includes: The prompt template is sent to the data processing terminal, which is either a user terminal or the cloud. The data processing terminal contains a first large-scale language model. If the data processing end is a user terminal, the user terminal will provide feedback to the user on the response output by the first large language model within the user terminal; If the data processing end is in the cloud, the response content output by the first large language model in the cloud is obtained and sent to the user terminal so that the user can receive feedback on the response content through the user terminal.
[0014] A health question-answering system based on the fusion of knowledge graph and large-scale language model, the system comprising: The user terminal is used to send query requests to the server; upon receiving encrypted information from the server, it decrypts the encrypted information, obtains the query intent association related to the query request, and queries the context information associated with the query intent from the health knowledge graph; if it receives a prompt template from the server, it processes the prompt template using the user terminal's first large-scale language model to obtain the response content to be fed back to the user; if it receives the response content corresponding to the query request sent by the server, it feeds back the response content to the user. In the cloud, upon receiving a prompt template from the server, the system applies the first large-scale language model within the cloud to process the prompt template in order to send a response to the server. The server is used to execute the aforementioned health question-answering method based on the fusion of knowledge graphs and large language models.
[0015] Optionally, after the user terminal queries the context information associated with the query intent from the health knowledge graph, it is further configured to: The context information and the query content in the query request are entered into the prompt template, and the prompt template is then entered into the first large language model in the user terminal to obtain the response content corresponding to the query request to the user.
[0016] Compared with the prior art, the present invention has the following advantages: This invention provides a health question-answering method based on the fusion of knowledge graph and large-scale language model, comprising: parsing a user-input query request to obtain the query intent related to the query content, wherein the query intent includes intent type and key entities; querying contextual information associated with the query intent from the user's associated health knowledge graph; inputting the contextual information and query content into a preset prompt template, wherein the prompt template includes constraint instructions for constraining the behavior of a first large-scale language model, wherein the constraint instructions are used to limit the response content of the first large-scale language model to be only related to the contextual information; and inputting the prompt template into the first large-scale language model to obtain the response content corresponding to the query request to be fed back to the user. Applying the method provided by this invention, the structured, highly credible facts of a personal health knowledge graph can be effectively combined with the powerful natural language processing capabilities of a large-scale language model to achieve an intelligent health question-answering system that ensures both factual accuracy and high personalization of the response content, while providing a smooth and natural interactive experience. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a health question-answering method based on the fusion of knowledge graph and large-scale language model, provided in an embodiment of the present invention. Figure 2 This is an example diagram illustrating one embodiment of the present invention. Figure 3 This is an example diagram illustrating another embodiment of the present invention. Figure 4 This is an example diagram illustrating another embodiment of the present invention. Figure 5 This is a schematic diagram of the structure of a health question-answering system based on the fusion of knowledge graph and large-scale language model, provided in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0021] This invention can be used in a wide variety of general-purpose or special-purpose computing environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor devices, distributed computing environments including any of the above devices, etc.
[0022] This invention provides a health question-answering method based on the fusion of knowledge graph and large-scale language model. The method is applied to one or more servers, on which corresponding application software modules, a database, and a large-scale language model interface are deployed. The method flowchart is shown below. Figure 1 As shown, it specifically includes: S1: Parse the query request input by the user to obtain the query intent related to the query content of the query request, wherein the query intent includes intent type and key entities; S2: Query contextual information related to the query intent from the user's associated health knowledge graph; S3: Input the context information and query content into a preset prompt template. The prompt template contains constraint instructions for constraining the behavior of the first large-scale language model. The constraint instructions are used to limit the response content of the first large-scale language model to be only related to the context information. S4: Input the prompt template into the first large language model to obtain the response content corresponding to the user's query request.
[0023] Based on the content of steps S1-S4 above, the following specific explanations are provided: S1: Parse the user's query request to obtain the query intent related to the query content.
[0024] The query intent includes the intent type and the key entity.
[0025] Users input query content through user terminals (e.g., smartphones, personal computers, etc.). The user terminal generates a corresponding query request based on the query content and sends the query request to the service. The query content can be natural language text, and the query request is an unstructured text string.
[0026] The user enters natural language text as the query content in the application on the user terminal. The user terminal sends the query request to the server according to the application's application interface. The server's application interface receives the query request. The server parses the query request to obtain the query content and analyzes the query content to generate a structured query intent.
[0027] In this invention, obtaining the intent type related to the query content involves classifying the user's questions within the query content into a predefined intent set. This intent set includes intent types such as factual queries, causal analysis, and longitudinal trend summaries. For example, if a user asks, "I've been feeling thirsty lately; could this be related to my high blood sugar levels detected two years ago?", the intent is determined to be causal analysis. Extracting key entities related to the query content involves extracting entities related to the personal health knowledge graph schema from the user's questions within the query content. For example, if a user asks, "I've been feeling thirsty lately; could this be related to my high blood sugar levels detected two years ago?", the extracted key entities may include: "thirst" (symptom), "recently" (time), "high blood sugar" (detection), and "two years ago" (time).
[0028] In the first embodiment, the specific method for obtaining the query intent corresponding to the query request can be as follows: The query content and a preset output format instruction are sent to a preset second large-scale language model, and the second large-scale language model outputs the query intent corresponding to the query request according to the content format specified by the output format instruction. Here, the second large-scale language model is a large, commonly used online model (e.g., deepseek). A request containing a specific instruction (Prompt) is provided to this model, which instructs the model to analyze the input text and output its intent and entity in JSON format. For the above example, the structured query intent output by the model after analysis can be as follows: JSON {"intent":"Causality_Analysis", "entities":[ {"text":"Thirsty","type":"Symptom","temporal":"Recently"}, {"text":"High blood sugar","type":"Finding","temporal":"Two years ago"}]} In the second embodiment, the specific method for obtaining the query intent corresponding to the query request can be as follows: Analyze the query content of the query request using a pre-defined text classification model to determine the intent type matching the query content in a pre-defined intent set; and extract key entities related to the health knowledge graph from the query content using a pre-defined bidirectional long short-term memory network-conditional random field model. The text classification model is a text classification model based on the BERT (Bidirectional Encoder Representations from Transformers) architecture. This model is fine-tuned on a large amount of health-related question-and-answer corpus to specifically identify predefined intents such as causal analysis and factual retrieval. During the key entity extraction process, a bidirectional long short-term memory network-conditional random field (BiLSTM-CRF) model is used for entity extraction. This model is trained on labeled medical entity text, prioritizing medical entities relevant to the user during training.
[0029] In this invention, by obtaining the intent type and key entities based on the query content, vague user queries can be transformed into clearly defined analytical tasks that are mechanically understandable. According to the two embodiments of S1 described above, specialized models can be used to extract the intent type and key entities. These specialized models are small in size, have fast inference speed, and low deployment cost. Furthermore, due to fine-tuning with domain data, their accuracy on specific tasks may be higher. This provides a feasible implementation path for this invention in scenarios with strict requirements on latency and cost.
[0030] In this invention, after obtaining the query intent, step S2 is executed, specifically as follows: S2: Query contextual information related to the query intent from the user's associated health knowledge graph.
[0031] It should be noted that the server can be configured with multiple health knowledge graphs, each associated with a different user. Each health knowledge graph is a dynamic, user-centric graph structure built based on the user's personal health information, containing time-series relationships. In addition, users' terminals can also configure health knowledge graphs associated with that user.
[0032] If a user terminal is configured with a health knowledge graph associated with that user, contextual information can be queried through the user terminal. The specific process is as follows: the query intent is converted into a graph query statement; the graph query statement is sent to the user terminal through a pre-set encrypted channel to obtain the contextual information fed back by the user terminal based on the graph query statement; wherein, the user terminal is configured with a health knowledge graph associated with the user, and after obtaining the graph query statement, the user terminal queries the contextual information associated with the graph query statement from the health knowledge graph.
[0033] An encrypted channel is established between the user terminal and the server. This encrypted channel serves as a secure data transmission channel, and all interactions between the user terminal and the server are conducted through data transmission. A lightweight graph database engine or query library runs on the user terminal. This engine executes queries received from the server on the user's locally encrypted personal health knowledge graph. After the user terminal retrieves the graph results from the health knowledge graph, it locally serializes the graph results into natural language text fragments (i.e., contextual information). In this invention, all of the user's personal health graph data remains within their personal device and never leaves, thus achieving the highest level of privacy protection.
[0034] Optionally, if the user terminal does not have a health knowledge graph associated with the user, the context information associated with the query intent can be obtained through the health knowledge graph set by the server.
[0035] For user terminals or servers, when querying contextual information through the health knowledge graph, the query intent is first converted into a graph query statement on the server. After obtaining the graph query statement, the graph query statement is executed on the health knowledge graph to obtain query results in graph structure form; the query results are then serialized into at least one natural language text, where the natural language text is the contextual information associated with the query intent.
[0036] This can be achieved by using a pre-defined template or rule engine to automatically translate query intent into a formalized graph query language (such as Cypher or SPARQL). For example, if the query is "I've been feeling thirsty lately, is this related to my high blood sugar, which I was diagnosed with two years ago?", the query intent is converted into a graph query. The logic of this graph query is: to search the user's health knowledge graph for a path connected by temporal relationships (such as precedence) from the "high blood sugar" event (occurring approximately two years ago) to the "thirst" symptom event (occurring recently). The graph query is then sent to the health knowledge graph (e.g., Neo4j), where it is executed to obtain a set of graph-structured query results (e.g., paths, nodes, or subgraphs that meet the criteria). These structured query results are then serialized into one or more natural language text fragments. For example, the retrieved path can be serialized as: "Fact: In October 2023, your record contains a 'fasting blood glucose' test event with a result of '7.5 mmol / L,' qualitatively described as 'high.' Fact: In November 2025, your record contains a 'excessive thirst' symptom event. Temporal relationship: The 'high blood glucose' event occurred before the 'excessive thirst' symptom event." Therefore, this invention can accurately retrieve personalized factual evidence related to the structured query intent from the user's health knowledge graph. After obtaining the query results, the machine-readable graph data is transformed into textual context that a large language model can understand.
[0037] In one optional implementation, if the query results from the health knowledge graph are empty, the pre-generated vector index corresponding to the health knowledge graph is obtained; the query intent is converted into a query vector; an approximate nearest neighbor search is applied to find related information similar to the query vector in the vector index, the related information including text descriptions of graph entities and / or events; and the related information is converted into natural language text. It is understood that if the query results are empty (or no query results are returned), a rollback operation can be performed, reverting to a vector similarity-based retrieval method, i.e., performing a semantic search on the text descriptions of nodes and edges in the knowledge graph, to increase the retrieval recall rate.
[0038] Specifically, if the returned query result is an empty set, a fallback retrieval mechanism based on vector similarity is triggered. The specific implementation of this mechanism includes: Offline steps: For the text descriptions (such as symptom names and event descriptions) of all nodes and edges in the health knowledge graph, calculate their semantic vectors using a text embedding model (such as Sentence-BERT) and build a vector index (e.g., using FAISS or Milvus). Online steps: During the query, the same text embedding model is used to calculate the query vector of the user's question. Then, an Approximate Nearest Neighbor Search is performed on this vector index to find the text descriptions of the Top-K graph entities or events that are semantically most similar to the user's question; The relevant information of entities or events found through vector retrieval is serialized into natural language text as supplementary contextual information.
[0039] The method provided by the embodiments of the present invention can handle user questions that are difficult to be accurately parsed into structured queries, or that are more colloquial or ambiguous. By using semantic similarity matching as a "backup," the system can ensure that even if the user's question is not in a standard way, the system can find some relevant personal health information to assist in the answer with a high probability, thereby improving the system's fault tolerance and user experience.
[0040] In this invention, after obtaining the context information, step S3 is executed, specifically as follows: S3: Input the context information and query content into the preset prompt template.
[0041] The prompt template includes constraint instructions for constraining the behavior of the first large language model. These constraint instructions limit the response content of the first large language model to be related only to contextual information. The first large language model (LLM) is a large model constructed based on the user's personal health information and the health information of other users.
[0042] In this invention, the query content is processed in a more refined manner through a first large-scale language model, and contextual information is added to guide the first large-scale language model to make more accurate inferences.
[0043] Specifically, the context information and query content are converted into a semi-structured format (such as JSON or XML), and prompts are added during the format conversion process. These prompts are used to indicate the parsing method for the large model to parse the semi-structured format. The context information and query content of the format conversion are then input into the prompt template.
[0044] Context information and query content can be converted into a semi-structured format based on a predefined format type. For example, the context information can be converted into JSON format, and the corresponding implementation process is shown in the string below: JSON { "evidence": [ { "type": "MedicalExamination", "date": "2023-10-15", "test_name": "fasting blood glucose", "result": "7.5mmol / L", "Qualitative": "Slightly high" }, { "type": "SymptomOccurrence", "date": "2025-11-05", "symptom_name": "Thirst" } ], "temporal_relation": { "from": "MedicalExamination_2023-10-15", "to": "SymptomOccurrence_2025-11-05", "relation_type": "precedes" }} During format conversion, add prompts to guide the first large language model on how to parse and use the JSON structure.
[0045] After format conversion, the context information of the format conversion and the query content are added to the prompt template. This prompt template also contains constraint instructions to explicitly tell the first large language model that the answer is only related to the context information. For example, the constraint instructions in the prompt template can explicitly instruct the first large language model: "You are an AI health assistant. Please answer the user's questions strictly according to the 'context information' provided below, and do not use any knowledge outside the context."
[0046] In this invention, after obtaining the prompt template, step S4 is executed, specifically as follows: S4: Input the prompt template into the first large language model to obtain the response content corresponding to the user's query request.
[0047] The prompt template is sent to the first large-scale language model. Under the constraints of the instructions, the model integrates contextual information and the user's query to generate a final answer, such as: "According to your personal health record, you did have a history of high blood sugar two years ago, and you have recently experienced thirst. Chronologically, the high blood sugar occurred first. Poor blood sugar control is one of the common causes of thirst. It is recommended that you monitor your blood sugar levels recently and consult a doctor." This answer is then returned to the user's terminal.
[0048] It should be noted that the first large language model can be set on the user's terminal and / or in the cloud. To ensure the security of users' personal information, when it is necessary to use the first large language model to generate response content, the first large language model set on the user's terminal should be selected first to process the prompt template.
[0049] Specifically, the prompt template is sent to the data processing end, which is either a user terminal or the cloud. The data processing end is equipped with a first large language model. If the data processing end is a user terminal, the user terminal provides feedback to the user with the response content output by the first large language model within the user terminal. If the data processing end is the cloud, the response content output by the first large language model in the cloud is obtained and sent to the user terminal so that the user terminal can provide feedback to the user.
[0050] It should be noted that both the user terminal and the cloud can set up a first large language model (LLM). When both are set up with LLM, the cloud can update the model accuracy of the LLM in real time. After the LLM is updated in the cloud, if the user terminal is online, the user terminal will synchronously update its own LLM based on the latest LLM in the cloud. When the user terminal is offline, the user terminal can implement the process of obtaining contextual information from the health knowledge graph and outputting the response content from the LLM itself.
[0051] In this invention, if the user terminal is equipped with a health knowledge graph, and if the user terminal is also equipped with an LLM or the cloud is equipped with an LLM, refer to... Figures 2-4 The corresponding flowcharts and the implementation processes of the above embodiments of the present invention can be implemented in the following ways: In the first embodiment, reference Figure 2When a user enters a query on their terminal, the terminal sends a query request to the server. Upon receiving the request, the server parses it to obtain the query intent and sends it back to the terminal. The terminal then uses its own health knowledge graph to query contextual information related to the query intent and sends this information back to the server. The server adds the contextual information and the query content to a prompt template and returns it to the terminal. The LLM (Local Management Module) configured within the terminal processes the prompt template and outputs the response.
[0052] In the second embodiment, reference is made to... Figure 3 The user enters a query on their terminal, which then sends a query request to the server. Upon receiving the request, the server parses it to obtain the query intent and sends it back to the user terminal. The user terminal uses its own health knowledge graph to retrieve contextual information related to the query intent and adds this contextual information to a prompt template. The prompt template is then processed by an LLM (Local Level Management) system configured within the user terminal before outputting the response. Notably, after generating the contextual information, the user terminal does not need to send it back to the server; subsequent template generation and LLM processing are performed directly on the user terminal, further enhancing the security of user information. This solution enables completely offline operation and provides robust privacy protection, but it is limited by the computing power of the terminal device and the performance of the local model.
[0053] In the third embodiment, reference is made to... Figure 4 The user enters a query on their terminal, which then sends a query request to the server. Upon receiving the request, the server parses it to obtain the query intent and sends it back to the user terminal. The user terminal then uses their health knowledge graph to query contextual information related to the query intent and sends this contextual information back to the server. The server adds the contextual information and the query content to a prompt template and sends the prompt template to the cloud. The LLM (Local Management Module) in the cloud processes the prompt template and outputs a response to the server, which then forwards the response to the user terminal.
[0054] In this embodiment, by decentralizing data storage and sensitive data processing (such as graph querying) to the user terminal, the privacy, security, and self-control of user data are fundamentally guaranteed at the architectural level. This provides a solid technical solution for applications with extremely high data security requirements (such as medical applications that comply with GDPR, HIPAA, and other regulations).
[0055] The health question-answering method of the present invention, based on the fusion of knowledge graph and large-scale language model, has one or more of the following significant beneficial effects: 1) Significantly improved the authenticity and factual accuracy of the responses, effectively suppressing "model illusion": In this invention, by constructing enhanced constraint prompts, the LLM is explicitly and mandatorily instructed to generate answers solely based on credible contextual information retrieved from a personal health knowledge graph. This design fundamentally changes the working mode of LLM. It transforms an open-domain, unconstrained text generation task into a closed-domain "reading comprehension and summarization" task based on given materials. Because the personal health knowledge graph, as the factual basis, is itself structured and verified, the factual accuracy of answers generated using it as the sole source is fundamentally guaranteed. For example, in a comparative test containing 50 questions requiring answers based on personal health data, the system using the method of this invention achieved a factual accuracy rate of 96.0%, an improvement of 18 percentage points compared to the baseline system that directly invokes a general LLM (78.0%), while completely eliminating the risk of generating harmful erroneous information.
[0056] 2) It achieves deep personalization of answers, enabling precise responses to questions highly relevant to the user's personal health history: This invention, through graph query translation and execution in step S2, can dynamically and in real-time retrieve personalized information most relevant to the current problem, such as historical medical records, vital signs, and lifestyle habits, from the user's personal health knowledge graph. The health knowledge graph is a digital mirror of the user's health status. This invention, through a "parse-translate-retrieve" process, precisely "awakens" dormant, problem-related personal facts within the graph when the user asks a question. These facts are then injected into the LLM's context, enabling the LLM to perceive the user's personal health history and reason and answer accordingly. Therefore, for questions like "How are my symptoms different this time compared to last time?", this invention can provide highly tailored, practically guiding answers rather than broad, general advice.
[0057] 3) While ensuring accuracy and personalization, it also considers the naturalness and smoothness of interaction, thus improving the user experience: The final answer in this invention is generated by an LLM (Learning Graph), fully leveraging the advantages of LLM in natural language generation. The knowledge graph handles its strengths in fact retrieval and logical reasoning, while the LLM excels in natural language understanding and fluent generation. The retrieved personalized context provides high-quality input data for the LLM, which then performs high-precision processing based on this data to obtain a more accurate natural language answer. This architecture ensures that the core of the answer is reliable "hard knowledge," while its external presentation is a human-like "soft interaction," thus achieving a unity of technical effectiveness and user experience.
[0058] In summary, this invention, through an innovative retrieval enhancement generation method based on a personal health knowledge graph, successfully overcomes the inherent defects of existing technical approaches and provides an intelligent health question-and-answer solution that is accurate, personalized, and sufficiently natural, demonstrating significant technological advancement and important application value.
[0059] and Figure 1 Corresponding to the method described above, this embodiment of the invention also provides a health question-answering system based on the fusion of knowledge graphs and large-scale language models, for use in answering questions about health. Figure 1 The specific implementation of the method, and the structural diagram of the health question-answering system based on the fusion of knowledge graph and large language model provided in this embodiment of the invention, are as follows: Figure 5 As shown, it specifically includes: User terminal 100 is used to send query requests to server 200; upon receiving encrypted information sent by server 200, it decrypts the encrypted information to obtain the query intent association related to the query request, and queries the context information associated with the query intent from the health knowledge graph; if it receives a prompt template sent by server 200, it processes the prompt template using the first large-scale language model of user terminal 100 to obtain the response content to be fed back to the user; if it receives the response content corresponding to the query request sent by server 200, it feeds back the response content to the user. Cloud 300 is used to process the prompt template sent by server 200 using the first large language model within Cloud 300, in order to send a response to server 200. Server 200 is used to execute the aforementioned health question-answering method based on the fusion of knowledge graph and large language model.
[0060] Optionally, after querying the contextual information associated with the query intent from the health knowledge graph, the user terminal 100 is also used for: The context information and the query content in the query request are entered into the prompt template, and the prompt template is then entered into the first large language model in the user terminal 100 to obtain the response content corresponding to the query request to be fed back to the user.
[0061] The specific working process of each module in the health question-answering system based on the fusion of knowledge graph and large language model disclosed in the above embodiments of the present invention can be found in the corresponding content of the health question-answering method based on the fusion of knowledge graph and large language model disclosed in the above embodiments of the present invention, and will not be repeated here.
[0062] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and relevant parts can be referred to the descriptions in the method embodiments. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0063] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both.
[0064] To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality above. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0065] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A health question-answering method based on the fusion of knowledge graph and large-scale language model, characterized in that, The method includes: Parse the user's query request to obtain the query intent related to the query content, wherein the query intent includes intent type and key entities; Retrieve contextual information related to the query intent from the user's associated health knowledge graph; Input the context information and query content into the preset prompt template. The prompt template contains constraint instructions for constraining the behavior of the first large language model. The constraint instructions are used to limit the response content of the first large language model to be only related to the context information. Input the prompt template into the first large language model to obtain the response content corresponding to the user's query request.
2. The method according to claim 1, characterized in that, The step of obtaining the query intent corresponding to the query request includes: The query content and the preset output format instruction are sent to the preset second large language model, and the second large language model outputs the query intent corresponding to the query request according to the content format specified by the output format instruction.
3. The method according to claim 1, characterized in that, The step of obtaining the query intent corresponding to the query request includes: The query content of the query request is analyzed using a pre-defined text classification model to determine the intent type that matches the query content in the pre-defined intent set. The pre-defined bidirectional long short-term memory network-conditional random field model is used to extract key entities related to the health knowledge graph from the query content.
4. The method according to claim 1, characterized in that, The step of querying contextual information related to the query intent from the user's associated health knowledge graph includes: Transform the query intent into a graph query statement; The graph query statement is sent to the user terminal through a pre-set encrypted channel to obtain the context information fed back by the user terminal based on the graph query statement; The user terminal is equipped with a health knowledge graph associated with the user. After obtaining a graph query statement, the user terminal queries the context information associated with the graph query statement from the health knowledge graph.
5. The method according to claim 1, characterized in that, The step of querying contextual information related to the query intent from the user's associated health knowledge graph includes: Transform the query intent into a graph query statement; Execute graph query statements on the health knowledge graph to obtain query results in the form of a graph structure; The query results are serialized into at least one natural language text, which is contextual information associated with the query intent.
6. The method according to claim 5, characterized in that, The method further includes: If the query results are empty, retrieve the vector index corresponding to the pre-generated health knowledge graph; Transform query intent into query vector; The approximate nearest neighbor search is applied to find similar association information in the vector index that is similar to the query vector. The association information includes textual descriptions of graph entities and / or events. Convert related information into natural language text.
7. The method according to claim 1, characterized in that, The step of inputting context information and query content into a preset prompt template includes: The context information and query content are converted into a semi-structured format, and prompts are added during the format conversion process. The prompts are used to guide the large model on the parsing method for the semi-structured format. Enter the context information for format conversion and the query content into the prompt template.
8. The method according to claim 1, characterized in that, The step of inputting the prompt template into the first large-scale language model to obtain the response content corresponding to the user's query request includes: The prompt template is sent to the data processing terminal, which is either a user terminal or the cloud. The data processing terminal contains a first large-scale language model. If the data processing end is a user terminal, the user terminal will provide feedback to the user on the response output by the first large language model within the user terminal; If the data processing end is in the cloud, the response content output by the first large language model in the cloud is obtained and sent to the user terminal so that the user can receive feedback on the response content through the user terminal.
9. A health question-answering system based on the fusion of knowledge graph and large-scale language model, characterized in that, The system includes: The user terminal is used to send query requests to the server; upon receiving encrypted information from the server, it decrypts the encrypted information, obtains the query intent association related to the query request, and queries the context information associated with the query intent from the health knowledge graph; if it receives a prompt template from the server, it processes the prompt template using the user terminal's first large-scale language model to obtain the response content to be fed back to the user; if it receives the response content corresponding to the query request sent by the server, it feeds back the response content to the user. In the cloud, upon receiving a prompt template from the server, the system applies the first large-scale language model within the cloud to process the prompt template in order to send a response to the server. A server is configured to execute the health question-answering method based on the fusion of knowledge graph and large language model as described in any one of claims 1-8.
10. The system according to claim 9, characterized in that, After the user terminal queries the context information associated with the query intent from the health knowledge graph, it is also used for: The context information and the query content in the query request are entered into the prompt template, and the prompt template is then entered into the first large language model in the user terminal to obtain the response content corresponding to the query request to the user.