JA EN
LearnAgents
·★ MEMBER·PAPER·10 min read

Multi-Agent Design Patterns — Division, Debate, Verification

Stack as many agents as you like — if they all fail the same way, you have one agent and a larger bill. The condition under which voting actually helps, written down, then the three patterns that follow from it: division of labour, debate, and adversarial verification — plus when one agent is enough.

ModalitytextTaskagent

Improving Factuality and Reasoning in Language Models through Multiagent Debate


Does adding people to the meeting make it smarter?

"Two heads are better than one" carries a hidden assumption: that the two heads think differently. Two people trained on the same material, in the same way, get stuck at the same place. Take a vote among them and all you have done is certify the mistake with more confidence.

Running several LLM agents is the engineering version of that proverb. Take one agent — the think, reach for a tool, look at the result loop covered in LLM Agents from Scratch — run several, split the roles, compare the answers. Done well, you reach a quality a single agent cannot. Done badly, the only thing that scales is the invoice.

So this article settles when adding agents pays before it looks at any pattern. In the other order you end up copying a fashionable topology and shipping a system that is slower, pricier, and exactly as accurate.

The condition, written down

Start with the simplest arrangement. Give the same problem to nn agents and take a majority vote. Suppose each is correct with probability pp, and that they fail independently.

Pmaj(n)=k>n/2(nk)pk(1p)nkP_{\text{maj}}(n) = \sum_{k > n/2} \binom{n}{k}\, p^{k} (1-p)^{\,n-k}
(1)

Read in words, this is the same shape as tossing nn slightly biased coins and asking how often heads takes the majority. pp is how strongly one coin leans towards heads — the accuracy of a single agent — and nn is how many coins you toss, the agent count.

Equation (1) says nothing more than "the probability that more than half of the nn agents are right." (nk)\binom{n}{k} is the number of ways to pick kk agents out of nn; pk(1p)nkp^k(1-p)^{n-k} is the probability that those kk get it right and the rest do not. What matters is the direction. If p>0.5p > 0.5, raising nn pushes the result towards 1. If p<0.5p < 0.5, it pushes it towards 0. On a task where a single agent is right less than half the time, adding agents makes you reliably wrong.

And the whole equation rests on that one-line independence assumption. Let ρ\rho be the correlation between the agents' errors. Then the spread of their average behaves like this:

Var ⁣(1ni=1nei)=σ2(1n+n1nρ)    n    σ2ρ\operatorname{Var}\!\left(\frac{1}{n}\sum_{i=1}^{n} e_i\right) = \sigma^{2}\left(\frac{1}{n} + \frac{n-1}{n}\rho\right) \;\xrightarrow[\;n \to \infty\;]{}\; \sigma^{2}\rho
(2)

Put in words, adding agents only dilutes the part of the error each one makes on its own; the part they all make together survives however many you line up. The arrow on the right reads "where this ends up as the agent count grows without bound."

Here eie_i is each agent's error, σ2\sigma^2 is how large those errors are, and ρ\rho is how strongly two agents tend to be wrong in the same direction. Equation (2) makes exactly one point: no number of agents pushes the spread below σ2ρ\sigma^2\rho. At ρ=1\rho = 1 — everyone wrong in precisely the same way — the 1/n1/n term vanishes and a hundred agents behave like one.

This is the sore spot of multi-agent design. Outputs from the same model, on the same prompt, at the same temperature, have ρ\rho close to 1, and neither voting nor debate does much for them. To make either work you have to force them apart: raise the temperature, change the angle of the prompt (look for counterexamples first, or state the conclusion first), hand them different source material, or use a different model. Diversity in sampling has been a working resource ever since self-consistency, which draws multiple reasoning paths and votes over the answers (Wang et al., 2022).

FIG 1Lower the temperature and nearly all the probability piles onto one candidate; raise it and the bars flatten. Parallel samples drawn near temperature 0 are close to copies of each other — that is ρ in equation (2) heading for 1

Pattern 1: Division — cutting the context into pieces

Splitting roles is a pattern about context and attention more than about accuracy. Cram "read the spec," "implement," "write tests," and "review" into one prompt and the later instructions get honoured least, while the history balloons. Give each job to a separate agent and hand each one only the material its own job needs.

There are two shapes. A pipeline is serial — survey, design, implement, verify — where each output feeds the next. It is easy to trace when something breaks, but an upstream error flows downstream untouched. A fan-out hands independent small jobs (migrate ten files, review from five angles) to agents at once, so the wall-clock time is set by the slowest single agent.

Division works under one condition: the split jobs have to stand up without knowing each other's work in progress. Force a split on work that needs shared state and one side proceeds on a stale assumption, then nothing reconciles at integration time. If parallel agents write files, give each its own working directory —

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. Improving Factuality and Reasoning in Language Models through Multiagent Debate. arXiv:2305.14325Paper page·PDF
  2. Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171Paper page·PDF
  3. AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation. arXiv:2308.08155Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment