Multi-agent thinking chain negotiation enhancement generation method
By using different large language models for mutual evaluation and negotiation in multi-agent systems, the problem of poor content generation of a single large language model is solved, and more efficient and high-quality content generation is achieved.
Patent Information
- Application Number
- CN202410899465.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-07-05
AI Technical Summary
When using the same large language model, the generated content is poor due to its fixed thinking tendency, lack of flexibility and adaptability.
By building a multi-agent system, each agent is mounted with a different large language model, evaluates and negotiates each other, and improves the generated content through multiple rounds of iterations, and is finally summarized and summarized by the target agent.
It effectively enhances the negotiation efficiency and quality of content generation, makes full use of the advantages of multiple large language models, and improves the accuracy and diversity of generated results.
Smart Images

Figure CN118821834B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a multi-agent thinking chain negotiation enhancement generation method. Background Art
[0002] At present, large language models have achieved far-reaching breakthroughs and have demonstrated powerful text generation capabilities in various fields. In addition, various organizations have a demand for private deployment of large language models, but large language models require higher hardware deployment conditions. When the hardware is poor, only large language models with low parameters can be deployed. However, large models with low parameters generally have poor performance, and the generated content still has some limitations. For example, the generated content may not be accurate enough, lack diversity, and be too simple in thinking. This may be due to various reasons such as the poor quality of the training corpus and the weak performance of the model itself.
[0003] In order to solve these problems, many researchers have proposed various methods to enhance the effect of generating content, such as the thought chain method, the retrieval enhanced generation (RAG) method, etc. The use of thought chains in the large language model imitates human thinking methods such as planning, organization, coordination, and control, and also gives the large language model the ability to use tools, allowing it to provide additional information to the large language model through operations such as querying information and running code, thereby enhancing the content generation effect of the large language model. There are many methods for retrieval enhanced generation, which can be achieved by comparing the similarity between user questions and private database paragraphs, or by comparing user questions with vector databases, recalling the most similar information, and providing it to the large language model to enhance the quality of content generation.
[0004] However, the above studies only use a single large language model to enhance the effect of content generation through various means. Although the thinking chain independently constructed by the large language model can effectively improve the quality of content generation, the use of the same large language model usually has a fixed thinking tendency and lacks flexibility and adaptability. After comparison, it is found that different large language models have different thinking tendencies, knowledge base volumes, and different capabilities. Therefore, there is an urgent need for a method that uses different large language models for enhancement and interaction to improve the quality of generated content. Summary of the invention
[0005] The present invention proposes a multi-agent thinking chain negotiation enhanced generation method to solve the technical problem that when using the same large language model, the fixed thinking tendency, lack of flexibility and adaptability lead to poor generated content.
[0006] In order to solve the above technical problems, the present invention provides a multi-agent thinking chain negotiation enhancement generation method, comprising the following steps:
[0007] Step S1: construct a multi-agent system through a number of agents, and create an individual thinking chain for each of the agents and mount different large language models;
[0008] Step S2: a plurality of the intelligent agents generate content according to the target task;
[0009] Step S3: mutual evaluation: the plurality of agents evaluate each other through individual thinking chains in a critical and perfect way of thinking, and the agents re-modify the generated content after receiving the evaluation information;
[0010] Step S4: After N rounds of iterations through step S3, after several of the intelligent agents solidify the generated content, the generated content of the several intelligent agents is sent to a target intelligent agent, and the target intelligent agent summarizes and summarizes all the generated content to obtain the final generated result.
[0011] Preferably, step S2 includes: setting the user's input as the target task, and providing a description of the tool that can be called in the prompt word; the large language model of the intelligent agent generates execution steps according to the target task and the prompt word; selecting the sequence of the reasoning modules and the tool type and related parameters called by the tool module according to the execution steps; executing the corresponding reasoning modules in turn, and the reasoning modules are handed over to the execution module for content generation after thinking through the thinking module, and finally connecting and summarizing the contents generated by all the reasoning modules to obtain generated content.
[0012] Preferably, step S3 and step S4 are iterated by an interactive negotiation method to generate a final result.
[0013] Preferably, the interactive negotiation includes the following steps: the user selects several first agents that generate satisfactory content, and requires other second agents to evaluate; the evaluations generated by the second agents are fed back to the first agent, and the first agent is required to modify the content to obtain new generated content; after N rounds of iterations, the content generated by several first agents is summarized and summarized by a third agent to obtain the final generated result.
[0014] Preferably, the second agent generates content by autonomously constructing prompt words when making an evaluation.
[0015] Preferably, the individual thought chain in step S1 is constructed using the following method:
[0016] 1) Construct the task target prompt: Please use "TARGET" as the target and think about the execution steps to complete the task, where "TARGET" is the task target entered by the user;
[0017] 2) Construct tool prompt words: Select the reasoning module and the tool module. The parameters of the thinking module are the topic of thinking, and the parameters of the tool module are the keywords to be searched;
[0018] 3) Build system built-in prompt words: Please output the modules to be executed in the format of a markdown table, including the selected modules and parameters;
[0019] 4) According to the feedback content of the intelligent agent, obtain the modules and corresponding parameters that need to be inferred or searched to construct the individual thinking chain.
[0020] Preferably, when the tool module needs to call the code to run, the following operations are performed:
[0021] 1) Generate corresponding code through the agent with given parameters as the goal;
[0022] 2) Execute the generated code by calling the corresponding environment and tools;
[0023] 3) When the generated code cannot be executed, re-execute the tool module to generate code;
[0024] 4) When the generated code fails to execute for the second time, the feedback information from the software terminal used to execute the code is resent to the agent, and the code is regenerated according to the error message requirements;
[0025] 5) When the generated code runs successfully, the information fed back by the software terminal used to execute the code is used as input into the historical dialogue of the intelligent agent.
[0026] Preferably, when the content generated by N rounds of iterations in step S4 is lower than expected, the reasoning module corresponding to the large language model is eliminated, or the process is streamlined, the structure of the individual thinking chain is rearranged, and the intelligent agents that negotiate with each other in step S3 are adjusted.
[0027] Preferably, when the content generated by performing N rounds of iterations in step S4 is lower than expected, a tool module for associating web pages or local files is added.
[0028] The present invention also provides a method for constructing a thinking chain and a negotiation chain of a large language model, which is used for constructing the above-mentioned individual thinking chain and constructing a process when conducting mutual evaluation;
[0029] The drag-and-drop method is used to connect the reasoning module and the tool module. The reasoning module contains two key fields, namely prompt and result, which are used to store the prompt words of the module and the results of single module reasoning. Two large language model prompt word construction modes are provided for the reasoning modules, including the historical dialogue mode and the single prompt word mode. In the historical dialogue mode, when the large language model mounted by the current module is different from the large language model of this module, the result field of the previous module is used as the user role when the module performs large language model reasoning. The reasoning result of the previous module is entered into the historical dialogue record of the large language model reasoning of the subsequent module as a user record. When the language model is the same as the current large language model, the prompt field of the previous module is used as the user role when the module performs large language model reasoning, and the result field is used as the assistant role when the module performs large language model reasoning, that is, the prompt word and reasoning result of the previous module are associated with this module as general historical conversation records; in the single prompt word mode, the result field of all previous modules is forcibly constructed into the prompt field of this module; in the tool module, tool modules of "associating local files" and "searching network information" are provided, and these modules are associated as previous modules to any reasoning module, and any reasoning module actively creates the required tool modules.
[0030] The beneficial effects of the present invention include at least:
[0031] The multi-agent thinking chain negotiation enhancement generation method of the present invention can be implemented through a computer program and applied to the fields of content enhancement generation of large language models, collaborative control of multi-agent systems, etc. The multi-agent thinking chain negotiation enhancement generation method proposed in the present invention can effectively enhance the negotiation efficiency of content generation and the quality of content generated by large language models by introducing thinking chain models and negotiation chains. Especially when the hardware conditions are poor and the video memory is low, resulting in the inability to run large language models with large parameters, insufficient computing power, the need to solve complex tasks, and high requirements for the quality of the generated content, the method comprehensively utilizes various large language models, and can give full play to the advantages of multiple large language models to enhance the generation results. This technical solution has broad application prospects and economic value. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a method flow of an embodiment of the present invention;
[0033] Figure 2 A schematic diagram of the feedback of different large language models and the thought chain generated by the manual implementation of Example 3;
[0034] Figure 3It is the individual thought chain model and corresponding feedback schematic diagram of the manual embodiment of embodiment 3;
[0035] Figure 4 This is a schematic diagram of the process of content negotiation of multiple large language models in Example 3;
[0036] Figure 5 A schematic diagram of feedback results of content simplification generated by negotiation and improvement of multiple large language models in Example 3;
[0037] Figure 6 A schematic diagram showing a comparison between the method in Example 3 and a single large language model and a method for generating content based on a traditional thought chain;
[0038] Figure 7 This is a flow chart of creating a thought chain in Example 4;
[0039] Figure 8 A schematic diagram of content independently generated according to the task objectives using different large language models for Example 4;
[0040] Fig. 9 A schematic diagram of a mutual evaluation process for Example 4;
[0041] Fig.10 A schematic diagram of a single round of evaluation, feedback and modification process for Example 4;
[0042] Fig.11 This is a flow chart of Example 4 using all large language models to generate content for a single task target and to perform evaluation, feedback, and modification;
[0043] Fig.12 A schematic diagram of using all large language models for criticism and suggestions to enhance the generation effect of large language models in Example 4;
[0044] Fig.13 This is a schematic diagram of Example 4 using the most powerful large language model to summarize all content that has been iteratively evaluated, fed back, and modified. DETAILED DESCRIPTION
[0045] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.
[0046] like Figure 1 As shown, an embodiment of the present invention provides a multi-agent thinking chain negotiation enhancement generation method, comprising the following steps:
[0047] Step S1: construct a multi-agent system through several agents, create an individual thinking chain for each agent and mount different large language models;
[0048] Step S2: Several agents generate content according to the target task;
[0049] Step S3: mutual evaluation: several intelligent agents evaluate each other through individual thinking chains in a critical and perfect way of thinking. After receiving the evaluation information, the intelligent agents re-modify the generated content;
[0050] Step S4: After N rounds of iterations through step S3, after several agents solidify the generated content, the generated content of the several agents is sent to a target agent, and the target agent summarizes and summarizes all the generated content to obtain the final generated result.
[0051] Specifically, from Figure 1 It can be seen that the present invention provides three different modes for using the same large language model to generate the required content, including manual implementation, automatic implementation for directly generating content, and automatic implementation for generating thought chains.
[0052] Example 1
[0053] This embodiment specifically introduces the method of directly generating content by automatic implementation and generating thought chains by automatic implementation.
[0054] Create a multi-agent system and create individual thought chains for each agent. Select a large language model for each agent, such as llama3, qwen2, phi3, etc. In the agent, set the user's input as the target task, and provide a description of the tool that can be called in the prompt word, including the tool, name, and parameters that need to be provided. The large language model will generate the steps to perform the task based on these inputs, select the corresponding thinking steps and call the appropriate tools, and generate the parameters that need to be provided for each thinking step and tool.
[0055] In the thinking chain constructed by the agent autonomously, each step is called a reasoning module and a tool module. It contains the order of the reasoning modules, the tool types called and the related parameters, and executes the corresponding reasoning modules in sequence. The reasoning module includes a thinking module and an execution module. Finally, the content generated by all the reasoning modules is connected and summarized according to the prompt words in a fixed format, and is used as the final output of the thinking chain model.
[0056] In the automatic negotiation mode, multiple agents will negotiate according to the following process:
[0057] Add communication and negotiation modules to the thinking chain to realize information exchange and iterative negotiation between agents.
[0058] Let different intelligent agents evaluate each other based on the target tasks. The intelligent agents will give evaluations on the information generated by other intelligent agents according to the critical and perfect thinking methods and feedback to other intelligent agents. Other intelligent agents will modify the generated content according to the returned information.
[0059] The negotiation process of the multi-agent system is completed by continuously iterating this process. If the target agent can accept the content generated by other agents, the generated content will be solidified; if the agent cannot accept it, relevant reasons and suggestions need to be given and other agents need to iterate the content to gradually optimize the generated results.
[0060] This embodiment introduces a thinking chain model into the intelligent agent, which enables the intelligent agent to use the large language model to autonomously plan and complete complex work tasks. Call different tools and find the required information, and organize the generated results and parameters into a chain structure to achieve transparency of the generation process and controllability of the generated content. A communication module is added to the generated thinking chain, which expands the thinking chain of a single intelligent agent into a communication chain of multiple intelligent agents, so that multiple large language models can communicate and communicate with each other, which can solve various problems such as inherent bias, fixed thinking logic, incomplete knowledge base, etc. in the thinking chain of a single large language model.
[0061] Enhance the quality of generation by creating a negotiation chain to iteratively generate content: Use a multi-agent system to enable different large language models to negotiate through communication and exchange of generated information, thereby improving the quality of the results generated by the large language model. The negotiation link designs several different types of prompt words to form different modules, including a criticism module and an acceptance module.
[0062] Critical Module: Use critical thinking to summarize the advantages, disadvantages and modification suggestions of the content generated by other agents, and provide feedback to the corresponding agents.
[0063] Improvement module: adopts the thinking of improvement and supplementation, improves and supplements the content generated by other intelligent agents, and feeds back to the corresponding intelligent agents.
[0064] By adopting a sequential compromise thinking process, a negotiation chain is automatically formed, and the similarities and differences between the content generated by multiple agents are continuously compared. Finally, a unified conclusion is reached to improve the quality of the content generated by the large language model. At the same time, the negotiation chain can accept user-defined control and can be effectively adjusted according to the generated content.
[0065] Example 2
[0066] This embodiment mainly illustrates the manual implementation method, through which different large language models are accessed and prompt words are manually constructed so that the large language model generates content and negotiates. The user can manually adjust the prompt words and select the appropriate content required for iteration according to the content generated during the dialogue process of multiple large language models, and determine the final content.
[0067] Specifically, users can perform the following operations to independently build a negotiation chain:
[0068] The user selects an agent that generates satisfactory content and asks other agents to evaluate it. The evaluation can choose from several modes or construct prompt words independently, such as critical evaluation and suggestive evaluation.
[0069] The evaluations generated by other agents are fed back to the target agent, and the target agent is required to make modifications to obtain new generated content.
[0070] Select satisfactory contents generated by multiple agents, designate a target agent and ask it to summarize and generalize these contents to obtain the final generated results.
[0071] For the generation of the final content, users can choose "automatic generation" or "self-selection" to determine the final generated content.
[0072] When all agents negotiate and reach a consensus after automatic generation, the large language model with high comprehensive scores of MMLU, CEval, AGIEval, GSM8K, and MATH or the large language model with good generation results will be selected to synthesize and summarize the content finally generated by all agents, and the summarized content will be submitted as output.
[0073] During autonomous selection, the content is iteratively negotiated by multiple large language models that satisfy the user, and the content summarized and inferred by different large language models is designated or compared as the final generated content.
[0074] Example 3
[0075] This embodiment specifically provides the construction of thought chains in manual implementation and the prompt word templates of each module.
[0076] Specifically, the process steps include:
[0077] 1) Access to large language models.
[0078] 1.1) Select the large language model to be called. In this example, llama3 and qwen1.5 are selected.
[0079] 1.2) By combining the following prompt words, we can build an initial chain of thoughts such as Figure 2The following prompt words are all examples.
[0080] 1.2.1) Task target prompt: [Please use "TARGET" as the target to think about the execution steps to complete the task], where "TARGET" is the task target entered by the user.
[0081] 1.2.2) Tool prompt words: [You can choose the following modules including thinking module (parameter is the topic of thinking), tool module (parameter is the keyword to be searched)], these modules can modify the prompt words according to the specific situation of software development.
[0082] 1.2.3) System built-in prompt: [Please output the module you need to execute in the format of a markdown table, which includes the selected module and parameters].
[0083] 1.3) Based on the feedback from the large language model, Figure 2 As shown in the figure, obtain the modules and corresponding parameters that need to be inferred or searched to construct the thinking chain as shown in the attached Figure 3 .
[0084] 2) Traverse all reasoning modules in order. Based on the prompt words generated in the thought chain, execute the reasoning module with the corresponding function. The execution process of various reasoning modules is as follows:
[0085] 2.1) In the thinking module, use the corresponding large language model to generate content according to the following prompts.
[0086]
Please take "TARGET" as the mission goal and think about "PROMPT".
[0087] "TARGET" is the task target, and "PROMPT" is the parameter provided in the thought chain.
[0088] 2.2) In the tool module, call the corresponding tool and use the above parameters to perform operations.
[0089] 2.2.1) When you need to use the "data search" tool module, you can obtain information from different resource channels. In this embodiment, you can use Bing search to read the information returned by the first web page provided by it as the initial input, and construct a prompt word. The specific format is as follows:
[0090]
Please use "TARGET" as the task goal and summarize the following information. The logic should be clear and try to use all the information: "RESOURCE".
[0091] "TARGET" is the task target, and "RESOURCE" is the information returned by the "Resource Search" tool module.
[0092] 2.2.2) When you need to use the "Code Run" tool module, perform the following operations.
[0093] 2.2.2.1) Generate the corresponding code with the given parameters as the target through the large language model.
[0094] 2.2.2.2) Execute the code generated by the large language model by calling the corresponding environment and tools.
[0095] 2.2.2.3) When the generated code cannot be executed, re-execute the tool module to generate the code.
[0096] 2.2.2.4) When the generated code fails to execute for the second time, the information fed back by the software terminal used to execute the code is resent to the large language model, and the code is regenerated according to the error message requirements.
[0097] 2.2.2.5) When the generated code runs successfully, the information fed back by the software terminal used to execute the code is used as input into the historical dialogue of the large language model.
[0098] 2.3) When all reasoning modules are executed, collect the content generated by each reasoning module and summarize the content according to the following prompt words.
[0099]
Please take "TARGET" as the task goal and summarize the following information. The logic should be clear and all information should be used as much as possible. The information is "MODEL_1"; "MODEL_2"; ... "MODEL_N".
[0100] "MODEL_1"; "MODEL_2"; ... "MODEL_N" in the prompt words are the final contents generated by each reasoning module.
[0101] 3) Provide the content generated by each large language model as prompt words to other large language models for external communication, and require the large language model to respond as follows: Figure 4 The modules are operated in sequence. The overall negotiation process is as follows: Figure 5 shown.
[0102] 3.1) Critical module: Generates evaluation critically. The following is an example of a prompt word format:
[0103] [Please take "TARGET" as the task goal and critically evaluate the following information: "OTHER CONTENT"]
[0104] “TARGET” is the goal of this task, and “OTHER CONTENT” is the information returned by other large language models.
[0105] 3.2) Thinking module: Improve the content generated by itself based on the evaluation generated by the "criticism module" of other large language models. The following is an example of the prompt word format:
[0106]
Please use "TARGET" as the task target and improve the content based on the opinions. The content is "CONTENT" and the opinions are "OPINION".
[0107] "TARGET" is the goal of this task, and "CONTENT" is the information returned by other large language models.
[0108] 3.3) Improvement module: Provide suggestions for the generated content. The following is an example of the prompt word format:
[0109] [Please use "TARGET" as the task target and make modification suggestions for the following content: "OTHER CONTENT"]
[0110] “TARGET” is the goal of this task, and “OTHER CONTENT” is the information returned by other large language models.
[0111] 3.4) Thinking module: Improve the content generated by itself based on the evaluation generated by the "improvement module" of other large language models. The following is an example of the prompt word format:
[0112]
Please use "TARGET" as the task target and improve the content based on the opinions. The content is "CONTENT" and the opinions are "OPINION".
[0113] "TARGET" is the goal of this task, and "CONTENT" is the information returned by other large language models.
[0114] 4) Generate the final result. Collect the feedback results of different large language models, select the large language model with high comprehensive scores of MMLU, CEval, AGIEval, GSM8K, and MATH, or the large language model with good generation results, and complete the task by constructing prompt words. The following is an example of the prompt word format:
[0115]
Please take "TARGET" as the task goal and summarize the following information. The logic should be clear and all the information should be used as much as possible. The information is as follows: "AGENT_1"; "AGENT_2"; ...; "AGENT_N".
[0116] The "AGENT_1"; "AGENT_2"; ...; "AGENT_N" in the prompt words are the final contents generated by each large language model.
[0117] This comparison uses a large language model (llama3) with better actual performance and higher scores to complete the task. From the generated results, it can be found that the content generated by using thought chain and calling tools is significantly better than the result dialogue generated by direct dialogue. In addition, by comparing the generated content of this embodiment, the content generated by a separate large language model, and the content generated based on the traditional thought chain method, Figure 6 As shown. It is found that the content generated by the method provided by the present invention integrates the understanding of the development of unmanned equipment by different large language models, and can effectively solve the problems of bias and fixed thinking in large language models. The details of the reasoning process can be adjusted according to the specific actual tasks, the reasoning structure formed by the thinking chain, the content generated by the reasoning module, and the available tool module types.
[0118] Example 4
[0119] This embodiment provides an implementation step for automatically creating a thought chain and a negotiation chain, with the task goal of "writing a review of the development of unmanned equipment" and negotiation through three large language models: Meta's llama3, Google's gemma, and Alibaba's qwen2. The specific implementation steps are as follows:
[0120] 1) First, a process-based large language model dialogue control system is created. The system is based on the electron cross-platform development framework and the ollama large language model calling framework. It can independently build thinking chains and negotiation chains, and the system can support searching network information and associating local files.
[0121] 2) By using the thinking chain creation prompt words in the manual implementation steps, the system automatically creates the corresponding reasoning module and tool module. An implementation process such as Figure 7 shown.
[0122] 3) Use different large language models to independently generate corresponding content according to the task objectives. An example of an implementation process is as follows: Figure 8 shown.
[0123] 4) Use different language models to negotiate with each other and build independent evaluation, feedback and modification units. An example of implementation is Fig. 9 As shown in the figure, llama was used to generate content, and then qwen2 was used to evaluate the content.
[0124] 5) When using multiple large language models for reasoning, all other different large language models are required to evaluate the content generated by the large language model, as follows: Fig.10As shown in the figure, qwen2 and gemma are used to evaluate the unmanned equipment overview generated by llama3, and llama3 modifies the generated content based on these evaluations.
[0125] 6) Use all available large language models to generate content for a single task target and perform a round of evaluation, such as Fig.11 shown.
[0126] 7) Conduct multiple rounds of iteration, evaluation, feedback and modification through design critique and suggestion sessions, as follows: Fig.12 shown.
[0127] 8) Use the most powerful large language model to summarize all the content that has been iteratively evaluated, fed back, and modified, as follows: Fig.13 shown.
[0128] Example 5
[0129] In some cases, the automatically created thought chain and negotiation chain may generate some poor quality content. This embodiment introduces manual control and customized operations to modify the thought chain and negotiation chain, which can effectively improve the effect of large language model generation. The specific implementation steps are as follows:
[0130] 1) Users can observe the automatically created thinking chains and negotiation chains, and modify the structures of the automatically created thinking chains and negotiation chains. When the negotiation effect is not good in the process, users can choose to remove the corresponding reasoning modules, or streamline the relevant processes and rearrange the structures of the thinking chains and negotiation chains.
[0131] 2) Users can check the content generated in a single reasoning module. When the generated content is of poor quality, users can choose two actions, including:
[0132] (1) Require the corresponding reasoning module to re-reason;
[0133] (2) Correct the prompt words of the reasoning module and ask the reasoning module to re-reason. The user can check the generated content until the generated result is satisfactory.
[0134] 3) Users can add new tool modules to associate web pages or local files, and use local knowledge bases to enhance the content generated by large language models. Various retrieval enhancement generation methods can be selected, including the use of tools such as langchain and vector knowledge base.
[0135] Example 6
[0136] This embodiment provides a structure of a thought chain and a negotiation chain constructed by using a flowchart to control a large language model.
[0137] 1) Provides a mapping method that connects reasoning modules and tool modules by dragging and dropping.
[0138] 2) The reasoning module contains two key fields, namely prompt and result, which are used to store the prompt words of the module and the results of single module reasoning.
[0139] 3) It provides two methods for constructing large language model prompt words for reasoning modules, including historical dialogue mode and single prompt word mode.
[0140] 4) In the historical dialogue mode, when the large language model mounted on the previous module is different from the large language model of this module, the result field of the previous module is used as the user role when the module performs large language model reasoning, and the reasoning result of the previous module is entered into the historical dialogue record of the large language model reasoning of the subsequent module as a user record. When the large language model mounted on the previous module is the same as this large language model, the prompt field of the previous module is used as the user role when the module performs large language model reasoning, and the result field is used as the assistant role when the module performs large language model reasoning, that is, the prompt word and reasoning result of the previous module are associated with this module as a general historical dialogue record.
[0141] 5) In the single prompt word mode, this mode is designed to solve the token limitation problem of large language models. By forcibly constructing the result fields of all previous modules into the prompt field of this module, the reasoning module can perform more efficient reasoning.
[0142] 6) The tool modules of "associating local files" and "searching network information" are provided in the tool module. These modules can be associated with any reasoning module as pre-order modules, and any reasoning module can also actively create the required tool modules.
[0143] Example 7
[0144] This embodiment provides a large language model dialogue control system in the form of a flowchart.
[0145] 1) Based on the Election cross-platform development framework and Ollama, different large language models can be utilized and efficiently sorted and used.
[0146] 2) It can mount different large language models and construct the process models of thinking chain and negotiation chain through reasoning modules and tool modules.
[0147] 3) Ability to quickly associate and process local files through tool modules, including Markdown files, PDF files, Word files, and Excel files.
[0148] 4) It can retrieve and organize web page information through the tool module, find the most relevant network information through bing or other search engines, and integrate jina.ai's web page organization interface to quickly organize web page information.
[0149] Compared with traditional, linear dialogue control systems, this system can effectively process, control and organize various historical information, enabling large language models to flexibly associate required information and perform reasoning.
[0150] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. Only the preferred embodiments of the present invention are expressed. The description is more specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. As long as there is no contradiction in the combination of these technical features, they should be considered as the scope recorded in this specification.
[0151] It should be noted that, for those skilled in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these modifications and improvements all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A multi-agent thought chain negotiation enhancement generation method, characterized by: The following steps are involved: Step S1: construct a multi-agent system through a number of agents, and create an individual thinking chain for each of the agents and mount different large language models; Step S2: a plurality of the intelligent agents generate content according to the target task; Step S3: mutual evaluation: the plurality of agents evaluate each other through individual thinking chains in a critical and perfect way of thinking, and the agents re-modify the generated content after receiving the evaluation information; Step S4: After N rounds of iterations of step S3, after several of the agents solidify the generated content, the generated content of the several agents is sent to a target agent, and the target agent summarizes and summarizes all the generated content to obtain the final generated result; Step S3 and step S4 use an interactive negotiation method to iterate and generate a final result; The interactive negotiation includes the following steps: the user selects several first agents that generate satisfactory content and requires other second agents to evaluate; the evaluation generated by the second agents is fed back to the first agent, and the first agent is required to modify to obtain new generated content; after N rounds of iterations, the content generated by several first agents is summarized and summarized by a third agent to obtain the final generated result; When the content generated by N rounds of iterations in step S4 is lower than expected, the reasoning module corresponding to the large language model is eliminated, or the process is streamlined, the structure of the individual thinking chain is rearranged, and the agents that negotiate with each other in step S3 are adjusted; When the content generated by performing N rounds of iterations in step S4 is lower than the expectation, a tool module for associating web pages or local files is added.
2. A method for enhancing the generation of multi-agent thought chain negotiation according to claim 1, characterized in that: Step S2 includes: setting the user's input as the target task, and providing the tool description to be called in the prompt word; the large language model of the intelligent agent generates execution steps according to the target task and the prompt word; selecting the sequence of the reasoning modules and the tool type and related parameters called by the tool module according to the execution steps; executing the corresponding reasoning modules in turn, and the reasoning modules are handed over to the execution module for content generation after being thought by the thinking module, and finally connecting and summarizing the contents generated by all the reasoning modules to obtain the generated content.
3. A multi-agent thought chain negotiation enhancement generation method according to claim 1, characterized in that: When the second agent makes an evaluation, it generates content by autonomously constructing prompt words.
4. A method for enhancing the generation of multi-agent thought chain negotiation according to claim 1, characterized in that: The individual thought chain described in step S1 is constructed using the following method: 1) Construct the task target prompt: Please use "TARGET" as the target to think about the execution steps to complete the task, where "TARGET" is the task target entered by the user; 2) Construct tool prompt words: select the reasoning module and the tool module. The parameters of the thinking module are the topic of thinking, and the parameters of the tool module are the keywords to be searched; 3) Build system built-in prompt words: Please output the modules to be executed in the format of a markdown table, which includes the selected modules and parameters; 4) According to the feedback content of the intelligent agent, obtain the modules and corresponding parameters that need to be inferred or searched to construct the individual thinking chain.
5. A method for enhancing the generation of multi-agent thought chain negotiation according to claim 4, characterized in that: When the tool module needs to call the code to run, perform the following operations: 1) Generate corresponding code through the agent with given parameters as the goal; 2) Execute the generated code by calling the corresponding environment and tools; 3) When the generated code cannot be executed, re-execute the tool module to generate the code; 4) When the generated code fails to execute for the second time, the feedback information from the software terminal used to execute the code is resent to the agent, and the code is regenerated according to the error information requirements; 5) When the generated code runs successfully, the information fed back by the software terminal used to execute the code is used as input into the historical dialogue of the intelligent agent.
6. A method for constructing a thinking chain and a negotiation chain of a large language model, characterized in that: Used for the construction of individual thinking chains and mutual evaluation process in any one of claims 1 to 5 of the multi-agent thinking chain negotiation enhancement generation method; The drag-and-drop method is used to connect the reasoning module and the tool module. The reasoning module contains two key fields, namely prompt and result, which are used to store the prompt words of the module and the results of single module reasoning. Two large language model prompt word construction modes are provided for the reasoning modules, including the historical dialogue mode and the single prompt word mode. In the historical dialogue mode, when the large language model mounted by the current module is different from the large language model of this module, the result field of the previous module is used as the user role when the module performs large language model reasoning. The reasoning result of the previous module is entered into the historical dialogue record of the large language model reasoning of the subsequent module as a user record. When the language model is the same as the current large language model, the prompt field of the previous module is used as the user role when the module performs large language model reasoning, and the result field is used as the assistant role when the module performs large language model reasoning, that is, the prompt word and reasoning result of the previous module are associated with this module as general historical conversation records; in the single prompt word mode, the result field of all previous modules is forcibly constructed into the prompt field of this module; in the tool module, tool modules of "associating local files" and "searching network information" are provided, and these modules are associated as previous modules to any reasoning module, and any reasoning module actively creates the required tool modules.
Citation Information
Patent Citations
Multi-agent cooperation system and strategy method suitable for industrial digitization
CN117649129A
Multi-agent collaborative knowledge reasoning framework and system based on large language model
CN117744795A