Health question and answer method based on large language model and electronic equipment

By acquiring question intent, geographic information, and user attributes for multiple searches, combined with output control based on dialogue turn, and utilizing a large language model to generate high-quality responses, the problem of long retrieval time in existing health question-and-answer systems has been solved, achieving fast and accurate health question-and-answer.

CN121662336APending Publication Date: 2026-03-13ZHUOSHI SUNAC (CHENGDU) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Existing health Q&A systems suffer from long search times due to their large knowledge bases, making it difficult to provide high-quality responses quickly.

Method used

By acquiring multiple retrievals based on question intent, geographic information, and user attributes, and combining this with output control based on dialogue turn, a large language model is used to generate high-quality responses.

Benefits of technology

It enables fast and accurate high-quality responses to health-related questions, improving response speed and search efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121662336A_ABST
    Figure CN121662336A_ABST
Patent Text Reader

Abstract

The invention discloses a health question and answer method based on a large language model and electronic equipment, and relates to the technical field of artificial intelligence. The method comprises the following steps: acquiring a to-be-processed problem and to-be-processed user information, wherein the to-be-processed user information comprises regional information and user attributes; determining the problem intention and reference content of the to-be-processed problem according to the dialogue round of the to-be-processed problem; candidate health information corresponding to the to-be-processed problem is screened from a health knowledge base in combination with the problem intention, the regional information and the user attributes; and according to the candidate health information and the reference content, generating a target reply corresponding to the to-be-processed question, and controlling the output of the target reply based on the dialogue round. According to the method, the question intention, the regional information and the user attributes are utilized for multiple retrieval, the retrieval efficiency is improved, different control is performed based on different dialogue rounds during content output, the response speed of questions and answers is improved, and then it is ensured that the healthy questions and answers can give high-quality replies rapidly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically to a health question-answering method and electronic device based on a large language model. Background Technology

[0002] With the widespread use of the internet and mobile devices, more and more people are seeking medical and health advice and information online. However, because the medical and health industry involves multiple and complex areas of expertise, users often find it difficult to obtain accurate and reliable health advice through online searches.

[0003] With the rapid development of large language models, these models can understand and generate natural language, making interactive dialogues and applications in complex medical scenarios possible. However, current health Q&A systems integrate all professional knowledge into a knowledge base, relying on retrieval of relevant knowledge to generate answers. Due to the sheer size of the knowledge base, retrieval is time-consuming, hindering the ability to quickly provide high-quality responses in health Q&A. Summary of the Invention

[0004] This application provides a health question-answering method and electronic device based on a large language model. It can perform multiple searches using question intent, geographic information, and user attributes to improve search efficiency. By performing different output controls based on different dialogue rounds, the response speed of question-answering can be improved, thereby ensuring that health questions and answers can quickly provide high-quality responses.

[0005] This application provides a health question-answering method based on a large language model, including: Obtain the issues to be processed and the user information to be processed, wherein the user information to be processed includes geographic information and user attributes; Based on the dialogue turn in which the problem to be addressed is located, determine the problem intent and reference content of the problem to be addressed; Based on the intent of the question, the geographical information, and the user attributes, candidate health information corresponding to the question to be processed is filtered from the health knowledge base; Based on the candidate health information and the reference content, a target response corresponding to the question to be processed is generated, and the output of the target response is controlled based on the dialogue round.

[0006] This application also provides a health question-answering device based on a large language model, including: The acquisition module is used to acquire the problem to be processed and the user information to be processed, including the geographic information and user attributes. The determination module is used to determine the problem intent and reference content of the problem to be processed based on the dialogue turn in which the problem to be processed is located; The filtering module is used to filter candidate health information corresponding to the problem to be processed from the health knowledge base by combining the question intent, the regional information and the user attributes. The output module is used to generate a target response corresponding to the question to be processed based on the candidate health information and the reference content, and to control the output of the target response based on the dialogue round.

[0007] This application also provides an electronic device, including a processor and a memory, wherein the memory stores multiple instructions; the processor loads instructions from the memory to execute steps in any of the health question-answering methods based on a large language model provided in this application.

[0008] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the health question-answering methods based on a large language model provided in this application.

[0009] This application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps in any of the health question-answering methods based on a large language model provided in this application.

[0010] This application embodiment can acquire the question to be processed and the user information to be processed, wherein the user information to be processed includes geographical information and user attributes; by utilizing the dialogue turn in which the question to be processed is located, the question intent and reference content are determined; by combining the question intent, geographical information and user attributes, multiple searches are performed in the health knowledge base to quickly identify candidate health information; then, using the candidate health information and reference content, a target answer is generated; when outputting the target answer, different output controls are performed based on different dialogue turns to improve the response speed of question and answer, thereby ensuring that health questions and answers can quickly provide high-quality responses. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of a scenario for the health question-answering method based on a large language model provided in an embodiment of this application; Figure 2 This is a flowchart illustrating the health question-answering method based on a large language model provided in an embodiment of this application; Figure 3 This is a schematic diagram illustrating the intent and reference content for determining the problem in different rounds provided in the embodiments of this application; Figure 4 This is a schematic diagram illustrating the generation of target responses and output control in different rounds provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of the health question-answering device based on a large language model provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0014] It is understood that in the specific implementation of this application, data involving user information such as age, gender, geographical location, medication, medical history, allergy history, etc., requires user permission or consent, and the collection, use and processing of such data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0015] See also Figure 1 This diagram illustrates an application scenario for a health-related question-and-answer method based on a large language model. The application scenario includes a terminal 101 and a server 102, which can exchange data via a network. The terminal 101 can have a question-and-answer related application installed. The terminal 101 can be a mobile phone, tablet, smart Bluetooth device, computer, large screen, robot, or other similar device. The server 102 can be a single server or a server cluster consisting of multiple servers.

