A heterogeneous multi-agent consensus reasoning method and system

By employing a heterogeneous multi-agent consensus reasoning method, utilizing a heterogeneous agent pool and an adaptive termination criterion, we have achieved efficient and accurate decision-making for multi-agent systems in complex tasks. This solves the problems of low efficiency and insufficient accuracy in existing systems and improves the robustness and stability of the system.

CN122334479APending Publication Date: 2026-07-03UNIV OF SCI & TECH OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
UNIV OF SCI & TECH OF CHINA
Filing Date
2026-04-01
Publication Date
2026-07-03

Smart Images

  • Figure CN122334479A_ABST
    Figure CN122334479A_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer software technology and discloses a heterogeneous multi-agent consensus reasoning method and system. The method includes: selecting at least two agents from a heterogeneous agent pool to form an initial verification group; each agent independently generates an initial response and extracts an answer; if the answers are consistent, the answer is output; in each round of debate within the initial verification group, each agent self-corrects based on the historical responses within the initial verification group in the previous round and generates a new answer; the debate status is monitored in real time according to an adaptive termination criterion; an independent reasoning subgroup independently infers and generates an answer based on the query task input by the user; a review subgroup reviews and generates an answer based on the debate history generated in the previous two stages; and a weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer. This invention transforms heterogeneous consensus into a controllable dynamic scheduling signal, thereby constructing a general framework for multi-agent reasoning that is both efficient and highly scalable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software technology, and specifically to a heterogeneous multi-agent consensus reasoning method and system. Background Technology

[0002] Large Language Models (LLMs) have made significant progress in recent years, demonstrating outstanding capabilities in downstream tasks such as logical reasoning, mathematical problem-solving, and code generation. Based on this, existing single-agent reasoning methods typically employ a unified and direct reasoning process to handle tasks, or introduce internal reinforcement strategies, such as designing pre-defined prompting strategies (chain reasoning, self-reflection, etc.) or integrating multiple sampling results (self-consistency, etc.) to generate answers. However, when faced with complex tasks requiring multi-step derivations or involving cognitive conflict, single models remain limited by insufficient reasoning diversity, resulting in suboptimal performance.

[0003] To overcome the limitations of single-agent systems in complex reasoning tasks, multi-agent systems (MAS) have been increasingly developed in recent years. Agent Systems (MAS) are gradually becoming an important research area. Multi-agent systems (MAS) enhance the overall reasoning ability of a system by introducing multiple agents to work collaboratively, utilizing information sharing, complementary perspectives, and collaborative decision-making mechanisms. One intuitive implementation is the multi-agent voting mechanism, which aggregates responses independently generated by multiple agents through majority voting or weighted averaging strategies. While such methods are simple and efficient, and can statistically aggregate different perspectives, their core drawback lies in the lack of deep interaction and substantive critique among agents. Therefore, their ability to improve the performance of complex problems requiring dialectical thinking or involving deep logical conflicts is limited.

