CN118093833B - Multi-agent question-answering system and method based on large language model - Google Patents

Multi-agent question-answering system and method based on large language model Download PDF

Info

Publication number
CN118093833B
CN118093833B CN202410473758.0A CN202410473758A CN118093833B CN 118093833 B CN118093833 B CN 118093833B CN 202410473758 A CN202410473758 A CN 202410473758A CN 118093833 B CN118093833 B CN 118093833B
Authority
CN
China
Prior art keywords
topic
user
topics
agent
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410473758.0A
Other languages
Chinese (zh)
Other versions
CN118093833A (en
Inventor
胡雷
夏磊
沈银
陈泽源
肖美虹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Creative Information Technology Co ltd
Original Assignee
Creative Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Creative Information Technology Co ltd filed Critical Creative Information Technology Co ltd
Priority to CN202410473758.0A priority Critical patent/CN118093833B/en
Publication of CN118093833A publication Critical patent/CN118093833A/en
Application granted granted Critical
Publication of CN118093833B publication Critical patent/CN118093833B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a multi-agent question-answering system and method based on a large language model, and belongs to the technical field of question-answering systems. The system comprises a plurality of intelligent agents which are created according to the application scene of the system and have mutually independent functions, and each intelligent agent uses natural language processing to carry out communication and self-adaptation; the intelligent agent comprises a monitor module, a context manager module, a topic enriching module and a chat agency module. According to the invention, responsibility and function division are carried out on the complex scene by using multiple intelligent agents, the intelligent agents cooperate with each other, and the complex business scene requirement is completed together. Meanwhile, in the intelligent agent, the system can perform active questioning and collect special information necessary for professional questioning and answering from the user; finally, the system can automatically manage topics in the dialogue, track topic promotion, effectively conduct discussion centering on the current topics, and enable the professional field knowledge question and answer of the large language model in a complex scene.

Description

Multi-agent question-answering system and method based on large language model
Technical Field
The invention relates to the technical field of question-answering systems, in particular to a multi-agent question-answering system and method based on a large language model.
Background
Large language models are becoming more and more complex, exhibiting human-like capabilities, and are assisting humans in accomplishing various tasks in daily life. The knowledge question-answering system based on artificial intelligence is an important application of a large language model.
Current large language models represent a popular way to answer general questions. However, basic question-and-answer dialogs often fail to meet complex diagnostic scenarios, such as legal or medical consultation. Despite extensive research in this regard, challenges remain due to the lack of training data, inefficiency, and the shortcomings of fine-tuning small models, including insufficient understanding of user intent and poor generation performance. Task-oriented dialog is often required in question-answering systems in the area of expertise, and applications are required to be able to actively ask questions and guide users through specific tasks. On the other hand, conventional large language models also fail to meet these requirements because they can only handle linear interactions and cannot effectively manage the dialog logic.
Disclosure of Invention
In view of the above, the embodiment of the invention provides a multi-agent question-answering system and method based on a large language model, which are used for solving the problems that the existing large language model is difficult to manage dialogue logic and is difficult to adapt to complex scenes.
The technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a multi-agent question-answering system based on a large language model, comprising:
The intelligent system comprises a plurality of intelligent agents which are created according to a system application scene and have mutually independent functions, wherein natural language processing is used for communication and self-adaptation among the intelligent agents;
The intelligent agent comprises a monitor module, a context manager module, a topic enriching module and a chat agency module; wherein,
The monitor module is used for collecting system internal data and external environment data according to the monitoring task;
The context manager module is used for recording context information of the system interacting with the user questions and answers;
The topic manager module is used for determining a target topic from the topic list according to query text of a user or interaction instructions of other intelligent agents;
the topic enriching module is used for carrying out information association retrieval according to the target topics determined by the topic manager module, enriching the target topics according to the retrieval result, and feeding the enriched target topics back to the chat agency module;
The chat agency module is used for taking the topics after the improvement as main topics of the dialogue of the user and generating user replies or agent interaction instructions by combining the context information of the interaction of the system and the user questions and answers.
Further, the topic manager module specifically includes:
The topic prediction unit is used for receiving query texts, operation lists, current states of topic lists and chat history records of users or other intelligent agents, analyzing and predicting development directions of topics through a large language model, and selecting the top topics from the topic lists as target topics;
and the topic maintenance unit is used for processing and controlling the change of topics by utilizing a topic list after determining the target topics, wherein the topic list is one data structure in the intelligent agent and is used for storing and tracking the dialogue state.
Further, the processing and controlling the change of the topics by using the topic list includes:
A dialogue state of interaction between the stack simulation system and the user question and answer is adopted, and when the user wants to start a new topic, the new topic is added into the topic list; deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed; the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
Further, the topic enriching module specifically includes:
The information retrieval unit is used for carrying out information association retrieval in a knowledge base or the Internet according to the target topics to obtain topic association information;
The topic distinguishing unit is used for distinguishing the types of the target topics to obtain topic types which are interacted with the questions and the answers of the users currently, wherein the topic types comprise inquiring users and answering users;
The topic enriching unit is used for expanding the text content of the target topic according to topic related information and the context information of interaction of the system and the user question and answer and combining the topic type of the target topic to output a final topic.
Further, the system further comprises an autonomous agent module, wherein the autonomous agent module specifically comprises:
The monitoring information processing unit is used for acquiring the internal data and the external environment data of the system in real time in a monitoring task, combining and converting the internal data and the external environment data of the system into prompts compatible with a large language model, and combining the messages of a plurality of agents into a single prompt in each task iterative execution process when the messages of the plurality of agents are received;
The GPT execution analysis unit is used for running the fine-tuned large language model, processing the data flow of the model in and out, generating model response or prediction, and converting the model response or prediction into executable commands;
And the generating reply unit is used for sending the user reply generated by the chat agency module to the corresponding user or forwarding the agent interaction instruction to other agents.
In a second aspect, the present invention further provides a multi-agent question-answering method implemented by using the multi-agent question-answering system based on a large language model according to the first aspect, where the method includes:
Acquiring a query text of a user or an interaction instruction of other intelligent agents, inputting the query document or the interaction instruction into a large language model for prediction, and determining a target topic;
tracking and acquiring a dialogue state between a system and a user, and controlling the change condition of the target topic through a topic list;
Performing information association retrieval according to the target topics, and performing topic enrichment processing on the target topics according to association retrieval results to obtain final topics;
and generating a user reply or an agent interaction instruction according to the final topic and the context information of the interaction of the system and the user question and answer.
Further, the obtaining the query text of the user or the interaction instruction of other agents, inputting the query text or the interaction instruction into the large language model for prediction, and determining the target topic includes:
The method comprises the steps of obtaining query text, an operation list and a current state and chat history record of a user or other intelligent agents, inputting a large language model, analyzing and predicting the development direction of topics through the large language model, and selecting the top topic from the topic list as a target topic.
Further, the tracking and acquiring a dialogue state between the system and the user, and controlling the change condition of the target topic through a topic list includes:
Storing and tracking a dialogue state through a topic list, adopting a stack simulation system to interact with a user question and answer, and adding a new topic into the topic list when the user wants to start the new topic; deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed; the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
Further, the performing information association search according to the target topic, and performing topic enrichment processing on the target topic according to an association search result to obtain a final topic, including:
Information association retrieval is carried out in a knowledge base or the Internet according to the target topics, so that topic association information is obtained;
Performing type distinction on the target topics to obtain topic types which are interacted with the user questions and answers currently, wherein the topic types comprise inquiring users and answering users;
According to topic association information and context information of interaction between the system and the user questions and answers, the text content of the target topic is expanded by combining the topic type of the target topic, and a final topic is output.
In summary, the beneficial effects of the invention are as follows:
According to the multi-agent question-answering system based on the large language model, responsibility and functions of complex scenes are divided by using the multi-agents, and the agents cooperate with each other to jointly complete the requirements of the complex business scenes. Meanwhile, inside the intelligent agent, the system can actively ask questions according to predefined examination contents, so that special information necessary for professional questions and answers is collected from users; finally, the system can automatically manage topics in the dialogue, track topic promotion, effectively conduct discussion centering on the current topics, and enable the professional field knowledge question and answer of the large language model in a complex scene.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described, and it is within the scope of the present invention to obtain other drawings according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a multi-agent question-answering system architecture based on a large language model according to the present invention;
FIG. 2 is a schematic diagram of the agent monitoring and management architecture of the large language model of the present invention;
FIG. 3 is a schematic diagram of the business architecture and flow within the individual agents of the present invention;
FIG. 4 is a schematic diagram of a new topic creation process by the topic manager module of the present invention;
FIG. 5 is a schematic diagram of a topic manager module of the present invention completing a current topic operation process;
FIG. 6 is a schematic flow chart of a multi-agent question-answering method based on a large language model of the invention;
Fig. 7 is a schematic diagram of the internal module structure of the intelligent agent of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. The various features of the invention and of the embodiments may be combined with one another without conflict, and are within the scope of the invention.
The invention provides a multi-agent professional field knowledge question-answering system model based on a large language model, which is an artificial intelligent knowledge question-answering system of the multi-agent, has definite responsibility division, automatic topic management, topic enrichment and guided question-answering functions, can be practically applied in professional field knowledge question-answering scenes such as law, finance, medical diagnosis and the like, and shows the potential of the system in practical application. Specific examples are given in the examples below.
Example 1: referring to fig. 1 and fig. 2, fig. 1 is a schematic diagram of a multi-agent question-answering system architecture based on a large language model in embodiment 1 of the present invention, and fig. 2 is a schematic diagram of an agent monitoring and management structure of the large language model in embodiment 1 of the present invention. The system provided by the embodiment comprises a plurality of mutually independent intelligent agents which are created according to the application scene of the system, and each intelligent agent uses natural language processing to communicate and adapt to each other. For example, agent A, agent B, agent C, agent D. Specifically, the intelligent agent comprises a monitor module, a context manager module, a topic enriching module and a chat agency module. According to the embodiment of the invention, a plurality of intelligent agents with mutually independent functions are created according to the application scene of the system, and each intelligent agent can provide independent autonomous agent behaviors, decision making capability and interaction capability.
The monitor module is used for collecting system internal data and external environment data according to the monitoring task; the context manager module is used for recording context information of the system interacting with the user questions and answers; the topic manager module is used for determining a target topic from the topic list according to query text of a user or interaction instructions of other intelligent agents; the topic enriching module is used for carrying out information association retrieval according to the target topics determined by the topic manager module, enriching the target topics according to the retrieval result, and feeding the enriched target topics back to the chat agency module; the chat agency module is used for taking the topics after the improvement as main topics of the dialogue of the user and generating user replies or agent interaction instructions by combining the context information of the interaction of the system and the user questions and answers.
Specifically, the intelligent agent in the embodiment of the invention integrates a Large Language Model (LLM). Each agent uses this technique in its control loop to create an environment, and each autonomous entity uses natural language to process communications; the architecture of the agents enables each agent to adapt and perform the responsible tasks while exhibiting advanced communication capabilities by integrating advanced large language models with modified traditional MAPE-K models. Two core components are contained in each agent: managed elements and autonomous agents. The managed elements comprise an environment of agent interactions, including a series of sensors and actuators, for monitoring and controlling the environmental elements. The workflow inside each functionally independent agent consists of four phases of thinking topic development, maintaining topic lists, enriching topics, generating responses or interactions.
Specifically, according to the knowledge scene of the professional field, a plurality of intelligent agents with internal monitoring and self-management are constructed, the whole system structure comprising the intelligent agents is shown in fig. 1, and each intelligent agent with mutually independent functions and responsibilities uses natural language to cooperate and communicate with each other. An agent's application is developed using a Python development framework. In the system initialization phase, each agent receives a prompt for its own function, sphere of responsibility, and descriptions of other agents, and when the agent is created, the temperature parameter of the model is set to 0.7, encouraging the model to generate more output even when the same input is used, facilitating a more open decision process, and enabling a more extensive search for potential agent behavior.
Specifically, in the embodiment of the present invention, topics and tasks are defined as follows: topics are defined as the main subjects of a conversation, which determine the main emphasis of the communication. A task is defined as a specific objective that needs to be completed in a task oriented dialog. After experiencing all predefined topics in the conversation, this particular task should be completed.
Further, referring to the detailed structure of monitoring and managing of agents shown in fig. 2, in the embodiment of the present invention, each agent receives instructions of a user or other agents through a monitor module, and uses a large language model to understand, infer or output instructions required by other agents in combination with sensor data. In addition, the agent can also process external environmental data, wherein the external data mainly comprises environmental factors and other system retrieval data, such as user physical examination data, life work and rest data or professional static knowledge base data.
In the workflow of the independent agent, the embodiment of the invention mainly builds a professional session system around the main functions and responsibilities of the independent agent. In the system workflow, the large language model not only needs to be capable of considering unique situations or information of users, but also can provide interactive questions and answers, and the system can conduct active questions and guide the users to provide answers, so that more professional detailed contexts are provided, and professionals are better simulated. The business module structure and workflow of each agent is shown in fig. 3, and includes a chat agency module, a topic manager module, a topic enriching module and a context manager module. Each module is implemented using a large language model, with specific hinting words used to guide its functions and responsibilities. Among the above modules, special attention is required to the implementation of the topic manager module because it tracks the dialogue state and automatically manages the dialogue topics.
Further, in the embodiment of the present invention, the topic manager module specifically includes:
The topic prediction unit is used for receiving query text, an operation list, the current state of the topic list and the chat history of a user or other intelligent agents, analyzing and predicting the development direction of topics through a large language model, and selecting the top topic from the topic list as a target topic.
And the topic maintenance unit is used for processing and controlling the change of topics by utilizing a topic list after determining the target topics, wherein the topic list is one data structure in the intelligent agent and is used for storing and tracking the dialogue state.
In a specific practical process, when the agent is in a stage of thinking about topic development, the topic manager module is responsible for determining topic development according to a query of a user. In each round of conversation, the system needs to adjust the current topic of the conversation before providing a response. Thus, the user's query or other agent's interaction instructions are first fed to the topic manager module for prediction and analysis, determining the topic development direction and the target topic. By means of the powerful understanding and reasoning capability of the large language model, the intelligent agent can accurately understand the intention of the instruction and help to conduct effective communication.
Further, when the agent is in the maintenance topic list stage, the topic maintenance unit processes and controls the change of topics using the topic list, the process specifically including:
Maintaining the topic list means that after obtaining the operational output of the topic manager module, the system will execute corresponding commands to process and control topic changes. A topic list is a data structure in the agent that is used to store and track dialog states. We consider that the progress of a dialog has multiple phases or states that follow a first-in, first-out order, and that can be effectively modeled using a stack that simulates the dialog states of a system interacting with a user question and answer.
Specifically, when maintaining the topic list, some common operations are used to control the topic list, including: creating a new topic, completing a current topic, and maintaining the current topic. Additionally, the operation list may be expanded to accommodate more complex scenarios in task-oriented conversations. We also implement a mechanism to automatically delete redundant topics. After a few rounds of dialogue, if the newly generated topic is not recalled, it is deleted. However, this deletion does not affect any predefined topics from the look-up table.
Creating a new topic refers to adding a new topic to the topic list when the user wishes to start a new topic. Completing the current topic refers to deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed. Maintaining the current topic means that the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
In the embodiment of the invention, the input of the topic manager module comprises the query, the operation list, the current state of the topic list and the chat history of a user or other intelligent agents. For large language models, it is necessary to analyze and predict the development of topics from these contextual information. The operation list contains various operations, which are execution tools of the topic manager module, each operation corresponding to a program function that executes a specific command. In Python, decorator is used. Whenever the topic manager module receives a query, it will analyze all available information and decide which operation to perform based on the hints associated with each operation. With the powerful understanding and reasoning capabilities of the large language model, the topic manager module can accurately understand the intention of the user and help to effectively communicate with the user. Examples of prompts for topic management are as follows:
name=keep current topic, description=is useful when you think that the user still wants to stay on the current topic and will talk about this topic more.
Name=create new topic, description=it is useful when you think that the user starts a new topic that is different from the current topic, and will be discussed next. If you want to create a new theme, but the new theme is similar to the current theme, you do not use this tool. The input to this tool should be a string of characters representing the name of the new topic.
Name = complete current topic, description = very useful when you think that the user has already known the answer to the current topic and wants to complete the current topic, or that the user has answered the question you have posed in the current topic, or that the user does not want to talk about the current topic anymore and wants to complete it. This tool has no input.
Name=jump to existing topics, description=very useful when you think that the user wants to jump to an existing topic in the topic list. The input to this tool should be a string representing the name of the existing topic in the topic list, which must be a topic in the topic list.
Specifically, when the target topic is output by the predictive analysis operation of the topic manager module, the topic maintenance list is used to process and control the change of the topic. Specifically, the operation procedure of creating a new topic is schematically shown in fig. 4. Completing the current topic the user no longer wishes to discuss it or the system considers the topic to be closed, removes the topic from the top of the list, completing the current topic operation diagram, as shown in fig. 5. The operation to keep the current topic indicates that the system determines that it still needs information and needs to continuously discuss the current topic, so the topic list does not need to be changed.
Further, the topic enriching module in the embodiment of the invention specifically includes:
The information retrieval unit is used for carrying out information association retrieval in a knowledge base or the Internet according to the target topics to obtain topic association information;
The topic distinguishing unit is used for distinguishing the types of the target topics to obtain topic types which are interacted with the questions and the answers of the users currently, wherein the topic types comprise inquiring users and answering users;
The topic enriching unit is used for expanding the text content of the target topic according to topic related information and the context information of interaction of the system and the user question and answer and combining the topic type of the target topic to output a final topic.
Specifically, after topic management is completed, the top topic needs to be selected from the topic list as the current topic. However, it cannot be provided directly to the chat proxy module as a chat topic for interaction with the user. To make up for the gap between input and chat agents, a topic enricher module is used to help better organize language for use by the chat agent module. Such as initially classifying topics as inquiring users and answering users. Typically, the newly generated topics belong to the answering user, while the predefined topics are categorized as querying users. Firstly, distinguishing topics by a topic enriching device, and helping a system to determine whether to answer or present the questions of a user in the current dialogue; then, obtain the output from the context manager and the current topic to enrich it into one containing sufficient information and context-dependent topics; finally, the topics through the topic enricher are provided for the chat agency module.
After the topic is enriched and the final topic is possessed by the topic enriching device, the chat agency module identifies the topic as the main topic of the round of dialogue. Thus, in conjunction with the context from the context manager, it can ultimately generate a reply for the user. In addition, background knowledge retrieved from environmental management may also be used to add to the prompt here to further improve the quality of the reply.
The topic enriching module is an independent module, the inputs of which are topic list from the topic manager module and chat history record, and uses the retrieval function to acquire related information from the knowledge base, then improves the original topics according to the requirements, and the enriched topics are fed to the chat agency module, and the topic enriching module only instructs how to improve the topics so that the chat agency module knows what to do next, unlike the chat agency prompt. In addition, the topic enricher module uses searches to find relevant information, which may be from a knowledge base or from the internet. The retrieved information is used to augment the details of the target topic.
In a multi-agent professional domain knowledge question-answering system, there is a great deal of extensibility. For example, the information collector may monitor user inputs and organize information into structured data for better future use. After completing the target task, the system may call a more complex program to meet the demand. Interface calls for some tools may also be added to the action list for execution, so that a plug-in may be provided to enrich the functionality of the knowledge question-answering system.
Specifically, in the intra-agent workflow of the embodiment of the present invention, a specific manner of generating a response is as follows:
inside the agent, after having the final topic, the chat agent recognizes it as the main topic of the current round of conversation. Thus, in conjunction with context from the context manager, user replies or other agent interaction instructions may be generated.
Further, the system of the embodiment of the invention further comprises an autonomous agent module, and the autonomous agent module specifically comprises:
The monitoring information processing unit is used for acquiring the internal data and the external environment data of the system in real time in a monitoring task, combining and converting the internal data and the external environment data of the system into prompts compatible with a large language model, and combining the messages of a plurality of agents into a single prompt in each task iterative execution process when the messages of the plurality of agents are received;
The GPT execution analysis unit is used for running the fine-tuned large language model, processing the data flow of the model in and out, generating model response or prediction, and converting the model response or prediction into executable commands;
And the generating reply unit is used for sending the user reply generated by the chat agency module to the corresponding user or forwarding the agent interaction instruction to other agents.
The autonomous agent module is mainly used for autonomously executing tasks, and the autonomous agent inside the intelligent agent executes three main tasks: monitoring, collecting data in a monitoring task, processing and combining information, converting the combined information into prompts compatible with a large language model, and combining the messages into a single prompt in each iteration if an automatic agent module receives the messages of a plurality of agents; GPT performs analysis and execution, the task encapsulates analysis, planning and knowledge activities, runs a fine-tuned large language model, processes data streams of the model in and out, generates responses or predictions, and converts the responses or predictions into executable commands; a reply is generated, at which stage the agent may reply to the user or send instructions to other agents based on the final result.
The system provided by the embodiment of the invention not only considers the unique situation or information of the user, but also can actively ask questions, provide professional interactive experience, fully understand the intention of the user and better simulate the actual medical expert or legal professional. The knowledge question-answering system in the professional field provided by the invention has the following main characteristics: firstly, dividing responsibilities and functions of a complex scene by using multiple intelligent agents, and mutually cooperating the intelligent agents to jointly complete the requirement of the complex business scene; then, inside the agent, the system can actively ask questions according to the predefined examination contents, thereby collecting the specific information necessary for professional questions and answers from the user; finally, the system can automatically manage topics in the dialogue, track topic advancement and effectively conduct discussion centered on the current topic.
Example 2: referring to fig. 6, the embodiment of the present invention further provides a multi-agent question-answering method based on a large language model based on embodiment 1, where the method includes:
S1: acquiring a query text of a user or an interaction instruction of other intelligent agents, inputting the query document or the interaction instruction into a large language model for prediction, and determining a target topic;
S2: tracking and acquiring a dialogue state between a system and a user, and controlling the change condition of the target topic through a topic list;
S3: performing information association retrieval according to the target topics, and performing topic enrichment processing on the target topics according to association retrieval results to obtain final topics;
s4: and generating a user reply or an agent interaction instruction according to the final topic and the context information of the interaction of the system and the user question and answer.
Further, in the embodiment of the present invention, in step S1, an interaction instruction of a query text or other intelligent agents of a user is obtained, and the query text or the interaction instruction is input into a large language model to predict, and a target topic is determined, which specifically includes the following steps:
The method comprises the steps of obtaining query text, an operation list and a current state and chat history record of a user or other intelligent agents, inputting a large language model, analyzing and predicting the development direction of topics through the large language model, and selecting the top topic from the topic list as a target topic.
Further, in the embodiment of the present invention, in step S2, the dialogue state between the acquisition system and the user is tracked, and the change condition of the target topic is controlled through the topic list, which specifically includes the following steps:
Storing and tracking a dialogue state through a topic list, adopting a stack simulation system to interact with a user question and answer, and adding a new topic into the topic list when the user wants to start the new topic; deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed; the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
Further, in the embodiment of the present invention, in step S3, information association search is performed according to the target topic, and topic enrichment processing is performed on the target topic according to an association search result, so as to obtain a final topic, which specifically includes the following steps:
Information association retrieval is carried out in a knowledge base or the Internet according to the target topics, so that topic association information is obtained;
Performing type distinction on the target topics to obtain topic types which are interacted with the user questions and answers currently, wherein the topic types comprise inquiring users and answering users;
According to topic association information and context information of interaction between the system and the user questions and answers, the text content of the target topic is expanded by combining the topic type of the target topic, and a final topic is output.
Specifically, in the embodiment of the present invention, the overall modular framework inside the intelligent agent is shown in fig. 7, and the modular framework is composed of five modules of observation, belief, communication, reasoning and planning, where the communication module and the reasoning module use a large language model to generate a message and make a high-level plan. In each step, we first process the original observations received by the observation module, then update the internal beliefs of the agent to the scene and other agents by the belief module, then construct hints for the communication module and the reasoning module with the beliefs and previous actions and dialogues, generate messages and formulate a high-level plan using the large language model, and finally the planning module gives the action or specific reply to be taken in this step according to the high-level plan.
1) Viewing module
In the efficient collaboration of multiple agents, perceiving the original observations from the environment and extracting useful information is critical to the higher-order reasoning downstream. To achieve this, we treat the observation module as the first module to process observations received from the environment and extract useful high-level information such as visual scene graphs, object-to-object relationships, environment maps, and other agent locations.
2) Belief module
Since large language models have no prior observations or interactive intrinsic memory, there is a need for a way to efficiently store and update physical scenes and other agent state beliefs. Here, we propose a belief module to keep track of four information:
Task progress: we keep track of task progress in the belief module and update it when possible using the processed observation information.
Self state: knowing the status of itself is critical to the agent, so we gather all information about the agent's own status from the processed observations and store it in the belief module's own status.
State of others: tracking the status of other agents is important for collaboration with other agents, so we maintain others' status in the belief module and update it when others can be observed.
Scene memory: a record of the objects seen and their state is kept as a scene memory, which may be inaccurate because an agent may interact with other objects and change their state.
3) Communication module
The cooperation between the agents is implemented using a communication module. In the communication module, a large language model is directly used as a generator of the message, and the message is prompted with an instruction head, a target description, a state description and a history record. In addition, to constrain large language message generation, we add the following notes at the end of the hint: the generated message should be accurate, helpful and concise and should not generate duplicate messages. Examples of communication cues are as follows:
You are a very good and well-known doctor and AI medical professional to serve the patient. You have a lot of experience with success and have served many users.
You are here to guide the user about their needs in the medical field, so try to do not let them discuss anything outside the medical field. Your user is unfamiliar with medical concepts and so uses a vocabulary that is easy to understand.
Your current dialog topics are: { current_topic })
Note that: in this round of dialog you have to always pay attention to this topic-! ! !
If the current topic is to answer the user, your answer should contain three parts: 1. a general answer derived from the theoretical analysis; 2. specific suggestions provided for the user according to the user scene; 3. the user is asked some information to clarify the question in order to answer it further better.
If the current topic is to accomplish a goal, you should give a comprehensive and detailed answer to meet the final goal directly from the chat history.
The current task profile of you in the entire dialog is: { task_overview }, a method of using the same
The final goal of you in the entire dialog is: { final_ goal }
Note that: you should always try to guide the development of dialog topics towards this goal, avoid leaving the topic, and finally accomplish this goal.
General knowledge start
{background_context}
General knowledge end
Knowledge of the user starts
{user_context}
User knowledge end
Chat history
{chat_history}
Current dialogue
The user: { human_input }
Of particular note is: the generated message should be accurate, helpful and concise, and not generate duplicate messages-! ! !
4) Reasoning module
With the help of all the information collected and provided by the previous modules, the agent can infer the current state, the goal, the operations performed, and thus what to do next. We directly use a powerful large language model as an inference module to infer all information using design cues similar to the communication module. Examples of inferences cues are as follows:
you are a very good and well-known doctor and AI medical professional to serve the patient. Predicting the next action of reasoning according to the current related data and medical field knowledge of you.
The action targets of your current task are: { act_overview }, a method of controlling the operation of a computer
Note that: the reasoning mode is based on basic facts, provides predicted theoretical knowledge sources as far as possible, and gives detailed and specific prediction results.
Predictive background knowledge onset
{background_context}
Prediction background knowledge end
Action history record
{act_histroy}
Chat history
{chat_history}
Current task
The user: { act_input }, a process for preparing a liquid crystal display
5) Planning module
Large language models are very effective in developing high-level plans, but are poorly effective in performing low-level controls. We use a heuristic-based planning module to generate stable low-level controls from a particular high-level plan so that the high-level plan in the inference module can robustly perform basic operations. In practice, doing so may also reduce the number of API requests required and save cost and time.
The method not only considers the unique situation or information of the user, but also can actively ask questions by the system, provide professional interactive experience, fully understand the intention of the user and better simulate the real medical expert or legal professional. Firstly, dividing responsibilities and functions of a complex scene by using multiple intelligent agents, and mutually cooperating the intelligent agents to jointly complete the requirement of the complex business scene; then, inside the agent, the system can actively ask questions according to the predefined examination contents, thereby collecting the specific information necessary for professional questions and answers from the user; finally, the system can automatically manage topics in the dialogue, track topic progress, and effectively conduct discussion centering on the current topics, and more importantly, the method is also excellent in managing various topic changes in the complex dialogue. The method effectively solves the problem that the large language model is difficult to be suitable for the knowledge question and answer in the professional field in the complex scene, and shows excellent performance and potential of practical application.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (9)

