Optional judge (default)

Multi-Agent Debate diagramQuestion, Debater A, Debater B, Debater C, Judge, Ruling. Step captions follow the diagram.QuestionDebater ADebater BDebater CJudgeRulingMulti-Agent Debate diagramQuestion, Debater A, Debater B, Debater C, Judge, Ruling. Step captions follow the diagram.QuestionDebater ADebater BDebater CJudgeRuling

All steps
Parts of this pattern
Question Input / output
The question posed to every debater, e.g. 'Is 3,599 prime?'.
Debater A Agent
Debater A answers independently, then rereads B's and C's answers and defends or fixes its own each round.
Debater B Agent
Debater B answers independently, then critiques the other answers and revises its own each round.
Debater C Agent
Debater C answers independently, then weighs A and B's reasoning and revises or defends its answer.
Judge Aggregator
Optional impartial judge. Reads the final answers and picks the best-supported one or merges them.
Ruling Input / output
The single ruling the judge returns, with the deciding evidence.
Question → Debater A
The same question goes to debater A.Question: Is 3,599 prime? Show your reasoning.
Question → Debater B
The same question goes to debater B in parallel.Question: Is 3,599 prime? Show your reasoning.
Question → Debater C
The same question goes to debater C in parallel.Question: Is 3,599 prime? Show your reasoning.
Debater A → Debater B
A's answer is shared with the other debaters (drawn as one ring edge for the all-to-all exchange).A: Yes, 3,599 is prime; no small divisor found.
Debater B → Debater C
B's answer is shared with the other debaters (drawn as one ring edge for the all-to-all exchange).B: No, 3,599 = 59 x 61, so it is composite.
Debater C → Debater A
C's answer is shared with the other debaters (drawn as one ring edge for the all-to-all exchange).C: Not prime. 59 x 61 = 3,599, I checked by multiplying.
Debater A → Judge
A's final answer, after the last round, goes to the judge.A (final): Composite. I missed 59 earlier; 59 x 61 = 3,599.
Debater B → Judge
B's final answer goes to the judge.B (final): Composite, 59 x 61.
Debater C → Judge
C's final answer goes to the judge.C (final): Composite, 59 x 61.
Judge → Ruling
The judge's decision and short justification are returned.{"answer": "No, 3,599 is not prime (59 x 61).", "why": "All three debaters converged and the factorisation is easy to verify."}

Adversarial + judge

Two debaters argue fixed opposite sides, and a judge reads every round and stops the debate as soon as one side has the right answer.

Multi-Agent Debate: Adversarial + judge diagramQuestion, Affirmative, Negative, Judge, Answer. Step captions follow the diagram.QuestionAffirmativeNegativeJudgeAnswerMulti-Agent Debate: Adversarial + judge diagramQuestion, Affirmative, Negative, Judge, Answer. Step captions follow the diagram.QuestionAffirmativeNegativeJudgeAnswer

All steps
Parts of this pattern
Question Input / output
A question with a tempting wrong answer, such as 'Up a hill at 1 m/s, down at 3 m/s: what is the average speed?'.
Affirmative Agent
The fixed 'for' side. States an answer, defends it, and must reply to the negative's attack point by point each round.
Negative Agent
The fixed 'against' side. It must disagree: it hunts for the flaw in the affirmative's argument and argues for a different answer.
Judge Evaluator
Reads each round's transcript and decides whether one side has the right answer; if not, it calls another round.
Answer Input / output
The answer the judge settles on, with its reason.
Question → Affirmative
The question opens the debate, and the affirmative speaks first.Up a hill at 1 m/s, then back down the same path at 3 m/s. What is the average speed for the round trip?
Affirmative → Negativeargue
The affirmative's answer and argument go to the negative, whose job is to attack it.Affirmative: 2 m/s. The two speeds are 1 and 3, and their average is 2.
Negative → Judgerebut
The negative's rebuttal closes the round, and the judge reads both sides' arguments.Negative: Wrong. The climb takes three times as long as the descent. Distance 2d in time d + d/3, so 2d / (4d/3) = 1.5 m/s.
Judge → Affirmativenext round
No side has won yet: the judge calls another round, and the affirmative must reply to the rebuttal.{"decided": false, "reason": "The sides disagree on whether to average the speeds or the times."}
Judge → Answerdecide
Once one side's answer is well supported, the judge stops the debate and returns it.{"decided": true, "answer": "1.5 m/s", "reason": "Average speed is total distance over total time, and the affirmative conceded."}

Consensus, no judge

Du et al.'s judge-free form. A plain check collects the answers and shares them; this build also stops early once they agree and falls back to the majority.

Multi-Agent Debate: Consensus, no judge diagramQuestion, Debater A, Debater B, Debater C, Round check, Answer. Step captions follow the diagram.QuestionDebater ADebater BDebater CRound checkAnswerMulti-Agent Debate: Consensus, no judge diagramQuestion, Debater A, Debater B, Debater C, Round check, Answer. Step captions follow the diagram.QuestionDebater ADebater BDebater CRound checkAnswer

All steps
Parts of this pattern
Question Input / output
The question posed to every debater, e.g. 'Is 3,599 prime?'.
Debater A Agent
Answers independently, then updates its answer each round after reading B's and C's.
Debater B Agent
Answers independently, then updates its answer each round after reading A's and C's.
Debater C Agent
Answers independently, then updates its answer each round after reading A's and B's.
Round check Aggregator
Plain code, not a model. Collects each round's answers, checks whether they agree, and if not hands every debater the others' answers.
Answer Input / output
The answer every debater agreed on, or the majority answer after the last round.
Question → Debater A
The same question goes to debater A.Question: Is 3,599 prime? Show your reasoning.
Question → Debater B
The same question goes to debater B in parallel.Question: Is 3,599 prime? Show your reasoning.
Question → Debater C
The same question goes to debater C in parallel.Question: Is 3,599 prime? Show your reasoning.
Debater A → Round check
A's answer for this round goes to the round check.A (first answer): Yes, 3,599 is prime. I found no divisor up to 50.
Debater B → Round check
B's answer for this round goes to the round check.B (first answer): No, 3,599 = 59 x 61.
Debater C → Round check
C's answer for this round goes to the round check.C (first answer): Not prime: 3,599 = 60 squared minus 1 = 59 x 61.
Round check → Debater A
The answers differ, so A gets B's and C's answers to read before the next round.These are the answers from the other agents: B: No, 3,599 = 59 x 61. C: Not prime, 60 squared minus 1 = 59 x 61. Give an updated answer.
Round check → Debater B
B gets A's and C's answers to read before the next round.These are the answers from the other agents: A: Yes, 3,599 is prime. C: Not prime, 59 x 61. Give an updated answer.
Round check → Debater C
C gets A's and B's answers to read before the next round.These are the answers from the other agents: A: Yes, 3,599 is prime. B: No, 59 x 61. Give an updated answer.
Round check → Answeragreed
When every debater gives the same answer, or the last round ends, the agreed or majority answer is returned.Round 1: A, B and C all answer 'not prime (59 x 61)'. They agree, so the debate ends.

← → neighboursesc atlas

Multi-Agent

Multi-Agent Debate

Also known as Society of minds · Debate-and-judge

Several agents answer independently, read and critique each other's answers over rounds, then converge by majority or an optional judge.

Optional judge, Consensus, no judge: Introduced by Du et al. (2023) · MIT CSAIL and Google Brain

Concurrent work: Liang et al. (Tencent AI Lab, Tsinghua University and Shanghai Jiao Tong University) gave two debaters fixed opposing sides and added a judge, arXiv 2305.19118: see the Adversarial tab.

Adversarial + judge: Introduced by Liang et al. (2023) · Tencent AI Lab & Tsinghua University and Shanghai Jiao Tong University

Multi-Agent Debate (MAD): one side must argue against the other, so the model escapes the degeneration of thought that self-reflection falls into; a judge decides when to stop.

Measured over one run

Optional judge

Nodes
6. Boxes in the diagram: models, tools, stores, people and plain code.
LLM calls
9. Model invocations in the first scenario: each time a model or agent node starts thinking, plus each branch it decides.
Tool calls
0. Messages sent to a tool node in the first scenario.
Steps
6. Steps in the first scenario, with repeated steps counted every time they run.
Scenarios
1. Distinct example runs you can switch between on the diagram.
Loop
yes. Whether the flow cycles back on itself until a condition is met.
Parallel
yes. Whether two or more messages are in flight at the same time.
Branch
no. Whether the flow takes one path out of several, chosen at run time.
Human in the loop
no. Whether a person appears as a node, to approve, correct or answer.
Autonomy
medium. How much the model decides the control flow itself, from fixed code paths (low) to open-ended (high).
Cost
high. Relative token spend per request.
Latency
high. Relative wall-clock time per request.