[0016] Users can send pending issues and user information to server 102 via terminal 101. Server 102 can then determine the intent and reference content of the pending issue based on the dialogue round it is in. Combining the intent, location information, and user attributes, server 102 can filter candidate health information corresponding to the pending issue from the health knowledge base. Based on the candidate health information and reference content, server 102 can generate a target response to the pending issue and control the output of the target response based on the dialogue round.

[0017] The output target response can be displayed on terminal 101, so that the user can obtain the target response through terminal 101.

[0018] In this embodiment, a health question-answering method based on a large language model is provided, such as... Figure 2 As shown, the specific process of this health question-answering method based on a large language model can be as follows: S110, Obtain the issues to be processed and the user information to be processed.

[0019] A pending problem refers to a problem that needs to be solved. This pending problem can be transmitted by the user to the server through the terminal, so that the server can obtain the pending problem for further processing.

[0020] Pending user information refers to information related to users who have submitted pending questions. Specifically, a pending user can be the user who submitted the pending question, and the user information linked to the account that submitted the question constitutes pending user information. Optionally, pending user information can be user information provided by the user along with the pending question. When retrieving pending questions, the question can be checked. If user-related information is detected, it can be directly used as pending user information; otherwise, pending user information is retrieved through account information.

[0021] The user information to be processed may include geographic information and user attributes. Geographic information can refer to the user's current location within a third-level administrative division, which can be obtained through the terminal's location service. Alternatively, it can be the region information specified by the user in the pending question. When the user mentions region information in the pending question, that region information will be used as the geographic information. For example, if the user is currently located in District A of City A in Province A, but the geographic information specified in the pending question is District C of City B in Province A, then the geographic information will be District C of City B in Province A.

[0022] User attributes refer to health-related information that describes a user's physical condition, such as gender, age, medical history, allergies, and medication use. Of course, obtaining user consent is required when acquiring user information and geographic location data, and relevant laws and regulations must be followed when using this data for subsequent processing.

[0023] S120. Determine the problem intent and reference content of the problem to be processed based on the dialogue round in which the problem to be processed is located.

[0024] When conducting health Q&A sessions, multiple rounds of dialogue may be involved. The methods for determining the intent of the question and the reference content differ depending on the round. The question intent refers to the true thought conveyed by the question after analysis and interpretation. For example, if the question is "What should I do if I have a persistent cough?", the intent is to know how to relieve the cough symptom. Analyzing the question intent helps to accurately understand user needs and generate responses that better meet user expectations. See also... Figure 3 This diagram illustrates the determination of problem intent and reference content in different rounds.

[0025] The reference content is designed to enhance the understanding of the problem to be processed by the large language model. It enables the large language model to understand the problem more accurately and ensures that a response can be generated accurately in the future.

[0026] The dialogue round in which a problem to be processed exists can include the first round of dialogue and non-first round dialogues. Optionally, there are corresponding determination methods for the first round of dialogue and non-first round dialogue. When a problem to be processed is received, the previous round of dialogue for the problem to be processed is checked; if no previous round of dialogue is detected, it is determined that the problem to be processed is in the first round of dialogue; if a previous round of dialogue is detected, the correlation between the previous round of dialogue and the current problem to be processed is calculated; if the correlation is greater than the correlation threshold, it is determined that the problem to be processed is in a non-first round of dialogue; if the correlation is not greater than the correlation threshold, it is determined that the problem to be processed is in the first round of dialogue. The storage period of the previous round of dialogue can be set according to actual needs. For example, the period can be 30 minutes. For example, when the time interval between two dialogues exceeds this period, it can be directly considered that a new round of dialogue has started, that is, the problem to be processed is in the first round of dialogue.

[0027] In some embodiments, if the dialogue round in which the problem to be processed is in is the first round of dialogue, when determining the problem intent and reference content of the problem to be processed based on the dialogue round in which the problem to be processed is in, a specified model may be used to generate the reference content corresponding to the problem to be processed; the problem to be processed is input into the intent recognition model to identify the problem intent corresponding to the problem to be processed.

[0028] If the issue to be addressed is the first round of dialogue, to improve the response speed of the first round, a designated model can be pre-called to generate reference content for the issue. This designated model can be a pre-trained emotion-based question-answering model. This model can generate emotionally comforting content, providing emotional support to the user and improving the response speed for subsequent first-round dialogues.

[0029] The problem to be processed can be directly input into a designated model. After analyzing and processing the problem, the model can generate reference content and output it. Alternatively, during intent recognition, the problem can be input into an intent recognition model, which will analyze the problem's intent. Specific intent types can be pre-defined, and the intent recognition model is trained to ensure it accurately categorizes the input content into the corresponding intent type, thus obtaining the problem's intent.

[0030] Therefore, when the problem to be processed is in the first round of dialogue, it can be input into a designated model and an intent recognition model respectively. The output of the designated model is the reference content, and the output of the intent recognition model is the problem intent. To improve processing efficiency, the generation of the reference content and the problem intent can be performed in parallel.

[0031] In some embodiments, if the dialogue round in which the question to be processed is not the first round, when determining the question intent and reference content of the question to be processed based on the dialogue round in which the question to be processed is, it may be to obtain the historical dialogue records before the question to be processed, and use the historical dialogue records as reference content; use the reference content to perform semantic completion processing on the question to be processed to obtain an intermediate question; input the intermediate question into the intent recognition model to identify the question intent corresponding to the question to be processed.

[0032] If the question to be addressed is not in the first round of a dialogue, historical dialogue records preceding the question can be retrieved for a more accurate understanding of the question. These historical dialogue records are all interactions prior to the current time. For example, if the current topic is a health consultation related to diabetes, and the questions already received include "What are the diagnostic criteria for diabetes?" and "What are the symptoms?", and the current question to be addressed is "What dietary precautions should be taken for this disease?", the first two questions and their corresponding system responses can be identified as historical dialogue records for reference. Alternatively, only the question itself can be identified as a historical dialogue record; the specific settings can be configured according to actual needs.