[0004] Based on this, multi-agent debate (Multi The Agent Debate (MAD) framework has been proposed and received widespread attention. Within this framework, multiple agents generate their own reasoning processes around the same task, and through multiple rounds of mutual critique, rebuttal, and iterative correction, optimize their intermediate reasoning results to ultimately reach a better answer. However, some multi-agent debate methods use fixed interaction topologies and preset debate rounds for all tasks, leading to token redundancy and potential accuracy reduction due to incorrect answers that overfit the debate process. To improve the efficiency of multi-agent debate, some recent studies have optimized communication structures to generate better intra-round topologies, but failed to achieve adaptive adjustment across the overall process, making it difficult to allocate computational resources reasonably across tasks of varying difficulty. Other studies focus on inter-round dynamics, such as training discriminators to predict termination timing or designing heuristic rules to skip invalid rounds, but these often require additional labeled data or training new model components, increasing system complexity and potentially leading to insufficient generalization in cross-task or cross-domain scenarios. Despite the positive progress made in these explorations, most existing methods optimize the topology or inter-round stopping mechanisms in isolation, failing to design both collaboratively within a unified framework to achieve better resource allocation. Based on the above analysis, this invention is based on the following idea: an ideal and efficient multi-agent reasoning system should have the ability to adaptively adjust its collaborative strategy according to the real-time reasoning state of the task: for simple tasks that can quickly reach a reliable consensus, it should terminate as early as possible with minimal cost; for tasks with disagreements, appropriate debate should be initiated to resolve conflicts; and for stubborn problems that cannot be resolved by debate, broader collective wisdom should be flexibly introduced for decision-making.

[0005] Furthermore, most current multi-agent reasoning methods employ homogeneous models to construct agent clusters, which are highly correlated when dealing with specific biases or flawed logic. During debates, agents tend to blindly follow the majority opinion, leading to the reinforcement of erroneous viewpoints in multiple iterations, creating a collaborative illusion. This echo chamber effect renders debates merely a formality, failing to truly analyze problems from diverse perspectives and limiting the model's capacity to solve complex problems.

[0006] In summary, designing a progressive multi-agent reasoning method that can balance reasoning efficiency and accuracy and has the ability to complement heterogeneous perspectives has become an urgent problem to be solved in the field of multi-agent question answering reasoning. Summary of the Invention

[0007] To address the aforementioned technical problems, this invention provides a heterogeneous multi-agent consensus reasoning method and system.

[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: In a first aspect, the present invention provides a heterogeneous multi-agent consensus reasoning method, comprising: Initialize the heterogeneous agent pool; In the first stage, at least two agents are selected from the heterogeneous agent pool to form an initial verification group. Each agent independently generates an initial response and extracts the answer. If the answers are consistent, the answer is output; otherwise, the second stage begins. In the second stage, the agents in the initial verification group conduct multiple rounds of debate. In each round of debate, each agent self-corrects based on the historical responses of the previous round and generates a new answer. The debate status is monitored in real time according to the adaptive termination criterion: if all agents reach a consensus, the consensus answer is output; if an abnormal debate status is detected or the preset maximum number of debate rounds is reached, the third stage is triggered; otherwise, the next round of debate continues. In the third stage, agents that did not participate in the first two stages are selected from the heterogeneous agent pool to form an upgrade cluster, which is then divided into an independent reasoning subgroup and a review subgroup. The independent reasoning subgroup generates an answer based on the user-input query task q, while the review subgroup reviews and generates an answer based on q and the debate history generated in the first two stages. A weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer.

[0009] In one embodiment, the initialization of the heterogeneous agent pool specifically includes: each agent is instantiated by a large language model and configured with system prompts appropriate to the role of the agent, thereby forming a heterogeneous agent pool.

[0010] In one embodiment, at least two agents are selected from a heterogeneous agent pool to form an initial verification group. Each agent independently generates an initial response and extracts an answer. If the answers match, the answer is output; otherwise, the process proceeds to the second stage, which specifically includes: Select two agents to form the initial verification group. Each agent in the initial verification group Query task based on user input and their respective system prompts Generate initial response independently : ; Represented as the i-th intelligent agent Large language models are instantiated. This indicates that the answer extraction function does not rely on any historical information. Get the initial predicted answer ; Define the consensus function within the group ,in This indicates an indicator function; the value of the indicator function is 1 when the condition within the parentheses is true, and 0 when the condition within the parentheses is false. If the initial predictions of all agents in the initial verification group are consistent, then the initial predictions will be returned as the final result; otherwise... Then, the initial prediction answers of each agent are saved as historical responses and passed on to the second stage.

[0011] In one embodiment, the process of having agents within the initial verification group conduct multiple rounds of debate, in which each agent self-corrects based on its historical responses from previous rounds and generates a new answer, and the debate status is monitored in real time according to an adaptive termination criterion, specifically including: For the t-th round of debate, each agent The input includes: the query task entered by the user. System prompt And the historical responses during the t-1 round of debates : ; intelligent agent This will generate the response for the t-th round of debate. : ; Call the answer extraction function Extracted The predicted answer for the t-th round of debate Then, the consensus function within the group is used to determine whether the answers of the agents in each initial verification group in this round of debate are consistent. An adaptive termination criterion with multiple conditions is executed after each round of debate, terminating the debate cycle when consensus is reached or an abnormal debate state is detected.

[0012] In one embodiment, if all agents reach a consensus, a consensus answer is output; if an abnormal debate state is detected or a preset maximum number of debate rounds is reached, a third stage is triggered, specifically including: If the initial validation group contains two agents, and their answers in the current round of debate are consistent, then the agents are considered to have reached a consensus, and a consensus answer is output. If the initial validation group contains three or more agents, the consensus score is calculated by determining the proportion of the subset with the largest consistency answer. : ; in, Indicates an indicator function, Indicates candidate answers, For the merged answer space, when When this happens, a fast early stop mechanism is triggered, and the answer with the highest proportion of consensus is output as the consensus answer. Indicates the consensus threshold; Monitor the evolution of the answer sequence generated in each round of debate. If an answer exchange event or a logical deadlock event is detected in the answer sequence and the number of consecutive occurrences exceeds the threshold, it is considered to have entered an abnormal debate state. The current round of debate is immediately terminated, and the third stage is entered. The answer of the current round of debate is saved as the debate history. If no consensus is reached after the preset maximum number of debate rounds, the process will be forcibly stopped and proceed to the third stage, where a structured summary of the complete interaction history generated in the second stage will be prepared to generate a debate summary.

[0013] In one embodiment, if the answers of the two agents in the current round are swapped with the answers of the two agents in the previous round, an answer swap event is determined to have occurred. ; Exchange the event indicator for the answer. This indicates that an answer exchange event has occurred. This indicates that no answer exchange event occurred; ; The maximum number of debate rounds is preset for the second stage. This is a consecutive exchange counter used to count the number of consecutive occurrences of the answer exchange event during the t-th round of debate.

[0014] In one embodiment, if the answers of the two agents in the current round are the same as and different from their respective answers in the previous round, a logical deadlock event is determined to have occurred: ; This is a logical deadlock event indicator. This indicates that a logical deadlock event has occurred. This indicates that no logical deadlock event has occurred; ; The maximum number of debate rounds is preset for the second stage. This is a logic deadlock counter used to count the number of consecutive occurrences of a logic deadlock event during the t-th round of debate.

[0015] In one embodiment, the independent reasoning subgroup generates an answer based on the user-input query task q, the review subgroup reviews and generates an answer based on q and the debate history generated in the previous two stages, and a weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer, specifically including: choose Each agent forms an independent reasoning group. , The j-th intelligent agent In the Candidate answers generated in rounds Defined as: ; in, for In the The response generated by the round, These are clues for independent reasoning. This indicates that it does not rely on any historical records. ; Represented as A large language model to be instantiated; choose A panel of debate judges composed of individual agents , , The intelligent system can simultaneously receive query tasks input by the user. Debate summary of the final round of debate between the two agents in the second phase , The maximum number of debate rounds is preset for the second stage; The k-th intelligent agent No. Candidate answers generated in rounds Defined as: ; , These are the prompts for the review panel. for No. The response generated by the round; Indicates to A large language model to be instantiated; Collect all candidate answers to form a set : ; The final decision is made using a weighted majority voting strategy. ; To upgrade the cluster, for The m-th intelligent agent in the process, For the corresponding candidate answers, For the final answer, express The corresponding weights.

[0016] In one embodiment, weights The calculation method is as follows: When a consensus is reached within an independent reasoning group, the candidate answers of the agents within that group are given higher weight: ; in, To adjust the reward coefficients for the importance of agents within an independent reasoning group, Based on the weights, This represents logical AND. Consensus indicator function: ; for The first in An intelligent agent. This indicates that the independent reasoning group has reached a consensus. This indicates that no consensus has been reached within the independent reasoning group.

[0017] In a second aspect, the present invention provides a computer system including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method of any embodiment of the first aspect.

[0018] Compared with the prior art, the beneficial technical effects of the present invention are: Balancing inference quality and efficiency, this invention achieves a smooth transition from reasoning with a small number of heterogeneous agents to collective decision-making by progressively introducing different numbers of agents and inference modes. This avoids the cost spike caused by a one-time call to a large number of model resources, providing a feasible path for the large-scale deployment of multi-agent inference systems. By introducing heterogeneous consensus as a dynamic stop signal, this invention avoids the practice of executing fixed multi-round multi-agent decision-making processes for all tasks, enabling simple tasks to complete inference quickly with minimal computational overhead. Compared to existing multi-agent debate methods with fixed rounds or fixed scales, this invention significantly reduces overall inference costs while ensuring inference quality.

[0019] This invention demonstrates enhanced robustness and stability in complex reasoning tasks. Leveraging the complementary perspectives of heterogeneous agents, it enables cross-validation of the same problem from different logical pathways, reducing the risks of shared bias and illusion amplification common in homogeneous systems. Addressing common issues such as reasoning disagreements, answer exchange, and logical deadlock, this invention employs adaptive termination and escalating collective voting mechanisms to effectively prevent perspective limitations, repeated answer exchanges, and prolonged standoffs that easily occur during multi-agent debates. This results in a system exhibiting stronger adaptability and stability across different task complexity distributions.

[0020] In summary, through the above-described progressive collaborative design, from shallow to deep and from simple to complex, this invention successfully transforms heterogeneous consensus into controllable dynamic scheduling signals, thereby constructing a multi-agent reasoning general framework that is both efficient and powerful, and has good scalability. Attached Figure Description

[0021] Figure 1 This is a schematic diagram of the overall process of the method of the present invention; Figure 2 This is a logic flowchart of the present invention; Figure 3 This is a structural diagram of the present invention. Detailed Implementation

[0022] A preferred embodiment of the present invention will now be described in detail with reference to the accompanying drawings.

[0023] like Figure 1 As shown, a heterogeneous multi-agent consensus reasoning method of the present invention includes the following steps: S1, Initialize the heterogeneous agent pool; S2, the first stage, select at least two agents from the heterogeneous agent pool to form an initial verification group. Each agent independently generates an initial response and extracts the answer. If the answers are consistent, output the answer; otherwise, proceed to the second stage. S3, the second stage, involves multiple rounds of debate among agents within the initial verification group. In each round, each agent self-corrects based on the historical responses within the initial verification group and generates a new answer. The debate status is monitored in real time according to the adaptive termination criterion: if all agents reach a consensus, the consensus answer is output; if an abnormal debate status is detected or the preset maximum number of debate rounds is reached, the third stage is triggered; otherwise, the next round of debate continues. S4, the third stage, selects agents from the heterogeneous agent pool that did not participate in the first two stages to form an upgrade cluster, and divides them into an independent reasoning subgroup and a review subgroup. The independent reasoning subgroup generates an answer based on the user-input query task q, and the review subgroup reviews and generates an answer based on q and the debate history generated in the first two stages. A weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer.

[0024] To overcome the technical shortcomings of existing multi-agent reasoning frameworks in handling tasks of varying complexity, such as computational redundancy and insufficient reasoning diversity due to homogeneous models, this invention proposes a heterogeneous multi-agent consensus reasoning method and system. The core concept of this invention lies in constructing a dynamic and progressive collaborative reasoning framework with the consensus state among heterogeneous agents as the key scheduling signal. This framework innovatively designs a cascaded decision-making mechanism of "heterogeneous consensus verification - heterogeneous multi-agent debate - collective voting decision," adaptively adjusting the number of participating agents, reasoning modes, and resource investment intensity by evaluating the consensus level of task solving in real time. First, rapid consensus verification is performed using the lightest heterogeneous agents, efficiently solving most simple tasks. If disagreements arise, targeted multi-agent debates are initiated to attempt to resolve conflicts. If the debate reaches a stalemate, a broadened collective vote is ultimately resorted to, bringing together a wider range of independent reasoning and debate history analysis for a final decision. Through this collaborative mode that adapts to task complexity, this invention can significantly reduce unnecessary token consumption while improving reasoning accuracy, thereby achieving synergistic optimization of the efficiency and effectiveness of the multi-agent system.

[0025] The present invention will be described in detail below in several parts.

[0026] 1. System initialization and task submission.

[0027] This invention will utilize multi-agent systems Defined as a tuple: ,in yes A collection of intelligent agents (a pool of heterogeneous intelligent agents). Indicates a set of query tasks. This represents a large set of language models (LLMs) used to initialize the agent. The system receives query tasks input by the user. Each intelligent agent From large language models Instantiate and configure system prompts appropriate for its role. Thus, a heterogeneous group of intelligent agents is formed.

[0028] Given a query task intelligent agent In the Round generating response : ; in, It is the first Historical responses generated from rounds of debate (initial round) ).

[0029] Subsequently, the system calls the answer extraction function. Extract the predicted answer : ; Based on the answers from all agents, a decision function is used. Generate the final answer : .

[0030] 2. Heterogeneous consensus verification phase.

[0031] The goal of this phase is to select simple tasks that can be solved quickly with minimal cost. This involves selecting from a pool of heterogeneous intelligent agents. At least two agents are selected to form the initial verification group. As the most preferred embodiment, two agents can be selected to form the initial verification group. To achieve an optimal balance between efficiency and reliability, each agent independently generates an initial response and extracts an answer. The consistency of answers within the initial verification group is verified. If consensus is reached, the task is considered solved, the answer is output, and the process terminates; otherwise, the heterogeneous multi-agent debate phase begins.

[0032] In one embodiment, during the heterogeneous consensus verification phase, it is preferable that two heterogeneous intelligent agents form an initial verification group. , Independent parallel inference by agents within the group: Verify that all agents within the group are working on the original query task. and their respective prompts Independent generation Initial response: ; in, Represented as the i-th intelligent agent Large language models are instantiated. This indicates that the system does not rely on any historical information; it extracts answers through a function. Get the predicted answer Then, consensus judgment and early stopping are performed. The system verifies the consistency of answers within the group and defines the consensus function within the group. ,in This indicates an indicator function. If... If a consensus is reached, a global early stop is immediately triggered, the consensus answer is returned as the final result, and the entire process ends. If no consensus is reached, the initial response is saved as a historical response and passed to the next stage.

[0033] 3. Heterogeneous multi-agent debate stage.

[0034] For tasks where no consensus has been reached, the initial verification group will handle the verification. The agents within the system enter a multi-round debate mode. In each round, each agent integrates its own and other agents' historical arguments from the initial validation group for self-correction. The system monitors the debate status in real time using an adaptive termination criterion: if the initial validation group reaches a consensus, the system outputs the answer; if the initial validation group enters an abnormal debate state or has reached the maximum number of debate rounds, the system extracts a summary of the current debate history and triggers an upgrade mechanism to enter the upgrade collective voting phase; otherwise, the debate continues until the maximum number of rounds is reached.

[0035] In one embodiment, during the heterogeneous multi-agent debate phase, the present invention employs a lightweight debate framework and an adaptive termination criterion to resolve tasks for which consensus was not reached in the previous phase, as follows: Debate Cluster Construction: The invention continues to use the agent cluster from the heterogeneous consensus verification phase to enter the debate, but it also supports selecting more agents to enter this phase according to the policy.

[0036] Multi-round debate and answer extraction: For the t-th round of debate, each agent... The input includes: the original query task System prompt and the previous round His own and other debate team members' historical responses : .

[0037] in, This represents the initial divergence context saved in the previous stage. The agent then generates a new, reflective response: ; System calls the answer extraction function Extract the answer .

[0038] Real-time status monitoring and adaptive termination: This is the core control unit of this phase. The environment server executes a multi-condition adaptive termination criterion after each round. The debate cycle terminates when a consensus is reached or an abnormal debate state is detected. Consensus detection: If all agents give the same answer in the current round, that is... If the condition is met, stop immediately and output the consensus result.

[0039] Abnormal Debate State Detection: The system monitors the evolution of the answer sequence. Answer exchange events and logical deadlock events are defined. For example, for an agent pair, if an answer exchange event of "AB→BA→AB" or a logical deadlock event of "AB→AB→AB" is detected, and the number of consecutive occurrences exceeds a threshold, it is determined to be trapped in invalid interaction. The debate is immediately terminated, the system proceeds to the upgraded collective voting stage, and the current debate responses are saved as historical records.

[0040] Define the answer swap event as the event that determines the first... Does the joint answer of the wheel agent match the The wheels are reversed, thus maintaining the continuous exchange counter. ,Will Defined as an indicator function, the consecutive swap counter is incremented when a consecutive answer swap event occurs, and reset to 0 otherwise: ; .

[0041] Similarly, the logical deadlock event is defined as the first... Does the joint answer of the wheel agent match the The wheels are completely consistent, thus maintaining the logical deadlock counter. The logical deadlock counter is incremented only when a deadlock event occurs; otherwise, it is immediately reset to 0. ; .

[0042] Round limit protection: If the maximum number of debate rounds is reached... If no consensus is reached, the process will be forcibly stopped and proceed to the next stage. A structured summary of the complete interaction history generated in this stage will be produced to generate a concise summary of the debate, preventing unlimited resource consumption. Otherwise... Then, the debate continues to the next round. A complete interaction history is included, comprising stored historical debate data and the reasoning process of each agent in each round; specifically, it includes the agent's reasoning logic and critical analysis process when generating answers, as well as standardized results extracted from the responses.

[0043] In summary, the adaptive termination criterion It can be represented as: ; The threshold for the number of consecutive answer exchanges. This is the threshold for the number of consecutive logical deadlocks.

[0044] 4. Upgrade the collective voting stage.

[0045] For unresolved tasks, the system recruits additional agents to introduce broader collective intelligence and aggregates their judgments to make a final decision. To reduce the potential spread of bias or errors from debate history, the system divides the upgrade cluster into two complementary subgroups: an independent reasoning subgroup that reasones from scratch. and a review panel to assess the history of the debate Finally, the system uses a weighted decision algorithm to aggregate the outputs of all agents within the upgrade cluster, outputting the final answer. .

[0046] In one embodiment, during the upgraded collective voting phase, for complex problems that cannot be resolved through debate, this phase introduces a broader group of functionally differentiated intelligent agents to make a final decision through collective decision-making, as follows: Group expansion and functional differentiation: Dynamically recruit and form an expanded upgrade cluster from agents in the agent pool that did not participate in the above stages. They are divided into two functionally complementary subgroups: Independent reasoning group :choose A group of intelligent agents, completely isolated from previous debate history, based solely on the original query task. Perform independent reasoning, providing an external perspective unaffected by any internal discussions. For intelligent agents... Finally the The response generated by the round and extracted candidate answers Defined as: ; in, These are clues for independent reasoning. This indicates that it does not rely on any historical records.

[0047] Debate Judges :choose Individual agents ( The group of intelligent agents receives the original query task. At the same time, the summary of the debates generated in the last round of the previous stage will be reviewed. To conduct in-depth reviews with contextual information for intelligent agents. , No. The response generated by the round and answer Defined as: .

[0048] The prompts for the review panel guide the review subgroups based on... The review process, combined with the debate history generated in the previous two stages, generates answers by examining evidence, identifying disagreements, and adjudicating conclusions on existing debate processes. This includes logical conflict analysis, adjudication based on existing content, and outputting standardized guidelines. The review panel's prompts can be adjusted based on the actual situation.

[0049] Weighted voting mechanism: Collect all candidate answers to form a set. This invention employs an innovative weighted majority voting strategy to obtain the final answer. : ; Among them, weight This is not fixed; when independent reasoning groups reach a consensus, this subgroup will be given priority. ; in To adjust the reward coefficients for the importance of agents within an independent reasoning group, Consensus indicator function: ; This formula means that only when independent reasoning groups Internal consensus reached Only when a vote is cast in a given group will each member's vote receive a significant additional weighting; otherwise, they will receive the base weight. This mechanism aims to highly reward collective consensus formed independently of debate disagreements, thereby effectively resisting the spread of group bias or misinformation that may arise in the early stages of debate and enhancing the robustness and objectivity of the final decision.

[0050] Example: The logical flow of this embodiment is as follows: Figure 2 As shown, the overall architecture is as follows Figure 3 As shown. The number of agents in this embodiment is only a preferred option and does not constitute a limitation on the scope of protection of this invention.

[0051] 1. System overall architecture and initial configuration.

[0052] The system architecture for implementing this invention mainly includes: a heterogeneous agent pool module, an environment server module, a cascaded three-stage inference engine (including a heterogeneous consensus verification engine, a heterogeneous multi-agent debate engine, and an upgraded collective voting engine), and a user interface module.

[0053] Heterogeneous Agent Pool Module: Responsible for managing and scheduling multiple agents. The system initializes a pool containing... A collection of intelligent agents To achieve heterogeneity, use This represents the set of large language models (LLMs) used to initialize agents. Each agent should be instantiable from different large language models (combinations of models with different architectures, parameter counts, and training data, such as the Llama series, GPT series, Gemini series, Claude series, Qwen series, etc.). Each agent... Equip a system prompt This prompt may include role definitions, task instructions, and output format specifications.

[0054] Environment server setup: Deploy a centralized environment server to maintain task status. Its core modules include: Session management: for each query task Create a unique session ID and query tasks. Belongs to the query task set .

[0055] State Memory: Uses a key-value database or in-memory data structure to store all responses generated by the agents. and the structured answer after analysis .

[0056] Process controller: Maintains a state machine, records the current inference stage, and drives stage state transitions based on the conditions defined for each stage (such as consensus state and counter states).

[0057] History Summarizer: It has a built-in lightweight text summarization model (or calls a dedicated summarization agent) to compress lengthy debate histories into a concise, objective summary when needed, highlighting the core arguments and points of disagreement.

[0058] Preset parameters: System administrators need to configure the following key parameters before deployment: The number of agents activated during the initial verification phase. The default value is 2 for optimal startup efficiency.

[0059] The maximum number of rounds in the system is recommended to be between 4 and 10. The heterogeneous consensus verification phase and the upgrade collective voting phase each consist of one round, while the rest are debate rounds.

[0060] , : Threshold for the consecutive number of answer exchanges and logical deadlocks in abnormal debate mode. Usually set to 2.

[0061] , Upgrade the number of agents in the independent reasoning group and debate judging group during the collective voting phase. Recommendation: , ,and .

[0062] , Base weights and reward coefficients. These can be set. , .

[0063] 2. Detailed implementation process of the heterogeneous consensus verification phase.

[0064] When a user submits a query task via the API After that, the system enters this stage. The specific process is as follows: Agent selection: The system's process controller selects agents from a heterogeneous pool of agents. The initial set consists of several agents. Under the default configuration, two agents with complementary capabilities are selected, denoted as... and .

[0065] Parallel Reasoning and Answer Extraction: Given a query The system round counter is set to The environment server simultaneously sends and Send a request, each agent According to its prompts Generate initial response The system then calls the answer extraction function. Extracting structured answers And store it in the state memory.

[0066] For multiple-choice questions It can be designed to match regular expressions from the response text (such as "The answer is [A]", "Option C"); for mathematical problems, It can be designed to extract the final numerical results; for open-ended questions, It can be designed as a text embedding model to calculate semantic similarity or extract key entities as answers.

[0067] Consensus Judgment and Decision-Making: Process Controller Calculates Consensus Indication Function .in This indicates an indicator function. Note that "equal to" here can be an exact match of the string for non-symbolic answers, or an approximate match after semantic similarity calculation (set a threshold, such as cosine similarity > 0.95).

[0068] like The controller immediately transitions the state to the "complete" state. The environment server will then reach a consensus answer. The packaged code, along with optional simple logs, is returned to the user interface.

[0069] like The environment server will respond. Saved as the initial disagreement context for this session, the controller transitions the state to the heterogeneous multi-agent debate phase.

[0070] 3. Detailed implementation process of heterogeneous multi-agent debate.

[0071] For tasks where consensus has not been reached, the initial verification group used in the previous phase... Entering the debate phase, the system round counter... And the counter for abnormal debate mode. , .

[0072] Multi-round debate and answer extraction: In each round t, for each agent The environment server retrieves the previous round from its state store. The responses of oneself and other debate team members construct its observable history.

[0073] .

[0074] Note hour, This is the initial divergence context saved in the previous stage. The environment server then... The system prompted that a request was sent. At this point, the debate interaction can be slightly modified by adding instructions such as "Please critically analyze the opponent's viewpoint and revise or defend your own position," and the agent will return a response. The system calls the answer extraction function. Extracting structured answers And update the state memory.

[0075] Adaptive Termination Detection: To improve efficiency, the process controller follows adaptive termination criteria. Perform a series of checks to terminate the debate cycle when consensus is reached or an abnormal debate state is detected: 1) Consensus Detection: If If a consensus is reached, the environment server will return the consensus answer as the final result, and the process will end.

[0076] 2) Abnormal Debate State Detection: If the debate is in an answer-exchanging state, i.e., the agents repeatedly exchange answers in consecutive rounds (e.g., AB→BA→AB), then continuing the debate is unnecessary. The answer-exchange event is defined as the event that determines the first round of debate. Does the joint answer of the wheel agent match the Wheel opposite: .

