A multi-agent thinking optimization method and system based on dynamic adjustment and a medium
By breaking down tasks into subtasks and setting initial budgets for agents, detecting and interrupting inference loops in real time, and dynamically adjusting the depth of thinking and content redundancy, the overthinking problem in multi-agent systems is solved, achieving efficient and reliable decision-making and resource optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN YUANTING INFORMATION TECH CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-02
Smart Images

Figure CN122133818A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-agent collaborative technology, and in particular to a method, system and medium for optimizing multi-agent thinking based on dynamic adjustment. Background Technology
[0002] Multi-agent systems are widely used in artificial intelligence applications such as complex task solving, collaborative decision-making, and simulation. In these systems, multiple agents collaborate through iterative reasoning, communication, and deep computing. However, in practical deployments, the phenomenon of "overthinking" is common. This occurs when agents generate redundant communication loops, meaningless iterative calculations, or excessively long inference chains during the reasoning process, leading to significantly increased system response latency, wasted computing resources, and decreased decision quality. This problem is particularly prominent in applications with high real-time requirements, such as intelligent customer service, autonomous driving collaboration, and medical assisted diagnosis, thus limiting the practicality and scalability of multi-agent systems.
[0003] To mitigate the overthinking problem, existing technologies primarily employ static constraint mechanisms. For example, some frameworks forcibly terminate the inference process by setting a maximum number of iteration rounds or communication rounds; some models introduce a thinking budget mechanism to limit the inference depth using the number of tokens or computation steps. However, these solutions have significant drawbacks. First, static thresholds cannot adaptively adjust based on the complexity, urgency, or historical execution feedback of the agent, easily leading to excessive resource consumption for simple tasks or insufficient thinking for complex tasks. Second, existing solutions lack real-time monitoring capabilities for communication interactions between agents, failing to detect and interrupt inference loops in a timely manner, and also struggling to effectively filter redundant communication content.
[0004] In summary, existing technologies have the problem of being unable to dynamically adjust the thinking process of intelligent agents. Summary of the Invention
[0005] To address the aforementioned technical problems, this invention provides a multi-agent thinking optimization method based on dynamic adjustment, comprising the following steps: Obtain the original task, break it down into multiple subtasks, and assign an agent to each subtask; Assign a corresponding initial thinking budget to each of the aforementioned agents, and control the agents to reason about the sub-tasks under the constraints of the initial thinking budget, generating intermediate reasoning results; The system collects communication and interaction data between the agents in real time, detects whether there is an inference loop, and if so, interrupts the current inference of the corresponding agent in the inference loop and generates a consensus result as a new input for the corresponding agent. The redundancy of the intermediate inference results is calculated in real time. When the redundancy exceeds a preset condition, the intermediate inference results are simplified. Based on the time constraints of the sub-tasks and the execution feedback of the corresponding agents, the thinking depth of the corresponding agents is adaptively adjusted. The final inference results output by each of the aforementioned agents are aggregated, and the consistency of the aggregated results is evaluated. Determine whether there are any subtasks that need to be re-executed based on the consistency assessment results.
[0006] Optionally, obtain the original task and break it down into multiple subtasks, including: Obtain the original task and convert it into a task embedding vector; The task embedding vector is divided into multiple semantic clusters using a clustering algorithm, and each semantic cluster represents a semantically independent subtask. A corresponding subtask description is generated for each semantic cluster using a large language model.
[0007] Optionally, an initial thinking budget can be allocated to each agent, specifically including: Construct a reinforcement learning controller, wherein the state space of the reinforcement learning controller includes the urgency of the sub-task, the historical accuracy of the agent and the current budget consumption, and the action space is the thought depth value or the token quantity limit; The Q-table of the reinforcement learning controller is updated according to the reward function, which is constructed based on task execution time, output accuracy, and resource consumption. Based on the reinforcement learning controller, the initial thinking budget of each agent is calculated and output according to the current state space.
[0008] Optionally, real-time collection of communication and interaction data between the agents is performed to detect the existence of inference loops, including: Real-time collection of communication and interaction data between the various intelligent agents. A dynamic directed communication graph is constructed based on the communication interaction data. The nodes of the dynamic directed communication graph are agent identifiers, the edges are message transmission paths, and the weight of each edge and the message content embedding vector are recorded. The dynamic directed communication graph is scanned using a depth-first search strategy to detect whether a closed loop exists. If a closed loop exists, it is determined that an inference loop exists, and the relevant agents in the inference loop are marked.
[0009] Optionally, the weights of the edges in the dynamic directed communication graph are calculated in the following way: The capability matching degree, current load factor, and historical accuracy of the target agent are obtained. The capability matching degree is used to characterize the degree of matching between the sub-task domain and the target agent's expertise. The load factor is used to characterize the target agent's current resource consumption. The historical accuracy is the success rate of the target agent on similar tasks in the most recent preset rounds. The edge weights are obtained by weighting and fusing the capability matching degree, current load factor, and historical accuracy.
[0010] Optionally, interrupting the current inference of the corresponding agent in the inference loop and generating a consensus result as a new input for the corresponding agent includes: Interrupt the current inference of the corresponding agent in the inference loop and save the current intermediate state of each agent; A weighted voting mechanism is triggered to generate a consensus result; the weight of the weighted vote is determined by the historical accuracy and output confidence of the corresponding agent. The consensus result is injected as a new input into the input queue of the corresponding agent, and the execution of the corresponding agent is resumed.
[0011] Optionally, the intermediate inference results may be simplified, including: The intermediate inference results are converted into embedding vectors, the similarity between the embedding vectors of the current inference result and the adjacent inference results is calculated, and the probability distribution information entropy of the intermediate inference results is calculated. When the similarity is greater than a preset similarity threshold or the information entropy is less than a preset entropy threshold, a sentence-level graph is constructed based on the corresponding reasoning results; Key sentences are extracted based on the TextRank algorithm, and the key sentences and corresponding inference results are input into a large language model to generate a fused summary.
[0012] Optionally, based on the time constraints of the sub-task and the execution feedback of the corresponding agent, the thinking depth of the corresponding agent is adaptively adjusted, including: Based on the time constraints of the sub-task and the execution feedback of the corresponding agent, calculate the urgency score of the sub-task; When the urgency score is greater than the first urgency threshold, the corresponding agent's thinking mode is switched to heuristic mode, and its maximum thinking depth is compressed. When the urgency score is less than the second urgency threshold, the corresponding agent is allowed to progressively deepen its thinking.
[0013] Corresponding to the aforementioned multi-agent thinking optimization method based on dynamic adjustment, the present invention provides a multi-agent thinking optimization system based on dynamic adjustment, comprising: The task decomposition module is used to obtain the original task, decompose it into multiple sub-tasks, and assign an agent to each sub-task. The reasoning module is used to allocate a corresponding initial thinking budget to each of the intelligent agents, control the intelligent agents to reason about the sub-tasks under the constraints of the initial thinking budget, and generate intermediate reasoning results. The detection module is used to collect communication and interaction data between the agents in real time, detect whether there is an inference loop, and if so, interrupt the current inference of the corresponding agent in the inference loop and generate a consensus result as the new input of the corresponding agent. The simplification module is used to calculate the content redundancy of the intermediate inference results in real time, and to simplify the intermediate inference results when the content redundancy exceeds a preset condition. The adaptive module is used to adaptively adjust the thinking depth of the corresponding agent based on the time constraints of the sub-task and the execution feedback of the corresponding agent. The aggregation module is used to aggregate the final inference results output by each of the aforementioned agents; The evaluation module is used to perform consistency evaluation on the aggregation results and determine whether there are any subtasks that need to be re-executed based on the consistency evaluation results.
[0014] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a dynamically adjusted multi-agent thinking optimization program, wherein the dynamically adjusted multi-agent thinking optimization program, when executed by a processor, implements the steps of the dynamically adjusted multi-agent thinking optimization method described above.
[0015] Compared with the prior art, the present invention has the following beneficial effects: (1) By decomposing the original task into multiple sub-tasks and assigning agents to each sub-task, distributed parallel processing of complex tasks is achieved; by allocating initial thinking budgets to each agent and constraining its reasoning process, unrestrained computational consumption is limited from the source; by collecting real-time communication interaction data between agents and detecting reasoning loops, and combining the interruption of loops with the injection of consensus results as new inputs, redundant communication loops are dynamically broken; by calculating the redundancy of intermediate reasoning results in real time, simplification is performed when the content exceeds the preset conditions, and redundant content generated by meaningless iterations is filtered out; by combining the time constraints of sub-tasks with the execution feedback of corresponding agents, the thinking depth is adaptively adjusted, so that the reasoning process can be dynamically adjusted according to the task characteristics and execution status; by aggregating the final reasoning results and performing consistency evaluation, the quality of the final output is guaranteed by determining whether the sub-tasks need to be re-executed based on the evaluation results. It can be seen that the present invention effectively suppresses the overthinking phenomenon of multi-agent systems, reduces system response latency and computational resource consumption, and ensures decision quality through consistency evaluation and re-execution mechanisms.
[0016] (2) By converting the original task into task embedding vectors and using a clustering algorithm to divide the task embedding vectors into multiple semantic clusters, the generation of subtasks is based on semantic similarity rather than simple rule segmentation. By generating corresponding subtask descriptions for each semantic cluster using a large language model, the boundaries and content of subtasks are made more accurate and standardized. It can be seen that the present invention realizes the semantic automatic decomposition of the original task, improves the semantic independence and description accuracy of subtask division, and lays the foundation for the accurate allocation and parallel reasoning of subsequent agents.
[0017] (3) By constructing a reinforcement learning controller and incorporating the urgency of subtasks, the agent's historical accuracy, and current budget consumption into the state space, and using the thinking depth value or token quantity limit as the action space, the initial thinking budget allocation can comprehensively consider task characteristics and agent capabilities. By constructing a reward function based on task execution time, output accuracy, and resource consumption and updating the Q-table, the controller learns the optimal budget allocation strategy that balances efficiency, quality, and resources during iterative optimization. It is evident that this invention achieves intelligent dynamic configuration of the initial thinking budget, avoiding the problem of excessive resource consumption for simple tasks or insufficient thinking for complex tasks caused by static thresholds.
[0018] (4) By collecting real-time communication interaction data between agents, a dynamic directed communication graph is constructed with agent identifiers as nodes, message transmission paths as edges, and edge weights and message content embedding vectors recorded, forming a formal model of communication topology and message semantics. A depth-first search strategy is used to scan this graph to detect closed loops, thus achieving automatic identification and location of inference loops. It is evident that this invention can transform the communication relationships between agents into a computable graph structure, improving the timeliness and accuracy of inference loop detection.
[0019] (5) By acquiring the target agent's capability matching degree, current load factor, and historical accuracy, and then weighting and fusing them to calculate the edge weights in the dynamic directed communication graph, the edge weights not only reflect the communication connection relationship, but also comprehensively characterize the matching degree between the agent and the sub-task domain, the current resource occupancy, and the historical execution reliability. This improves the accuracy of the dynamic directed communication graph in representing the actual performance of agent collaboration, and provides a more accurate basis for determining closed loops.
[0020] (6) By saving the current intermediate state of each agent when interrupting the inference loop, the loss of inference context is avoided; by triggering a weighted voting mechanism whose weights are determined by the historical accuracy and output confidence of the corresponding agent, a consensus result is generated, so that the consensus result reflects the comprehensive judgment of the highly reliable agent; by injecting the consensus result into the input queue of the corresponding agent and resuming execution, the inference process continues while breaking the loop. It can be seen that the present invention achieves safe interruption and fast convergence of the inference loop, which not only avoids the waste of resources and delay caused by redundant iteration, but also ensures the continuity of inference and the reliability of the result.
[0021] (7) By converting intermediate inference results into embedding vectors, calculating the similarity between the embedding vectors of intermediate inference results and those of adjacent inference results, as well as the information entropy of the probability distribution of intermediate inference results, redundancy is evaluated from two dimensions: semantic repetition and information content. When redundancy is determined, a sentence-level graph is constructed based on the corresponding inference results, and key sentences are extracted based on the TextRank algorithm. Then, a fusion summary is generated using a large language model. It can be seen that this invention achieves multi-dimensional accurate identification and intelligent simplification of intermediate inference results, compressing communication content and reducing transmission and processing overhead while retaining key semantic information.
[0022] (8) By calculating the urgency score based on the time constraints of the sub-tasks and the execution feedback of the corresponding agents, a quantitative evaluation benchmark for task urgency is established. When the urgency score is greater than the first urgency threshold, the thinking mode is switched to heuristic mode and the maximum thinking depth is compressed to prioritize response speed. When the urgency score is less than the second urgency threshold, the agents are allowed to progressively deepen their thinking depth to ensure reasoning quality. It can be seen that the present invention achieves dynamic adaptation between thinking depth and task urgency, balancing system response speed and reasoning accuracy. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1This is a simplified flowchart of an embodiment of the multi-agent thinking optimization method based on dynamic adjustment of the present invention; Figure 2 This is a framework diagram of an embodiment of the dynamically adjusted multi-agent thinking optimization system of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] like Figure 1 As shown, the present invention provides a multi-agent thinking optimization method based on dynamic adjustment, which includes the following steps: Obtain the original task, break it down into multiple subtasks, and assign an agent to each subtask; Assign an initial thinking budget to each agent, and control the agents to reason about subtasks under the constraints of the initial thinking budget, generating intermediate reasoning results; Real-time collection of communication and interaction data between agents; detection of inference loops; if so, interruption of the current inference of the corresponding agent in the inference loop and generation of consensus results as new input for the corresponding agent. The redundancy of intermediate inference results is calculated in real time. When the redundancy exceeds the preset condition, the intermediate inference results are simplified. Based on the time constraints of the sub-tasks and the execution feedback of the corresponding agents, the thinking depth of the corresponding agents is adaptively adjusted. Aggregate the final inference results output by each agent and perform a consistency evaluation on the aggregation results; Determine whether there are any subtasks that need to be re-executed based on the consistency assessment results.
[0026] This invention achieves distributed parallel processing of complex tasks by decomposing the original task into multiple sub-tasks and assigning agents to each sub-task. It limits unrestrained computational consumption at the source by allocating initial thinking budgets to each agent and constraining their reasoning process. It dynamically breaks redundant communication loops by collecting real-time communication interaction data between agents and detecting inference loops, combining loop interruption with consensus injection as new input. It simplifies intermediate inference results in real-time, filtering redundant content generated by meaningless iterations when redundancy exceeds preset conditions. It adaptively adjusts the thinking depth by combining the time constraints of sub-tasks with the execution feedback of corresponding agents, enabling the reasoning process to dynamically adjust according to task characteristics and execution status. Finally, it aggregates the final inference results and performs a consistency evaluation, determining whether to re-execute sub-tasks based on the evaluation results, thus ensuring the quality of the final output. Therefore, this invention effectively suppresses overthinking in multi-agent systems, reduces system response latency and computational resource consumption, and ensures decision quality through consistency evaluation and re-execution mechanisms.
[0027] In this embodiment, the original task is obtained and decomposed into multiple sub-tasks, including: The original task is obtained and converted into a task embedding vector; the preferred original task is text, vector, or multimodal input, where multimodal data will be extracted using a visual model, an automatic speech recognition model, and OCR, and uniformly transcribed into text; Clustering algorithms (such as K-means clustering) are used to divide the task embedding vectors into multiple semantic clusters, each representing a semantically independent subtask; The large language model generates corresponding subtask descriptions for each semantic cluster; furthermore, a DAG graph can also be generated.
[0028] This invention transforms the original task into task embedding vectors and employs a clustering algorithm to divide these vectors into multiple semantic clusters. This allows subtask generation to be based on semantic similarity rather than simple rule-based segmentation. Furthermore, a large language model generates corresponding subtask descriptions for each semantic cluster, resulting in more precise and standardized subtask boundaries and content representations. Therefore, this invention achieves automatic semantic decomposition of the original task, improves the semantic independence and accuracy of subtask partitioning, and lays the foundation for subsequent precise agent allocation and parallel reasoning.
[0029] In this embodiment, an initial thinking budget is allocated to each agent, specifically including: Construct a reinforcement learning controller. The state space of the reinforcement learning controller includes the urgency of subtasks, the historical accuracy of the agent, and the current budget consumption. The action space is the depth of thought or the token limit. The Q-table of the reinforcement learning controller is updated according to the reward function, which is constructed based on task execution time, output accuracy, and resource consumption; preferably, the reward function is... The formula is as follows: Where t represents the task execution time. This indicates the maximum task execution time, acc indicates the accuracy of the output result, and cost indicates the resource consumption. Furthermore, the weight coefficient can be fine-tuned after every 10 rounds of tasks. When the remaining budget is less than 10%, a "forced output" instruction is immediately generated to prevent infinite iteration. Based on a reinforcement learning controller, the initial thinking budget of each agent is calculated and output according to the current state space.
[0030] This invention constructs a reinforcement learning controller and incorporates the urgency of subtasks, the agent's historical accuracy, and current budget consumption into the state space, while using the thinking depth value or token limit as the action space. This allows the initial thinking budget allocation to comprehensively consider task characteristics and agent capabilities. By constructing a reward function based on task execution time, output accuracy, and resource consumption and updating the Q-table, the controller learns an optimal budget allocation strategy that balances efficiency, quality, and resources through iterative optimization. Therefore, this invention achieves intelligent dynamic configuration of the initial thinking budget, avoiding the problems of excessive resource consumption for simple tasks or insufficient thinking for complex tasks caused by static thresholds.
[0031] In this embodiment, real-time collection of communication interaction data between agents and detection of inference loops include: Real-time collection of communication and interaction data between various intelligent agents. A dynamic directed communication graph is constructed based on the communication interaction data. The nodes of the dynamic directed communication graph are agent identifiers, the edges are message passing paths, and the weight of each edge and the message content embedding vector are recorded. A depth-first search strategy is used to scan the dynamic directed communication graph to detect whether a closed loop exists. If a closed loop exists, it is determined that an inference loop exists, and the relevant agents in the inference loop are marked.
[0032] This invention constructs a dynamic directed communication graph by collecting real-time communication interaction data between agents. The graph uses agent identifiers as nodes, message transmission paths as edges, and records edge weights and message content embedding vectors, thus forming a formal model of the communication topology and message semantics. A depth-first search strategy is then used to scan this graph to detect closed loops, enabling automatic identification and location of inference loops. Therefore, this invention can transform the communication relationships between agents into a computable graph structure, improving the timeliness and accuracy of inference loop detection.
[0033] Furthermore, after each round of communication, the latest communication graph snapshot is pushed, which includes a content summary (or embedding vector) of each communication message.
[0034] In this embodiment, the weights of edges in the dynamic directed communication graph are calculated in the following way: The target agent's capability matching degree, current load factor, and historical accuracy are obtained. The capability matching degree is used to characterize the degree of matching between the sub-task domain and the target agent's expertise. The load factor is used to characterize the target agent's current resource consumption. The historical accuracy is the success rate of the target agent on similar tasks in the most recent preset rounds. Preferably, the preset rounds are 10. The edge weights are obtained by weighting and fusing the capability matching degree, current load factor, and historical accuracy. The specific calculation formula is as follows: Where W is the edge weight, M is the capability matching degree of the target agent, L is the current load factor of the target agent (L equals the sum of the number of currently executed subtasks and the number of tokens being processed), and H is the historical accuracy of the target agent (the value ranges from 0 to 1).
[0035] This invention obtains the target agent's capability matching degree, current load factor, and historical accuracy, and then weights and fuses these data to calculate the edge weights in a dynamic directed communication graph. This allows the edge weights to not only reflect communication connections but also comprehensively characterize the agent's matching degree with the sub-task domain, current resource usage, and historical execution reliability. Therefore, it improves the accuracy of the dynamic directed communication graph in representing the actual effectiveness of agent collaboration and provides a more accurate basis for determining closed loops.
[0036] In this embodiment, interrupting the current inference of the corresponding agent in the inference loop and generating a consensus result as the new input for the corresponding agent includes: Interrupt the current inference of the corresponding agent in the inference loop and save the current intermediate state of each agent; A weighted voting mechanism is triggered to generate a consensus result; the weight of the vote is determined by the historical accuracy and output confidence of the corresponding agent; the formula for calculating the output confidence is as follows: Where C is the output confidence of the corresponding agent, and l is the logit probability of the corresponding agent. When the corresponding agent generates the final answer in the current reasoning, the logit probability distribution of the last token is taken out, and the probability value of the token with the highest probability is calculated by the softmax function, which is used as the basic confidence index. The consensus result is injected as a new input into the input queue of the corresponding agent, and the execution of the corresponding agent is resumed.
[0037] This invention avoids the loss of inference context by preserving the current intermediate states of each agent when interrupting the inference loop; it generates a consensus result by triggering a weighted voting mechanism whose weights are determined by the historical accuracy and output confidence of the corresponding agent, ensuring that the consensus result reflects the comprehensive judgment of highly reliable agents; and it continues the inference process while breaking the loop by injecting the consensus result into the input queue of the corresponding agent and resuming execution. Therefore, this invention achieves safe interruption and rapid convergence of the inference loop, avoiding resource waste and delays caused by redundant iterations while ensuring the continuity of inference and the reliability of the results.
[0038] In this embodiment, the intermediate inference results are simplified, including: The intermediate inference results are converted into embedding vectors, the similarity between the embedding vectors of the current inference result and the adjacent inference results is calculated, and the probability distribution information entropy of the intermediate inference results is calculated. When the similarity is greater than the preset similarity threshold (preferably 0.8) or the information entropy is less than the preset entropy threshold (preferably a suitable value between 0.5 and 1.2), a sentence-level graph is constructed based on the corresponding reasoning results; Key sentences are extracted based on the TextRank algorithm (preferably the Top-K important sentences, where K defaults to 3), and the key sentences and corresponding inference results are input into the large language model to generate a fused summary. Preferably, the large model is required to fuse the data in the most concise and non-repetitive way, retain the core information, and generate a fused summary that does not exceed 50% of the original total length.
[0039] This invention converts intermediate inference results into embedding vectors, calculates the similarity of the embedding vectors with adjacent inference results and the information entropy of the probability distribution of intermediate inference results, and evaluates redundancy from two dimensions: semantic repetition and information content. When redundancy is determined, a sentence-level graph is constructed based on the corresponding inference results, and key sentences are extracted using the TextRank algorithm, followed by a fusion summary generated by a large language model. Therefore, this invention achieves multi-dimensional accurate identification and intelligent simplification of intermediate inference results, compressing communication content and reducing transmission and processing overhead while preserving key semantic information.
[0040] In this embodiment, the depth of thought of the corresponding agent is adaptively adjusted based on the time constraints of the sub-task and the execution feedback of the corresponding agent, including: Calculate the urgency score of the subtask based on its time constraints and the execution feedback of the corresponding agent. When the urgency score is greater than the first urgency threshold (preferably 0.6), the corresponding agent's thinking mode is switched to heuristic mode, and its maximum thinking depth is compressed. When the urgency score is less than the second urgency threshold (preferably 0.4), the corresponding agent is allowed to progressively deepen its thinking.
[0041] This invention establishes a quantitative assessment benchmark for task urgency by calculating an urgency score based on the time constraints of sub-tasks and the execution feedback of the corresponding agents. When the urgency score exceeds a first urgency threshold, the thinking mode is switched to a heuristic mode and the maximum thinking depth is compressed to prioritize response speed. When the urgency score is below a second urgency threshold, the agent is allowed to progressively deepen its thinking depth to ensure reasoning quality. Thus, this invention achieves dynamic adaptation between thinking depth and task urgency, balancing system response speed and reasoning accuracy.
[0042] In this embodiment, the final inference results output by each agent are aggregated, preferably by weighted averaging. The specific weighted averaging formula is as follows: Where R represents the aggregation result, N represents the number of final inference results, and i represents the i-th agent. This represents the weight corresponding to the final inference result output by the i-th agent. This represents the final inference result output by the i-th agent. Preferably, ;in, This represents the urgency score of the subtask handled by the i-th agent. The corresponding weight for the urgency score (preferably 0.5). Let represent the historical accuracy of the i-th agent, where the i-th agent represents the corresponding weight of the historical accuracy (preferably 0.3). This represents the output confidence score of the i-th agent. The corresponding weight for the output confidence level (preferably 0.2).
[0043] Furthermore, a consistency assessment of the aggregation results is performed, including: Calculate the average value of pairwise cosine similarity based on the final inference results output by each agent; Based on the probability distribution of the final inference results output by all agents, calculate the information entropy of the probability distribution of the final inference results; Based on the above average value and the probability distribution information entropy of the final inference result, calculate the aggregation consistency score and determine whether it is less than the preset aggregation consistency threshold (preferably 0.85). If so, there is a subtask that needs to be re-executed.
[0044] In this embodiment, the formula for calculating the aggregation consistency score is as follows: Where S represents the aggregation consistency score, avg represents the average value, and e represents the probability distribution information entropy of the final inference result.
[0045] likeFigure 2 As shown, the present invention also provides a multi-agent thinking optimization system based on dynamic adjustment, which includes: The task decomposition module 10 is used to obtain the original task, decompose it into multiple sub-tasks, and assign an agent to each sub-task. The reasoning module 20 is used to allocate corresponding initial thinking budgets to each agent, control the agents to reason about sub-tasks under the constraints of the initial thinking budgets, and generate intermediate reasoning results. The detection module 30 is used to collect communication and interaction data between agents in real time, detect whether there is an inference loop, and if so, interrupt the current inference of the corresponding agent in the inference loop and generate a consensus result as the new input of the corresponding agent. The simplification module 40 is used to calculate the content redundancy of intermediate inference results in real time. When the content redundancy exceeds the preset conditions, the intermediate inference results are simplified. The adaptive module 50 is used to adaptively adjust the thinking depth of the corresponding agent based on the time constraints of the subtask and the execution feedback of the corresponding agent. The aggregation module 60 is used to aggregate the final inference results output by each agent; Evaluation module 70 is used to perform consistency evaluation on the aggregation results and determine whether there are any subtasks that need to be re-executed based on the consistency evaluation results.
[0046] This invention also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the memory described in the above embodiments; or it may be a standalone computer-readable storage medium not assembled into a device. The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement... Figure 1 The illustrated method is a multi-agent thinking optimization method based on dynamic adjustment. The computer-readable storage medium can be a read-only memory, a hard disk, or an optical disk, etc.
[0047] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For system embodiments and storage medium embodiments, since they are basically similar to method embodiments, the descriptions are relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0048] Furthermore, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0049] The foregoing description illustrates and describes preferred embodiments of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the inventive concept by means of the foregoing teachings or techniques or knowledge in related fields. Any modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A multi-agent thinking optimization method based on dynamic adjustment, characterized in that, Includes the following steps: Obtain the original task, break it down into multiple subtasks, and assign an agent to each subtask; Assign a corresponding initial thinking budget to each of the aforementioned agents, and control the agents to reason about the sub-tasks under the constraints of the initial thinking budget, generating intermediate reasoning results; The system collects communication and interaction data between the agents in real time, detects whether there is an inference loop, and if so, interrupts the current inference of the corresponding agent in the inference loop and generates a consensus result as a new input for the corresponding agent. The redundancy of the intermediate inference results is calculated in real time. When the redundancy exceeds a preset condition, the intermediate inference results are simplified. Based on the time constraints of the sub-tasks and the execution feedback of the corresponding agents, the thinking depth of the corresponding agents is adaptively adjusted. The final inference results output by each of the aforementioned agents are aggregated, and the consistency of the aggregated results is evaluated. Determine whether there are any subtasks that need to be re-executed based on the consistency assessment results.
2. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, Obtain the original task and break it down into multiple subtasks, including: Obtain the original task and convert it into a task embedding vector; The task embedding vector is divided into multiple semantic clusters using a clustering algorithm, and each semantic cluster represents a semantically independent subtask. A corresponding subtask description is generated for each semantic cluster using a large language model.
3. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, Assign an initial thinking budget to each agent, specifically including: Construct a reinforcement learning controller, wherein the state space of the reinforcement learning controller includes the urgency of the sub-task, the historical accuracy of the agent and the current budget consumption, and the action space is the thought depth value or the token quantity limit; The Q-table of the reinforcement learning controller is updated according to the reward function, which is constructed based on task execution time, output accuracy, and resource consumption. Based on the reinforcement learning controller, the initial thinking budget of each agent is calculated and output according to the current state space.
4. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, Real-time acquisition of communication and interaction data between the agents, and detection of inference loops, including: Real-time collection of communication and interaction data between the various intelligent agents. A dynamic directed communication graph is constructed based on the communication interaction data. The nodes of the dynamic directed communication graph are agent identifiers, the edges are message passing paths, and the weight of each edge and the message content embedding vector are recorded. The dynamic directed communication graph is scanned using a depth-first search strategy to detect whether a closed loop exists. If a closed loop exists, it is determined that an inference loop exists, and the relevant agents in the inference loop are marked.
5. The multi-agent thinking optimization method based on dynamic adjustment according to claim 4, characterized in that, The weights of the edges in the dynamic directed communication graph are calculated in the following way: The capability matching degree, current load factor, and historical accuracy of the target agent are obtained. The capability matching degree is used to characterize the degree of matching between the sub-task domain and the target agent's expertise. The load factor is used to characterize the target agent's current resource consumption. The historical accuracy is the success rate of the target agent on similar tasks in the most recent preset rounds. The edge weights are obtained by weighting and fusing the capability matching degree, current load factor, and historical accuracy.
6. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, Interrupting the current inference of the corresponding agent in the inference loop and generating a consensus result as a new input for the corresponding agent includes: Interrupt the current inference of the corresponding agent in the inference loop and save the current intermediate state of each agent; A weighted voting mechanism is triggered to generate a consensus result; the weight of the weighted vote is determined by the historical accuracy and output confidence of the corresponding agent. The consensus result is injected as a new input into the input queue of the corresponding agent, and the execution of the corresponding agent is resumed.
7. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, The intermediate inference results are simplified, including: The intermediate inference results are converted into embedding vectors, the similarity between the embedding vectors of the current inference result and the adjacent inference results is calculated, and the probability distribution information entropy of the intermediate inference results is calculated. When the similarity is greater than a preset similarity threshold or the information entropy is less than a preset entropy threshold, a sentence-level graph is constructed based on the corresponding reasoning results; Key sentences are extracted based on the TextRank algorithm, and the key sentences and corresponding inference results are input into a large language model to generate a fused summary.
8. The multi-agent thinking optimization method based on dynamic adjustment according to claim 1, characterized in that, Based on the time constraints of the sub-tasks and the execution feedback of the corresponding agents, the depth of thought of the corresponding agents is adaptively adjusted, including: Based on the time constraints of the sub-task and the execution feedback of the corresponding agent, calculate the urgency score of the sub-task; When the urgency score is greater than the first urgency threshold, the corresponding agent's thinking mode is switched to heuristic mode, and its maximum thinking depth is compressed. When the urgency score is less than the second urgency threshold, the corresponding agent is allowed to progressively deepen its thinking.
9. A multi-agent thinking optimization system based on dynamic adjustment, characterized in that, include: The task decomposition module is used to obtain the original task, decompose it into multiple sub-tasks, and assign an agent to each sub-task. The reasoning module is used to allocate a corresponding initial thinking budget to each of the intelligent agents, control the intelligent agents to reason about the sub-tasks under the constraints of the initial thinking budget, and generate intermediate reasoning results. The detection module is used to collect communication and interaction data between the agents in real time, detect whether there is an inference loop, and if so, interrupt the current inference of the corresponding agent in the inference loop and generate a consensus result as the new input of the corresponding agent. The simplification module is used to calculate the content redundancy of the intermediate inference results in real time, and to simplify the intermediate inference results when the content redundancy exceeds a preset condition. The adaptive module is used to adaptively adjust the thinking depth of the corresponding agent based on the time constraints of the sub-task and the execution feedback of the corresponding agent. The aggregation module is used to aggregate the final inference results output by each of the aforementioned agents; The evaluation module is used to perform consistency evaluation on the aggregation results and determine whether there are any subtasks that need to be re-executed based on the consistency evaluation results.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a dynamically adjusted multi-agent thinking optimization program, which, when executed by a processor, implements the steps of the dynamically adjusted multi-agent thinking optimization method as described in any one of claims 1 to 8.