[0033] In multi-turn dialogues, users may omit the subject or use pronouns to describe content mentioned in previous questions. Therefore, semantic completion of the question to be addressed can be performed using reference content, making the question clear and complete. For example, contextual understanding can be used to resolve pronoun references and complete omitted semantics. For instance, in the current example, the current question to be addressed is "What dietary precautions should be taken for this disease?" Using reference content, it can be determined that "this disease" refers to diabetes, and the completed intermediate question becomes "What dietary precautions should be taken for diabetes?"

[0034] Then, input the obtained intermediate question into the intent recognition model to obtain the question intent corresponding to the question to be processed. The intent recognition model is the same as the one mentioned above. For relevant content, please refer to the above, and it will not be elaborated here.

[0035] As an implementation method, during non-first-round conversations, question reconstruction and intent recognition can be completed simultaneously. Specifically, corresponding prompt templates can be designed in advance. The prompt templates can include two tasks to be executed, namely question reconstruction and intent classification, as well as the task requirements corresponding to each task. Of course, to ensure that the large language model can output results that meet the requirements, output requirements and example content can also be designed in the prompt templates. For example, the prompt template can be: #role You are a question organizer. Now you need to complete two tasks and give your classification reasons.

[0036] ## Task 1 Please rewrite the user's question based on the user's input question and reference content to make it clear, complete, and express the user's current situation.

[0037] ## Requirements: ## Output Requirements Please output the results in JSON format, including the following fields: - rewrite: The rewritten question - reason: Classification reason - categories: Question category **It is crucial for the user to ensure the correctness of the JSON format. Please confirm that the output JSON format is correct** The following are two examples: # Example 1: <Input> <Historical Question> [[ID=3D]]- How to deal with dysmenorrhea? - Can people with hypertension eat sweets? < / Historical Question> <Current Question>Then what is the recommended diet?< / Current Question> < / Input> - Question Organization Result: {"reason": "Now asking about what to eat, related to the previous question about hypertension. Currently, it can be rewritten as recommended foods for hypertension to make the question without context understanding issues, which is a disease and health-related question.", "rewrite": "What are the recommended foods for people with hypertension?", "categories": "2"} # Example 2: <Input> <Historical Issues> - What to do about dysmenorrhea? - Can people with high blood pressure eat sweets? < / Historical Issues> <Current Issue>It's okay, thank you< / Current Issue> < / Input> - Problem sorting result: {"reason": "Previously, we were talking about foods for high blood pressure. Currently, the user expresses that it's okay, which can be rewritten as there is no problem and can be classified as others.", "rewrite": "It's okay, thank you", "categories": "4"}

[0038] Input the to-be-processed problem and the reference content into the corresponding positions in the prompt template to obtain the complete prompt. Input this prompt into the large language model to obtain the intermediate problem and the problem intention simultaneously.

[0039] S130. Combine the problem intention, the geographical information, and the user attributes to screen the candidate health information corresponding to the to-be-processed problem from the health knowledge base.

[0040] The health knowledge base may include text content obtained by pre-collecting and cleaning data in the medical and health field. Using the problem intention, geographical information and user attributes, retrieval can be performed in the health knowledge base to screen out the candidate health information corresponding to the to-be-processed problem.

[0041] Optionally, the health knowledge base may include a special knowledge base, a general knowledge base, and a geographical knowledge base. Among them, there may be multiple special knowledge bases, and each special knowledge base contains knowledge in a specific sub-field. For example, a symptom knowledge base, a drug knowledge base, an examination item library, a treatment plan library, etc. The general knowledge base contains general medical knowledge and general medical information. The geographical knowledge base may contain region-specific medical information, such as prevention and treatment of endemic diseases, regionally prevalent diseases, and regional medical policies. Compared with storing all knowledge in a single health knowledge base, when retrieving knowledge, there is no need to traverse all knowledge each time, which can significantly reduce the data retrieval volume and improve the retrieval efficiency. And dividing the health knowledge base into a special knowledge base, a geographical knowledge base, and a general knowledge base can avoid knowledge overlap and confusion and improve the accuracy of retrieval.

[0042] When selecting candidate health information corresponding to a problem to be processed from a health knowledge base by combining the problem intent, geographic information, and user attributes, the process can be as follows: based on the problem intent, first health information corresponding to the problem to be processed can be retrieved from both the specialized knowledge base and the general knowledge base; using the geographic information and the problem to be processed, second health information corresponding to the problem to be processed can be retrieved from the geographic knowledge base; and the first and second health information can be integrated and processed using the user attributes to obtain candidate health information.

[0043] The process involves using the question intent to retrieve primary health information corresponding to the problem in both specialized and general knowledge bases. Secondary health information is retrieved from the regional knowledge base using geographic information. Finally, the information is integrated to obtain candidate health information. This three-tiered knowledge base retrieval ensures comprehensiveness, and the parallel execution of these three retrieval layers enables highly efficient searching.

[0044] Optionally, when retrieving the first health information corresponding to the problem to be processed from the specialized knowledge base and the general knowledge base according to the problem intent, the target specialized knowledge base corresponding to the problem intent can be determined based on the mapping relationship between the intent type and the specialized knowledge base, wherein the intent type includes the problem intent; specialized health information is determined based on the relevance between the problem to be processed and each piece of specialized information, wherein the specialized information is information in the specialized knowledge base; general health information is determined based on the cosine similarity between the problem to be processed and general information, wherein the general information is information in the general knowledge base; and the specialized health information and the general health information are determined as the first health information.

[0045] The intent type is pre-defined, and the problem intent is the intent type that best matches the problem to be addressed. There can be multiple specialized knowledge bases, and a mapping relationship between intent types and specialized knowledge bases can be pre-established, with one intent type corresponding to one specialized knowledge base. For example, if the intent type is "symptom," its mapped specialized knowledge base could be a symptom database; similarly, if the intent type is "medicine," its mapped specialized knowledge base could be a medicine database.

[0046] Based on this mapping relationship, the target specialized knowledge base corresponding to the problem intent can be determined. This base contains multiple pieces of specialized information, and the relevance between the problem to be processed and each piece of specialized information is calculated. The relevance value characterizes the degree of association between the problem and the specialized information; a higher relevance value indicates a stronger association, and thus a higher probability that the specialized information is candidate health information. Specifically, the problem to be processed is vectorized to obtain a problem vector; each piece of specialized information is also vectorized to obtain a specialized information vector; the cosine similarity between the problem vector and each specialized information vector is calculated as the relevance value. Specialized information with a relevance value greater than a relevance threshold is considered intermediate specialized information, and then these intermediate specialized information are sorted in descending order of relevance value. The top-ranked first few pieces of intermediate specialized information are considered specialized health information.

[0047] Similarly, the general knowledge base contains multiple pieces of general information. Each piece of general information can be vectorized to obtain a general information vector. The cosine similarity between the question vector and each general information vector is calculated. General information with a cosine similarity greater than the general threshold is taken as intermediate general information. The intermediate general information is sorted in descending order of cosine similarity, and the second-to-last intermediate general information is taken as general health information.

[0048] Then, specific health information and general health information can be identified as primary health information.

[0049] The geographic information in the user information to be processed is geographical location information in a specified format determined based on the user's current location. This specified format can be at the province / city / district level. Using the geographic information and the question to be processed, the target geographic information can be determined first. For example, if the question to be processed contains location information, this location information can be directly converted to the specified format and used as the target geographic information; if the question to be processed does not contain location information, the geographic information can be used as the target geographic information.

[0050] Multiple regional knowledge bases are set up. Using the target regional information, the regional knowledge base that matches the target regional information can be located and used as the target regional knowledge base. Then, the second health information corresponding to the problem to be processed is retrieved in the target regional knowledge base. Specifically, the problem to be processed can be vectorized to obtain a problem vector. Each piece of knowledge in the target regional knowledge base is converted into a regional knowledge vector. The cosine similarity between the problem vector and the regional knowledge vector is calculated. First, regional knowledge with a cosine similarity greater than a regional threshold is selected as intermediate regional knowledge. Then, the intermediate regional knowledge is sorted in descending order of cosine similarity. The top three-digit number of intermediate regional knowledge in the sorted order are used as the second health information.

[0051] Through the three-layer retrieval described above, first and second health information that are highly relevant to the problem to be addressed were retrieved from three different health knowledge bases. To ensure that this information is suitable for the user, the first and second health information can be integrated and processed using user attributes to obtain candidate health information.

[0052] Optionally, when integrating the first health information and the second health information using user attributes to obtain candidate health information, the following steps can be taken: determining target attribute information using user attributes and the problem to be processed; deduplicating the first health information and the second health information to obtain merged information; for each merged information, filtering intermediate candidate information from the merged information based on a preset time parameter and the time parameter of the merged information; and determining the intermediate candidate information that matches the target attribute as candidate health information.

[0053] User attributes contain basic user information, such as gender, age, and medication history. The pending issues submitted by users may also contain specific user information. Therefore, by combining user attributes and pending issues, target attributes—that is, the attribute information needed to filter health information—can be determined. Optionally, user information can be detected in the pending issues; if user information is detected, it is used as the target attribute; if no user information is detected, the user attribute is used as the target attribute information. The aforementioned multi-level retrieval retrieves first and second health information, where the first health information includes specific health information and general health information. Deduplicating the first and second health information essentially deduplicates the specific health information, general health information, and second health information. After deduplication, merged information is obtained, and each merged information is unique.

[0054] To ensure the timeliness of candidate health information, time parameters can be used to filter merged information and obtain intermediate candidate information. Specifically, the time parameter for each merged piece of information can be obtained; this time parameter is the publication time of the merged information. For example, if a merged piece of information is policy information, the time parameter is the publication time of that policy. Preset time parameters are pre-defined and can be used to filter out more recent merged information as intermediate candidate information. The preset time parameter can be a time period; merged information within this time period is used as intermediate candidate information. The specific settings for the preset time parameter can be customized according to actual needs and are not limited here.

[0055] Understandably, while intermediate candidate information is already relatively recent data relevant to the problem at hand, some intermediate candidate information may still not match the target attribute. For example, in the medical field, some diseases are related to specific age groups or genders. By matching the target attribute with each intermediate candidate piece of information, the intermediate candidate information that matches the target attribute can be retained as candidate health information. Specifically, when matching the target attribute with each intermediate candidate piece of information, prompt words can be pre-set and used in conjunction with a large language model. The large language model provides a conclusion on whether a match has occurred, and the intermediate candidate information that is concluded to be a match is then retained to obtain candidate health information.

[0056] By integrating and filtering the health information obtained from the three-level search in multiple dimensions, high-quality candidate health information can be selected, laying the foundation for accurate answers to user questions in the future.

[0057] S140. Based on the candidate health information and the reference content, generate a target response corresponding to the question to be processed, and control the output of the target response based on the dialogue round.

[0058] After selecting candidate health content, the candidate health content, along with reference content, can be used to generate a target response to the question to be addressed. Specifically, the candidate health content provides a wealth of high-quality medical and health knowledge, while the reference content helps the large language model accurately understand the question to be addressed, thereby improving the accuracy of the generated target response.

[0059] The way the target response is output differs depending on the stage of the dialogue. For example, in the first round of dialogue, to ensure a quick response, partial content can be output first; in subsequent rounds, the target response can be output directly. See [reference needed]. Figure 4 This diagram illustrates the generation of target responses and output control in different rounds.