[0077] To identify persistent instability, maintain the continuous switching counter. The counter increments when a consecutive answer swap event occurs; otherwise, it is reset to 0. .

[0078] Furthermore, if the debate is in a persistent logical deadlock state, meaning that the answers generated by each agent remain unchanged but are always inconsistent (e.g., a fixed pattern AB→AB→AB), then the debate enters a logical deadlock, and the current logical deadlock event is defined as: .

[0079] Similarly, maintain a logical deadlock counter. The counter is incremented only when a deadlock event occurs; otherwise, it is immediately reset to 0. .

[0080] If the counter is continuously switched Or logic deadlock counter If a consensus is not reached by the threshold, or after the maximum round T-1 of the heterogeneous multi-agent debate phase, the system proceeds to the upgraded collective voting phase and saves the current debate response as a historical record; otherwise... Then, we will move on to the next round of debate.

[0081] Note that if the number of agents selected in the above stages If the value is greater than 2, the consensus can be calculated using a generalized formula, i.e., a consensus score. Defined as the proportion of the largest consistent subset: ; in Indicates an indicator function. When At that time, a fast early stop mechanism is triggered. This design ensures that regardless of the initial verification group... Regardless of the number of intelligent agents involved, consensus can be used to measure the difficulty of tasks and quickly resolve simple tasks. This represents the consensus threshold, which is set to 0.6 by default and can be learned from the task validation set.

[0082] 4. Detailed implementation process for the upgraded collective voting phase.

[0083] This stage is the final means of solving complex tasks; system round counter. The specific process is as follows: Voting agent selection: To reduce the potential spread of bias or errors from debate history, the process controller excludes agents who have already participated in the debate from the agent pool. and The upgrade cluster will be divided into two complementary subgroups. (Select) Each agent forms an independent reasoning group. Then select A panel of debate judges composed of individual agents (in In terms of form, a new upgrade cluster is built. ,in .

[0084] Parallel voting answer generation and answer extraction: intelligent agent No. The response generated by the round is The extracted candidate answers are ; intelligent agent No. The response generated by the round is The extracted candidate answers are ; The candidate answer set is defined as .

[0085] Weighted voting and final decision-making: Detecting whether all answers in an independent reasoning group are identical. Defining a consensus indicator function. for: ; If the independent groups reach a complete consensus, they are given a higher weighted reward; otherwise, they are given the basic weight. .

[0086] Finally, merge all answers and check the answer space. candidate answers A weighted vote is conducted, and the candidate answer with the highest score is determined as the final answer. If a draw occurs, the first choice can be selected. The supported answer, i.e., the final answer, is: ; The environment server will provide the final answer. The system returns the results to the user and generates a detailed report, including the status of each stage, reasons for stopping, voting details, and weighting, for the user or analyst to review.

[0087] This invention proposes a progressive inference control mechanism guided by heterogeneous consensus. Unlike existing multi-agent debate methods with fixed interaction flows, this invention uses the consensus state among heterogeneous agents as the core control signal, driving the system to automatically and intelligently transition between the three stages of "verification-debate-voting". The mechanism includes a lightweight heterogeneous consensus verification module for early task selection and cessation; a heterogeneous multi-agent debate module for resolving disagreements and conflicts; and a final upgraded collective voting module for adjudicating complex tasks. Through this consensus-guided progressive collaboration, the system achieves dynamic matching of computational resources and task complexity.

[0088] This invention designs an adaptive debate termination criterion. Addressing the inefficiency of existing debate methods that pre-determine fixed rounds, this invention innovatively introduces an adaptive termination criterion into a heterogeneous multi-agent debate module. This criterion not only monitors consensus achievement but also identifies and quantifies two abnormal debate modes—response exchange loops and logical deadlock—in real time by defining answer exchange indicators and maintaining corresponding continuous counters. When these modes exceed thresholds, the system can prematurely exit invalid debates, significantly saving computational resources and avoiding redundant overhead.

[0089] This invention constructs a weighted collective voting adjudication mechanism that integrates independent and contextual perspectives. For unresolved problems in debate, the upgraded collective voting module of this invention constructs two complementary intelligent agent subgroups: an independent reasoning group and a historical debate review group. These subgroups provide new external perspectives and in-depth reviews combined with historical debate, respectively. Based on this, an innovative weighted majority voting strategy is designed: this strategy specifically rewards consensus reached within the independent reasoning group, enhancing its decision-making influence through dynamic weighting coefficients. This mechanism effectively balances independent judgment with historical context, enhancing the robustness and accuracy of the final decision.

[0090] In summary, this invention constructs a progressive, adaptive decision-making pipeline that progresses from "rapid heterogeneous consensus verification" to "multi-agent debate" and then to "upgraded collective voting." It uses heterogeneous consensus as the core scheduling signal to dynamically allocate computing resources, thereby achieving a balance between high precision and high efficiency in various complex question-answering and reasoning tasks.

[0091] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0092] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple steps or stages, which are not necessarily completed at the same time, but may be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but may be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0093] In one embodiment, the present invention provides a computer system, which may be a server. The computer system includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data used in the methods described above. The network interface communicates with external terminals via a network connection. The computer program is executed by the processor to implement the methods described above.

