TAI BUI
Back to curriculum
BuildPython

Consensus and Byzantine Fault Tolerance for Agents

Classical distributed-systems BFT meets stochastic LLMs. Three research directions showed up in 2025-2026: **CP-WBFT** (arXiv:2511.10400) weighs each vote by a confidence probe; **DecentLLMs** (arXiv:2507.14928) goes leaderless, with parallel worker proposals and geometric-median aggregation; **WBFT** (arXiv:2505.05103) combines weighted voting with Hierarchical Structure Clustering to split Core and Edge nodes. The honest empirical result from "Can AI Agents Agree?" (arXiv:2603.01213) is that even scalar agreement is fragile today: a single deceptive agent can compromise a Mixture-of-Agents. BFT is necessary but not sufficient. This lesson builds a minimal BFT protocol, injects three agent-specific attacks (byzantine lie, sycophantic conformity, correlated-error monoculture), and measures how each consensus variant copes.

TIME: ~75 minutesPREREQUISITES: Phase 16 · 07 (Society of Mind and Debate), Phase 16 · 13 (Shared Memory)

Learning Objectives

  • Explain why classical PBFT's independent-fault assumption breaks for LLM agents, and name the three agent-specific attacks (byzantine lie, sycophantic conformity, correlated-error monoculture).
  • Compare plurality, CP-WBFT confidence weighting, DecentLLMs-style aggregation and WBFT Core/Edge clustering by the failure each one targets.
  • Run and read a stdlib consensus simulation, and say which aggregators fail on the monoculture scenario and why.
  • Choose a threshold, a clustering method and an escalation policy for a small agent ensemble, and pair consensus with an independent verifier.

Problem

You have N LLM agents, each producing an answer, and they disagree. Majority vote picks the wrong one because two agents are correlated (same base model, same training data, same failure modes). A third agent happens to be wrong in a novel way, so the majority is a false majority.

Now add a deceptive agent that lies on purpose. Or a sycophantic agent that agrees with whoever spoke last. Classical BFT assumes the Byzantine nodes are a fraction f < n/3 and behave arbitrarily. LLM nodes in 2026 are stochastic even when honest, correlated across models, and influenced by each other's outputs, so you can't treat them as independent Bernoulli voters.

Classical BFT (PBFT, 1999) is not wrong, just incomplete. It handles arbitrary bit-flipping. It does not handle three honest agents sharing a hallucination because they share training data. This lesson starts from PBFT's foundation and layers three 2025-2026 adaptations on top.

Warm-up0/3
1. In a multi-round debate where each agent reads the others' previous answers, what risk does that create for a final vote?Warm-up
Round 1 shows three people giving three different independent opinions. Round 3 shows the same three people, now all answering B, with dashed arrows from each round-1 answer toward the round-3 answers, meaning each saw the others' answers first.
2. One agent writes a hallucinated fact into a shared blackboard. What typically happens to agents that read it later?Warm-up
A note on a shared blackboard reading the meeting is at 3pm, written by person A and later read by person B, with nothing on the board marking where the note came from or whether it was checked.
3. Three coworkers all read the same flawed article and each gives you the same answer. How much extra confidence should that agreement give you?Warm-up
Three coworkers, each connected by an arrow to one shared article, all give the same answer: $40 billion.
Check: Problem0/1
1. A teammate says the 7-agent ensemble is safe because only one agent is Byzantine, well within f < n/3. What does that argument miss?Analyze
A seven-node network with one node shaded, next to a card with a teammate's argument: f equals 1, n equals 7, 1 is less than 7 over 3, so the ensemble is called safe.

Concept

What classical BFT gives you

Practical Byzantine Fault Tolerance (Castro & Liskov, OSDI 1999) tolerates f < n/3 Byzantine nodes. The protocol has three phases (pre-prepare, prepare, commit) and two primitives (signed messages, quorum certificates). It gets n >= 3f + 1 honest-or-malicious nodes to agree on a single value.

The guarantees are strong, but they rest on three assumptions:

  1. Independent faults. Byzantine nodes do not coordinate.
  2. Honest nodes are truly honest. Correctness of honest outputs is a non-issue, and the protocol only aligns disagreement.
  3. The question has a ground-truth answer. Consensus on a wrong fact is still consensus.

LLM agents break all three. Two agents running the same base model share faults. An "honest" LLM still hallucinates. On ambiguous questions the "truth" is whatever the agents decide, because there is no external oracle.

The three LLM-specific attacks

Byzantine lie. One agent outputs a deliberately wrong answer. Classical BFT handles this when f < n/3.

Sycophantic conformity. One agent reads the others' answers before voting and aligns with whoever spoke last. It isn't malicious, but its vote tracks the loudest voice. Classical BFT can't prevent this because the agent passes every signature check.

Correlated-error monoculture. Three agents share a base model and hallucinate the same wrong answer. The majority is wrong, and classical BFT can't help because all three "honestly" agree.

The 2025-2026 responses

CP-WBFT (arXiv:2511.10400) is Confidence-Probed Weighted BFT. Each voter attaches a confidence probe to its answer, either a self-reported probability or a separate calibration model's prediction, and vote weights scale with confidence. The paper reports a +85.71% BFT improvement on complete graphs. It targets sycophantic conformity, since conforming agents tend to have low confidence in a position they only volunteered.

DecentLLMs (arXiv:2507.14928) is leaderless. Worker agents propose in parallel, evaluator agents score the proposals, and the final answer is the geometric median of the scored positions. It is robust when f < n/2. It targets the Byzantine lie and correlated errors, because the geometric median resists outliers and pulls toward the dense cluster instead of the model-biased average.

WBFT (arXiv:2505.05103) is Weighted BFT with Hierarchical Structure Clustering. Vote weights come from response quality plus a trust score learned from history. Agents are clustered into Core and Edge: Core agents reach consensus first and Edge agents follow. This helps with scalability (the Core is small and fast) and partly with monoculture (you can pick the Core for diversity).

Empirical: "Can AI Agents Agree?" (arXiv:2603.01213)

The paper measures scalar agreement, meaning LLM agents agreeing on a single numeric value, across multiple frontier models. The findings are uncomfortable:

  • With no adversaries at all, LLM agents disagree on scalar questions at rates above 30% on many benchmarks.
  • A single agent with a deceptive persona can pull the Mixture-of-Agents consensus 40+ percentage points off the honest baseline.
  • Disagreement rates correlate with model diversity. Heterogeneous ensembles disagree more than homogeneous ones, which is good because their errors are less correlated. They also drift toward agreement more slowly, which is bad because time-to-agreement grows.

The takeaway: BFT gives you machinery to align outputs, but it can't tell you whether the aligned output is right. Pair it with verification (Phase 16 · 08 role specialization), diversity (Phase 16 · 15 debate variants), and evaluator agents (Phase 16 · 24 benchmarks).

The core protocol, stripped down

A minimal BFT round for LLM agents:

1. task arrives; each agent i produces answer a_i
2. each agent attaches confidence probe c_i in [0, 1]
3. aggregator collects (a_i, c_i) from all n agents
4. aggregator groups by semantic cluster (equivalent answers)
5. aggregator computes weight for each cluster C:
     w(C) = sum_{i in C} c_i
6. winner = cluster with max weight, if max > threshold * sum(c_i)
   else: retry or escalate
7. minority clusters logged with provenance for post-hoc audit

Semantic clustering is the LLM-specific twist. "The study reports 4.2%" and "4.2% improvement" belong in the same cluster, and a naive string-equality check would miss that. So would the demo's canonicalizer below, which strips case and punctuation but not extra words, so 4.2%improvement would land in its own cluster. In production, use a cheap embedding model or explicit canonicalization.

Threshold tuning