Adversarial + judge

Nodes
5. Boxes in the diagram: models, tools, stores, people and plain code.
LLM calls
6. Model invocations in the first scenario: each time a model or agent node starts thinking, plus each branch it decides.
Tool calls
0. Messages sent to a tool node in the first scenario.
Steps
3. Steps in the first scenario, with repeated steps counted every time they run.
Scenarios
1. Distinct example runs you can switch between on the diagram.
Loop
yes. Whether the flow cycles back on itself until a condition is met.
Parallel
no. Whether two or more messages are in flight at the same time.
Branch
yes. Whether the flow takes one path out of several, chosen at run time.
Human in the loop
no. Whether a person appears as a node, to approve, correct or answer.
Autonomy
medium. How much the model decides the control flow itself, from fixed code paths (low) to open-ended (high).
Cost
high. Relative token spend per request.
Latency
high. Relative wall-clock time per request.

Consensus, no judge

Nodes
6. Boxes in the diagram: models, tools, stores, people and plain code.
LLM calls
6. Model invocations in the first scenario: each time a model or agent node starts thinking, plus each branch it decides.
Tool calls
0. Messages sent to a tool node in the first scenario.
Steps
5. Steps in the first scenario, with repeated steps counted every time they run.
Scenarios
1. Distinct example runs you can switch between on the diagram.
Loop
no. Whether the flow cycles back on itself until a condition is met.
Parallel
yes. Whether two or more messages are in flight at the same time.
Branch
yes. Whether the flow takes one path out of several, chosen at run time.
Human in the loop
no. Whether a person appears as a node, to approve, correct or answer.
Autonomy
medium. How much the model decides the control flow itself, from fixed code paths (low) to open-ended (high).
Cost
high. Relative token spend per request.
Latency
high. Relative wall-clock time per request.

Counted from the first scenario's timeline when the site is built.

Problem

A single model asked a hard question will commit to one line of reasoning and defend it, even when it is wrong. Sampling it again gives you another confident answer with no way to tell which one holds up. Math, factual recall and strategy questions suffer most from this lock-in.

How it works

Run several instances as debaters and make them read each other. The question goes to debater A, debater B and debater C at the same time. Each answers independently, so the first answers often disagree: asked whether 3,599 is prime, one says yes, the others find 59 × 61.

Then come the rounds. In each round every debater sees what the others wrote, critiques it, and revises its own answer in light of it. A debater that finds an arithmetic slip in a peer’s reasoning says so, and a debater whose own answer is exposed as wrong changes it. The diagram draws one cross edge per debater (A to B, B to C, C to A) to keep it readable, but in the original method each agent reads all the others. All of this happens in parallel, and two rounds are typically enough for answers to converge or for the disagreement to sharpen.

In the original method of Du et al. there is no judge: the agents converge over the rounds, and the final answer is a majority vote or the consensus. Later variants add an optional judge, as drawn here, which reads the final answers with their arguments and issues one ruling. Use the judge when the answers will not converge on their own.

The Consensus tab shows that judge-free form: a plain check collects each round’s answers and hands every debater the others’. Du et al. run a fixed number of rounds; the build there also stops early once the answers agree and falls back to the majority. The Adversarial tab shows the concurrent Multi-Agent Debate of Liang et al.: two debaters take fixed opposite sides, and a judge decides after every round whether to stop.

When to use

  • The question has a verifiable-in-principle answer, such as math, facts or logic, where independent reasoning errors differ.
  • Accuracy matters more than cost.
  • Different model families or prompts can supply diverse viewpoints.

When to avoid

  • Cheap tools can verify the answer directly: run the tests, query the database.
  • The question is subjective, so there is nothing to converge on.
  • Latency or token budget is tight.

Trade-offs

Cost scales as agents times rounds, and the prompt grows each round as answers accumulate. In exchange, reported gains on reasoning and factuality benchmarks are real but vary by task. Debaters built from the same model share biases, so more rounds do not add independence.

Failure modes

  • Conformity: debaters drop correct answers to agree with a confident wrong one. Instruct them to hold their position unless given a concrete reason.
  • Echo chamber: identical agents repeat the same error. Vary the model, prompt or persona.
  • Verbose drift: arguments balloon and the judge loses the thread. Cap each response and ask for a one-line answer.
  • Judge bias: the judge favors the longest or last answer. Randomize the order and require evidence-based reasons.

Build it with your AI

Optional judge

