Course contents 20 / 27

20 / 27 · Agents at Work

Multi-agent systems

When several agents beat one: game-theoretic interaction and coordination in brief, role-play, conversation frameworks, debate and orchestrators with subagents, what parallel work and separate contexts buy, what tokens, handoffs and coordination cost, and why correlated errors cap the gain of voting.

On this page 7

Every agent of this section so far has been one model in one loop with one context. The research agent already strains that design: a question that branches into ten sub-questions makes one context fill with pages read for the first sub-question while the agent works on the tenth, and the sub-questions wait for each other although they do not depend on each other. Splitting the work among several agents, each with its own context, is the obvious remedy, and it raises an old question of artificial intelligence: what happens when several agents act in the same environment? This note answers it in two parts. First, briefly, the classical view: agents with their own goals, and how they come to cooperate. Then the language-model systems of the last three years, what they gain from several agents, what they pay, and a calculation that bounds what any number of agents voting together can achieve.

Notation. There are nn agents. In a game, agent ii chooses an action aia_i and receives a payoff ui(a1,…,an)u_i(a_1, \dots, a_n). In the analysis of voting, the agents answer a yes-or-no question; Xi∈{0,1}X_i \in \{0, 1\} indicates that agent ii is right, with P(Xi=1)=pP(X_i = 1) = p for every agent, and ρ\rho is the correlation between the correctness of any two agents. AnA_n is the probability that the majority of nn agents (with nn odd) is right, and Bn(p)B_n(p) the same probability for independent agents.

Baseline: one agent does everything#

A single agent handles a task with many parts by doing them one after another in one context. This has real advantages: every decision is made with everything the agent has seen, nothing is lost in passing work between agents, and the cost is one context’s worth of calls. Its limits are those of the context window and of time. Every page read for any part stays in the context, or is compacted away, for all later parts; the steps run in sequence even when they are independent; and one model’s blind spots are present at every step, with nothing to catch them.

Classical multi-agent ideas, in brief#

In the vocabulary of What an agent is, an environment is multi-agent when other agents act in it too. The classical theory, developed long before language models, distinguishes them by their goals (Russell and Norvig, 2021, chapter 18; Shoham and Leyton-Brown, 2009).

Competition is the case of Games and Monte Carlo tree search: two players, one’s gain the other’s loss, solved by minimax. General-sum games are subtler, because the agents’ interests partly agree. Game theory describes each agent’s payoff for every combination of actions and asks which combinations are stable. A Nash equilibrium is a choice of actions in which no agent can gain by changing its own action alone:

ui(ai⋆,a−i⋆)≥ui(ai,a−i⋆)for every agent i and every action ai,u_i(a_i^\star, a_{-i}^\star) \ge u_i(a_i, a_{-i}^\star) \quad \text{for every agent } i \text{ and every action } a_i,

where a−ia_{-i} denotes the actions of all agents other than ii. Worked example. In the prisoner’s dilemma, two agents each cooperate (C) or defect (D), with payoffs (3,3)(3, 3) for (C, C), (0,5)(0, 5) for (C, D), (5,0)(5, 0) for (D, C) and (1,1)(1, 1) for (D, D). Whatever the other does, defecting pays more: 5>35 > 3 against C, 1>01 > 0 against D. So (D, D) is the only equilibrium, and both agents get 1 where cooperation would have given each 3. Rational agents acting separately can do worse together than they could: this is the coordination problem in its sharpest form, and it reappears whenever agents optimize their own part of a task.

Cooperation is the case of agents that share a goal and must divide the work. The contract net protocol (Smith, 1980) gave a recipe still recognizable in today’s systems: a manager announces a task, contractors bid according to their capabilities, the manager awards the task, and contractors report results, possibly acting as managers for subtasks of their own. The field also defined languages for agents to talk to each other, built from speech acts such as inform, request and propose, so that a message’s purpose was explicit. Their modern descendant is a protocol such as Agent2Agent, through which agents built by different organizations hand each other tasks (Workflows, frameworks and protocols). Multi-agent reinforcement learning adds a difficulty that single-agent learning does not have: while one agent learns, the others change, so its environment is no longer stationary.