The threshold parameter decides when to accept a result and when to retry. Set it too low and you accept weak majorities. Set it too high and you never accept anything. The empirical range is 0.5-0.67 for n=5-7 agents, and higher for smaller n. Below the threshold, escalate to a human or to a different agent ensemble.

Where consensus does not help

  • Ambiguous questions. If the question has no ground truth, consensus is an opinion. Call it that.
  • Compound questions. "Write code and explain it" is two answers, so vote on each independently.
  • Adversarial multi-round. If agents can observe prior rounds and mimic each other (Du 2023 debate), they start agreeing regardless of truth. Bound the rounds, typically to 2-3.
Check: Concept0/23
1. What fraction of Byzantine nodes can classical PBFT tolerate?Define
Six nodes in a signed-message network, one shaded differently, next to a card listing signed messages and quorum certificates, with the maximum misbehaving fraction left as f less than a question mark.
2. What are PBFT's three protocol phases?Define
A client box followed by three phase boxes in sequence, each phase labelled only phase 1, phase 2 or phase 3 with a question mark, leading to the request being committed.
3. What is a Byzantine node in a consensus protocol?Define
Three nodes in one protocol round: node C sends an unrequested value, node D never replies, node E replies once then goes silent, with a card asking what one word covers all three.
4. What is correlated-error monoculture?Define
Three agents all built on Model Zeta, all honestly answering north wing, with a note that none is lying and none read another's answer, and a card asking what the pattern is called.
Illustrative wrong answer; not from the lesson's own example.
5. What is sycophantic conformity?Define
Agent 1 answers blue first, agent 2 reads that answer before voting, with a note that agent 2 saw the question only after agent 1 answered, and a card asking what agent 2's own vote is.
6. What is a confidence probe in CP-WBFT?Define
A vote card with answer B and an attached number 0.8, next to a separate calibration model reading the same vote and predicting 0.6, with a note that both numbers are meant to say how likely the answer is right.
7. What does the semantic clustering step do in the minimal BFT round?Define
Three worded-differently answers, yes, Yes! and YES, next to a card asking whether they count as one vote or three.
Illustrative wording, not the lesson's own example.
8. What is the geometric median of a set of points?Define
Four scored proposals plotted as points A, B, C, D, with a marked candidate center point P among them.
Positions are illustrative.
9. How does WBFT's Hierarchical Structure Clustering organize agents?Define
Three agents in a small group A reach a decision first, then an arrow leads to a larger group B of five agents, with the groups labelled only A and B.
10. Which classical PBFT assumption do LLM agents violate?Explain
A four-node network with one node shaded, and a card stating the classical assumption that a faulty node acts on its own, not in coordination with others.
11. Why can classical BFT not prevent sycophantic conformity?Explain
A vote passing through signature valid and quorum reached checks to acceptance, with a note that the vote came from an agent that read the others first, and a card asking whether any check notices that.
12. How does CP-WBFT target sycophantic conformity?Explain
Two bars for votes on the same answer: a high bar at 0.9 for an agent that worked out the answer, and a low bar at 0.3 for an agent that echoed the first vote, with a note that a confidence-weighted tally counts each by this number.
Confidences are illustrative.
13. Why does DecentLLMs use a geometric median rather than a mean?Explain
Five points on a line: four clustered close together and one outlier far to the right, with a note that two kinds of center point could summarize them.
14. Which failure does each method mainly target?Explain
Three attack-pattern boxes, byzantine lie, sycophantic conformity and correlated-error monoculture, above four method boxes, plurality, CP-WBFT, DecentLLMs and WBFT, with no lines connecting them.
15. Why does the acceptance threshold need tuning, and what range suits n=5-7?Explain
A 0 to 1 dial for the acceptance threshold with a too low zone near 0 and a too high zone near 1 marked, and a note that too low accepts weak majorities while too high accepts nothing.
16. What does the evidence show about one deceptive-persona agent in a Mixture-of-Agents ensemble?Explain
An arrow labelled 40-plus percentage points running from a box for the honest baseline to a box for the ensemble with one deceptive-persona agent added, with a note that only the shift is reported, not absolute accuracy.
Shift size reported in the cited paper; absolute levels are not given and are not shown.
17. LLM agents disagree on scalar questions at high rates even with no adversaries. What does that imply for a design?Explain
A bar for how often agents disagree on scalar questions starting at the 30% mark and extending rightward with no exact right edge, with every agent answering honestly and no adversary present.
The lesson gives only a floor, "above 30%"; the exact rate is not stated.
18. What tradeoff do heterogeneous, diverse-model ensembles show?Explain
Two cards side by side: a homogeneous ensemble with one base model, low disagreement and fast agreement, and a heterogeneous ensemble with several base models, higher disagreement and slower agreement.
Illustrative; the lesson does not give exact figures for this comparison.
19. Why should a compound question like "write code and explain it" not get a single vote?Explain
One task card reading write code and explain it, shown as a single undivided request.
20. A minority cluster with the correct answer keeps appearing, while the majority is repeatedly wrong. What does the pattern point to?Analyze
A three-round table where the majority answers Q, marked wrong, every round, while a minority answers P, marked correct, every round.
Letters are illustrative.
21. Your agents must answer "write a function and explain how it works" and you want consensus. Which design fits?Design
One task card reading write a function and explain how it works, shown as a single undivided request.
22. You will pick a small WBFT Core to reach consensus first. Which Core best addresses monoculture?Design
Five candidate agents labelled by base model, three on Model A and one each on Model B and Model C, with a note asking which three should make the Core.
23. A high-stakes round ends with the top cluster at 0.4 of the total weight, below your 0.5 threshold. Which policy fits?Design
A bar chart showing the top cluster at 0.4 of total weight against an acceptance threshold line at 0.5, with a note stating both values.

Build It

code/main.py is stdlib-only Python. The pieces:

  • Vote, a dataclass holding (agent, answer, confidence). Its canonical() method is the clustering step: lowercase the answer and strip everything except alphanumerics, . and %. That is string canonicalization, not embeddings.
  • plurality, classical one-agent-one-vote counting.
  • cp_wbft, which sums confidence per cluster and rejects the round if the winner holds less than threshold (default 0.5) of the total weight.
  • decentllms, a simplified stand-in. The aggregator scores clusters itself, using confidence as the score. Each cluster gets size * max(0, 1 - dist), where dist is the summed absolute distance of its members' confidences from the cluster median. It is not a true geometric median over scored proposals.
  • scenario, which prints the votes and each aggregator's answer, marked [CORRECT], [WRONG] or [rejected below threshold].

main() runs four scenarios on the same question, where the correct answer is 4.2%: no attack, byzantine (one agent lies with high confidence), sycophancy (two agents echo the first answer, 42%, with low confidence) and monoculture (three agents confidently share the same wrong answer).

Run:

python3 code/main.py

The output is one block per scenario, listing each agent's vote and then the three aggregators' answers. On the votes hard-coded in main(), all three aggregators get the first three scenarios right and all three get monoculture wrong. The takeaways printed at the end say why: no aggregator here can beat a wrong cluster that is both larger and more confident than the right one. That case needs diversity or verification.

