/pattern/self-consistency/

01 · Single AgentMajority ReasoningSample-and-VoteConsensus Sampling

Self-Consistency.
Vote across many minds. Settle on the majority.

The system generates multiple independent reasoning outputs for the same prompt, and then merges the results via consensus or voting for a final answer.

When to reach for it

  • The stochastic diversity of models should be leveraged.
  • The result must be robust against individual logic errors in single runs.

When it backfires

  • The task can be deterministically validated anyway.
  • The cost per request is strictly limited.

The tradeoff

Significantly more robust answers against false paths, paid for by multiple inference costs.

The effect

What it actually does.

Several samples vote; the majority answer wins.

promptsample 1sample 2sample 3majority
Pitfalls

Two ways this pattern will hurt you.

Majority agreement on the same hallucination

All reasoners share the same training bias and agree on an incorrect answer. Majority voting amplifies the error.

Fix · Use diverse prompts or models for each reasoner, or add a verifier that checks against an external source.

Even number of voters with no tie-break rule

A 2-2 split leaves the majority node without a clear winner. The system hangs or picks arbitrarily.

Fix · Use an odd number of reasoners, or define a tie-break (e.g., highest-confidence vote, or escalate to human).

Framework support

Where Self-Consistency is native.

Google ADKsampled runsNative
LangGraphparallel samples + voteNative
Microsoft Agent Frameworkmulti-sampleNative
Anthropic Cookbookdocumented as a recipeAdaptable

Search

Search patterns, frameworks, and pages.