Language-model systems inherited the cooperative case almost entirely. Their agents usually share one goal, the user’s, and the questions are those of the contract net: how to divide the task, what to tell each agent, and how to combine what comes back.

Language-model multi-agent systems#

Four designs recur.

Role-play. CAMEL (Li et al., 2023) put two instances of a model in conversation, one as a user who gives instructions and one as an assistant who carries them out, each given its role by an initial prompt, to complete a task without a human in the loop. Its authors documented failures that every later system has met: the agents swap roles, repeat each other, reply without content, or loop in conversation without ending.

Conversation frameworks. AutoGen (Wu et al., 2023) made multi-agent conversation a programming model: agents that send and receive messages, a human or a code executor as one of the participants, and group chats in which a manager chooses who speaks next. Such frameworks make it easy to build many topologies, and therefore easy to build ones that are worse than a single agent; Workflows, frameworks and protocols discusses what a framework does and does not decide for the designer.

Debate. Several instances answer the same question, read each other’s answers, and revise over a few rounds (Du et al., 2023). With three agents and two rounds of gpt-3.5-turbo (2023), debate raised arithmetic accuracy from 67.0% for a single agent to 81.8%, against 69.0% for a majority vote of the agents’ first answers, and grade-school math (GSM8K) from 77.0% to 85.0%, against 81.0% for the vote.

Orchestrator and subagents. A lead agent plans, writes a brief for each subagent, runs them in parallel, and merges what they return: the contract net with language models as manager and contractors, and the orchestrator–workers workflow with workers that are agents in their own right:

Figure

An orchestrator and its workers

An orchestrator and its workersAt the top left the task, at the top centre the orchestrator, at the top right the answer. Below, three workers, each with its own context and its own calls to search and read tools. An amber bus of briefs goes from the orchestrator to the workers, and a green bus of short results goes back to the orchestrator, which checks and merges them into the answer.tasksix citiesorchestratorsplit, merge, check1briefworker 1own contextworker 2own contextworker 3own context2search, readsearch, readsearch, read3short result4answerwith its source5An orchestrator and its workersAt the top left the task, at the top centre the orchestrator, at the top right the answer. Below, three workers, each with its own context and its own calls to search and read tools. An amber bus of briefs goes from the orchestrator to the workers, and a green bus of short results goes back to the orchestrator, which checks and merges them into the answer.tasksix citiesorchestratorsplit, merge, check1worker 1own contextworker 2own contextworker 3own context2toolstoolstools34answerwith its source5brief ↓ short result ↑
Each worker sees only its brief and what it read itself, so its context stays short and the work runs in parallel: the chain of calls in sequence does not grow with the number of parts. The price is instructions repeated in every context and detail lost at the handoff: the orchestrator sees only what a worker chose to return. That is why results come back in a checkable structure, and the orchestrator checks them before it merges.
  1. Split. The orchestrator divides the task into parts that do not depend on each other.
  2. Brief. Each worker receives a short description of its part: the objective, the expected form of the result, the tools to use and where to stop.
  3. Work. The workers run their own loops in parallel, each in its own context, calling tools.
  4. Return. Each worker returns a short, structured result instead of everything it read.
  5. Merge. The orchestrator checks the results, asks again where one fails a check, and writes the answer.

Anthropic described such a system for research in June 2025: a lead agent on Claude Opus 4 with subagents on Claude Sonnet 4 scored 90.2% higher than a single Claude Opus 4 agent on the company’s internal research evaluation (Anthropic, 2025). The lead usually started three to five subagents in parallel, more than ten for complex questions, and parallel tool calls cut research time by up to 90% on complex queries. A separate agent placed the citations. Coding systems use the same pattern more cautiously: as of April 2026, Cognition reported that the setups that work keep writing to one agent, with other agents reading, searching or reviewing in clean contexts, and that swarms of agents editing in parallel still fail because their implicit decisions conflict (Yan, 2026).