Check: Build It0/9
1. Why do all three aggregators in main.py get the monoculture scenario wrong?Explain
A table of main.py's monoculture scenario: three agents answering 42% at confidences 0.70, 0.68 and 0.72, and two agents answering 4.2% at confidences 0.85 and 0.82, with a note that all three aggregators return 42%.
Captured by running main.py.
2. Vote.canonical() lowercases and strips everything except alphanumerics, "." and "%". Which pair of answers lands in the same cluster?Apply
The canonical() rule, lowercase and keep only letters, digits, period and percent sign, demonstrated on USD 9.99! which becomes usd9.99, a pair not among the question's own four answer choices.
3. With threshold 0.5, cp_wbft sees "4.2%" at confidence 0.3 twice and "42%" at 0.95 once. What does it return?Apply
A three-row vote table for cp_wbft at threshold 0.5: agent x and agent y both answer 4.2% at confidence 0.30, agent z answers 42% at confidence 0.95.
4. With threshold 0.5, cp_wbft sees cluster X (confidences 0.5 and 0.4), cluster Y (0.5 and 0.3) and cluster Z (0.3). What happens?Apply
A five-row vote table for cp_wbft at threshold 0.5: cluster X has voters at 0.50 and 0.40, cluster Y has voters at 0.50 and 0.30, cluster Z has one voter at 0.30.
5. decentllms scores a cluster as size * max(0, 1 - dist). Cluster A has confidences 0.9, 0.8, 0.7. Cluster B has 0.9, 0.9. Which wins?Apply
A five-row vote table: cluster A has three voters at confidences 0.90, 0.80 and 0.70, cluster B has two voters at 0.90 and 0.90, above the formula size times max of 0 and 1 minus dist.
6. On the shipped monoculture votes the wrong cluster holds 2.10 of 3.77 total confidence. What does cp_wbft return?Apply
The monoculture vote table again, three agents at 42% with confidences 0.70, 0.68, 0.72 and two agents at 4.2% with confidences 0.85, 0.82, with a note giving the total confidence as 3.77 and the 42% cluster's share as 2.10.
Figures match main.py's shipped votes.
7. In the sycophancy scenario, two agents echo "42%" at low confidence while three others answer "4.2%". What does plurality return?Apply
A table of main.py's sycophancy scenario: two agents answering 42% at low confidences 0.35 and 0.30, and three agents answering 4.2% at high confidences 0.85, 0.80 and 0.82, with a note that plurality counts one agent, one vote.
Captured by running main.py.
8. A colleague cites the decentllms function in main.py as evidence that geometric-median aggregation works. What is wrong with that?Analyze
The decentllms function's own docstring from main.py, stating that it is simplified, that the evaluator is the aggregator itself, and that the geometric median description is approximate.
Quoted from the shipped code.
9. On the shipped monoculture votes, which change would make cp_wbft return "4.2%"?Analyze
The monoculture vote table once more, three agents at 42% and two at 4.2% with their shipped confidences, with a note that cp_wbft as shipped returns 42% on this input.

Use It

outputs/skill-consensus-designer.md designs a consensus protocol for a multi-agent ensemble. It picks the clustering method, the weighting, the threshold, and the escalation policy for sub-threshold rounds.

Check: Use It0/1
1. Which decisions does the consensus-designer skill make for an ensemble?Define
A file header card for skill-consensus-designer.md showing its name and version, with the rest of the document shown only as blank redacted lines.

Ship It

Before shipping any consensus mechanism:

  • Attack-test with at least the three patterns above. Your protocol should fail predictably, not silently.
  • Log each minority cluster with provenance. Minority clusters are your early-warning system for correlated errors.
  • Bound the rounds. "Keep debating until agreement" rewards sycophancy.
  • Separate agreement from correctness. Consensus output goes to a verifier, and the verifier is independent of the ensemble.
  • Monitor the agreement rate. A sharp rise points to conformity bias, and a sharp fall points to model drift.
Check: Ship It0/5
1. Why should BFT consensus be paired with a separate, independent verifier?Explain
A round of five agents voting, feeding an aggregator, reaching consensus on answer B, with a card asking whether B is actually correct.
2. Why log each minority cluster with provenance?Explain
A four-round table where the majority answers Y every round and a logged minority answer Z recurs every round, with a note that the minority keeps showing up.
Letters are illustrative, not from the lesson's own data.
3. After you add a debate loop where agents read each other's answers, the agreement rate jumps sharply but accuracy does not improve. What is the likeliest cause?Analyze
Two lines over 20 debate rounds: agreement rate climbing from about 0.55 toward 0.9, and accuracy staying flat near 0.75.
Illustrative curves matching the stem's description, not a real training run.
4. Your agreement rate falls sharply week over week while prompts, ensemble and threshold are unchanged. What does that most likely indicate?Analyze
A line over 12 weeks showing agreement rate falling from about 0.85 to about 0.55, with a note that prompts, ensemble and threshold stay unchanged across the weeks.
Illustrative curve matching the stem's description, not a real run.
5. You run five agents on one question. Three share a base model and answer "42%" with confidences 0.70, 0.68 and 0.72. Two others answer "4.2%" at 0.85 and 0.82. Plurality, a confidence-weighted vote and a DecentLLMs-style score all return "42%". What should you add?Design
A table of five agents: three sharing one base model answering 42% at confidences 0.70, 0.68, 0.72, and two on different models answering 4.2% at confidences 0.85, 0.82, with a note that plurality, a confidence-weighted vote and a DecentLLMs-style score all return 42%.
Author's Note

I'd run main.py before reading the paper summaries. It prints each scenario's votes and then what plurality, CP-WBFT and DecentLLMs return, so you see the failure before the theory explains it. With the votes hard-coded in main(), the three aggregators agree with each other in every scenario, and all three get monoculture wrong. The wrong cluster there holds 2.10 of the 3.77 total confidence, so even the weighted vote lands on 42%.

Read the sycophancy scenario carefully. Plurality gets it right too, because the two conformers are outnumbered three to two. The low confidence on those two votes is what CP-WBFT is designed to exploit, but this input doesn't separate it from plain counting. If you want to see weighting earn its keep, change the numbers until plurality fails and CP-WBFT doesn't.

I'd also keep decentllms in proportion. In this file the aggregator scores clusters itself, and the score is cluster size times a penalty for confidence spread. That is a rough proxy for the paper's approach, and I wouldn't cite its results as evidence about geometric-median aggregation. Same for canonical(): string canonicalization is enough for 4.2% versus 42%, and a real ensemble needs the embedding step from the exercises.

Exercises

  1. Run code/main.py. Confirm plurality fails the monoculture attack, and note that CPWBFT fails it too on the shipped votes. Then lower the three monoculture confidences until CPWBFT flips to the right answer, and record where that happens.
  2. Add a fourth attack pattern: silent abstention: one agent refuses to answer ("I don't know"). How should each aggregator treat abstentions? Implement your choice.
  3. Swap the semantic clustering from string canonicalization to embedding-similarity (use any open-source embedding model). What happens to the sycophancy attack?
  4. Read CP-WBFT (arXiv:2511.10400). Implement the confidence-probe calibration step (a separate calibration model checks each agent's self-reported confidence). Measure the accuracy gain on the monoculture scenario.
  5. Read "Can AI Agents Agree?" (arXiv:2603.01213). Reproduce a simplified scalar-agreement experiment: three agents, one scalar question, the deceptive-persona prompt. Does CPWBFT or DecentLLMs catch it?

Key Terms

TermWhat people sayWhat it actually means
BFT"Byzantine fault tolerance"Castro-Liskov 1999 protocol for consensus with f < n/3 arbitrary faults.
Byzantine"Any bad behavior"A node that can lie, drop messages, or fail silently: anything but crash safely.
Confidence probe"How sure are you?"Self-reported or calibrator-predicted probability attached to a vote.
Semantic clustering"Same answer, different words"Grouping equivalent answers before counting votes.
Geometric median"Robust center"The point minimizing sum of distances to sample points. Robust to outliers, unlike the mean.
Monoculture"Same model, same failures"Correlated errors when agents share training data or base model.
Sycophantic conformity"Agreeing with the loud voice"An agent's vote biases toward whoever spoke first/loudest.
Core/Edge"Hierarchical BFT"WBFT split: small Core consensus first, Edge nodes follow. Bounds latency.

Further Reading

Code

Ships With