1. A multi-agent question-answering system based on a large language model, comprising:
The intelligent system comprises a plurality of intelligent agents which are created according to a system application scene and have mutually independent functions, wherein natural language processing is used for communication and self-adaptation among the intelligent agents;
The intelligent agent comprises a monitor module, a context manager module, a topic enriching module and a chat agency module; wherein,
The monitor module is used for collecting system internal data and external environment data according to the monitoring task;
The context manager module is used for recording context information of the system interacting with the user questions and answers;
The topic manager module is used for determining a target topic from the topic list according to query text of a user or interaction instructions of other intelligent agents;
the topic enriching module is used for carrying out information association retrieval according to the target topics determined by the topic manager module, enriching the target topics according to the retrieval result, and feeding the enriched target topics back to the chat agency module;
The chat agency module is used for taking the topics after the improvement as main topics of the dialogue of the user and generating user replies or agent interaction instructions by combining the context information of the interaction of the system and the user questions and answers.
2. The large language model based multi-agent question-answering system according to claim 1, wherein the topic manager module specifically comprises:
The topic prediction unit is used for receiving query texts, operation lists, current states of topic lists and chat history records of users or other intelligent agents, analyzing and predicting development directions of topics through a large language model, and selecting the top topics from the topic lists as target topics;
and the topic maintenance unit is used for processing and controlling the change of topics by utilizing a topic list after determining the target topics, wherein the topic list is one data structure in the intelligent agent and is used for storing and tracking the dialogue state.
3. The large language model based multi-agent question-answering system according to claim 2, wherein the utilizing a topic list to process and control the change of topics comprises:
A dialogue state of interaction between the stack simulation system and the user question and answer is adopted, and when the user wants to start a new topic, the new topic is added into the topic list; deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed; the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
4. The large language model based multi-agent question-answering system according to claim 1, wherein the topic enricher module specifically comprises:
The information retrieval unit is used for carrying out information association retrieval in a knowledge base or the Internet according to the target topics to obtain topic association information;
The topic distinguishing unit is used for distinguishing the types of the target topics to obtain topic types which are interacted with the questions and the answers of the users currently, wherein the topic types comprise inquiring users and answering users;
The topic enriching unit is used for expanding the text content of the target topic according to topic related information and the context information of interaction of the system and the user question and answer and combining the topic type of the target topic to output a final topic.
5. The large language model based multi-agent question-answering system according to claim 1, further comprising an autonomous agent module, the autonomous agent module specifically comprising:
The monitoring information processing unit is used for acquiring the internal data and the external environment data of the system in real time in a monitoring task, combining and converting the internal data and the external environment data of the system into prompts compatible with a large language model, and combining the messages of a plurality of agents into a single prompt in each task iterative execution process when the messages of the plurality of agents are received;
The GPT execution analysis unit is used for running the fine-tuned large language model, processing the data flow of the model in and out, generating model response or prediction, and converting the model response or prediction into executable commands;
And the generating reply unit is used for sending the user reply generated by the chat agency module to the corresponding user or forwarding the agent interaction instruction to other agents.
6. A multi-agent question-answering method using the multi-agent question-answering system based on a large language model according to any one of claims 1 to 5, comprising:
Acquiring a query text of a user or an interaction instruction of other intelligent agents, inputting the query document or the interaction instruction into a large language model for prediction, and determining a target topic;
tracking and acquiring a dialogue state between a system and a user, and controlling the change condition of the target topic through a topic list;
Performing information association retrieval according to the target topics, and performing topic enrichment processing on the target topics according to association retrieval results to obtain final topics;
and generating a user reply or an agent interaction instruction according to the final topic and the context information of the interaction of the system and the user question and answer.
7. The multi-agent question-answering method based on a large language model according to claim 6, wherein the steps of obtaining the query text of the user or the interaction instruction of other agents, inputting the query document or the interaction instruction into the large language model for prediction, and determining the target topic include:
The method comprises the steps of obtaining query text, an operation list and a current state and chat history record of a user or other intelligent agents, inputting a large language model, analyzing and predicting the development direction of topics through the large language model, and selecting the top topic from the topic list as a target topic.
8. The large language model based multi-agent question-answering method according to claim 6, wherein the tracking and obtaining of dialogue states between a system and a user and controlling of the change status of the target topic through a topic list comprises:
Storing and tracking a dialogue state through a topic list, adopting a stack simulation system to interact with a user question and answer, and adding a new topic into the topic list when the user wants to start the new topic; deleting the current topic from the top of the topic list when the user no longer wishes to discuss the current topic or the system considers the topic to be closed; the topic list does not need to be changed when the system determines that the current topic still needs information and needs to continuously discuss the current topic.
9. The multi-agent question-answering method based on a large language model according to claim 6, wherein the performing information association search according to the target topic and performing topic enrichment processing on the target topic according to an association search result to obtain a final topic comprises:
Information association retrieval is carried out in a knowledge base or the Internet according to the target topics, so that topic association information is obtained;
Performing type distinction on the target topics to obtain topic types which are interacted with the user questions and answers currently, wherein the topic types comprise inquiring users and answering users;
According to topic association information and context information of interaction between the system and the user questions and answers, the text content of the target topic is expanded by combining the topic type of the target topic, and a final topic is output.
CN202410473758.0A 2024-04-19 2024-04-19 Multi-agent question-answering system and method based on large language model Active CN118093833B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410473758.0A CN118093833B (en) 2024-04-19 2024-04-19 Multi-agent question-answering system and method based on large language model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410473758.0A CN118093833B (en) 2024-04-19 2024-04-19 Multi-agent question-answering system and method based on large language model

