Method and device for constructing multi-role cooperative processing task based on large language model
By creating a multi-role collaborative task processing method in a large language model, dynamically generating role agents and splitting tasks, the problem of low efficiency of single-role processing in complex tasks of large language models is solved, and efficient and flexible task execution is achieved.
Patent Information
- Application Number
- CN202510933836.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-08
- Publication Date
- 2025-10-17
AI Technical Summary
Existing large language models use single-role workflow processing when solving complex tasks, with low success rates and inability to automatically plan and process tasks.
By assigning the identity of a large language model as a general role agent, multiple task role agents are created, tasks are broken down into subtasks and assigned to the corresponding role agents for execution, and finally the results are summarized.
It enhances the flexibility and adaptability of task processing, improves the quality and efficiency of task execution, reduces bias and one-sidedness, and significantly speeds up task completion.
Smart Images

Figure CN120803656A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, and in particular to a method and device for constructing a multi-role collaborative processing task based on a large language model. BACKGROUND
[0002] With the continuous evolution of deep learning neural network architecture, the Transformer architecture has become the theoretical basis of large language models. The Transformer solves the long-distance dependency problem through self-attention mechanisms and improves parallel computing capabilities. The rapid development of the Internet has made various text data (such as books, articles, and web pages) easily accessible, and modern data processing methods have made it more efficient to filter and clean useful information in large-scale corpora, providing a data foundation for training large models. Large language models use these vast amounts of data for pre-training, making continuous iteration of large models possible. With the advent of graphics processing units (GPUs) and tensor processing units (TPUs), especially hardware optimized for deep learning tasks, the computing power for training large-scale models has been greatly improved. These hardware can accelerate matrix operations, thereby shortening training time and providing computational power support for the emergence of large language models. Iteration and optimization of distributed computing frameworks, such as deep learning frameworks like TensorFlow and PyTorch, support distributed computing, allowing models to be trained across multiple machines and providing a practical foundation for improving large language model training efficiency.
[0003] The role system of large language models gives virtual characters specific personalities, styles, and backgrounds, making conversations more personalized and emotional and improving user interaction experience. However, current large language models still have low success rates and cannot automatically plan and process tasks when solving complex tasks (such as cross-domain tasks) as single-role workflows. SUMMARY
[0004] The present application mainly provides a method and device for constructing a multi-role collaborative processing task based on a large language model to solve the problem of low accuracy and inability to automatically plan and process tasks when existing large language models solve complex tasks as single-role workflows.
[0005] To solve the above technical problems, one technical solution adopted by the present application is to provide a method for constructing a multi-role collaborative processing task based on a large language model, which includes: The identity of the large language model is a general role agent, and the general role agent creates multiple task role agents based on the content of the task instruction, and the identities of the task role agents are different; updating the identity of the large language model as a task split agent, and the task split agent splits the task into a plurality of sub-tasks based on the obtained identities of the task role agents, and assigns the plurality of sub-tasks to corresponding task role agents; Each task role agent executes the corresponding sub-task to obtain a sub-task result and submits each sub-task result. updating the identity of the large language model as a task result summary agent, the task result summary agent summarizes each sub-task result to obtain an execution result corresponding to the task.
[0006] In an optional embodiment of the present application, the general role agent creates a plurality of task role agents based on the content of the task instruction, comprising: The general role agent creates a task role agent based on the content of the task instruction. Evaluate whether the task role agent currently created can meet the requirements of the task instruction. In response to the task role agent currently created being unable to meet the requirements of the task instruction, a new task role agent is created, and the evaluation of whether the task role agent currently created can meet the requirements of the task instruction is performed again.
[0007] In an optional embodiment of the present application, the general role agent continuously creates the task role agent up to a first preset number of times, or the task role agent currently created meets the requirements of the task instruction, and then the creation of a new task role agent is terminated.
[0008] In an optional embodiment of the present application, after each task role agent executes the corresponding sub-task to obtain a sub-task result, the method further comprises: updating the identity of the large language model as a task result evaluation agent, the task result evaluation agent performing result quality evaluation based on the content of the sub-task and the corresponding sub-task result, and giving an execution suggestion of the task role agent; The task role agent re-executes the corresponding sub-task based on the execution suggestion to obtain a new sub-task result.
[0009] In an optional embodiment of the present application, after each task role agent executes the corresponding sub-task to obtain a sub-task result, the method further comprises: The task role agent also evaluates the sub-task results obtained by the remaining task role agents and gives an execution suggestion. The task role agent also performs the corresponding subtask again based on the execution suggestions given by the remaining task role agents to obtain a new subtask result.
[0010] In an optional implementation of the embodiment of the application, the task role agent re-executes the corresponding subtask based on the execution suggestions to obtain a new subtask result until a second preset number of times is reached, and then the result quality evaluation is terminated.
[0011] In an optional implementation of the embodiment of the application, the method further comprises: Based on a preset mapping rule of the number of task role agents and the task complexity, the task complexity of the task is determined according to the number of the created task role agents. Based on a preset mapping rule of the task complexity and the number of result quality evaluations, the second preset number of times is determined.
[0012] In an optional implementation of the embodiment of the application, the current created task role agent is evaluated by a counterquestion mechanism to determine whether the task role agent can meet the requirements of the task instruction.
[0013] To solve the above technical problems, another technical solution adopted by the application is to provide a computer device, comprising a memory, a processor and a computer program stored in the memory, characterized in that the processor executes the computer program to implement the steps of the above method for constructing a multi-role cooperative processing task based on a large language model.
[0014] To solve the above technical problems, another technical solution adopted by the application is to provide a computer readable storage medium having a computer program stored thereon, characterized in that the computer program is executed by a processor to implement the steps of the above method for constructing a multi-role cooperative processing task based on a large language model.
[0015] The beneficial effects of the present application are: different from the prior art, the present application discloses a method and device for constructing a multi-role cooperative processing task based on a large language model. The method creates multiple task role agents based on the content of the task instruction through the general role agent of the large language model. Then, the large language model is updated to the task splitting agent to split the task into multiple subtasks and assign them to the corresponding task role agent. Each task role agent executes the subtask and submits the subtask result. Finally, the large language model is updated to the task result summary agent to summarize the subtask results to obtain the execution result corresponding to the task. The method dynamically creates a multi-role task processing pipeline according to the specific task, provides multi-perspective analysis through different task role agents according to user demand, expands the field of processing tasks, adapts to more task scenarios, and enhances flexibility and adaptability. Multiple roles analyze problems from their respective professional fields, reducing bias and one-sidedness and improving the quality of task execution. Through task decomposition, different roles simultaneously process, which can significantly speed up the completion of the overall task, improve execution efficiency, and improve resource utilization efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. Figure 1 is a flowchart of embodiment one of the method for constructing a multi-role cooperative processing task based on a large language model provided by the present application; Figure 2 is a flowchart of iterative creation of task role agents of embodiment one of the method for constructing a multi-role cooperative processing task based on a large language model provided by the present application; Figure 3 is a flowchart of result quality evaluation of embodiment one of the method for constructing a multi-role cooperative processing task based on a large language model provided by the present application; Figure 4 is a flowchart of mutual evaluation of task role agents of embodiment one of the method for constructing a multi-role cooperative processing task based on a large language model provided by the present application; Figure 5 is a flowchart of a specific embodiment of the method for constructing a multi-role cooperative processing task based on a large language model provided by the present application. DETAILED DESCRIPTION
[0017] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0018] The terms “first”, “second”, “third” in the embodiments of the present application are only used for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with “first”, “second”, “third” can explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of “a plurality of” is at least two, for example, two, three, etc., unless otherwise explicitly and specifically limited. In addition, the terms “include” and “have” and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed, or can optionally include other steps or units inherent to the process, method, product or device.
[0019] In this document, referring to “an embodiment” means that a particular feature, structure or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The phrase appears at various places in the specification does not necessarily all refer to the same embodiment, nor is it necessarily mutually exclusive of other embodiments. It is explicitly and implicitly understood by a person of ordinary skill in the art that the embodiments described herein can be combined with other embodiments.
[0020] Embodiment one The present application provides a method for constructing a multi-role collaborative processing task based on a large language model, referring to Figure 1 , Figure 1 is a flowchart of embodiment one of the method for constructing a multi-role collaborative processing task based on a large language model provided by the present application. The method for constructing a multi-role collaborative processing task based on a large language model includes: S10: The identity of the large language model is a general role agent, and the general role agent creates a plurality of task role agents based on the content of the task instruction, and the identities of the task role agents are different.
[0021] Large Language Model (LLM) is a deep learning model trained based on massive text data, which can understand and generate human language. The mainstream LLM is based on the Transformer architecture (such as the Decoder of GPT and the Encoder of BERT), which relies on the self-attention mechanism to capture long-distance semantic associations. Model training acceleration requires the configuration of a GPU, and the recommended machine configuration is, for example, a CPU with 32 cores, 128 GB of memory, a GPU V100 with 80 GB of video memory, and a 1 TB SSD. Then deploy the open source large language model.
[0022] Agent is a system that combines a large language model (LLM) with external tools or autonomous decision-making capabilities, which can actively plan, execute tasks, and interact with the environment, and has the ability to call tools such as APIs, search engines, and code interpreters.
[0023] In this application, an agent can be understood as a large language model with specific or general functions, collectively referred to as LLM Agent. By submitting a corresponding identity prompt to the large language model, the large language model is given a corresponding identity, i.e., an agent with the corresponding identity. Among them, the identity prompt is a personification description used to represent the specific function of the current agent, which can be understood as the person setup or ability of the agent, for example, the identity prompt is "you are a novelist", which will build a novelist agent who will create novels for us.
[0024] After creating an agent, the work of the agent is to receive user input questions and give answers that meet the person setup according to the identity of the agent. In the case where the agent already exists, multiple question and answer sessions can be performed without the need to input the identity prompt again; if you want to adjust the identity of the agent, you need to input or adjust the identity prompt to update the agent.
[0025] In this application, the first identity given to the large language model is the general role agent, i.e., submitting a pre-written general identity prompt to the large language model to build a general role agent with the corresponding function of the general identity prompt. Among them, the pre-written general identity prompt can be jointly written by humans and the large language model in the early stage, with the basic appeal given by humans and the general identity prompt written by the large language model, and the effect is debugged and detected by humans to output the final general role prompt. After multiple rounds of learning, the large language model can independently write the general role identity prompt in the later stage. In addition, all identity prompts in this application can be written in this way, which will not be described again in the following.
[0026] In the present application, the function of the general role agent is to analyze the content of the task instruction input by the user to obtain a specific task to be executed, and then create multiple task role agents with different identities for cooperative execution of the task. Therefore, the pre-written general identity prompt can be "you are a task analyst", that is, the persona of the general role agent is a task analyst, or an identity prompt containing other identity nouns, such as "task planner", "task analysis manager", etc. As long as the constructed general role agent implements the function as described in step S10, it is not limited here.
[0027] The following is a specific case of the general role agent creating multiple task role agents based on the content of the task instruction: The general identity prompt is "you are a task analyst".
[0028] The skills corresponding to the task analyst are 1) analyzing the task input by the user; 2) evaluating the roles required to complete the task according to the task content and giving identity prompts for these roles; 3) continuing to improve the role information required to complete the task according to the existing roles, and actively auditing whether the generated roles are reasonable.
[0029] The user inputs the task instruction to the constructed general role agent: "output a detailed report on the founding background and early development of company A, including: specific timeline, founding team, and early business model, etc."
[0030] After receiving the task instruction, the general role agent analyzes the task and generates a role list information corresponding to the task, such as research analyst, content writer, project manager, business expert, and data visualization designer (if chart support is required).
[0031] Unlike the prior art, the method for constructing multiple role agents for collaborative task processing based on a large language model provided by the present application creates multiple task role agents based on the content of the task instruction through a general role agent to cover the task in all aspects, enhances flexibility and adaptability, dynamically creates multiple roles according to the actual situation of the specific task, and provides multi-perspective analysis according to the user's needs, expands the field of processing tasks, and adapts to more task scenarios.
[0032] In the present application, with reference to Figure 2 , Figure 2 is a flowchart of the iterative creation of task role agents according to the first embodiment of the method for constructing multiple role agents for collaborative task processing based on a large language model provided by the present application. The general role agent creates multiple task role agents based on the content of the task instruction, including: S11: The general role agent creates a task role agent based on the content of the task instruction.
[0033] S12: evaluating whether the current created task role agent can meet the demand of the task instruction.
[0034] S13: in response to the current created task role agent failing to meet the demand of the task instruction, creating a new task role agent and again evaluating whether the current created task role agent can meet the demand of the task instruction.
[0035] S14: in response to the current created task role agent meeting the demand of the task instruction, terminating the creation.
[0036] In the present application, the current created task role agent is evaluated by a counter-question mechanism to determine whether it can meet the demand of the task instruction.
[0037] In the present application, the general role agent analyzes the content of the task instruction and then provides the roles required to complete the task and the corresponding identity prompt words, thereby initializing the task role agent, i.e., creating the task role agent.
[0038] To ensure that the created task role agent can completely cover all the fields required to execute the task, the task role agent can be selectively iteratively created. After the general role agent creates the task role agent in the first round based on the content of the task instruction, it can evaluate whether the task role agent created in the first round can meet the demand of the task instruction. The evaluation method can use a counter-question mechanism, i.e., after creating the task role agent, it can ask itself in a counter-question manner, such as: “Can the current created roles A, B and C fully solve the user's problem: …… problem? If not, please continue to improve the role information.” When the task role agent created in the first round fails to meet the demand of the task instruction, it will continue to analyze the content of the task instruction, create a new task role agent in the second round, and again evaluate all the task role agents created in the first and second rounds. In addition, other evaluation methods can also be used, such as preset evaluation standards, self-evaluation according to the evaluation standards, etc., which are not limited here.
[0039] The above operation of creating a task role agent and evaluating all the created task role agents is repeated until the current created task role agent meets the demand of the task instruction, then step S14 is executed, and no new task role agent is created, and the current created task role agent is directly output.
[0040] In the present application, the general role agent continuously creates the task role agent for a first preset number of times, or the current created task role agent meets the demand of the task instruction, and then the creation of the new task role agent is terminated.
[0041] In addition to evaluating whether the currently created task role agent can meet the requirements of the task instruction, a maximum number of creations can be set, i.e., when the number of times of creating the task role agent by the general role agent reaches a first preset number of times, the creation is stopped, wherein the first preset number of times can be set according to the specific requirements of the task instruction or the experience value of the historical creation number of times, for example, can be set to 5 times, i.e., if the task role agent is created for the fifth time, the evaluation is not performed, and the currently created task role agent is directly output, so as to avoid falling into a long-term iteration cycle and thus delaying the reply of the user and reducing the task processing efficiency.
[0042] Unlike the prior art, the application dynamically adjusts the number and roles of the created task role agents by evaluating whether the currently created task role agent can meet the requirements of the task instruction, so that the created task role agent can process the task from multiple directions and angles, and the accuracy of task processing is improved; complex task management is supported, different roles can simulate the cooperation between different functional roles, help to organize and coordinate complex projects, and improve work efficiency.
[0043] The following is a specific case of creating multiple task role agents by the general role agent based on the content of the task instruction: User question (task instruction): Output a detailed report on the founding background and early development of A company, including: specific timeline, founding team, and early business model, etc.
[0044] The final answer output by the general role agent: "To complete the task of outputting a detailed report on the founding background and early development of A company, the following roles and identity prompts are required: 1) Role: Project Manager; Identity prompt: Responsible for planning, coordinating, and supervising the overall task to ensure that all work is completed on time. Requires project management experience and good communication skills.
[0045] 2) Role: Business Analyst; Identity prompt: Responsible for analyzing the business model of A company, understanding its early operation strategy and market positioning. Requires professional knowledge of business analysis and market research.
[0046] 3) Role: Historical Researcher; Identity prompt: Responsible for collecting and organizing the founding background, timeline, and key development events of A company. Requires historical research methods and data collection capabilities.
[0047] 4) Role: Content Writing Expert; Identity prompt: Responsible for writing the collected information into a detailed and coherent report. Requires excellent writing skills and business writing experience.
[0048] 5) Role: Data Analyst; Identity Prompt: Responsible for analyzing early business data of Company A, supporting the timeline and business pattern description in the report. Requires proficiency in data processing and analysis tools.
[0049] 6) Role: Editor Proofreader; Identity Prompt: Responsible for reviewing the accuracy, logic, and language expression of the report content to ensure the quality of the final report. Requires meticulous proofreading skills and good language expression skills.
[0050] 7) Role: Designer (Optional); Identity Prompt: Responsible for the visual design and layout of the report to make the content clearer and easier to read. Requires proficiency in graphic design and layout software.
[0051] Review Result: The above roles cover all aspects of the task, from information collection, analysis, to content writing and final presentation, ensuring the comprehensiveness and high quality of the report. The identity prompts of each role are clear and the responsibilities are well-defined, making the process reasonable and effective. S20: Update the identity of the large language model to a task splitting agent, and based on the obtained identities of each task role agent, split the task into multiple sub-tasks and assign the multiple sub-tasks to the corresponding each task role agent.
[0052] In this application, a new identity prompt can be input to the large language model, i.e. the current general role agent, to update the identity of the general role agent. After creating each task role agent based on the general role agent, the next step is to split the task. Since the function of the general role agent at this time is to create multiple task role agents based on the task instruction content, it is necessary to write an identity prompt for "splitting tasks and assigning tasks to specific roles" and submit it to the large language model to give it a new identity of a task splitting agent. Among them, the agent and the identity prompt are in a 1-to-1 relationship, i.e. one identity prompt corresponds to one agent. After inputting a new identity prompt to the original agent, the original agent is updated to a new agent corresponding to the new identity prompt, or a new agent can be created.
[0053] Submit the multiple task role agents created in step S10 and the task that needs to be split to the task splitting agent. The task splitting agent can split the task based on each task role agent, split each sub-task, and assign each sub-task to the corresponding each task role agent. Among them, the task splitting agent can be constrained by a pre-set task splitting standard when splitting the task, for example, the task splitting standard can include: 1) Clarity: Each sub-task must have a clear objective and expected outcome, avoiding ambiguity; 2) Independence: Sub-tasks should be independent as much as possible, reducing interdependence and avoiding bottlenecks during execution; 3) Measurability: Each sub-task has a clear measurement standard to assess completion and quality; 4) Relevance: Sub-tasks must be closely related to the overall goal (user task / question), ensuring that all split tasks contribute to the realization of the final goal.
[0054] The following is a specific case of creating a task splitting agent and splitting tasks by it: Identity prompt word submitted to large language model: "Role: You are a task splitting and task allocation expert; Skills: a. Split the user's question or task into multiple executable sub-tasks; b. Assign sub-tasks to existing roles to execute; Output: Role information and sub-tasks that the role can perform." Task allocation result output by task splitting agent: Role information: Research Analyst, Content Writer, Business History Expert, Data Visualization Designer (if chart support is needed), and Project Manager; Task allocation result: 1) Role: Research Analyst. Sub-task: Collect information on the founding background of Company A, including the time and place of establishment and initial goals; Collect relevant information on the early development of Company A, such as key events, market environment and initial business operation status.
[0055] 2) Role: Business History Expert. Sub-task: Analyze the founding background of Company A and understand its industry background and reasons for establishment; Research the business model of Company A in its early stages and evaluate its business strategy and market positioning.
[0056] 3) Role: Content Writer. Sub-task: Write a report on the founding background of Company A, covering the detailed process of company establishment and initial goals; Write a detailed report on the early development of Company A, describing the company's operation status and key development nodes in the initial stage.
[0057] 4) Role: Data Visualization Designer. Sub-task: Create a timeline chart of Company A, showing the major events and milestones from its founding to early development; Design relevant charts and graphs to assist in the presentation of report content (if needed).
[0058] 5) Role: Project Manager. Sub-task: Coordinate the work progress among various roles to ensure timely completion of tasks; Supervise the overall progress of the project and solve problems encountered during execution; Integrate all parts of the content into the final detailed report.
[0059] Through the above task allocation, we can ensure that the detailed report on the founding background and early development of Company A is completed comprehensively and efficiently.
[0060] Different from the existing technology, the method provided by this application is to build a multi-role collaborative task processing method based on a large language model. By splitting the task and assigning subtasks to each task role intelligent agent for simultaneous processing, the task completion speed can be significantly accelerated; the number of roles is dynamically generated according to the user's questions, so as to realize the dynamic allocation of tasks to roles, and dynamically adjust the role workload according to real-time needs, thereby improving resource utilization efficiency.
[0061] S30: Each task role agent performs the corresponding subtask to obtain the subtask results and submits each subtask result.
[0062] In the above step S30, each task role agent uses the corresponding tools to perform the subtasks according to the corresponding subtasks assigned in step S20. Among them, tools mainly refer to software tools, specifically APIs (application programming interfaces) based on the HTTP protocol. In actual applications, tools refer to API interfaces with specific functions such as search engine APIs (search interfaces provided by Google), query addition APIs (weather query interfaces provided by AutoNavi), etc. The tools used by each task role agent are determined according to the subtasks it needs to complete, and there is no direct dependency relationship between the use of tools by each task role agent. For example: Task role agent 1: to query the founder information of Company A, use the search engine tool; Task role agent 2: to query the development history and stock information of Company A, use the search engine tool and the stock market data query tool.
[0063] In this application, reference is made to Figure 3 , Figure 3 This is a flowchart of the result quality assessment of the first embodiment of the method for constructing a multi-role collaborative task processing method based on a large language model provided by the present application. After each task role agent performs the corresponding subtask and obtains the subtask result, it also includes: S31: Update the identity of the large language model to the task result evaluation agent. The task result evaluation agent evaluates the result quality based on the content of the subtasks and the corresponding subtask results, and gives execution suggestions to the task role agent.
[0064] S32: The task role agent re-executes the corresponding subtask based on the execution suggestion to obtain a new subtask result.
[0065] In the present application, in order to ensure the accuracy of task execution, when each task role agent executes the corresponding subtask to obtain the subtask result, the result quality evaluation can also be performed to evaluate the quality of the subtask result. First, the identity of the large language model is updated again to the task result evaluation agent, and the updated manner is still to submit the corresponding task result evaluation identity prompt word to the large language model; then, the data including each subtask description and each subtask execution result are assembled and submitted to the task result evaluation agent, and the task result evaluation agent performs result quality evaluation based on the content of the subtask and the corresponding subtask result.
[0066] Among them, the standards for result quality evaluation can include: Correctness: whether the subtask result meets the expectations and specifications, and whether the output is consistent with the expected result, such as searching for information about company A, searching for company B, and the result is incorrect; Completeness: whether the subtask result covers all requirements of the subtask, and whether there is omission, such as writing a market analysis report, which must include market overview, competition analysis, consumer analysis, and SWOT analysis, etc.; Quality: whether the subtask result meets the standards of correctness, readability, and professionalism, etc.; Standard: whether the subtask result complies with relevant laws and industry standards.
[0067] In the present application, the task result evaluation agent performs quality evaluation according to the above standards based on the content of each subtask and the corresponding subtask result, gives execution suggestions for each task role agent, and then each task role agent re-executes the corresponding subtask based on the given execution suggestions and the current subtask result to obtain new subtask results. For example, subtask: "list environmental protection measures"; task role agent executes subtask and outputs subtask result: "A, B, C, D four measures"; task result evaluation agent evaluates subtask result: "environmental protection measures have A, B, C, D four points, combine existing results to analyze user problems and give multi-angle analysis answers"; task role agent re-executes subtask and outputs new subtask result: "from X angle, environmental protection measures have A, B, C, D four points, from Y angle, environmental protection measures have E, F two points……".
[0068] Whenever the sub-task result is obtained, the task result evaluation agent needs to perform result quality evaluation, i.e., the process of repeatedly performing the above steps S31-S32, if the sub-task result does not meet the standard of result quality evaluation, the task result evaluation agent will give the corresponding execution suggestion, and then the corresponding task role agent re-executes the sub-task; if the sub-task result meets the quality evaluation standard, the task result evaluation agent will no longer give the execution suggestion, and the current sub-task result will be taken as the final sub-task result, and the final sub-task result will be stored in the temporary area for subsequent aggregation.
[0069] In an embodiment, the result quality evaluation can also be self-evaluated by each task role agent, not by the task result evaluation agent based on the large language model update, i.e., the self-evaluation thinking chain reflection mechanism is additionally set for each task role agent, specifically, a new identity prompt word (containing the intention of self-evaluation according to the result quality evaluation standard and re-executing the sub-task according to the evaluation result) is added to each task role agent, so that the updated each task role agent can realize self-evaluation and iterative execution of sub-tasks.
[0070] In this application, the task role agent re-executes the corresponding sub-task based on the execution suggestion to obtain a new sub-task result until the second preset number of times is reached, and then the result quality evaluation is terminated.
[0071] In this application, in addition to restricting the number of result quality evaluations by the quality evaluation standard, a maximum number of result quality evaluations can also be set, i.e., the result quality evaluation is terminated after the number of result quality evaluations reaches the second preset number of times. The second preset number of times can be set according to the specific requirements of the task instruction or the empirical value of the historical evaluation times, for example, it can be set to 2 times, i.e., after the second execution suggestion is given, the task role agent re-executes the corresponding sub-task based on the execution suggestion to obtain the final sub-task result.
[0072] In this application, based on the preset mapping rule of the number of task role agents and the task complexity, the task complexity is determined according to the number of created task role agents. Based on the preset mapping rule of the task complexity and the number of result quality evaluations, the second preset number of times is determined.
[0073] In the present application, the second preset number of times can also be determined according to the task complexity. According to historical experience, the task complexity can be judged according to the number of task role agents, that is, the more task role agents required to complete the task, the higher the task complexity. The mapping rule between the number of task role agents and the task complexity can be preset as follows: a task requiring less than 3 necessary role agents to execute is a simple task; a task requiring a number of necessary role agents in the range of [3, 6] is a medium task; and a task requiring more than 6 necessary role agents to execute is a complex task.
[0074] For example, the task is "write an essay describing spring", only the necessary writing personnel are required to complete, and the task is a simple task; the task is "write an environmental protection manual", the necessary roles include content writers, reviewers and proofreaders, and the task is a medium task; the task is "develop and release a large Internet application (such as an e-commerce platform, a social network)", the necessary roles include product managers, UI designers, front-end engineers, back-end engineers, test engineers, operation and maintenance engineers, marketing personnel and project managers, and the task is a complex task.
[0075] According to the number of task role agents created in step S10, it is determined whether the task is a simple task, a medium task or a complex task. According to the result of the determination of the task complexity, the number of times of result quality evaluation is determined. According to historical experience, the mapping rule between the task complexity and the number of times of result quality evaluation can be preset as follows: the number of times of result quality evaluation for a simple task is 0 or 1; the number of times of result quality evaluation for a medium task is 2; and the number of times of result quality evaluation for a complex task is 3 or more. On this basis, the second preset number of times can be determined in combination with the actual demand of the task instruction.
[0076] Unlike the prior art, the method for constructing a multi-role collaborative processing task based on a large language model provided in the present application performs result quality evaluation after each task role agent executes the corresponding subtask to obtain a subtask result, and re-executes the subtask to obtain a new subtask result according to the execution suggestion given by the evaluation, introduces a self-evaluation mechanism for the role, and additionally sets a thinking chain reflection mechanism for self-evaluation for the dynamically generated role. Through the evaluation and iterative execution of the subtask, the correctness of task execution is improved, and multiple roles analyze problems from their respective professional fields, reducing bias and one-sidedness.
[0077] In the present application, with reference to Figure 4 , Figure 4 is a process diagram of mutual evaluation of task role agents in the first embodiment of the method for constructing a multi-role collaborative processing task based on a large language model provided in the present application, and each task role agent executes the corresponding subtask to obtain a subtask result, and further comprises: S33: The task role agent also evaluates the sub-task results obtained by the remaining task role agents and gives execution suggestions.
[0078] S34: The task role agent also executes the corresponding sub-task again based on the execution suggestions given by the remaining task role agents to obtain new sub-task results.
[0079] In this application, in the sub-task result quality evaluation stage, in addition to the quality evaluation of each sub-task result by the task result evaluation agent, the task role agents can also evaluate each other and give execution suggestions. For example, A, B, C, and D four task role agents, after obtaining their respective sub-task results, A evaluates the respective sub-task results of B, C, and D, B evaluates the respective sub-task results of A, C, and D, and so on. Each task role agent executes the corresponding sub-task again based on the execution suggestions given by the remaining task role agents to obtain new sub-task results. After obtaining the new sub-task results, mutual evaluation can also be performed again in S33 until a preset evaluation number is reached, or until the execution suggestions given by the remaining task role agents are all improvement suggestions (i.e., there is no need to re-execute), and the evaluation is terminated. The preset evaluation number is adjusted according to actual needs, which is not limited here.
[0080] Unlike the prior art, the multi-role collaborative processing task method based on a large language model provided in this application realizes discussion and negotiation between roles by mutual evaluation between task role agents after obtaining sub-task results, promotes in-depth analysis of complex problems, and thus improves the quality of task results.
[0081] It should be noted that the process of mutual evaluation between the above-mentioned task role agents and giving execution suggestions (i.e., steps S33-S34) can occur before the above-mentioned steps S31-S32, or after the above-mentioned steps S31-S32, or in parallel with the above-mentioned steps S31-S32, which is not limited here.
[0082] S40: Update the identity of the large language model to a task result summary agent, and the task result summary agent summarizes each sub-task result to obtain the execution result corresponding to the task.
[0083] In step S40, the identity prompt word of the task result summary is submitted to the large language model again, and the large language model is updated to a task result summary agent. The task result summary agent summarizes the subtask results obtained in step S30, including summarizing each subtask result respectively to obtain each subtask summary result, and then performing a summary again to obtain an execution result corresponding to the task instruction as a completion condition summary of the task, so as to facilitate the user to view the execution result of the task. The task result summary agent, the general role agent, the task splitting agent and the task result evaluation agent are collectively referred to as a general agent, and the agents with specific features such as the doctor agent and the project manager agent are collectively referred to as a task role agent.
[0084] In the present application, with reference to Figure 5 , Figure 5 is a flowchart of a specific embodiment of a method for constructing a multi-role collaborative processing task based on a large language model provided by the present application. First, a general role agent is constructed based on a large language model, and a task instruction is submitted to the general role agent. Then, the general role agent iteratively creates different task role agents according to the content of the task instruction, and determines whether the number of creations exceeds 5 times. If the number of creations exceeds 5 times, the large language model is updated to a task splitting agent, and the task splitting agent splits and assigns tasks based on the task role agents. Then, each task role agent uses a tool to execute each subtask to obtain a subtask result, and the large language model is updated to a task result evaluation agent. The task result evaluation agent evaluates the quality of the results based on the content of the subtasks and the corresponding subtask results, and gives an execution suggestion for the task role agent. Each task role agent executes each subtask again to obtain a new subtask result according to the execution suggestion, and determines whether the number of quality evaluations exceeds 2 times. If the number of quality evaluations exceeds 2 times, the evaluation is not performed again, and each task role agent submits the current subtask result to a specified location for temporary storage. Finally, the large language model is updated to a task result summary agent, and the task result summary agent summarizes the subtask results to obtain an execution result corresponding to the task and notifies the user to accept the execution result.
[0085] Embodiment two Based on the same inventive concept, the present application also provides a computer device, which includes a memory, a processor and a computer program stored in the memory. The processor executes the computer program to implement the method for constructing a multi-role collaborative processing task based on a large language model as described in the above embodiment one.
[0086] Embodiment three Based on the same inventive concept, the embodiment of the present application also provides a computer readable storage medium, which stores computer programs / instructions, and the computer programs / instructions are executed by a processor to realize the method for constructing a multi-role collaborative processing task based on a large language model as described in the above embodiment one. Different from the prior art, the present application discloses a method and device for constructing a multi-role collaborative processing task based on a large language model. The method creates multiple task role agents based on the content of the task instruction through a general role agent of the large language model, then updates the large language model to a task splitting agent to split the task into multiple subtasks and assign them to the corresponding task role agents, executes the subtasks by the task role agents and submits the subtask results, and finally updates the large language model to a task result summarizing agent to summarize the subtask results to obtain the execution result corresponding to the task. The method dynamically creates a multi-role task processing pipeline according to the specific task, provides multi-perspective analysis through different task role agents according to user needs, expands the field of processing tasks, adapts to more task scenarios, enhances flexibility and adaptability; multiple roles analyze problems from their respective professional fields, reducing bias and one-sidedness, and improving the quality of task execution; through task decomposition, different roles simultaneously process, which can significantly speed up the completion of the overall task, improve execution efficiency, and improve resource utilization efficiency.
[0087] The above is only an embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation using the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for constructing multi-role collaborative task processing based on a large language model, characterized in that: include: The large language model is assigned an identity as a general role agent, and the general role agent creates multiple task role agents based on the content of the task instruction, each task role agent having a different identity; Updating the identity of the large language model to a task splitting agent, and the task splitting agent splits the task into multiple subtasks based on the obtained identities of each of the task role agents, and assigning the multiple subtasks to the corresponding task role agents; Each of the task role agents executes the corresponding subtask to obtain a subtask result and submits each of the subtask results; The identity of the large language model is updated to be a task result summarizing agent, and the task result summarizing agent summarizes the results of each subtask to obtain the execution result corresponding to the task.
2. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 1 is characterized in that: The general role agent creates a plurality of task role agents based on the content of the task instruction, including: The general role agent creates a task role agent based on the content of the task instruction; Evaluate whether the currently created task role agent can meet the requirements of the task instructions; In response to the currently created task role agent failing to meet the requirements of the task instruction, a new task role agent is created, and the currently created task role agent is evaluated again to see whether it can meet the requirements of the task instruction.
3. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 2 is characterized in that: When the general role agent continuously creates the task role agent for a first preset number of times, or the currently created task role agent meets the requirements of the task instruction, the creation of the new task role agent is terminated.
4. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 1 is characterized in that: After each of the task role agents executes the corresponding subtask and obtains the subtask result, the method further includes: Updating the identity of the large language model to a task result evaluation agent, wherein the task result evaluation agent performs a result quality evaluation based on the content of the subtask and the corresponding subtask result, and provides execution suggestions for the task role agent; The task role agent re-executes the corresponding subtask based on the execution suggestion to obtain a new subtask result.
5. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 1 or 4, characterized in that: After each of the task role agents executes the corresponding subtask and obtains the subtask result, the method further includes: The task role agent also evaluates the subtask results obtained by the other task role agents and gives execution suggestions; The task role agent also executes the corresponding subtask again based on the execution suggestions given by the other task role agents to obtain new subtask results.
6. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 4 is characterized in that: The task role agent re-executes the corresponding subtask based on the execution suggestion to obtain a new subtask result until a second preset number of times is reached, and then terminates the result quality evaluation.
7. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 6 is characterized in that: Also includes: Based on a preset mapping rule between the number of task role agents and the task complexity, determining the task complexity of the task according to the number of the created task role agents; The second preset number of times is determined based on a preset mapping rule between task complexity and result quality evaluation times.
8. The method for constructing a multi-role collaborative task processing method based on a large language model according to claim 2 is characterized in that: The counter-question mechanism is used to evaluate whether the currently created task role agent can meet the requirements of the task instructions.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the steps of the method for constructing a multi-role collaborative processing task based on a large language model as described in any one of claims 1-8.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for constructing a multi-role collaborative processing task based on a large language model as described in any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Multi-agent space cooperative treatment method and system
CN121093010A
Multi-agent space collaborative governance method and system
CN121093010B
Intelligent agent system generation method and device, equipment, storage medium and product
CN121724053A