TAI BUI
Back to curriculum
BuildPython

Voting, Self-Consistency, and Debate Topology

The cheapest aggregation is to sample N independent agents and take a majority vote. Wang et al. (2022) did this with one model sampled N times. Multi-agent systems extend it with **heterogeneous** agents (different models, prompts, temperatures, and contexts) to escape monoculture. Past majority vote, debate topology matters: MultiAgentBench (arXiv:2503.01935, ACL 2025) evaluated star, chain, tree, and graph coordination, found graph best for research, and saw a "coordination tax" past ~4 agents. AgentVerse (ICLR 2024) documents two emergent patterns, volunteer and conformity behaviors. Conformity is both a feature (it finds consensus) and a risk (groupthink, Lesson 24). This lesson maps the topology space, builds each variant, and measures what each one costs in tokens and steps.

TIME: ~75 minutesPREREQUISITES: Phase 16 · 07 (Society of Mind and Debate), Phase 16 · 14 (Consensus and BFT)

Learning Objectives

  • Explain why self-consistency has correlated errors and how heterogeneous agents reduce them.
  • Compare star, chain, tree, and graph topologies and say which task shape each one fits best.
  • Describe the coordination tax and conformity behavior, and why bounded rounds with a separate judge soften them.
  • Run the simulation and read the homogeneous and heterogeneous tables to see how topology and N change accuracy and token cost.
  • Choose an ensemble for a task by starting from self-consistency at N=5 and upgrading only when the measurements justify it.

Problem

Debate can improve accuracy (Du et al., arXiv:2305.14325). It can also degrade it. Whether it helps depends on four structural choices:

  1. Who talks to whom (topology).
  2. How many rounds (Du 2023: both rounds and agents matter independently).
  3. Whether agents are heterogeneous (different base models break monoculture).
  4. Whether an adversarial voice is present (steel-manning vs. straw-manning).

Teams that bolt "run 5 agents and vote" onto a task often regress against a single agent. The failures are not random. They track topology and heterogeneity, and this lesson is the topology map.

Warm-up0/3
1. Five agents are all built on the same base model. Four answer X and one answers Y. Why is X not trustworthy just because it won the vote?Warm-up
Five agent cards, all labeled Model Q, with vote labels X, X, X, X, Y beneath them.
All five agents share one base model, shown as the same model name on every card.
2. You sample a language model at temperature above 0 instead of decoding greedily. What changes?Warm-up
A bar chart of four candidate next tokens, cat 0.4, dog 0.3, car 0.2, cup 0.1, under a model's probability distribution, with a note that any of them can be the one sampled at temperature above 0.
Probabilities are illustrative, not from a real model.
3. Ten answers come back from a set of workers: six say 42, three say 41, and one says 40. What does a plurality vote return?Warm-up
A bar chart of ten worker answers: 42 picked six times, 41 picked three times, 40 picked once.
These are the ten raw answers before any vote is taken.

Concept

Self-consistency, the single-model baseline

Wang et al. 2022 ("Self-Consistency Improves Chain of Thought Reasoning") sampled the same model N times at temperature > 0 and majority-voted on reasoning-path answers. The result on GSM8K: substantial gains with N=40 samples over a single greedy decode. Self-consistency is the single-agent precursor to multi-agent voting.

The limit is that it uses one base model, so errors are correlated by construction. If the model has a systematic bias, all N samples share it.

Multi-agent vote, the heterogeneous extension

Replace N samples with N different agents: different base models (Claude, GPT, Llama), different prompts, different tool access. You get uncorrelated errors. You pay for it, because different agents cost different amounts and coordinating them adds overhead.

The canonical 2026 name for heterogeneous debate is A-HMAD, Adversarial Heterogeneous Multi-Agent Debate. It isn't universally adopted, but papers use it for "different models debate, which reduces correlated errors from monoculture collapse."

The four topologies

star                chain               tree                graph

    ┌─A─┐           A─B─C─D         ┌──A──┐              A───B
    │   │                           │     │              │ × │
    B   C                           B     C              D───C
    │   │                          / \   / \
    D   E                         D   E F   G           (fully connected)

Star: one hub, and the other agents talk only to the hub. Equivalent to supervisor-worker without a back-channel. Chain: linear, each agent sees the prior one's output. Pipeline-like. Tree: hierarchical, as in hierarchical agent systems (Lesson 06). Graph: any-to-any. Includes the fully-connected clique and arbitrary DAGs.

The coordination tax (MultiAgentBench)

MultiAgentBench (MARBLE, ACL 2025, arXiv:2503.01935) benchmarked star, chain, tree, and graph on a task suite including research, coding, and planning. The measured results:

  • Graph topology wins on research tasks. Information flows any-to-any, so agents can critique each other.
  • Star wins on fast-answer factual tasks. The hub filters and consolidates.
  • Chain wins on stepwise pipelines (staged refinement).
  • Coordination tax appears past ~4 agents in graph topology. Wall-clock and token cost grow faster than quality.

The 4-agent ceiling is empirical, not fundamental. It reflects 2026 LLM context capacity: each agent's context fills with peers' outputs, and the marginal value of agent N+1 drops once everyone can see everyone.

Multi-Agent Debate Strategies ("Should we be going MAD?")

arXiv:2311.17371 is the 2023 survey of MAD strategies. Its key finding, replicated by others, is that MAD variants that are structurally similar to self-consistency (independent sampling plus aggregation) often underperform self-consistency at the same budget. MAD helps most when agents are genuinely heterogeneous and the debate has adversarial structure, meaning one agent argues against.

AgentVerse emergent patterns

AgentVerse (ICLR 2024, https://proceedings.iclr.cc/paper_files/paper/2024/file/578e65cdee35d00c708d4c64bce32971-Paper-Conference.pdf) documents two behaviors that emerge from multi-agent debate even without explicit design:

  • Volunteer. An agent offers help ("I can take the next step") unprompted. This is useful because it allocates work to the most capable agent for a subtask.
  • Conformity. An agent adjusts its stance to match a critic, even when the critic is wrong. This is the debate-equivalent of sycophancy (Lesson 14).

Conformity is why debate-until-agreement rewards bullies. Bounded rounds with a separate judge soften the problem.

Heterogeneity: the knob that moves accuracy

A pattern in the 2024-2026 practical literature: swapping one of your N agents for a different base model gives a bigger accuracy bump than increasing N by 1. The intuition is monoculture. Each new independent source of error is worth more than one more correlated sample.

Heterogeneity beats numerosity. Three different models beat five copies of one model on most tasks that have clean ground truth.

Jury methods

The Sibyl framework (cited in Minsky-LLM literature) formalizes a "jury": a small set of specialized agents that refine answers by voting at each stage. Unlike plain majority vote, a jury has roles. One agent cross-examines, one supplies context, and one scores plausibility. Jury methods sit between plain vote (cheap, monoculture-prone) and full MAD (expensive, conformity-prone).

When vote-with-debate dominates

  • The question has ground truth (fact, math, code behavior), so vote convergence means something.
  • Agents can access different sources or tools, so heterogeneity is available.
  • Rounds are bounded (2-3 typical) and there is a separate judge or verifier.
  • Budget allows 3-5 agents. Beyond 5-7 on graph topology, coordination tax dominates.

When vote-with-debate hurts

  • The question is opinion-shaped. Agents converge on whichever answer looks most confident, not most correct.
  • The agents share a base model. Monoculture makes consensus meaningless.
  • Rounds are unbounded. Conformity wins every time.
  • The task is simple. A single agent with self-consistency at N=5 is cheaper and about as accurate.
Check: Concept0/22
1. What is self-consistency?Define
One model box labeled Base-7 at temperature 0.8 connects to five sample boxes, each showing a reasoning path's final answer: 45, 45, 44, 45, 43.
Illustrative example, not from the lesson's own code.
2. In an agent ensemble, what does heterogeneity mean?Define
Three agent cards labeled Claude, GPT and Llama, each producing its own independent answer with no connection drawn between them.
Model names are the ones the lesson uses for a heterogeneous ensemble.
3. What does MAD, multi-agent debate, refer to?Define
Three agents answer in round 1, 12, 15, 12, then each produces a new round 2 answer after reading the other two round 1 answers, shown as question marks.
Round 2 answers are left blank; only the exchange across rounds is shown.
4. In a multi-agent ensemble, what does topology describe?Define
Four small node-and-line diagrams labeled star, chain, tree and graph, each showing a different connection pattern between four dots.
Shapes only; no performance data is attached to any of them.
5. What is the coordination tax?Define
An illustrative line chart with agent count on the x axis and two rising curves, cost and quality, where cost keeps climbing while quality flattens out.
Illustrative shape, not the lesson's own measured numbers.
6. What is volunteer behavior in AgentVerse?Define
An unassigned write-the-summary task, two agents already busy with other work, and a third agent, Agent C, saying it can take this one, with an arrow pointing to the task.
No one assigned the task to Agent C ahead of time.
7. What is A-HMAD?Define
Three agent cards, Claude, GPT and Llama, connected by lines, with Llama marked as arguing against the majority.
Model names match the lesson's heterogeneity example; the dashed line stands for every pair seeing each other's answers.
8. How does a Sibyl-style jury differ from a plain majority vote?Define
A candidate answer flows into three role boxes, Examiner, Context and Scorer, which each feed into a verdict box marked with a question mark.
Roles are named for what the lesson's jury description does, not a specific run.
9. AgentVerse documents conformity behavior in multi-agent debate. What is it?Define
Round 1 shows Agent A answering 19 and Critic B answering 24. Round 2 shows Agent A now also answering 24, matching the critic.
Whether 19 or 24 is actually correct is not shown.
10. Why are self-consistency's errors described as correlated by construction?Explain
One model box labeled Base-7, same weights, connects to five samples. Four of the five answers, 72, are tagged as sharing the same bias; one answer, 71, is tagged correct.
Illustrative example showing how one model's samples can repeat the same mistake.
11. Why does swapping one agent for a different base model usually help more than adding one more copy of an existing agent?Explain
A row of four Model A agents, with two options below it: add a fifth Model A, or swap one existing agent for a Model B agent.
Neither option is marked as the better choice here.
12. On tasks with clean ground truth, which ensemble tends to win?Explain
A single card labeled factual extraction task, ground truth is known, with no ensemble shown.
The task type is the only thing given here.
13. Which topology did MultiAgentBench (MARBLE) find best for research-style tasks, and why?Explain
A single card describing the task: a research task that is open-ended and multi-step.
No topology is attached to the task here.
14. Besides graph winning on research tasks, what else did MultiAgentBench report?Explain
Two task cards: fast factual lookup, one correct fact, and stepwise pipeline, staged refinement.
No topology is attached to either task here.
15. Why does a fully connected graph of agents stop paying off past roughly four agents?Explain
A bar chart with agent count 3, 4, 5, 6 on the x axis and an illustrative percentage of context filled by peers' outputs, rising with each added agent.
Illustrative; the harness does not measure context fill.
16. Why does a debate that runs until every agent agrees tend to end on a wrong answer?Explain
A bar chart of how many of five agents agree, climbing from 2 of 5 in round 1 to 5 of 5 by round 5, in a hypothetical unbounded debate.
Illustrative; the harness only runs bounded rounds.
17. What did the 'Should we be going MAD?' survey find about MAD variants that are structurally similar to independent sampling plus aggregation?Explain
Two boxes at equal budget of N calls: self-consistency, one model with N samples, and this MAD variant, N agents answering independently then aggregated.
Which one wins at this budget is not shown here.
18. A team runs five copies of one model in a graph debate. All five agree on a confident answer, and it is wrong. Which missing ingredient best explains this?Analyze
Five identical Model Z cards all answering 58, marked in a warning color, with a note that the stem says this agreed answer is wrong.
The scenario is exactly as the question states it.
19. A team asks five agents which product name sounds best and debates until all agree. They converge fast on one name. Why should that convergence not be trusted?Analyze
Five agent cards all settling on the name Nova in round one, with a note that there is no ground truth to check the name against.
The scenario is exactly as the question states it.
20. A graph ensemble goes from N=5 to N=7. Accuracy rises a little, but tokens and wall-clock time jump sharply. Which idea from the lesson explains this?Analyze
Two stat cards show graph topology accuracy rising a little from 0.95 at N=5 to 0.99 at N=7, with a bar pair below showing cost rising much more sharply, drawn at relative height only.
Accuracy numbers are from the lesson's own heterogeneous run; cost bars are illustrative height, not exact token counts.
21. A teammate says: 'Our debate setup has five agents answer independently and then aggregates the answers. It loses to self-consistency at the same budget, so something is broken.' What is the best response?Analyze
A speech bubble quoting a teammate's claim: five agents answer independently, then aggregate, it loses to self-consistency at the same budget, so something is broken.
The claim is exactly as the question states it.
22. You must answer a multi-step research question. Three base models and different search tools are available, and the budget fits about four agents. Which design fits best?Design
Three cards: the task is a multi-step research question, three different models with search tools are available, and the budget is about four agents.
No design is chosen yet.

Build It

code/main.py is a stdlib-only simulation. The agents are scripted, not LLM calls. It implements:

  • run_star(agents, correct, rng): the first agent is the hub, the rest answer, and the final answer is the majority of the workers' answers.
  • run_chain(agents, correct, rng): sequential refinement. Each agent proposes, and may replace the current answer with its proposal.
  • run_tree(agents, correct, rng): a root plus two groups of leaves. Each group takes a majority, then the two group answers are combined.
  • run_graph(agents, correct, rng, rounds=2): all-to-all debate with bounded rounds. Every agent proposes, then agents off the majority may switch to it.
  • A scripted heterogeneity dial: each SimAgent has a base_accuracy and an error_bias, the wrong answer it drifts to on a miss. The homogeneous run gives every agent the same bias. The heterogeneous run spreads three different biases across the agents.
  • A measurement harness that runs each topology at N=3, 5, 7 over 200 trials and reports accuracy, average tokens, and steps.

Run:

python3 code/main.py

Expected output: two tables, one homogeneous and one heterogeneous, each listing topology x N with accuracy, tokens, and steps. Steps stand in for latency, since the harness doesn't simulate wall-clock time. In the heterogeneous table, star goes from 0.75 at N=3 to 0.98 at N=7, graph is ahead of star at N=3 (0.89 vs. 0.75), and chain gets worse as N grows. Graph costs about twice the tokens of star at the same N.

Check: Build It0/12
1. In the simulated graph topology, how does the second debate round behave?Explain
A bar chart of five round-1 answers, three saying 17 and two saying 22, with a dashed question-mark box for round 2.
What round 2 does to these positions is not shown.
2. Why does the heterogeneous run in the simulation give the agents three different error biases?Explain
Six agents under two setups: a homogeneous row where every miss drifts to the same value X, and a heterogeneous row where misses cycle through X, Y, Z.
Which setup wins more votes is not shown here.
3. In the Build It simulation, chain accuracy with heterogeneous agents falls from N=3 to N=7 while star improves. What causes the drop in chain?Explain
A chart from N=3 to N=7 with two lines: chain accuracy falling from 0.76 to 0.69, and star accuracy rising from 0.75 to 0.98.
Numbers are the lesson's own heterogeneous run, also quoted in the Author's Note.
4. run_star is called with 5 agents, each at the default 400 tokens per call. What tokens value does the result report?Apply
A hub box and four worker boxes, each at 400 tokens per call, with a dashed question-mark box below for the total tokens.
The computed total is not shown.
5. In run_star with 3 agents, whose answers go into the final majority vote?Apply
A star structure with one hub and two workers, connected by lines, with no vote arrows drawn.
Which of the three agents' answers feed the final vote is not shown here.
6. run_graph is called with 5 agents at 400 tokens per call and the default rounds=2. What are the tokens and steps?Apply
A parameter panel showing 5 agents, 400 tokens per call each, and rounds set to the default of 2, with a dashed question-mark box for tokens and steps.
The computed totals are not shown.
7. In run_graph, the opening positions are [RIGHT, RIGHT, WRONG-A, WRONG-A, WRONG-A] and one more round runs. What is the final majority answer?Apply
Five position chips, RIGHT, RIGHT, WRONG-A, WRONG-A, WRONG-A, with a dashed question-mark box below for what one more round produces.
These five positions are exactly as the question states them.
8. In run_chain the current answer is RIGHT. The next agent has base_accuracy 0.72 and proposes WRONG-A. How likely is the current answer to become WRONG-A?Apply
The run_chain replacement line from main.py, with the agent's base_accuracy given as 0.72, and a dashed question-mark box for the replacement probability.
The code line is quoted exactly as it appears in main.py.
9. run_tree is called with only 2 agents. What does it do?Apply
A root and one leaf, with a note that the leaf count is 1 and hits the <=1 guard, plus a dashed question-mark box for what run_tree returns.
What the guard does with only one leaf is not shown.
10. A heterogeneous run uses N=5 agents, and biases are assigned by index cycling through WRONG-A, WRONG-B, WRONG-C. Which other agents share agent-0's error_bias?Apply
The bias-cycling formula from make_agents, the list of five agent names, and a dashed question-mark box for which agents share agent-0's bias.
The remainder of i mod 3 for each agent is not worked out here.
11. The simulation reports 5600 average tokens for graph at N=7 and 1200 for star at N=3. Roughly how much more does that graph cost?Apply
Two stat cards: graph at N=7 averaging 5600 tokens, and star at N=3 averaging 1200 tokens.
Both numbers are exactly as the question states them.
12. A reviewer reads the Build It tables and says graph has no latency cost as N grows, since its steps stay at 4. What is wrong with that reading?Analyze
A table showing graph's steps column holding at 4 for N equal to 3, 5 and 7.
This matches the Build It table; only the steps column is shown here.

Use It

outputs/skill-topology-picker.md is a skill that reads a task description and recommends a topology (star / chain / tree / graph), an N (number of agents), a heterogeneity profile (base models to use), and a round bound.

Check: Use It0/1
1. Which set of recommendations does the topology-picker skill return for a task description?Define
A task description box with an arrow into the topology-picker skill, producing a recommendation box marked only with a question mark.
The specific fields inside the recommendation are not shown here.

Ship It

For any ensemble:

  • Start with self-consistency at N=5 using one strong base model. It is the cheap baseline.
  • Upgrade to heterogeneous voting at N=3 if accuracy matters, and measure the delta.
  • Move to debate topology only if the task has structure (research, multi-step) and bounded rounds are feasible.
  • Log the minority cluster. When a minority is persistently right, you have a diversity signal.
  • Benchmark wall-clock and tokens alongside accuracy. "Better accuracy at 10x cost" is a business decision.
Check: Ship It0/4
1. Why does the lesson say to start any ensemble with self-consistency at N=5 on one strong model?Explain
A three-step flow: self-consistency at N=5 first, heterogeneous voting at N=3 second, and debate topology third, with the first step highlighted.
Order matches Ship It; no reason for starting there is stated.
2. Why does Ship It recommend logging the minority cluster in an ensemble vote?Explain
A five-row log table with columns trial, majority and minority. The majority answer varies, B, B, C, B, B, while the minority answer is A in every trial.
Whether A is ever actually correct is not shown.
3. Licensing limits you to one base model, but you want less correlated errors in a vote of 5. Which approach best uses the lesson's ideas?Design
A license card restricted to one model, above a row of five agents, with a note that all five currently share the same prompt and the same tools.
This is the current setup before any change.
4. You must answer factual extraction questions that have clean ground truth. Your current setup runs 5 samples of one model with a majority vote, and accuracy has plateaued. Following Ship It, what is the best next step?Design
An illustrative curve of accuracy against added samples from one model, rising then flattening out.
Illustrative shape; no specific numbers are given for this scenario.
Author's Note

I'd run main.py first and read the homogeneous and heterogeneous tables side by side. The agents are scripted, so every number comes from a seeded coin flip, and a rerun prints the same table.

The row I'd look at is chain. With heterogeneous agents it goes from 0.76 at N=3 to 0.69 at N=7, while star goes from 0.75 to 0.98 on the same agents. In run_chain, every extra agent is another chance to overwrite a right answer, so more agents hurt. That is the cleanest demonstration in the file that topology matters as much as N.

My caveats come from what the harness leaves out. The cost columns are tokens and steps, and graph holds at 4 steps for every N, so the coordination tax only shows up in tokens: 5600 at graph N=7 against 1200 at star N=3, roughly 4.7x, which is what the script's closing line prints. The harness also runs one task type, so it can't reproduce the research-versus-factual split from MultiAgentBench. For that I'd need real agents on real tasks, which is Exercise 5.

I'd also treat the graph's second round as a conformity model. An agent off the majority switches to it with probability 0.4, whether or not the majority is right. That is the behavior Exercise 3 asks you to change with a judge.

Exercises

  1. Run code/main.py. Plot the coordination-tax curve for graph topology: accuracy vs N, tokens vs N. At what N does the curve inflect?
  2. Implement A-HMAD: three agents with deliberately different biases. How does the all-same-bias baseline compare to A-HMAD on the monoculture attack from Lesson 14?
  3. Add a "judge" role to the graph topology that does not vote, only scores the final consensus. Does this change the emergent conformity behavior?
  4. Read the AgentVerse paper (ICLR 2024). Identify which emergent behavior your implementation exhibits most strongly. Can you elicit the opposite behavior by a prompt change?
  5. Read MultiAgentBench (arXiv:2503.01935) Section 4 (topology experiments). Reproduce the "graph-wins-research" result on one task from the paper using your harness.

Key Terms

TermWhat people sayWhat it actually means
Self-consistency"Sample N times, vote"Wang 2022. Single model, N temperature>0 samples, majority vote on reasoning paths.
Heterogeneity"Different models"Ensemble of different base models or prompt families. Breaks monoculture.
MAD"Multi-agent debate"Generic term for agents exchanging critiques over rounds. See Du 2023.
A-HMAD"Adversarial Heterogeneous MAD"MAD variant emphasizing different models + adversarial structure.
Topology"Who talks to whom"Star, chain, tree, graph. Determines information flow.
Coordination tax"Diminishing returns"Above ~4 agents on graph, cost grows faster than quality.
Volunteer behavior"Unprompted help"AgentVerse emergent pattern: an agent offers to take a step.
Conformity behavior"Agreement under pressure"AgentVerse emergent pattern: an agent aligns with a critic.
Jury"Small specialized panel"Sibyl-style ensemble with roles (examiner, context, scorer).

Further Reading

Code

Ships With