When several agents help#

Parallel exploration. Tasks that are broad rather than deep, such as covering many sources, trying several approaches, or checking many candidates, split into independent parts. The chain of calls in sequence is then the length of one part, not of all of them.

Separate contexts. A worker reads twenty pages and returns two paragraphs. The orchestrator’s context holds the paragraphs, not the pages: the workers act as a compression step, and each context stays short enough for the model to use well. A reviewer in a clean context, which has not seen the reasoning that produced a piece of work, also judges it more independently than the agent that wrote it.

Diversity. Agents with different prompts, tools or models make different mistakes. When the errors are independent, comparing or voting cancels them, as the last section quantifies.

The cost arithmetic of the Code section makes the trade concrete. Each model call reads its whole context, instructions and tool definitions take 3,000 tokens, and each document 600:

documentssingle agent: tokens readlongest contextcalls in sequencemulti-agent: tokens readlongest contextcalls in sequence
634,7906,890747,2603,7004
30392,15022,25031211,9006,0504

For a small task the multi-agent design reads more tokens, because every worker repeats the instructions. For a large one it reads fewer, because the single agent re-reads its growing context at every step, a cost that grows with the square of the number of steps (the arithmetic of the ReAct loop). In both cases its contexts are shorter and its sequential chain is fixed. Real systems spend more than this toy suggests, because their workers explore: Anthropic measured agents using about 4 times the tokens of a chat, and its multi-agent system about 15 times, and found that the number of tokens used explained 80% of the variance in performance on BrowseComp. Much of what several agents buy is the ability to spend more computation usefully.

When several agents hurt#

Token cost. Fifteen times the tokens of a chat is worth paying for a hard research question and wasteful for an easy one. A multi-agent design must earn its cost on the tasks it is used for.

Errors at handoffs. Each handoff passes a summary, and a summary can drop what the receiver needed. In the Code section, a careless worker returns the population of a city as 2 because it dropped the word million; merged without a check, that error would change the answer to a different city, and the orchestrator would report it with confidence. A single agent that read the document itself would not have made this error. The defence is the one in the code: results in a structure that can be validated (a number, a unit, a source), and a check before merging.

Coordination failures. An analysis of more than 1,600 annotated traces from seven multi-agent frameworks, on coding, math and general tasks, sorted the failures into 14 modes in three categories (Cemri et al., 2025), with high agreement between annotators (κ = 0.88):

  • system design and specification: agents ignore their role or the task’s constraints, repeat steps, lose the conversation history, or do not know when the task is finished;
  • inter-agent misalignment: agents fail to ask for clarification, withhold information another agent needs, ignore each other’s input, or drift from the task, and what they say does not match what they do;
  • task verification: the system stops too early, or verifies incompletely or incorrectly.

Many of these failures are not fixed by a better model, because they come from the structure: briefs that do not say enough, results that say too little, and nobody responsible for checking. Cognition’s argument against parallel writers makes the same point from practice: every action carries decisions nobody stated (a name, a style, an interpretation of the task), and agents working on parts of one artifact in parallel make incompatible ones (Yan, 2025).

Voting, debate and correlated errors#

Majority voting is the simplest way to combine agents, and it has a classical justification: if each of nn independent voters is right with probability p>1/2p > 1/2, the majority is right with a probability that tends to 1 as nn grows, Condorcet’s jury theorem. Language-model agents are not independent. Several instances of one model share its training data and its blind spots, and even different models share much of their data. How much does that matter?

A model of shared errors. Let a shared switch decide, for each question, whether the agents fail or succeed together: with probability ρ\rho, all agents give the same answer, right with probability pp; with probability 1−ρ1 - \rho, they answer independently, each right with probability pp. Each agent is still right with probability pp. For two agents i≠ji \ne j,

E[XiXj]=ρ p+(1−ρ) p2shared: both right with p; independent: p⋅pCov⁡(Xi,Xj)=E[XiXj]−p2=ρ (p−p2)=ρ p(1−p)subtract E[Xi] E[Xj]=p2Corr⁡(Xi,Xj)=ρ p(1−p)p(1−p)=ρeach variance is p(1−p),\begin{aligned} E[X_i X_j] &= \rho\, p + (1 - \rho)\, p^2 && \text{shared: both right with } p\text{; independent: } p \cdot p \\ \operatorname{Cov}(X_i, X_j) &= E[X_i X_j] - p^2 = \rho\,(p - p^2) = \rho\, p(1 - p) && \text{subtract } E[X_i]\,E[X_j] = p^2 \\ \operatorname{Corr}(X_i, X_j) &= \frac{\rho\, p(1 - p)}{p(1 - p)} = \rho && \text{each variance is } p(1 - p), \end{aligned}

so ρ\rho is exactly the correlation of the agents’ correctness. When they agree by the shared switch, the majority is right with probability pp; when they are independent, with the binomial tail Bn(p)B_n(p). By the law of total probability,

An=ρ p+(1−ρ) Bn(p),Bn(p)=∑k>n/2(nk)pk(1−p)n−k\boxed{ \begin{aligned} A_n &= \rho\, p + (1 - \rho)\, B_n(p), \\ B_n(p) &= \sum_{k > n/2} \binom{n}{k} p^k (1 - p)^{n - k} \end{aligned} }

and since Bn(p)→1B_n(p) \to 1 for p>1/2p > 1/2, the accuracy of the vote can never exceed

A∞=ρ p+1−ρ=1−ρ (1−p).A_\infty = \rho\, p + 1 - \rho = 1 - \rho\,(1 - p).

Worked example. With p=0.7p = 0.7 and n=5n = 5, B5=10⋅0.73⋅0.32+5⋅0.74⋅0.3+0.75=0.3087+0.3602+0.1681=0.837B_5 = 10 \cdot 0.7^3 \cdot 0.3^2 + 5 \cdot 0.7^4 \cdot 0.3 + 0.7^5 = 0.3087 + 0.3602 + 0.1681 = 0.837. Independent agents (ρ=0\rho = 0) raise accuracy from 0.700.70 to 0.8370.837. At ρ=0.5\rho = 0.5, A5=0.5⋅0.7+0.5⋅0.837=0.768A_5 = 0.5 \cdot 0.7 + 0.5 \cdot 0.837 = 0.768, and no number of agents gets past 1−0.5⋅0.3=0.851 - 0.5 \cdot 0.3 = 0.85. The gain over one agent is at most (1−ρ)(1−p)(1 - \rho)(1 - p): the vote can only fix the independent part of the errors.

Figure

Majority-vote accuracy against the number of agents

Majority-vote accuracy against the number of agentsFour curves of majority-vote accuracy for odd numbers of agents from 1 to 25, with single-agent accuracy 0.7 and error correlation ρ = 0, 0.2, 0.5 and 0.8. At ρ = 0 the accuracy rises to 0.983 with 25 agents; at ρ = 0.8 only to 0.757. Dashed lines mark the limits 1 − ρ(1 − p): 1, 0.94, 0.85 and 0.76.0.70.80.91.015913172125number of agents naccuracy of the majority0.9830.9260.8410.757ρ = 0ρ = 0.2ρ = 0.5ρ = 0.8dashed:the limit1 − ρ(1 − p)Majority-vote accuracy against the number of agentsFour curves of majority-vote accuracy for odd numbers of agents from 1 to 25, with single-agent accuracy 0.7 and error correlation ρ = 0, 0.2, 0.5 and 0.8. At ρ = 0 the accuracy rises to 0.983 with 25 agents; at ρ = 0.8 only to 0.757. Dashed lines mark the limits 1 − ρ(1 − p): 1, 0.94, 0.85 and 0.76.0.70.80.91.015913172125number of agents naccuracy of the majority0.9830.9260.8410.757ρ = 0ρ = 0.2ρ = 0.5ρ = 0.8dashed: the limit 1 − ρ(1 − p)
Each agent is right with probability p = 0.7; with probability ρ all agents are right or wrong together (a shared blind spot), otherwise independently. The majority is right with probability ρp + (1 − ρ)Bₙ(p), where Bₙ is the probability that more than half of n independent agents are right. Independent agents reach 0.983 at n = 25; at ρ = 0.5 the accuracy never exceeds 0.85, however many agents are added. Votes help exactly as much as the errors differ.

Optional depth: why correlation sets a floor in any model, not only this one. The rest of the note does not depend on it.

For any agents with equal accuracy pp and pairwise correlation ρ\rho, the fraction of agents that are right, Xˉ=1n∑iXi\bar X = \frac1n \sum_i X_i, has variance

Var⁡(Xˉ)=1n2(∑iVar⁡(Xi)+∑i≠jCov⁡(Xi,Xj))=n p(1−p)+n(n−1) ρ p(1−p)n2=p(1−p)(ρ+1−ρn).\operatorname{Var}(\bar X) = \frac{1}{n^2}\Big(\sum_i \operatorname{Var}(X_i) + \sum_{i \ne j} \operatorname{Cov}(X_i, X_j)\Big) = \frac{n\, p(1-p) + n(n-1)\, \rho\, p(1-p)}{n^2} = p(1-p)\Big(\rho + \frac{1 - \rho}{n}\Big).

As nn grows, the variance falls to ρ p(1−p)\rho\, p(1 - p), not to 0. With independent agents the fraction right concentrates at pp, and a majority threshold at 1/21/2 below it is crossed almost never. With correlated agents the fraction keeps a spread that does not shrink, so on some questions most agents are wrong together however many there are.

Debate. Does letting the agents talk do better than voting? In the toy of the Code section, five agents with ρ=0.2\rho = 0.2 each adopt the majority’s answer with probability one half after seeing the others. The individual accuracy rises from 0.700.70 to 0.750.75, and the accuracy of the majority stays at 0.810.81: the agents agree more, and are not more often right. The evidence with real models points the same way. Du et al. found debate above voting in 2023. A controlled study in 2025 separated the two ingredients of debate, the ensemble of answers and the exchange of messages, across seven benchmarks: majority voting alone accounted for most of the gains attributed to debate (Choi, Zhu and Li, 2025). Its analysis models debate as a process whose expected correctness does not change from round to round unless something biases the updates toward the right answer, such as a verifier, a tool, or an agent that knows more. Exchanging opinions spreads them; only new information or a check makes them more accurate.

What changed#

one agentseveral agents
contextsone, holding everythingone per agent, each holding its part
sequenceevery step in orderindependent parts in parallel
tokensgrows with the square of the stepsinstructions repeated per agent; usually more in total for real tasks
failure pointsthe model’s own mistakesplus handoffs, briefs and coordination
errors combinednonevoting and review cancel independent errors, not shared ones
who decidesthe agentan orchestrator, a protocol, or a conversation

Limitations#

  • Gains are measured on chosen tasks. Reported improvements come from tasks that suit parallel work, such as broad research; tasks with tightly coupled parts, including most code changes, gain less or lose.
  • Correlation is the norm. Copies of one model share its blind spots, and different models share much of their training data; the independent part of the errors, which voting can fix, is often small.
  • Debate persuades as well as corrects. A confident wrong agent can bring the others to its answer; agreement after debate is not evidence of correctness.
  • Failures are hard to attribute. In a trace of many agents, finding the step and the agent at which a run went wrong is itself an open problem.
  • The design space is large and lightly charted. Topologies, briefs and merging rules are chosen by trial; a taxonomy of failures exists, a theory of good designs does not.

What you should remember#

  • Classical multi-agent theory separates competition (minimax), general-sum interaction (Nash equilibria, where self-interested agents can do worse together, as in the prisoner’s dilemma) and cooperation (task allocation, as in the contract net protocol).
  • Language-model multi-agent systems use role-play (CAMEL), conversation frameworks (AutoGen), debate (Du et al.) and orchestrators with subagents; the last is the most used in practice.
  • Several agents help through parallel exploration, separate contexts that compress what was read, and independent errors. They hurt through token cost, errors at handoffs, and coordination failures (MAST: 14 modes in three categories).
  • Majority vote with correlation ρ\rho: An=ρp+(1−ρ)Bn(p)A_n = \rho p + (1 - \rho) B_n(p), capped at 1−ρ(1−p)1 - \rho(1 - p); the variance of the fraction right never falls below ρp(1−p)\rho p(1 - p).
  • Debate makes agents agree; it makes them more accurate only when something brings in new information or a check. Majority voting explains most of its reported gains.
  • Return results in checkable structures and check them before merging; keep writes to one agent when the parts of an artifact depend on each other.

Code#

An orchestrator that splits a question about six cities among scripted workers, validates their structured results and asks again when one fails; the token arithmetic of one agent against several; majority voting with correlated errors, simulated and exact; and one round of debate. NumPy and the standard library only; seeds are fixed, and exact numbers can differ slightly across platforms and library versions. The script runs in under a second.

The workers are regular expressions and the agents of the vote are coins with a shared switch. Real workers are language-model agents running the loops of the previous notes, and real agents’ errors are correlated in ways no single ρ\rho describes; the merge-and-check structure, the token arithmetic and the bound on what voting can fix stay the same.

import re
from math import comb
import numpy as np

# 1. a task that splits: which of six (fictional) cities has the largest population? One document per city.
DOCS = {
    'Arvel': 'Arvel, a river port, had 412,000 inhabitants in the last census.',
    'Brisk': 'The census counted 1.3 million people in Brisk and its suburbs.',
    'Corran': 'Corran is home to 2.1 million residents, the census reports.',
    'Dunmoor': 'Dunmoor has a population of 870,000 according to the census.',
    'Elsby': 'With 1,950,000 inhabitants, Elsby is the largest city of its province.',
    'Fenwick': 'Fenwick, a university town, has 95,000 inhabitants.',
}
def read(city): return DOCS[city]                  # the tool every agent uses: one document, about 15 words

def worker(city, careless=False):                 # a scripted worker: reads its document, returns a short structured result
    text = read(city)
    m = re.search(r'(\d[\d,]*(?:\.\d+)?)( million)?', text)
    value = float(m.group(1).replace(',', '')) * (1e6 if m.group(2) and not careless else 1)
    return {'city': city, 'population': int(value), 'source': city}

def check(result):                                # the orchestrator validates every result before merging
    return result['population'] >= 1000 and result['source'] in DOCS

def orchestrator(cities, careless=()):
    results, log = [], []
    for c in cities:                               # the workers are independent: they could run in parallel
        r = worker(c, careless=c in careless)
        if not check(r):
            log.append(f'rejected {r}; asked again')
            r = worker(c)
        results.append(r)
    best = max(results, key=lambda r: r['population'])
    return best, results, log

best, results, log = orchestrator(list(DOCS), careless={'Corran'})
print(*log, sep='\n')
print([(r['city'], r['population']) for r in results])
print('answer:', best['city'], best['population'], 'source:', best['source'])
# rejected {'city': 'Corran', 'population': 2, 'source': 'Corran'}; asked again
# [('Arvel', 412000), ('Brisk', 1300000), ('Corran', 2100000), ('Dunmoor', 870000), ('Elsby', 1950000), ('Fenwick', 95000)]
# answer: Corran 2100000 source: Corran
# (without the check, the careless result 2 would be merged and the answer would be Elsby: an error passed on at a handoff)

# 2. what it costs: tokens read by every model call (each call re-reads its whole context) and the longest chain of calls
SYSTEM, TASK, DOC, NOTE, BRIEF = 3000, 50, 600, 40, 60  # token sizes: instructions and tools, task, document, note, brief
def single_agent(n):                               # one context: reads all n documents, one call per document
    ctx, total = SYSTEM + TASK, 0
    for _ in range(n):
        total += ctx; ctx += NOTE + DOC            # the call writes a tool request; the document is appended
    total += ctx                                   # the final call that answers
    return total, ctx, n + 1
def multi_agent(n):                                # an orchestrator, and n workers with their own short contexts
    plan = SYSTEM + TASK                           # the orchestrator plans and writes n briefs
    w_ctx = SYSTEM + BRIEF                         # each worker: one call to read, one to summarize
    worker_total = w_ctx + (w_ctx + NOTE + DOC)
    merge = SYSTEM + TASK + n * BRIEF + n * NOTE   # the orchestrator reads the n compact results
    return plan + n * worker_total + merge, max(w_ctx + NOTE + DOC, merge), 1 + 2 + 1
for n in (6, 30):
    print(n, 'single: total %d, longest context %d, calls in sequence %d' % single_agent(n),
          '| multi: total %d, longest context %d, calls in sequence %d' % multi_agent(n))
# 6 single: total 34790, longest context 6890, calls in sequence 7 | multi: total 47260, longest context 3700, calls in sequence 4
# 30 single: total 392150, longest context 22250, calls in sequence 31 | multi: total 211900, longest context 6050, calls in sequence 4

# 3. majority vote with correlated agents: with probability rho all agents share one draw (the same blind spot)
def vote_exact(n, p, rho):
    independent = sum(comb(n, k) * p ** k * (1 - p) ** (n - k) for k in range(n // 2 + 1, n + 1))
    return rho * p + (1 - rho) * independent
def simulate(n, p, rho, trials, rng):
    shared = rng.random(trials) < rho             # questions on which the agents err (or succeed) together
    common = rng.random(trials) < p
    own = rng.random((trials, n)) < p
    correct = np.where(shared[:, None], common[:, None], own)
    return correct
rng = np.random.default_rng(0)
p = 0.7
for rho in (0.0, 0.2, 0.5, 0.8):
    row = []
    for n in (1, 3, 5, 9, 25):
        c = simulate(n, p, rho, 200_000, rng)
        row.append(f'{(c.sum(1) > n / 2).mean():.3f}/{vote_exact(n, p, rho):.3f}')
    print(f'rho={rho}: ' + '  '.join(row) + f'   limit {1 - rho * (1 - p):.3f}')
# rho=0.0: 0.699/0.700  0.784/0.784  0.838/0.837  0.902/0.901  0.983/0.983   limit 1.000
# rho=0.2: 0.700/0.700  0.767/0.767  0.811/0.810  0.860/0.861  0.926/0.926   limit 0.940
# rho=0.5: 0.703/0.700  0.743/0.742  0.769/0.768  0.800/0.801  0.842/0.841   limit 0.850
# rho=0.8: 0.700/0.700  0.717/0.717  0.730/0.727  0.741/0.740  0.758/0.757   limit 0.760
print('pairwise correlation at rho=0.5:', round(np.corrcoef(simulate(2, p, 0.5, 200_000, rng).T)[0, 1], 3))
# pairwise correlation at rho=0.5: 0.497

# 4. a round of "debate": each agent sees the others' answers and adopts the majority with probability 0.5
c = simulate(5, p, 0.2, 200_000, rng)
majority = c.sum(1, keepdims=True) > 2.5
switch = rng.random(c.shape) < 0.5
after = np.where(switch, majority, c)
print('individual accuracy %.3f -> %.3f; majority accuracy %.3f -> %.3f' %
      (c.mean(), after.mean(), majority.mean(), (after.sum(1) > 2.5).mean()))
# individual accuracy 0.699 -> 0.754; majority accuracy 0.808 -> 0.808

Next#

The agents of this section get their abilities from a model trained for something else, next-token prediction followed by instruction tuning, and from the prompts, tools and structures built around it. The scores of the last three notes rose in 2024 and 2025 as much because the models themselves were trained on agentic tasks as because the structures improved. The next section opens that box. Reinforcement learning for language models brings back the policy gradients of the second section and applies them to a language model: the objective of RLHF, the group-relative estimates of GRPO, and rewards that a program can verify.

References#