Question and answer method and device
Through the multi-agent collaborative architecture and large model rewriting mechanism, the problem of insufficient intent recognition in the existing intelligent medical question-answering system is solved, deep understanding and professional answers to user questions are achieved, and the accuracy and efficiency of the question-answering system are improved.
Patent Information
- Application Number
- CN202411605017.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-11-11
AI Technical Summary
Existing intelligent medical question-and-answer systems mainly rely on keyword matching, making it difficult to provide authoritative, professional, and comprehensive answers to users' questions. Especially in medical scenarios, they lack a deep understanding of user intent and support for multi-round conversations.
It adopts a multi-agent collaborative architecture, through the division of labor between decision-making agents and task agents, combined with large models and rewriting mechanisms, to achieve a deep understanding of user questions, information sharing and intent recognition in multiple rounds of dialogue, and generate authoritative and professional answers.
The accuracy and efficiency of the question-answering system have been improved, and it can accurately identify user intentions in multiple rounds of conversations, providing one-stop smart health services to meet the multiple needs of users.
Smart Images

Figure CN119557397B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the fields of natural language processing, deep learning, and large language model technology. Background Art
[0002] A question-and-answer system is an advanced form of information retrieval system that can answer user questions in natural language. When applied to medical scenarios, intelligent medical question-and-answer systems can understand patients' complaints, simulate doctors' conversational thinking, help patients systematically sort out their conditions, and generate standardized pre-diagnosis reports, helping doctors gain a more comprehensive understanding of patients and improving consultation efficiency.
[0003] Currently, intelligent medical question-and-answer systems primarily rely on keyword matching. They match user questions against a pre-defined list of keywords and provide responses based on the keyword hits. This approach can be applied to simple drug information queries or health education, offering simplicity and low cost. Summary of the Invention
[0004] The embodiments of the present disclosure provide a question-answering method, apparatus, device, storage medium, and program product.
[0005] In the first aspect, an embodiment of the present disclosure proposes a question-answering method, including: inputting the current question input by the user into a decision-making agent, and outputting a task agent chain; selecting a task agent corresponding to the task agent chain from a set of task agents; and executing the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0006] On the second aspect, an embodiment of the present disclosure proposes a question-answering device, including: a decision module, configured to input the current question input by the user into a decision agent, and output a task agent chain; a selection module, configured to select a task agent corresponding to the task agent chain from a set of task agents; and an execution module, configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0007] In the third aspect, an embodiment of the present disclosure proposes an intelligent agent, including: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a first large model based on the target task, and obtaining output information by calling the first large model to execute the method described in the first aspect; and an output module for outputting the output information obtained by the processing module.
[0008] In a fourth aspect, an embodiment of the present disclosure proposes an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the first aspect.
[0009] In a fifth aspect, an embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present disclosure proposes a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.
[0011] The key or important features of the embodiments of the present disclosure are not intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Other features, objects, and advantages of the present disclosure will become more apparent upon reading the detailed description of the non-limiting embodiments made with reference to the following drawings. The drawings are provided for a better understanding of the present disclosure and do not constitute a limitation of the present disclosure. Among them:
[0013] Figure 1 is a flow chart of an embodiment of the question-answering method according to the present disclosure;
[0014] Figure 2 is a flow chart of another embodiment of the question-answering method according to the present disclosure;
[0015] Figure 3 is a flow chart of another embodiment of the question-answering method according to the present disclosure;
[0016] Figure 4 is an architectural diagram for implementing the question-answering method of the embodiment of the present disclosure;
[0017] Figure 5 is a structural diagram of an embodiment of a question-answering device according to the present disclosure;
[0018] Figure 6 3 is a block diagram of an electronic device for implementing the question-answering method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0020] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0021] Figure 1 FIG1 shows a process 100 of an embodiment of a question-answering method according to the present disclosure. The question-answering method includes the following steps:
[0022] Step 101: Input the current question input by the user into the decision agent and output the task agent chain.
[0023] In this embodiment, the execution subject of the question-answering method can input the current question input by the user into the decision-making agent and output a task agent chain.
[0024] The execution entity of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitations are given here.
[0025] Usually, a question-and-answer application or browser is installed on the user's terminal. The user can input questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the current question can be input into the decision-making agent, and a task agent chain is output. Among them, the decision-making agent can be composed of one or more models, which are used to understand the questions input by the user and distribute tasks. The task agent chain may include the task agents that need to be executed to answer the questions input by the user, and the execution order between the task agents. The task agent set may include multiple different task agents for performing different tasks. When applied to an intelligent medical question-and-answer system, the task agent set may include but is not limited to: task agents for answering medical popular science knowledge, interpreting reports, detecting skin diseases, asking medical questions, asking medical questions in return, etc. The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, serial and parallel combination connection of task agents, etc.
[0026] In some embodiments, the information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set. The information of the decision-making agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision-making agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0027] Step 102: Select a task agent corresponding to the task agent chain from the task agent set.
[0028] In this embodiment, the execution entity can select a task agent corresponding to the task agent chain from a set of task agents. When applied to an intelligent medical question-answering system, the set of task agents may include, but is not limited to, agents for answering medical knowledge, interpreting reports, detecting skin diseases, asking follow-up questions, and asking counter-questions.
[0029] Step 103: execute the selected task agent in the order of the task agent chain to obtain the answer to the current question.
[0030] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain can include but is not limited to: parallel execution of task agents, serial execution of task agents, and a combination of serial and parallel execution of task agents.
[0031] The disclosed embodiment provides an authoritative, convenient, and highly satisfying question-answering method based on multi-agent collaboration. Accurate and authoritative questions and answers are provided through the collaboration of multiple agents with different functions and fields. The organic collaboration of multiple agents is achieved through information understanding, task distribution, memory transfer, etc., thereby obtaining an answer with better effect and wider coverage. Through the division of labor between decision-making agents and task agents, the questions input by users are broken down into multiple categories and multiple steps for answering, thereby reducing the difficulty of the task and obtaining more authoritative and professional answers. In addition, by introducing environmental variables, information sharing among multiple agents is achieved.
[0032] Figure 2 A process 200 of another embodiment of the question-answering method according to the present disclosure is shown. The question-answering method includes the following steps:
[0033] Step 201: In response to receiving the current question, obtain the user's historical information from the environment variables.
[0034] In this embodiment, the execution subject of the question-answering method may obtain the user's historical information from the environment variables after receiving the current question input by the user.
[0035] The execution entity of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitations are given here.
[0036] Typically, a question-and-answer application or browser is installed on the user's terminal. The user can enter questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the user's historical information can be obtained from the environment variable. Among them, the historical information can be the user's historical questions. For example, the historical information can be the historical conversation information of this question and answer, or it can be the historical search questions entered by the user on a third-party platform (such as a search application). The user's historical information can assist the first model in identifying the intent of the current question input by the user, thereby improving the accuracy of intent recognition.
[0037] In some embodiments, if the current question is the first question in this Q&A session, the user's previous search questions entered on the third-party platform can be obtained. For Q&A sessions without a historical conversation, the user's historical information can also be tracked to assist the first model in intent recognition, improving the accuracy of intent recognition.
[0038] In some embodiments, if the current question is not the first question in this Q&A session, the user's previous conversation information for this Q&A session can be obtained. For Q&A sessions with historical conversations, the user's contextual needs can be effectively understood and tracked across multiple rounds of conversation, thereby accurately identifying the user's true intent.
[0039] Step 202: Generate prompt information based on the current question and historical information.
[0040] In this embodiment, the execution entity may generate prompt information based on the current question and historical information.
[0041] In the field of artificial intelligence, a prompt is a text or instruction that provides input to a model to guide it to produce a specific output. A prompt is a paragraph of text provided by the user when interacting with a model, describing the information, answer, or text the user wants from the model. The purpose of a prompt is to guide the model to produce a desired response, allowing for greater control over the generated output.
[0042] For the large model, the prompt can be a short question, a full paragraph, or a set of instructions, depending on the user's needs and scenario. When generating text, the large model attempts to understand the prompt and generate an appropriate response based on its understanding.
[0043] In some embodiments, the current question and historical information may be processed before generating the prompt information. For example, the current question and historical information may be concatenated. Another example is to truncate the historical information to avoid excessive length. Another example is to filter the historical information based on the current question for relevance to avoid interference from irrelevant information.
[0044] Typically, after collecting a user's historical information, a convolutional neural network (CNN) can be used to roughly identify the user's intent and label the identified intent with the user's historical information. After receiving the user's current question input, a CNN can also be used to roughly identify the intent of the current question and, based on the identified intent, filter out historical information related to the current question.
[0045] In some embodiments, different application scenarios may correspond to different prompt information templates. By setting different prompt information templates corresponding to different application scenarios, an integrated, multi-functional question-and-answer system can be provided. Effectively integrate multiple functional entrances and accurately understand user needs in multiple rounds of dialogue. When applied to an intelligent medical question-and-answer system, application scenarios may include but are not limited to: drug consultation, disease diagnosis, drug and equipment purchase, doctor registration, etc., thereby integrating multiple functions so that users can complete a one-stop experience from health consultation to registration appointment in an intelligent medical question-and-answer system. Thereby improving the efficiency and accuracy of health consultation and providing users with more comprehensive intelligent health services.
[0046] In some embodiments, the user can select an application scenario before engaging in the current Q&A session. Based on the application scenario selected by the user, a corresponding prompt information template can be determined. The prompt information can be generated by filling the prompt information template with the current question and historical information. For example, the processed current question and historical information can be used as variables to fill in corresponding positions in the prompt information template to generate the prompt information.
[0047] Step 203: Input the prompt information into the first large model, and output the rewritten question and user intention information.
[0048] In this embodiment, the execution entity may input the prompt information into the first large model, output the rewritten question and user intention information, and then generate an answer to the current question based on the rewritten question and user intention information.
[0049] Large models are machine learning models with large parameters and complex computational structures. These models are typically built using deep neural networks and have billions or even hundreds of billions of parameters. Large models are designed to improve their expressiveness and predictive performance, enabling them to handle more complex tasks and data. By training on massive amounts of data to learn complex patterns and features, large models possess stronger generalization capabilities and can make accurate predictions on unseen data. Here, large models use a rewriting mechanism to understand and rewrite prompts. This rewriting mechanism can be applied to multiple rounds of dialogue. Rewriting can include, but is not limited to, reference omission rewriting, error correction, and style alignment, making rewriting more standardized and regulated, thereby improving intent recognition accuracy. Large models and rewriting mechanisms enable in-depth understanding and rewriting of user input, generating optimized queries for subsequent task retrieval and historical summarization. Furthermore, large models can output segmented user intent, providing a precise basis for selecting prompts and other rule-based processing for specific scenarios in subsequent tasks.
[0050] In some embodiments, the prompt information is input into the first large model, and the original token corresponding to each word of the prompt information can be obtained. For the original token corresponding to the i-th word, the first processing step can be performed. Wherein, the initial value of i is 1. The first processing step may include: rewriting the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word; based on the rewritten tokens corresponding to the first i words, generating the intention data corresponding to the i-th word; in response to the i-th word being the last word of the prompt information, generating a rewriting question based on the rewritten tokens corresponding to the first i words; and generating user intention information based on the intention data corresponding to the first i words. In response to the i-th word not being the last word of the prompt information, i is increased by 1, and the first processing step is continued.
[0051] Step 204: Generate a task agent chain based on the rewritten question and user intention information.
[0052] In this embodiment, the execution entity can generate a task agent chain based on the rewritten question and user intention information.
[0053] Among them, the decision-making agent can be composed of one or more models, which are used to understand the questions input by the user and distribute tasks. The task agent chain can include the task agents that need to be executed to answer the questions input by the user, as well as the execution order between the task agents. The task agent set can include multiple different task agents for performing different tasks. When applied to an intelligent medical question-answering system, the task agent set can include but is not limited to: task agents for answering medical popular science knowledge, interpreting reports, detecting skin diseases, asking medical questions, asking medical questions in return, etc. The task agent chain can include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, serial and parallel combination connection of task agents, etc.
[0054] In some embodiments, the information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set. The information of the decision-making agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision-making agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0055] Step 205: Select the task agent corresponding to the task agent chain from the task agent set.
[0056] In this embodiment, the execution entity can select a task agent corresponding to the task agent chain from a set of task agents. When applied to an intelligent medical question-answering system, the set of task agents may include, but is not limited to, agents for answering medical knowledge, interpreting reports, detecting skin diseases, asking follow-up questions, and asking counter-questions.
[0057] Step 206: execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0058] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain can include but is not limited to: parallel execution of task agents, serial execution of task agents, and a combination of serial and parallel execution of task agents.
[0059] The disclosed embodiments provide a question-and-answer method that incorporates a large-scale model for segmented intent and a rewriting mechanism. This rewriting mechanism can extract the user's core needs. Furthermore, the large-scale model can simultaneously identify and process multiple user intents. This helps resolve multiple user questions simultaneously, improving user satisfaction.
[0060] Figure 3 FIG3 shows a process 300 of another embodiment of a question-answering method according to the present disclosure. The question-answering method includes the following steps:
[0061] Step 301: In response to receiving the current question, obtain the user's historical information from the environment variables.
[0062] In this embodiment, the execution subject of the question-answering method may obtain the user's historical information from the environment variables after receiving the current question input by the user.
[0063] The execution entity of the question-and-answer method is usually a server. The server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, to provide distributed services), or it can be implemented as a single software or software module. No specific limitations are given here.
[0064] Typically, a question-and-answer application or browser is installed on the user's terminal. The user can enter questions through the question-and-answer application or the question-and-answer webpage in the browser. After receiving the current question input by the user, the user's historical information can be obtained from the environment variable. Among them, the historical information can be the user's historical questions. For example, the historical information can be the historical conversation information of this question and answer, or it can be the historical search questions entered by the user on a third-party platform (such as a search application). The user's historical information can assist the first model in identifying the intent of the current question input by the user, thereby improving the accuracy of intent recognition.
[0065] In some embodiments, if the current question is the first question in this Q&A session, the user's previous search questions entered on the third-party platform can be obtained. For Q&A sessions without a historical conversation, the user's historical information can also be tracked to assist the first model in intent recognition, improving the accuracy of intent recognition.
[0066] In some embodiments, if the current question is not the first question in this Q&A session, the user's previous conversation information for this Q&A session can be obtained. For Q&A sessions with historical conversations, the user's contextual needs can be effectively understood and tracked across multiple rounds of conversation, thereby accurately identifying the user's true intent.
[0067] Step 302: Generate prompt information based on the current question and historical information.
[0068] In this embodiment, the execution entity may generate prompt information based on the current question and historical information.
[0069] In the field of artificial intelligence, a prompt is a text or instruction that provides input to a model to guide it to produce a specific output. A prompt is a paragraph of text provided by the user when interacting with a model, describing the information, answer, or text the user wants from the model. The purpose of a prompt is to guide the model to produce a desired response, allowing for greater control over the generated output.
[0070] For the large model, the prompt can be a short question, a full paragraph, or a set of instructions, depending on the user's needs and scenario. When generating text, the large model attempts to understand the prompt and generate an appropriate response based on its understanding.
[0071] In some embodiments, the current question and historical information may be processed before generating the prompt information. For example, the current question and historical information may be concatenated. Another example is to truncate the historical information to avoid excessive length. Another example is to filter the historical information based on the current question for relevance to avoid interference from irrelevant information.
[0072] Typically, after collecting a user's historical information, a convolutional neural network (CNN) can be used to roughly identify the user's intent and label the identified intent with the user's historical information. After receiving the user's current question input, a CNN can also be used to roughly identify the intent of the current question and, based on the identified intent, filter out historical information related to the current question.
[0073] In some embodiments, different application scenarios may correspond to different prompt information templates. By setting different prompt information templates corresponding to different application scenarios, an integrated, multi-functional question-and-answer system can be provided. Effectively integrate multiple functional entrances and accurately understand user needs in multiple rounds of dialogue. When applied to an intelligent medical question-and-answer system, application scenarios may include but are not limited to: drug consultation, disease diagnosis, drug and equipment purchase, doctor registration, etc., thereby integrating multiple functions so that users can complete a one-stop experience from health consultation to registration appointment in an intelligent medical question-and-answer system. Thereby improving the efficiency and accuracy of health consultation and providing users with more comprehensive intelligent health services.
[0074] In some embodiments, the user can select an application scenario before engaging in the current Q&A session. Based on the application scenario selected by the user, a corresponding prompt information template can be determined. The prompt information can be generated by filling the prompt information template with the current question and historical information. For example, the processed current question and historical information can be used as variables to fill in corresponding positions in the prompt information template to generate the prompt information.
[0075] Step 303: Input the prompt information into the first large model, and output the rewritten question, user intention information and user additional category.
[0076] In this embodiment, the execution entity may input the prompt information into the first large model, output the rewritten question, user intent information, and user added categories, and then generate an answer to the current question based on the rewritten question, user intent information, and user added categories.
[0077] Large models are machine learning models with large parameters and complex computational structures. These models are typically built using deep neural networks and have billions or even hundreds of billions of parameters. Large models are designed to improve their expressiveness and predictive performance, enabling them to handle more complex tasks and data. By training on massive amounts of data to learn complex patterns and features, large models possess stronger generalization capabilities and can make accurate predictions on unseen data. Here, large models use a rewriting mechanism to understand and rewrite prompts. This rewriting mechanism can be applied across multiple rounds of dialogue. Rewriting can include, but is not limited to, elision rewriting, error correction, and style alignment, making rewriting more standardized and effective, thereby improving intent recognition accuracy. Large models and rewriting mechanisms enable in-depth understanding and rewriting of user input, generating optimized queries for subsequent task retrieval and historical summarization. Furthermore, large models can output segmented user intent and additional categories to which users belong, providing a precise basis for selecting segmented prompts and other rule-based processing for subsequent tasks. By establishing a flexible classification framework, multiple potential intents contained in user queries can be identified and presented.
[0078] In some embodiments, the prompt information is input into the first large model, and the original token corresponding to each word of the prompt information can be obtained. For the original token corresponding to the i-th word, the second processing step can be performed. Wherein, the initial value of i is 1. The second processing step may include: rewriting the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word; based on the rewritten tokens corresponding to the first i words, generating the intention data corresponding to the i-th word; in response to the i-th word being the last word of the prompt information, generating a rewriting question based on the rewritten tokens corresponding to the first i words; generating user intention information based on the intention data corresponding to the first i words; generating a user additional category based on the category data corresponding to the first i words. In response to the i-th word not being the last word of the prompt information, i is increased by 1, and the second processing step is continued.
[0079] Step 304: Generate a task agent chain based on the rewritten question and user intention information.
[0080] In this embodiment, the execution entity can generate a task agent chain based on the rewritten question and user intention information.
[0081] Among them, the decision-making agent can be composed of one or more models, which are used to understand the questions input by the user and distribute tasks. The task agent chain can include the task agents that need to be executed to answer the questions input by the user, as well as the execution order between the task agents. The task agent set can include multiple different task agents for performing different tasks. When applied to an intelligent medical question-answering system, the task agent set can include but is not limited to: task agents for answering medical popular science knowledge, interpreting reports, detecting skin diseases, asking medical questions, asking medical questions in return, etc. The task agent chain can include but is not limited to at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, serial and parallel combination connection of task agents, etc.
[0082] In some embodiments, the information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set. The information of the decision-making agent can be the result of understanding the question input by the user. When applied to the intelligent medical question-answering system, the information of the decision-making agent can include but is not limited to: historical summary, key medical entities, user medical intentions, etc. The information of the task agent set can be historical dialogue information, that is, the questions input by the user and the answers to the questions obtained by the task agent. In order to facilitate query, the information in the environment variable can be stored in the form of key-value pairs (kv, key-value).
[0083] Step 305: Select the task agent corresponding to the task agent chain from the task agent set.
[0084] In this embodiment, the execution entity can select a task agent corresponding to the task agent chain from a set of task agents. When applied to an intelligent medical question-answering system, the set of task agents may include, but is not limited to, agents for answering medical knowledge, interpreting reports, detecting skin diseases, asking follow-up questions, and asking counter-questions.
[0085] Step 306: execute the selected task agent in the order of the task agent chain to obtain the answer to the current question.
[0086] In this embodiment, the execution subject can execute the selected task agent in the order of the task agent chain to obtain the answer to the current question. The execution order indicated by the task agent chain can include but is not limited to: parallel execution of task agents, serial execution of task agents, and a combination of serial and parallel execution of task agents.
[0087] Step 307 : In response to the training sample data generated based on the current question and user intention information belonging to a new application scenario, a second largest model is trained based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario.
[0088] In this embodiment, when the training sample data generated based on the current question and user intention information belongs to a new application scenario, the above execution can mainly train a second largest model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario.
[0089] Among them, the first large model can be trained using training sample data of at least one existing application scenario. The second large model can be trained using training sample data of at least one existing application scenario and training sample data of a new application scenario. The number of parameters of the second large model is smaller than that of the first large model. The first large model is usually used in the initial stage of the question-answering system. It is slow and costly, but effective. The second large model is usually trained after the question-answering system accumulates a certain amount of training sample data of new application scenarios. After the second large model is trained, the second large model can be used to replace the first large model. It is fast and cost-effective, but the effect is slightly worse. It should be noted that for application scenarios with high recognition accuracy requirements, the first large model can always be used.
[0090] Typically, the answer to the current question, generated based on the rephrased question, user intent information, and user-added categories, is returned to the user. Users can also provide real-time data feedback. Based on user feedback, training sample data can be generated. For example, user scores greater than a first preset score threshold are used as positive training sample data. User scores less than a second preset score threshold are used as negative training sample data. Based on the positive and negative training sample data, the large model can be continuously optimized to adapt to ever-changing user needs and behavior patterns. The first preset score threshold is not less than the second preset score threshold.
[0091] The disclosed embodiments provide a question-and-answer method that introduces a large model for segmenting intent, a rewriting mechanism, and a dynamic multi-dimensional classification method. The rewriting mechanism enables the extraction of the user's core demands. Furthermore, the large model can simultaneously identify and process the user's multiple intentions, and based on the user's consultation, determine whether the relevant information currently requires medical treatment, and dynamically add additional categories. The model is continuously optimized through real-time data feedback, resulting in richer user portraits and greater system adaptability.
[0092] Figure 4 The following figure shows an architecture 400 for implementing the question-answering method of the present disclosure. The architecture 400 may include user input 410, a decision agent 420, a task agent set 430, an environment variable 440, and an output result 450, and is used to perform the following steps:
[0093] 1. User input request.
[0094] 2. Obtain the task agent chain.
[0095] 3. Task agent chain execution.
[0096] 4. Output the results.
[0097] User input 410 may input a user question.
[0098] The decision agent 420 may include input understanding 421 and task distribution 422, which are used to understand user input and perform task distribution. At this time, the decision agent 420 may output a task agent chain, as well as user question understanding results such as historical summary, key medical entities, and user medical intent.
[0099] The task agent set 430 may include but is not limited to: medical science knowledge answers, report interpretation, skin disease detection, medical question follow-up, medical question counter-questions, etc. task agents, which are used to solve user tasks.
[0100] The task agent chain may include but is not limited to at least one of the following connection forms: parallel connection of task agents (such as operator 1, operator 2 and operator 3 in parallel), serial connection of task agents (such as operator 4, operator 5 and operator 6 in series), serial and parallel combination connection of task agents (such as operator 7, operator 9 and operator 10 in series, and operator 10 and operator 8 in parallel), etc.
[0101] According to the task agent chain, a corresponding agent may be selected from the task agent set 430 to answer until the last agent is executed, and the result is output to the user by the output result 450 .
[0102] The environment variables 440 can share information about the decision-making agent and the task agent, as well as information in the history of multiple rounds of dialogues between agents.
[0103] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a question-answering device. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0104] like Figure 5 As shown, the question-answering device 500 of this embodiment may include: a decision module 501, a selection module 502, and an execution module 503. The decision module 501 is configured to input the current question input by the user into the decision agent and output a task agent chain; the selection module 502 is configured to select a task agent corresponding to the task agent chain from the task agent set; and the execution module 503 is configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question.
[0105] In this embodiment, the specific processing of the decision module 501, the selection module 502 and the execution module 503 and the technical effects thereof can be referred to in the respective Figure 1 The relevant descriptions of steps 101-103 in the corresponding embodiment are not repeated here.
[0106] In some optional implementations of this embodiment, the task agent set includes at least one of the following task agents: answering medical knowledge popularization questions, interpreting report forms, detecting skin diseases, asking medical questions, and asking medical questions in return.
[0107] In some optional implementations of this embodiment, the task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and serial-parallel combination connection of task agents.
[0108] In some optional implementations of this embodiment, information of the decision-making agent and the task agent set is stored in an environment variable for sharing information between the decision-making agent and the task agent set.
[0109] In some optional implementations of this embodiment, the decision module 501 includes: an acquisition sub-module, configured to acquire the user's historical information from environmental variables in response to receiving the current question; a first generation sub-module, configured to generate prompt information based on the current question and historical information; an output sub-module, configured to input the prompt information into the first large model, and output the rewritten question and user intention information, wherein the large model understands and rewrites the prompt information through a rewriting mechanism; and a second generation sub-module, configured to generate a task agent chain based on the rewritten question and user intention information.
[0110] In some optional implementations of this embodiment, the first generating submodule is further configured to: determine a prompt information template for the application scenario selected by the user; fill the current question and historical information into the prompt information template to generate prompt information.
[0111] In some optional implementations of this embodiment, the application scenarios include at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
[0112] In some optional implementations of this embodiment, the output submodule is further configured to: input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; execute the following first processing step: rewrite the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word, generate intention data corresponding to the i-th word based on the rewritten tokens corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten tokens corresponding to the first i words, and generate user intention information based on the intention data corresponding to the first i words, wherein the initial value of i is 1; in response to the i-th word not being the last word of the prompt information, add 1 to i and continue to execute the first processing step.
[0113] In some optional implementations of this embodiment, the first large model also outputs user additional categories; and the output submodule is further configured to: input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; execute the following second processing step: rewrite the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word, generate intention data corresponding to the i-th word based on the rewritten token corresponding to the first i words, generate category data corresponding to the i-th word based on the intention data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten token corresponding to the first i words, generate user intention information based on the intention data corresponding to the first i words, and generate user additional categories based on the category data corresponding to the first i words, wherein the initial value of i is 1; in response to the i-th word not being the last word of the prompt information, add 1 to i and continue to execute the second processing step.
[0114] In some optional implementations of this embodiment, the first large model is trained using training sample data of at least one existing application scenario.
[0115] In some optional implementations of this embodiment, the question-and-answer device 500 also includes: a training module, configured to respond to the training sample data generated based on the current question and user intention information belonging to a new application scenario, and train a second largest model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario, wherein the parameter amount of the second largest model is smaller than that of the first largest model.
[0116] According to an embodiment of the present disclosure, the present disclosure also provides an intelligent agent, including: an input module for receiving input information; a processing module for determining a target task based on the input information received by the input module, determining a first large model based on the target task, and obtaining output information by calling the first large model to execute the method described in the first aspect; and an output module for outputting the output information obtained by the processing module.
[0117] In the technical solutions disclosed herein, the acquisition, storage, and application of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0118] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0119] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are provided as examples only and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0120] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0121] Various components in device 600 are connected to I / O interface 605, including an input unit 606, such as a keyboard, mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, optical disk, etc.; and a communication unit 609, such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0122] The computing unit 601 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the question-answering method. For example, in some embodiments, the question-answering method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the question-answering method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the question-answering method in any other appropriate manner (e.g., by means of firmware).
[0123] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0124] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0125] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0126] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0127] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0128] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.
[0129] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved. This is not limited herein.
[0130] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.
Claims
1. A question-answering method, comprising: Input the current question input by the user into the decision agent and output the task agent chain; Selecting a task agent corresponding to the task agent chain from a task agent set, wherein the task agent set includes multiple agents with different functions and fields; Executing the selected task agents in the order of the task agent chain to obtain an answer to the current question, wherein the answer is generated based on the rewritten question, the user intent information, and the user added category; The current question input by the user is input into the decision agent, and the task agent chain is output, including: In response to receiving the current question, obtaining historical information of the user from an environment variable; Generate prompt information based on the current question and the historical information; Inputting the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; Perform the following second processing step: rewrite the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word, generate intent data corresponding to the i-th word based on the rewritten tokens corresponding to the first i words, generate category data corresponding to the i-th word based on the intent data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten tokens corresponding to the first i words, generate user intent information based on the intent data corresponding to the first i words, and generate a user additional category based on the category data corresponding to the first i words, wherein the initial value of i is 1; In response to the i-th word not being the last word of the prompt information, incrementing i by 1 and continuing to perform the second processing step; The task agent chain is generated based on the rewritten question, the user intention information and the user additional category.
2. The method according to claim 1, wherein The task agent set includes at least one of the following task agents: answering medical knowledge, interpreting report sheets, detecting skin diseases, asking medical questions, and asking medical questions in return.
3. The method according to claim 1, wherein The task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and serial-parallel combination connection of task agents.
4. The method according to claim 1, wherein The information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set.
5. The method according to claim 4, wherein The generating of prompt information based on the current question and the historical information includes: Determine a prompt information template for the application scenario selected by the user; Fill the prompt information template with the current question and the historical information to generate the prompt information.
6. The method according to claim 5, wherein: The application scenarios include at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
7. The method according to claim 4, wherein: The first large model is trained using training sample data of at least one existing application scenario.
8. The method according to claim 7, wherein: The method further comprises: In response to the fact that the training sample data generated based on the current problem and the user intention information belongs to a new application scenario, a second large model is trained based on the training sample data of the at least one existing application scenario and the training sample data of the new application scenario, wherein the number of parameters of the second large model is smaller than that of the first large model.
9. A question-answering device, comprising: A decision module is configured to input the current question input by the user into the decision agent and output a task agent chain; A selection module is configured to select a task agent corresponding to the task agent chain from a task agent set, wherein the task agent set includes multiple agents with different functions and fields; an execution module configured to execute the selected task agent in the order of the task agent chain to obtain an answer to the current question, wherein the answer is generated based on the rewritten question, the user intention information, and the user added category; The decision module includes: an acquisition submodule, configured to acquire the user's historical information from an environment variable in response to receiving the current question; A first generating submodule is configured to generate prompt information based on the current question and the historical information; The output submodule is configured to input the prompt information into the first large model to obtain the original token corresponding to each word of the prompt information; perform the following second processing step: rewrite the original token corresponding to the i-th word to generate a rewritten token corresponding to the i-th word, generate intention data corresponding to the i-th word based on the rewritten tokens corresponding to the first i words, generate category data corresponding to the i-th word based on the intention data corresponding to the first i words, in response to the i-th word being the last word of the prompt information, generate a rewriting question based on the rewritten tokens corresponding to the first i words, generate user intention information based on the intention data corresponding to the first i words, and generate a user additional category based on the category data corresponding to the first i words, wherein the initial value of i is 1; in response to the i-th word not being the last word of the prompt information, add 1 to i and continue to perform the second processing step; The second generation submodule is configured to generate the task agent chain based on the rewritten question, the user intention information and the user additional category.
10. The device according to claim 9, wherein The task agent set includes at least one of the following task agents: answering medical knowledge, interpreting report sheets, detecting skin diseases, asking medical questions, and asking medical questions in return.
11. The device according to claim 9, wherein The task agent chain includes at least one of the following connection forms: parallel connection of task agents, serial connection of task agents, and serial-parallel combination connection of task agents.
12. The device according to claim 9, wherein The information of the decision-making agent and the task agent set is stored in the environment variable for sharing information between the decision-making agent and the task agent set.
13. The device according to claim 12, wherein The first generation submodule is further configured to: Determine a prompt information template for the application scenario selected by the user; Fill the prompt information template with the current question and the historical information to generate the prompt information.
14. The device according to claim 13, wherein The application scenarios include at least one of the following: drug consultation, disease diagnosis, drug and equipment purchase, and doctor registration.
15. The device according to claim 12, wherein The first large model is trained using training sample data of at least one existing application scenario.
16. The device according to claim 15, wherein The device further comprises: The training module is configured to train a second large model based on the training sample data of at least one existing application scenario and the training sample data of the new application scenario in response to the training sample data generated based on the current problem and the user intention information belonging to a new application scenario, wherein the parameter amount of the second large model is smaller than that of the first large model.
17. An intelligent agent comprising: An input module, used for receiving input information; a processing module, configured to determine a target task based on the input information received by the input module, determine a first large model based on the target task, and execute the method according to any one of claims 1 to 6 by calling the first large model to obtain output information; An output module is used to output the output information obtained by the processing module.
18. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
19. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are configured to cause the computer to execute the method according to any one of claims 1 to 8.
20. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Information processing method and device based on large language model, equipment and storage medium
CN117521675A
Multi-agent question answering system and method based on large language model
CN118093833A