Publications (2)

Publication Number Publication Date
CN118093833A CN118093833A (en) 2024-05-28
CN118093833B true CN118093833B (en) 2024-06-18

Family

ID=91163969

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410473758.0A Active CN118093833B (en) 2024-04-19 2024-04-19 Multi-agent question-answering system and method based on large language model

Country Status (1)

Country Link
CN (1) CN118093833B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105512228B (en) * 2015-11-30 2018-12-25 北京光年无限科技有限公司 A kind of two-way question and answer data processing method and system based on intelligent robot
EP3680802A1 (en) * 2019-01-14 2020-07-15 Accenture Global Solutions Limited System and method for using a question and answer engine
US11431660B1 (en) * 2020-09-25 2022-08-30 Conversation Processing Intelligence Corp. System and method for collaborative conversational AI
CN115525740A (en) * 2021-06-24 2022-12-27 Tcl科技集团股份有限公司 Method and device for generating dialogue response sentence, electronic equipment and storage medium
CN117573834B (en) * 2023-11-30 2024-04-16 北京快牛智营科技有限公司 Multi-robot dialogue method and system for software-oriented instant service platform

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Multi-agent human–machine dialogue: issues in dialogue management and referring expression semantics;Alistair Knott等;Artificial Intelligence;20070727;69-102 *
基于知识图谱的可解释多跳问答方法研究;崔海;中国博士学位论文全文数据库 (信息科技辑);20231215;I138-36 *