[0060] In some embodiments, during the first round of dialogue, a target response corresponding to the question to be processed is generated based on candidate health information and reference content, and the output of the target response is controlled based on the dialogue round. This can be achieved by outputting the reference content if it is detected; simultaneously, the reference content and the candidate health information are added to a preset system template to obtain system prompt words; the question to be processed and the user attributes are added to a preset user template to obtain user prompt words; the system prompt words and the user prompt words are used to guide a large language model to generate a target response, which includes question answering content; and the question answering content is controlled to be output following the output of the reference content.

[0061] When users interact with a health Q&A system, the system requires time to understand the user's question and perform multiple searches, resulting in long waiting times for users. To improve the initial response speed of the health Q&A system, upon receiving a question in the first round of dialogue, the generation of reference content and the retrieval process after intent recognition can be executed in parallel, with reference content being monitored in real time. If reference content is detected, its output is immediately controlled.

[0062] Simultaneously, the intent recognition and retrieval process continues. After the retrieval is complete, the target response can be generated using candidate health information and reference content. The target response in the first round of dialogue includes reference content and question-and-answer content. The reference content can be related to emotional comfort, providing users with emotional support. Furthermore, the reference content can be directly generated and output using the model after receiving the question to be processed, significantly reducing user waiting time and improving the initial response rate. While generating and outputting the reference content, intent recognition, multi-knowledge retrieval, and the incorporation of reference content are performed to generate the target response. The generated target response includes both reference content and question-and-answer content, ensuring a smooth transition between the two. After the reference content is output, the question-and-answer content can be output, thus forming a complete target response.

[0063] In non-first-round conversations, there is no need to speed up the response; instead, the focus is on generating a target response that better meets the user's needs, ensuring the accuracy of the answer. In some embodiments, during non-first-round conversations, when generating a target response corresponding to the question to be processed based on candidate health information and the reference content, and controlling the output of the target response based on the conversation round, the reference content and the candidate health information can be added to a preset system template to obtain system prompt words; the question to be processed, the user attributes, and the preset user template can be merged to obtain user prompt words; the system prompts and the user prompt words can be used to guide the large language model to generate the target response; and the target response can be output. Based on the above, it is clear that there are significant differences in the processing of first-round and non-first-round dialogues. In the first-round dialogue, reference content is generated directly through the model and output immediately to improve the initial response speed. While generating and outputting the reference content, the normal intent recognition and retrieval process is executed, and the target response is generated and appended to the reference content using a large language model. In contrast, in non-first-round dialogues, the intent recognition and retrieval process is directly initiated, and the target response is generated using a large language model before being output.

[0064] Whether it's the first round of dialogue or subsequent rounds, it's necessary to use cue words to guide the large language model to ensure that it can output the target response that meets the requirements.

[0065] Specifically, reference content and candidate health information can be added to a preset system template to obtain system prompts. The question to be processed, user attributes, and preset user templates can be merged to obtain user prompts. The system prompts and user prompts are combined to guide the large language model to generate the target response.

[0066] Before obtaining the preset system template and preset user template, different types of templates can be dynamically selected based on the relevance of the candidate health information. The preset system template and preset user template are divided into complete type and simplified type. The complete type requires explicit labeling of the source of the candidate health information, while the simplified type does not require labeling of the source of the candidate health information and only needs to rely on the model's own knowledge.

[0067] First, determine if the candidate health information is empty. If it is, a simplified prompt template can be selected directly. If the candidate health information is not empty, obtain the relevance of each candidate health information. If the relevance is lower than the set threshold, it can be determined that the candidate health information is not strongly related to the problem to be addressed, and a simplified prompt template can be selected directly. If the relevance is not lower than the set threshold, it can be determined that the candidate health information is strongly related to the problem to be addressed, and a complete prompt template can be selected directly.

[0068] The preset system template can include roles, thinking directions, and requirements. The role section clearly defines the role to be played and the task to be performed; the thinking direction section specifies the process for solving the problem to be processed; and the requirements section specifies the specific requirements for the output. The preset user template includes problem slots and attribute slots, which are used to fill in the problem to be processed and the target attribute, respectively.

[0069] Both the preset system template and the preset user template can be set according to actual needs, and no specific limitations are made here. In the embodiments of this application, the preset system template and the preset user template are as follows: System prompt ## Role You are an experienced promoter of the family doctor convenience knowledge base, possessing solid clinical experience and extensive healthcare knowledge. Your task is to provide scientific, accurate, and concise medical advice and solutions based on users' questions and past conversations. Only answer questions related to health, family doctor policies, and contract signing. ### Direction of Thinking 1. **Solutions and Recommendations** - Provide scientific and practical solutions, including but not limited to: - Lifestyle adjustment suggestions - Recommended inspection or testing items - Symptom relief strategies and possible treatment options (short-term and long-term). - When is further medical attention or referral needed? - **Safe and effective treatment options are given priority** - Taking into account both Traditional Chinese Medicine and Western Medicine 2. **Follow-up Questions** - Consider whether you need to ask the user follow-up questions. Avoid asking more than one follow-up question in a row, and ensure the follow-up questions are of high quality. 3. **Organize and answer** - Structure: The first paragraph clearly states the overall recommendations, the middle paragraph elaborates on the points, and the last paragraph summarizes the main points.

[0070] - Bold key terms (e.g., drug names). - Do not use --- as a separator ### Require - Language style: Maintain a balance between professionalism and accessibility, ensure easy understanding for users, reduce the use of symbols, be fluent, avoid headings, and conform to human conversation habits. - **Caution with Medication:** When making recommendations regarding medication or surgery, or other medically-related matters, the relevant contraindications must be mentioned. Dosage is not provided for medications. - **Personalized suggestions:** Provide targeted suggestions based on the user's specific situation, avoiding generalities. - **Scientific Basis:** All recommendations are based on medical expertise and the latest clinical guidelines or supplementary knowledge to ensure the accuracy and reliability of the information. - Emotional support: For users who are feeling down, emotional support should be provided verbally; in case of emergency, brief and clear guidance should be provided immediately. {Supplementary Knowledge} User prompt {question} {Personal Attributes} In the preset system template, the {Supplementary Knowledge} section can be filled with candidate health information and reference content, the {Question} section can be filled with the question to be processed, and the {Personal Attributes} section can be filled with the target attribute. After the content is filled in, system prompts and user prompts will be obtained. Combining these two prompts into the final prompts and inputting them into the large language model will yield the target response.

[0071] It should be noted that the reference content provided in the first round of dialogue ensures a smooth transition between the content generated by the large language model and the reference content, resulting in a more coherent overall target response. References provided in subsequent rounds of dialogue ensure that the large language model accurately understands the current problem to be addressed, ensuring an accurate output of the target response.

[0072] In some embodiments, in addition to providing users with medical advice related to their pending questions, the health question-and-answer system can also recommend relevant medical resources. For example, it can use the geographic information and the pending question to determine geographic recommendation resources; determine candidate recommendation resources from the geographic recommendation resources based on the similarity between the question intent and each geographic recommendation resource; determine the target recommendation resource from the candidate recommendation resources using the user attributes and the pending question; and control the output of the target recommendation resource and the target answer together.

[0073] For different regions, a regional resource database can be pre-set. This database can include available medical resources within the region, such as purchasable medicines and institutions providing medical services. These medical resources are all pre-entered after compliance review. Similar to the aforementioned search of the health knowledge base, target regional information can be determined based on regional information and the question to be addressed. All content in the corresponding regional resource database can then be used as recommended resources for that region.

[0074] To ensure that the recommended resources meet user needs, the geographic recommendation resources can be further filtered using question intent. Each geographic recommendation resource has its corresponding descriptive information; for example, medicines may have descriptions of their indications, and institutions may have descriptions of the services they provide. This descriptive information is converted into description vectors using a vectorization model. The question intent is then converted into question vectors. The cosine similarity between the question vectors and each description vector is calculated. Geographic recommendation resources corresponding to description vectors with cosine similarity greater than a similarity threshold are identified as candidate recommendation resources.

[0075] By utilizing user attributes and the problem to be addressed, target attributes can be identified. These target attributes include personal information such as gender and age. These attributes can then be used to filter more relevant target resources from the candidate pool. For example, age can be used to determine whether the user is a child or an adult. If the user is a child, institutions specializing in services for children can be identified as target resources to provide more professional services; if the user is an adult, institutions serving adults will be selected as target resources.

[0076] Therefore, the target recommended resources obtained through multi-level filtering are more in line with user needs. The number of these target recommended resources can be set according to actual needs, such as 5 or 10. These target recommended resources can be output along with the target response or after the target response has been output, so as to provide users with more comprehensive health services based on answering their health inquiries.

[0077] Understandably, both the target recommended resources and the target responses will be output to the user. To ensure the rigor of medical research, necessary checks are required on both. These checks can include accuracy checks and compliance checks. Accuracy checks primarily target responses, requiring tracing the source of the viewpoints or suggestions within them. For example, which knowledge in the knowledge base is a particular viewpoint or suggestion in the generated content based on? If all content generated by the large language model can be found in the knowledge base, the generated content can be considered sufficiently accurate and passes the accuracy check. Compliance checks primarily target recommended resources, mainly used to check whether the recommended resource is safe and compliant. For example, if the recommended resource is an institution, its qualifications can be verified. If the recommended resource's qualifications all meet the requirements, it can be determined that the accuracy check has passed.

[0078] After providing the target response and target recommended resources, you can also continue to provide risk warnings and disclaimers.

[0079] As one implementation method, to avoid overly lengthy output that could strain user patience, the length of the output can be controlled. For example, the length of the target response can be controlled, and the large language model can be required to adhere to a concise principle when generating the target response, thus avoiding lengthy and verbose responses. Furthermore, controlling the number of recommended resources can also prevent excessive output that could interfere with user choices.

[0080] The health question-answering solution based on a large language model provided in this application can be applied to various health question-answering scenarios. This solution can take many forms; it can be integrated into large hardware screens in hospitals or communities to provide patients with basic health advice as a health assistant; or it can be used as a mini-program to provide users with health advice.

[0081] The method provided in this application can divide the knowledge base into specialized knowledge bases, general knowledge bases, and regional knowledge bases, and perform multi-level retrieval based on question intent, regional information, and user attributes, effectively reducing the amount of data traversed and improving retrieval efficiency. When generating target answers, accurate knowledge retrieval and reference content ensure accurate understanding at the large language model level. Using prompt words to impose multi-dimensional constraints on the generation of the large language model and performing multi-dimensional detection on the generated content ensures the generation of high-quality target answers and recommended resources. When outputting content, reference content is prioritized in the first round to improve the response speed of question answering, enabling fast and high-quality health-related question answering.

[0082] To better implement the above methods, this application also provides a health question-and-answer device based on a language model. This device can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer; the server can be a single server or a server cluster consisting of multiple servers.

[0083] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the health question-and-answer device based on a large language model specifically integrated into the server as an example.

[0084] For example, such as Figure 5 As shown, the health question-and-answer device 200 based on a large language model may include an acquisition module 210, a determination module 220, a filtering module 230, and an output module 240.

