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.

Level
01 · Single Agent
Also known as
Majority Reasoning, Sample-and-Vote, Consensus Sampling
Trade-off
Significantly more robust answers against false paths, paid for by multiple inference costs.
Native in
Google ADK, LangGraph, Microsoft Agent Framework
The effect

What it actually does.

Several samples vote; the majority answer wins.

promptsample 1sample 2sample 3majority
Walk it through

A real run, step by step.

Task“A warehouse receives 3 pallets of 48 boxes. 17 boxes are damaged. Each box holds 12 items. How many items can be sold?” The same prompt runs five times at temperature 0.7:
Vote: 1,524 wins with 3 of 5 samples.
SampleReasoningAnswer
13 × 48 = 144 boxes, minus 17 damaged = 127, times 121,524
2144 boxes, 127 intact, 127 × 121,524
3144 × 12 = 1,728 items, minus 17 × 12 = 2041,524
4144 × 12, the damaged boxes are forgotten1,728
51,728 items, minus 17 (boxes mistaken for items)1,711
What this shows: a single call would have returned a wrong number in two of five runs. The two errors differ from each other, while the correct paths agree, and that is what the vote uses. It works because the answers can be compared: a number, a label, a choice. Free text needs a different way to merge.
In code

The pattern in code.

Plain Pythonpython
from collections import Counter

def self_consistent(question, n=5):
    # same prompt, n samples
    answers = [extract_answer(model(question, temperature=0.7))
               for _ in range(n)]
    answer, votes = Counter(answers).most_common(1)[0]
    return answer, votes / n  # the vote share is a rough confidence signal
Fit

Use it, or not.

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.
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.

Countermeasure

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.

Countermeasure

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

Search

Search patterns, frameworks, and pages.