Paste this into Claude Code, Cursor, ChatGPT or any AI coding assistant.

Implement the Multi-Agent Debate pattern in this codebase, using the LLM client and language we already use.

## Goal

Answer a hard question more reliably by having several debaters answer independently, read and critique each other's answers over a few rounds, and then settle on one answer by majority or an optional judge.

## How it works

1. Send the question to every debater (default 3) in parallel and collect their independent first answers, each ending in a one-line answer.
2. For each round, give every debater its own previous answer and all the other debaters' answers with the Debater revision prompt, and call all of them in parallel.
3. After the first answers and after each round, pull the one-line answer out of each reply; if every debater gives the same answer, end the rounds early.
4. After the last round, take the majority answer. If there is no majority, or you always want a ruling, send the final answers to the judge with the Judge prompt and parse its JSON into answer and why. If that is not valid JSON, retry once, then return the majority answer if there is one, otherwise all final answers with a not-converged status.
5. Return the answer together with every debater's final answer, so a reader can see where they disagreed.

## Prompts

### Debater revision prompt

```markdown
You are debater {{name}}. Question: {{question}}

<your_previous_answer>{{own}}</your_previous_answer>
<other_answers>{{others}}</other_answers>

Reread the other answers critically. If they expose a mistake in yours,
fix it. If you still think you are right, defend your answer and say why
the others are wrong. Do not change your answer just to agree.
End with your current answer in one line.
```

### Judge prompt

```markdown
You are an impartial judge. {{n}} debaters answered the question below
over {{rounds}} rounds.

<question>{{question}}</question>
<final_answers>{{answers}}</final_answers>

Pick the best-supported answer, or merge them if they are compatible.
Respond in JSON: {"answer": "...", "why": "two sentences on the deciding evidence"}
```

## Stop rule

Stop after 2 rounds, or earlier when every debater gives the same one-line answer. With no majority and no judge, return all the final answers with a status saying the debate did not converge.

## Requirements

- Make the number of debaters (default 3) and the round cap (default 2) parameters.
- Vary the debaters by model, temperature or persona so their mistakes are independent.
- Normalize the one-line answers (trim, lowercase, strip punctuation) before comparing them. If a reply has no answer line, retry that debater once, then leave it out of the vote.
- Shuffle the order of the other answers in each prompt, so no debater always reads the same peer first.
- Add a test with stub debaters whose first answers are yes, no, no and whose round-1 answers are all no; assert exactly 6 debater calls, no judge call, and the answer no.

Adversarial + judge

Paste this into Claude Code, Cursor, ChatGPT or any AI coding assistant.

Implement the Multi-Agent Debate pattern (Adversarial + judge variant) in this codebase, using the LLM client and language we already use.

## Goal

Get past a model's first, tempting answer by making two debaters argue fixed opposite sides, while a judge ends the debate as soon as one side is right.

## How it works

1. Start an empty transcript. Call the affirmative debater with the Debater prompt (fixed side), side set to affirmative, and append its answer and argument.
2. Call the negative debater with the same prompt, side set to negative, and the transcript; it must find the flaw and argue for a different answer. Append its rebuttal.
3. At the end of each round, call the judge with the Judge prompt and the transcript, and parse its JSON into decided, answer and reason.
4. If decided is true, return the answer and the reason.
5. Otherwise run the next round: the affirmative replies to the latest rebuttal, then the negative replies.
6. If the round cap is hit, call the judge once more with final set to true, so it must pick the better-supported answer from the transcript.

## Prompts

### Debater prompt (fixed side)

```markdown
You are the {{side}} side in a debate. Question: {{question}}

<transcript>{{transcript}}</transcript>

{{#if affirmative}}
State your answer and the argument for it. If the other side has attacked
it, reply to each point, and concede only if the attack is correct.
{{else}}
You disagree with the affirmative side. Find the flaw in its argument and
argue for a different answer, step by step.
{{/if}}
End with your current answer in one line.
```

### Judge prompt

```markdown
You judge a debate between an affirmative and a negative side.

<question>{{question}}</question>
<transcript>{{transcript}}</transcript>

Decide whether one side has given a correct, well-supported answer.
{{#if final}}This is the last round: you must pick the better-supported answer.{{/if}}
Respond in JSON:
{"decided": true|false, "answer": "only when decided", "reason": "one or two sentences"}
```

## Stop rule