[0094] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0095] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention, and no reference numerals in the claims should be construed as limiting the scope of the claims.

[0096] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.

Claims

1. A heterogeneous multi-agent consensus reasoning method, characterized in that, include: Initialize the heterogeneous agent pool; In the first stage, at least two agents are selected from the heterogeneous agent pool to form an initial verification group. Each agent independently generates an initial response and extracts the answer. If the answers are consistent, the answer is output; otherwise, the second stage begins. In the second stage, the agents in the initial verification group conduct multiple rounds of debate. In each round of debate, each agent self-corrects based on the historical responses of the previous round and generates a new answer. The debate status is monitored in real time according to the adaptive termination criterion: if all agents reach a consensus, the consensus answer is output; if an abnormal debate status is detected or the preset maximum number of debate rounds is reached, the third stage is triggered; otherwise, the next round of debate continues. In the third stage, agents that did not participate in the first two stages are selected from the heterogeneous agent pool to form an upgrade cluster, which is then divided into an independent reasoning subgroup and a review subgroup. The independent reasoning subgroup generates an answer based on the user-input query task q, while the review subgroup reviews and generates an answer based on q and the debate history generated in the first two stages. A weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer.

2. The heterogeneous multi-agent consensus reasoning method of claim 1, wherein, The initialization of the heterogeneous agent pool specifically includes: each agent is instantiated by a large language model and configured with system prompts that are appropriate to the role of the agent, thereby forming a heterogeneous agent pool.

3. The heterogeneous multi-agent consensus reasoning method of claim 1, wherein, The process involves selecting at least two agents from a heterogeneous agent pool to form an initial verification group. Each agent independently generates an initial response and extracts an answer. If the answers match, the answer is output; otherwise, the process proceeds to the second stage, which specifically includes: Selecting two agents to form an initial validation group Each agent within the initial validation group A query task based on user input And respective system prompts Independently generating an initial response : ; denotes the i-th agent a large language model being instantiated, denotes that the answer extraction function is independent of any historical information obtains an initial predicted answer ; Defining consensus function in group wherein denotes an indicator function, whose value is 1 when the condition in the bracket is true, and 0 when the condition in the bracket is false; if , it indicates that the initial predicted answers of each agent in the initial verification group are consistent, and the initial predicted answer is returned as the final result; if , the initial predicted answers of each agent are saved as historical responses and passed to the second stage.

4. The heterogeneous multi-agent consensus reasoning method of claim 3, wherein, The process involves multiple rounds of debate among agents within the initial verification group. In each round, each agent self-corrects based on its historical responses from previous rounds and generates a new answer. The debate status is monitored in real time according to an adaptive termination criterion. Specifically, this includes: For the t-th round of debate, the input of each agent contains: the user-input query task , system prompts , and the historical responses in the t-1-th round of debate : ; Intelligent agent Generating a response for the tth round of debate : ; Call the answer extraction function Extracted The predicted answer for the t-th round of debate Then, the consensus function within the group is used to determine whether the answers of the agents in each initial verification group in this round of debate are consistent. An adaptive termination criterion with multiple conditions is executed after each round of debate, terminating the debate cycle when consensus is reached or an abnormal debate state is detected.

5. The heterogeneous multi-agent consensus reasoning method according to claim 4, characterized in that, If all agents reach a consensus, the consensus answer is output. If an abnormal debate state is detected or the preset maximum number of debate rounds is reached, the third stage is triggered, which specifically includes: If the initial validation group contains two agents, and their answers in the current round of debate are consistent, then the agents are considered to have reached a consensus, and a consensus answer is output. If the initial validation group contains three or more agents, the consensus score is calculated by determining the proportion of the subset with the largest consistency answer. : ; in, Indicates an indicator function, Indicates candidate answers, For the merged answer space, when When this happens, a fast early stop mechanism is triggered, and the answer with the highest proportion of consensus is output as the consensus answer. Indicates the consensus threshold; Monitor the evolution of the answer sequence generated in each round of debate. If an answer exchange event or a logical deadlock event is detected in the answer sequence and the number of consecutive occurrences exceeds the threshold, it is considered to have entered an abnormal debate state. The current round of debate is immediately terminated, and the third stage is entered. The answer of the current round of debate is saved as the debate history. If no consensus is reached after the preset maximum number of debate rounds, the process will be forcibly stopped and proceed to the third stage, where a structured summary of the complete interaction history generated in the second stage will be prepared to generate a debate summary.

6. The heterogeneous multi-agent consensus reasoning method according to claim 5, characterized in that, If the answers of the two agents in the current round are swapped with the answers of the two agents in the previous round, then an answer swap event is determined to have occurred. ; Exchange the event indicator for the answer. This indicates that an answer exchange event has occurred. This indicates that no answer exchange event occurred; ; The maximum number of debate rounds is preset for the second stage. This is a consecutive exchange counter used to count the number of consecutive occurrences of the answer exchange event during the t-th round of debate.

7. The heterogeneous multi-agent consensus reasoning method according to claim 5, characterized in that, If the answers from the two agents in the current round are the same as and different from their respective answers in the previous round, then a logical deadlock event is determined to have occurred. ; This is a logical deadlock event indicator. This indicates that a logical deadlock event has occurred. This indicates that no logical deadlock event has occurred; ; The maximum number of debate rounds is preset for the second stage. This is a logic deadlock counter used to count the number of consecutive occurrences of a logic deadlock event during the t-th round of debate.

8. The heterogeneous multi-agent consensus reasoning method according to claim 4, characterized in that, The independent reasoning subgroup generates an answer based on the user-input query task q, and the review subgroup generates an answer based on q and the debate history generated in the previous two stages. A weighted voting mechanism is used to aggregate the answers of all agents in the upgrade cluster as the final answer, specifically including: choose Each agent forms an independent reasoning group. , The j-th intelligent agent In the Candidate answers generated in rounds Defined as: ; in, for In the The response generated by the round, These are clues for independent reasoning. This indicates that it does not rely on any historical records. ; Represented as A large language model to be instantiated; choose A panel of debate judges composed of individual agents , , The intelligent system can simultaneously receive query tasks input by the user. Debate summary of the final round of debate between the two agents in the second phase , The maximum number of debate rounds is preset for the second stage; The k-th intelligent agent No. Candidate answers generated in rounds Defined as: ; , These are the prompts for the review panel. for No. The response generated by the round; Indicates to A large language model to be instantiated; Collect all candidate answers to form a set : ; The final decision is made using a weighted majority voting strategy. ; To upgrade the cluster, for The m-th intelligent agent in the process, For the corresponding candidate answers, For the final answer, express The corresponding weights.

9. The heterogeneous multi-agent consensus reasoning method according to claim 8, characterized in that, Weight The calculation method is as follows: When a consensus is reached within an independent reasoning group, the candidate answers of the agents within that group are given higher weight: ; in, To adjust the reward coefficients for the importance of agents within an independent reasoning group, Based on the weights, This represents logical AND. Consensus indicator function: ; for The first in An intelligent agent. This indicates that the independent reasoning group has reached a consensus. This indicates that no consensus has been reached within the independent reasoning group.

10. A computer system comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 9.