[0085] The acquisition module 210 is used to acquire the problem to be processed and the user information to be processed, wherein the user information to be processed includes geographical information and user attributes. The determination module 220 is used to determine the problem intent and reference content of the problem to be processed based on the dialogue turn in which the problem to be processed is located; The filtering module 230 is used to filter candidate health information corresponding to the problem to be processed from the health knowledge base by combining the problem intent, the regional information and the user attributes. The output module 240 is used to generate a target response corresponding to the question to be processed based on the candidate health information and the reference content, and to control the output of the target response based on the dialogue round.

[0086] In some embodiments, the health knowledge base includes a specialized knowledge base, a general knowledge base, and a regional knowledge base, and the filtering module 230 is specifically used for: Based on the intent of the question, the first health information corresponding to the question to be processed is retrieved from the specialized knowledge base and the general knowledge base, respectively. Using the aforementioned regional information and the problem to be processed, the second health information corresponding to the problem to be processed is retrieved from the regional knowledge base; The first health information and the second health information are integrated and processed using the user attributes to obtain candidate health information.

[0087] In some embodiments, the filtering module 230 is specifically used for: Based on the mapping relationship between intent types and specialized knowledge bases, the target specialized knowledge base corresponding to the question intent is determined, wherein the intent type includes the question intent; Based on the relevance between the problem to be processed and each piece of specific information, specific health information is determined, and the specific information is information in the specific knowledge base; Based on the cosine similarity between the problem to be processed and the general information, the general health information is determined, wherein the general information is the information in the general knowledge base; The specific health information and the general health information are identified as the first health information.

[0088] In some embodiments, the filtering module 230 is specifically used for: Using the user attributes and the problem to be processed, determine the target attributes; The first and second health information are deduplicated to obtain merged information. For each merged piece of information, intermediate candidate information is selected from the merged information based on a preset time parameter and the time parameter of the merged information. Intermediate candidate information that matches the target attribute is identified as candidate health information.

[0089] In some embodiments, the dialogue rounds include the first round of dialogue, and the determining module 220 is specifically used for: Using the specified module, generate reference content corresponding to the problem to be processed; The problem to be processed is input into the intent recognition model to identify the intent corresponding to the problem to be processed.

[0090] In some embodiments, the output module 240 is specifically used for: If the reference content is detected, the reference content is output; While outputting the reference content, the reference content and the candidate health information are added to a preset system template to obtain system prompt words; By merging the unprocessed problem, the user attributes, and the preset user template, user prompt words are obtained; The system prompts and user prompts are used to guide the large language model to generate a target response, which includes the answer to the question. The answer to the question is output after the reference content output.

[0091] In some embodiments, the dialogue rounds include non-first rounds of dialogue, and the determining module 220 is specifically used for: Obtain the historical dialogue records prior to the problem to be processed, and use the historical dialogue records as reference content; Using the reference content, semantic completion processing is performed on the problem to be processed to obtain the intermediate problem; The intermediate problem is input into the intent recognition model to identify the intent corresponding to the problem to be processed.

[0092] In some embodiments, the output module 240 is specifically used for: The reference content and the candidate health information are added to a preset system template to obtain system prompt words; By merging the unprocessed problem, the user attributes, and the preset user template, user prompt words are obtained; The system prompts and user prompts are used to guide the large language model in generating the target response; Output the target response.

[0093] In some embodiments, the health question-answering device 200 based on a large language model further includes a recommendation module, which is specifically used for: Using the aforementioned geographic information and the problem to be processed, recommended resources for the region are determined; Based on the similarity between the question intent and each region's recommended resources, candidate recommended resources are determined from the region's recommended resources; Using the user attributes and the problem to be processed, determine the target recommended resource from the candidate recommended resources; The target recommended resources and the target response are output together.

[0094] In practice, the above modules can be implemented as independent entities or combined in any way to be implemented as the same or several entities. For the specific implementation of the above modules, please refer to the previous method implementation examples, which will not be repeated here.

[0095] As can be seen from the above, the health question-answering device based on the large language model in this embodiment can acquire the question to be processed and the user information to be processed, wherein the user information to be processed includes regional information and user attributes; by using the dialogue turn in which the question to be processed is located, the question intent and reference content are determined; by combining the question intent, regional information and user attributes, multiple searches are performed in the health knowledge base to quickly determine candidate health information; then, using the candidate health information and reference content, a target answer is generated; when outputting the target answer, different output controls are performed based on different dialogue turns to improve the response speed of question answering, thereby ensuring that health question answering can quickly provide high-quality responses.

[0096] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.

[0097] In some embodiments, the health question-answering device based on a large language model can also be integrated into multiple electronic devices. For example, the health question-answering device based on a large language model can be integrated into multiple servers, and the health question-answering method based on a large language model of this application can be implemented by multiple servers.

[0098] In this embodiment, a server will be used as an example for detailed description. For example, ... Figure 6 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically: The electronic device may include components such as a processor 310 with one or more processing cores, a memory 320 with one or more computer-readable storage media, a power supply 330, an input module 340, and a communication module 350. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 310 is the control center of the electronic device, connecting various parts of the device via various interfaces and lines. It executes various functions and processes data by running or executing software programs and / or modules stored in the memory 320, and by calling data stored in the memory 320. In some embodiments, the processor 310 may include one or more processing cores; in some embodiments, the processor 310 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 310.

[0099] The memory 320 can be used to store software programs and modules. The processor 310 executes various functional applications and data processing by running the software programs and modules stored in the memory 320. The memory 320 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 320 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 320 may also include a memory controller to provide the processor 310 with access to the memory 320.

[0100] The electronic device also includes a power supply 330 that supplies power to the various components. In some embodiments, the power supply 330 can be logically connected to the processor 310 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 330 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0101] The electronic device may also include an input module 340, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0102] The electronic device may also include a communication module 350. In some embodiments, the communication module 350 may include a wireless module, through which the electronic device can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 350 can be used to help users send and receive emails, browse web pages, and access streaming media.

[0103] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 310 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 320 according to the following instructions, and the processor 310 runs the applications stored in the memory 320, thereby implementing the steps in the methods of the various embodiments of this application.

[0104] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0105] As can be seen from the above, the electronic device provided in this application embodiment can acquire the question to be processed and the user information to be processed, wherein the user information to be processed includes geographical information and user attributes; by utilizing the dialogue turn in which the question to be processed is located, the question intent and reference content are determined; by combining the question intent, geographical information and user attributes, multiple searches are performed in the health knowledge base to quickly determine candidate health information; then, using the candidate health information and reference content, a target answer is generated; when outputting the target answer, different output controls are performed based on different dialogue turns to improve the response speed of question and answer, thereby ensuring that health questions and answers can quickly provide high-quality responses.

[0106] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0107] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the health question-answering methods based on a large language model provided in embodiments of this application.

[0108] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0109] According to one aspect of this application, a computer program product or computer program is provided, comprising a computer program / instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer program / instructions from the computer-readable storage medium and executes the computer program / instructions, causing the electronic device to perform the methods provided in various optional implementations of the health question-answering aspect based on a large language model as described in the above embodiments.

[0110] Since the instructions stored in the storage medium can execute the steps of any of the health question-answering methods based on a large language model provided in the embodiments of this application, the beneficial effects that any of the health question-answering methods based on a large language model provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.

[0111] The above provides a detailed description of a health question-answering method and electronic device based on a large language model provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A health question-answering method based on a large language model, characterized in that, The method includes: Obtain the issues to be processed and the user information to be processed, wherein the user information to be processed includes geographic information and user attributes; Based on the dialogue turn in which the problem to be addressed is located, determine the problem intent and reference content of the problem to be addressed; Based on the intent of the question, the geographical information, and the user attributes, candidate health information corresponding to the question to be processed is filtered from the health knowledge base; Based on the candidate health information and the reference content, a target response corresponding to the question to be processed is generated, and the output of the target response is controlled based on the dialogue round.

2. The method according to claim 1, characterized in that, The health knowledge base includes a specialized knowledge base, a general knowledge base, and a regional knowledge base. The step of combining the question intent, the regional information, and the user attributes to filter candidate health information corresponding to the question to be processed from the health knowledge base includes: Based on the intent of the question, the first health information corresponding to the question to be processed is retrieved from the specialized knowledge base and the general knowledge base, respectively. Using the aforementioned regional information and the problem to be processed, the second health information corresponding to the problem to be processed is retrieved from the regional knowledge base; The first health information and the second health information are integrated and processed using the user attributes to obtain candidate health information.

3. The method according to claim 2, characterized in that, The step of retrieving the first health information corresponding to the problem to be processed from the specialized knowledge base and the general knowledge base, respectively, based on the intent of the problem, includes: Based on the mapping relationship between intent types and specialized knowledge bases, the target specialized knowledge base corresponding to the question intent is determined, wherein the intent type includes the question intent; Based on the relevance between the problem to be processed and each piece of specific information, specific health information is determined, and the specific information is information in the specific knowledge base; Based on the cosine similarity between the problem to be processed and the general information, the general health information is determined, wherein the general information is the information in the general knowledge base; The specific health information and the general health information are identified as the first health information.

4. The method according to claim 2, characterized in that, The process of integrating the first health information and the second health information using the user attributes to obtain candidate health information includes: Using the user attributes and the problem to be processed, determine the target attributes; The first and second health information are deduplicated to obtain merged information. For each merged piece of information, intermediate candidate information is selected from the merged information based on a preset time parameter and the time parameter of the merged information. Intermediate candidate information that matches the target attribute is identified as candidate health information.

5. The method according to claim 1, characterized in that, The dialogue rounds include the first round of dialogue. Determining the intent and reference content of the problem to be addressed based on its current dialogue round includes: Using the specified model, generate reference content corresponding to the problem to be processed; The problem to be processed is input into the intent recognition model to identify the intent corresponding to the problem to be processed.

6. The method according to claim 5, characterized in that, The step of generating a target response corresponding to the question to be processed based on the candidate health information and the reference content, and controlling the output of the target response based on the dialogue round, includes: If the reference content is detected, the reference content is output; While outputting the reference content, the reference content and the candidate health information are added to a preset system template to obtain system prompt words; By merging the unprocessed problem, the user attributes, and the preset user template, user prompt words are obtained; The system prompts and user prompts are used to guide the large language model to generate a target response, which includes the answer to the question. The answer to the question is output after the reference content output.

7. The method according to claim 1, characterized in that, The dialogue rounds include non-first rounds of dialogue. Determining the intent and reference content of the question to be processed based on its current dialogue round includes: Obtain the historical dialogue records prior to the problem to be processed, and use the historical dialogue records as reference content; Using the reference content, semantic completion processing is performed on the problem to be processed to obtain the intermediate problem; The intermediate problem is input into the intent recognition model to identify the intent corresponding to the problem to be processed.

8. The method according to claim 7, characterized in that, The step of generating a target response corresponding to the question to be processed based on the candidate health information and the reference content, and controlling the output of the target response based on the dialogue round, includes: The reference content and the candidate health information are added to a preset system template to obtain system prompt words; By merging the unprocessed problem, the user attributes, and the preset user template, user prompt words are obtained; The system prompts and user prompts are used to guide the large language model in generating the target response; Output the target response.

9. The method according to claim 1, characterized in that, The method further includes: Using the aforementioned geographic information and the problem to be processed, recommended resources for the region are determined; Based on the similarity between the question intent and each region's recommended resources, candidate recommended resources are determined from the region's recommended resources; Using the user attributes and the problem to be processed, determine the target recommended resource from the candidate recommended resources; The target recommended resources and the target response are output together.

10. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to execute the steps in the health question-answering method based on a large language model as described in any one of claims 1 to 9.