Stop when the judge decides, or after 3 rounds, when the judge must pick an answer. If its final reply is still unusable, return both sides' last answers with a status saying the debate was not settled.

## Requirements

- Make the round cap a parameter (default 3).
- Keep the sides fixed for the whole debate, and tell the negative to disagree even when the affirmative sounds plausible.
- If the judge's reply is not valid JSON, retry once, then treat the round as undecided.
- Let the judge use a different model from the debaters, at a low temperature.
- Add a test with stub debaters and a stub judge that is undecided after round 1 and decides after round 2; assert 4 debater calls, 2 judge calls, and that the judge's answer is returned.

Consensus, no judge

Paste this into Claude Code, Cursor, ChatGPT or any AI coding assistant.

Implement the Multi-Agent Debate pattern (Consensus, no judge variant) in this codebase, using the LLM client and language we already use.

## Goal

Answer a hard question by letting several debaters revise their answers after reading each other's, with no judge: the rounds end when they agree, and otherwise the majority wins.

## How it works

1. Send the question to every debater (default 3) in parallel and collect their first answers, each ending in a one-line answer.
2. Pull out each one-line answer and compare them after normalizing (trim, lowercase, strip punctuation). If they all agree, return that answer.
3. Otherwise give each debater the other debaters' full answers with the Debater update prompt, and call all of them in parallel for the next round.
4. Repeat the agreement check after every round.
5. After the last round, return the majority answer with every debater's final answer attached.

## Prompts

### Debater update prompt

```markdown
Question: {{question}}

These are the answers to the question from the other agents:
{{#each others}}
<agent_answer>{{this}}</agent_answer>
{{/each}}

Using the other agents' reasoning as additional advice, give an updated
answer. Check each step yourself; do not just adopt the majority.
End with your answer in one line.
```

## Stop rule

Stop as soon as every debater agrees, or after 2 rounds. If there is no majority after the last round, return all the final answers with a status saying there was no consensus.

## Requirements

- Make the number of debaters (default 3) and the round cap (default 2) parameters; an odd number of debaters avoids most ties.
- Keep the round check in plain code: no model call decides the outcome.
- If a debater's reply has no answer line, retry it once, then leave it out of that round's check.
- Log every debater's answer per round, so you can see who changed their mind and when.
- Add a test with stub debaters whose first answers are yes, no, no and whose round-1 answers are all no; assert 6 debater calls and the answer no.

Prompt templates

Optional judge

Debater revision prompt
You are debater {{name}}. Question: {{question}}
<your_previous_answer>{{own}}</your_previous_answer>
<other_answers>{{others}}</other_answers>
Reread the other answers critically. If they expose a mistake in yours,
fix it. If you still think you are right, defend your answer and say why
the others are wrong. Do not change your answer just to agree.
End with your current answer in one line.
Judge prompt
You are an impartial judge. {{n}} debaters answered the question below
over {{rounds}} rounds.
<question>{{question}}</question>
<final_answers>{{answers}}</final_answers>
Pick the best-supported answer, or merge them if they are compatible.
Respond in JSON: {"answer": "...", "why": "two sentences on the deciding evidence"}

Adversarial + judge

Debater prompt (fixed side)
You are the {{side}} side in a debate. Question: {{question}}
<transcript>{{transcript}}</transcript>
{{#if affirmative}}
State your answer and the argument for it. If the other side has attacked
it, reply to each point, and concede only if the attack is correct.
{{else}}
You disagree with the affirmative side. Find the flaw in its argument and
argue for a different answer, step by step.
{{/if}}
End with your current answer in one line.
Judge prompt
You judge a debate between an affirmative and a negative side.
<question>{{question}}</question>
<transcript>{{transcript}}</transcript>
Decide whether one side has given a correct, well-supported answer.
{{#if final}}This is the last round: you must pick the better-supported answer.{{/if}}
Respond in JSON:
{"decided": true|false, "answer": "only when decided", "reason": "one or two sentences"}

Consensus, no judge

Debater update prompt
Question: {{question}}
These are the answers to the question from the other agents:
{{#each others}}
<agent_answer>{{this}}</agent_answer>
{{/each}}
Using the other agents' reasoning as additional advice, give an updated
answer. Check each step yourself; do not just adopt the majority.
End with your answer in one line.

Related patterns

Composes well with:

Sources

  1. Improving Factuality and Reasoning in Language Models through Multiagent Debate (Du et al., 2023)

From the Agentic Atlas by Joran Kikke · Edit on GitHub · Suggest a correction