Also Published As

Publication number Publication date
CN118093833A (en) 2024-05-28

Similar Documents

Publication Publication Date Title
Rutschi et al. Towards a framework of implementing software robots: Transforming human-executed routines into machines
Bradshaw An introduction to software agents
Jokinen Constructive dialogue modelling: Speech interaction and rational agents
Mekni An artificial intelligence based virtual assistant using conversational agents
Saini et al. Teaching modelling literacy: An artificial intelligence approach
Görer et al. Generating requirements elicitation interview scripts with large language models
Brézillon et al. SART: an intelligent assistant system for subway control
CN110046290A (en) A kind of personalization automated instruction course system
Capuano et al. An ontology-based approach for context-aware e-learning
CN117494814A (en) Prompt word full life cycle management method, system, electronic equipment and storage medium
CN118093833B (en) Multi-agent question-answering system and method based on large language model
Spivack et al. Cognition is All You Need-The Next Layer of AI Above Large Language Models
Yuan et al. A task ontology model for domain independent dialogue management
Ciupe et al. Learning agile with intelligent conversational agents
Ferreira et al. Intelligent search agents using web-driven natural-language explanatory dialogs
Smith et al. Apprentice Tutor Builder: A Platform For Users to Create and Personalize Intelligent Tutors
Soulier et al. Narrative tools to improve collaborative sense-making
Campo et al. AgileTalk: A Conversational Virtual Reality Synthetic Platform for Training in Agile Processes
Cunha et al. User modelling in scheduling system with artificial neural networks
Wilmont et al. A Case Study of Executive Functions in Real Process Modeling Sessions
Pan Large language modeling chatbots: training and session design
Kumar et al. A contemporary approach to hybrid expert systems case base reasoning
Graf von Malotky et al. Implement Adaptation in a Case Based ITS.
Zukerman Towards probabilistic argumentation
Crowley et al. HumanE AI Net: The HumanE AI Network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant