Özer Cem KELAHMETKELAHMET
Articles · Self-consistency

Self-consistency explained: sample many reasoning paths, vote, and know when it pays

Self-consistency is the cheapest search method there is: ask the same question several times with sampling on and take the most common answer. This guide explains the paper, simulates how accuracy grows with the number of samples, and shows where the method fits in agents.

Download Markdown
At a glance
Reading time
13 min
Sections
9
Code examples
3
Tables
2
Sources
6
Published
24 Nov 2026
In 30 seconds
What changed
The self-consistency paper is posted on arXiv
Why it matters
Self-consistency is the first thing to try when a model is "nearly right": it often lifts accuracy on answers you can compare, needs no prompt engineering beyond a stable answer format, and runs in parallel.
What to do
Fix the answer format

If you ask a person a hard arithmetic question once, they might slip. Ask ten people, and the answer most of them reach is probably right, because there are many ways to make a mistake but the correct answer tends to be reached by many different routes. Self-consistency applies that idea to a single language model. Instead of taking one greedy chain of thought, it samples several reasoning paths at a non-zero temperature, extracts the final answer from each, and returns the answer that appears most often.

The method, from a 2022 Google Research paper, needs no training, no extra model and no special prompt. It improved chain-of-thought accuracy on every arithmetic and commonsense benchmark the authors tried, including a 17.9-point gain on the GSM8K maths word problems. It is still one of the most useful tools in an agent builder's kit: for answers you can compare, it buys accuracy and a free confidence signal with nothing more than extra samples.

What happened

The self-consistency paper is posted on arXiv (21 March 2022)

Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, Sharan Narang, Aakanksha Chowdhery and Denny Zhou proposed "self-consistency" as a replacement for greedy decoding in chain-of-thought prompting. They tested it on arithmetic and commonsense reasoning benchmarks with several large models.

The paper is published at ICLR 2023 (May 2023)

The final version reports absolute gains over chain-of-thought prompting of +17.9% on GSM8K, +11.0% on SVAMP, +12.2% on AQuA, +6.4% on StrategyQA and +3.9% on ARC-challenge.

Self-consistency becomes a building block for later methods

Tree of Thoughts compares against chain-of-thought with self-consistency as a baseline, and ReAct's best HotpotQA and FEVER results came from switching between ReAct and CoT with self-consistency. "Universal self-consistency", proposed later by Google researchers, extends the idea to free-form answers by asking a model to pick the most consistent response instead of counting exact matches.

How self-consistency works, step by step

The paper describes three steps:

  1. Prompt with chain of thought. Use the same few-shot exemplars you would use for chain-of-thought prompting, each ending with a fixed phrase such as "The answer is 18."
  2. Sample diverse reasoning paths. Instead of greedy decoding, sample k completions with temperature or top-k sampling turned on, so that the model takes different routes.
  3. Marginalise out the reasoning. Parse the final answer from each path and return the most frequent one. The reasoning text is thrown away; only the answers vote.

The paper also tried weighting each path by its normalised probability. A plain unweighted majority vote performed about as well, which is why almost every implementation today just counts answers.

Why does it work? A reasoning path can go wrong in countless ways, so wrong answers scatter. Correct paths, even when they reason differently, land on the same number. As long as the correct answer is the single most likely one, adding samples makes the vote converge to it.

Code: self-consistency with an answer parser

The code below separates the two parts you will reuse: an answer extractor and a vote. The sampler is a toy that reaches the right answer, 18, on 55% of paths and scatters the rest over four wrong answers. Replace sample() with a model call at temperature 0.7 or so.

import random, re
from collections import Counter

def extract_answer(completion):
    """Parse 'The answer is X.' as the paper's few-shot exemplars end."""
    m = re.search(r"The answer is\s*\$?(-?[\d,\.]+)", completion)
    return m.group(1).replace(",", "").rstrip(".") if m else None

def self_consistency(sample, k):
    answers = [extract_answer(sample()) for _ in range(k)]
    votes = Counter(a for a in answers if a is not None)
    answer, count = votes.most_common(1)[0]
    return answer, count / k, votes

def make_sampler(rng, p_correct=0.55, wrong=("16", "20", "14", "26")):
    def sample():
        a = "18" if rng.random() < p_correct else rng.choice(wrong)
        return f"... so she makes 9 * 2 = {a} dollars. The answer is {a}."
    return sample

rng = random.Random(0)
print(self_consistency(make_sampler(rng), k=10))

for k in (1, 3, 5, 10, 20, 40):
    ok = sum(self_consistency(make_sampler(rng), k)[0] == "18" for _ in range(20000))
    print(f"k={k:>2}: accuracy {ok / 20000:.3f}")

Output:

('18', 0.4, Counter({'18': 4, '14': 3, '26': 2, '20': 1}))
k= 1: accuracy 0.550
k= 3: accuracy 0.653
k= 5: accuracy 0.770
k=10: accuracy 0.913
k=20: accuracy 0.987
k=40: accuracy 1.000

Reading the worked numbers

The single run shows why voting works even when the right answer is a minority of all samples: 18 got only 4 of 10 votes, but each wrong answer got fewer. The sweep shows the shape of the gain. Going from 1 to 10 samples lifts this toy from 55% to about 91%, a large jump. Going from 20 to 40 adds little, because the vote has already converged. Real benchmarks behave the same way: the paper's curves rise quickly over the first handful of samples and flatten after that. The paper used up to 40 sampled paths in its main experiments.

There is also a trap. In this toy the per-sample accuracy is 55% and wrong answers are spread evenly, so voting helps. If the model's most frequent answer is wrong, for example because one misconception dominates, voting makes that wrong answer more certain. Self-consistency amplifies the mode of the distribution; it cannot create knowledge the model does not have.

Ties and unparseable answers

Small k produces ties. With k = 3 and three different answers, Counter.most_common returns whichever answer came first, which is no better than a single sample. Use odd k of 5 or more, and decide a tie rule explicitly: re-sample, escalate to a stronger model, or return "uncertain". Discard completions you cannot parse rather than counting them as a vote, and log how often that happens; a high parse-failure rate usually means the exemplars or the output format need work.

Agreement as a confidence signal

The vote share is a cheap confidence estimate. The paper reports that consistency correlates with accuracy: when most samples agree, the answer is much more likely to be correct. That gives you a routing rule for free.

Table 1. Agreement as a confidence signal
Vote share among k = 10 samples Suggested action
80% or more Return the answer
50% to 79% Return it, flagged as lower confidence, or add samples
Below 50% Escalate to a stronger model, a tool or a human

These thresholds are illustrative; calibrate them on your own labelled data by plotting accuracy against vote share. Used this way, self-consistency becomes part of a cost-aware cascade: run a cheap model several times, and only send the low-agreement cases to an expensive one. The agent routing page explains cascades in more detail, and the pass@k versus pass^k simulation shows the related maths of repeated attempts.

Cost and latency

Self-consistency multiplies output tokens by k. Input tokens can often be shared: many APIs accept a parameter for several completions per request, and prompt caching makes repeated prompts cheaper. Suppose a chain-of-thought answer uses 1,200 input tokens and 300 output tokens. With k = 10 and separate calls, you pay 12,000 input and 3,000 output tokens; with one request for ten completions you pay 1,200 input and 3,000 output tokens. Because output tokens usually cost several times more than input tokens, the output side dominates the bill either way.

Latency need not grow with k if you sample in parallel, since the samples are independent. The total time is roughly the slowest single sample plus parsing. That is a big practical difference from ReAct or Tree of Thoughts, whose steps depend on each other. The parallel tool calls simulation shows the same critical-path effect for tools.

Self-consistency in agents

Agents rarely end in a single number, so the method needs adapting.

Vote on decisions, not essays. Classification, routing, extraction of a field and yes or no judgements all have discrete answers. Sample a router or a guardrail classifier five times and take the majority, and its errors become less frequent and better flagged.

Vote on tool-call plans. Sample several plans or first tool calls and pick the most common one. Normalise arguments (lower case, sorted keys) before comparing, or near-identical calls will split the vote.

Use a judge for free-form answers. Universal self-consistency asks a model to choose the response most consistent with the others. It works where exact matching cannot, but it adds a judge call and inherits the judge's biases; the LLM judge agreement simulation shows how to check one.

Combine with ReAct. The ReAct paper switched to CoT with self-consistency when the agent ran out of steps, and from CoT-SC to ReAct when the samples disagreed. Agreement is the signal that tells you when to stop thinking and start searching.

Self-consistency against other ways to spend compute

Self-consistency is one way to spend extra inference compute. It helps to compare it with the alternatives at the same budget, because the cheapest gain is not always the one you expect.

Table 2. Self-consistency against other ways to spend compute
Option Extra cost What it improves Main weakness
Self-consistency, k samples About k times the output tokens, parallel Accuracy on comparable answers, plus a confidence signal Cannot fix a dominant misconception
Longer reasoning budget on one call More thinking tokens, sequential Hard multi-step problems No built-in confidence signal
A stronger model, one call Higher price per token Knowledge and reasoning together Usually the most expensive per call
Tree search over steps Many proposal and evaluation calls Puzzles where partial states can be judged Hard to bound cost

A worked comparison makes the choice concrete. Suppose a small model answers a task correctly 70% of the time at 300 output tokens and $0.50 per million output tokens, and a large model answers correctly 85% of the time at $5 per million. Ten samples of the small model cost 3,000 output tokens, or $0.0015 per question. One call to the large model costs 300 tokens at ten times the price, also $0.0015. If voting lifts the small model above 85% on your data, self-consistency wins at equal cost and also gives you an agreement score; if it plateaus below, the large model wins. The prices here are illustrative; plug in your own. This is the same question the test-time compute literature asks, and reasoning models answer part of it internally by thinking longer. The agentic patterns simulation shows where sampling and voting sit next to planning and reflection.

What it means in practice

Self-consistency is the first thing to try when a model is "nearly right": it often lifts accuracy on answers you can compare, needs no prompt engineering beyond a stable answer format, and runs in parallel. It is the wrong tool when outputs cannot be compared, when the model's typical answer is wrong, or when latency budgets cannot absorb even parallel sampling. For sampling settings, the temperature and top-p simulation shows how much diversity each setting creates; too little diversity and all samples repeat the same mistake.

What to do now

  1. Fix the answer format. End every exemplar with the same phrase, such as "The answer is X", or ask for structured output with an answer field.
  2. Turn sampling on. Use a temperature around 0.5 to 0.8; greedy decoding gives identical samples and no benefit.
  3. Start with k = 5 and measure. Plot accuracy against k on a labelled set and stop where the curve flattens.
  4. Sample in parallel. Send samples concurrently or as one multi-completion request so latency stays close to a single call.
  5. Log the vote share. Store agreement next to every answer and use it to route low-agreement cases.
  6. Normalise before voting. Strip units, commas and case, and canonicalise JSON, so equivalent answers count together.
  7. Define a tie rule. Re-sample, escalate or return "uncertain", but never pick silently.
  8. Compare at equal cost. Check whether one call to a stronger model beats k calls to a weaker one for the same spend.

Risks and open questions

Confident wrong answers. When a misconception dominates the distribution, voting raises its share and its apparent confidence. Agreement is evidence, not proof.

Correlated samples. Samples from one model share its blind spots. Mixing models or prompts can diversify errors, but adds complexity and may lower the best model's share of votes.

Free-form outputs. Exact-match voting breaks for summaries, code or plans. Judge-based variants help but add a model you must also evaluate.

Reasoning models change the baseline. Models that already think at length gain less from external sampling on some tasks. Measure before paying for k samples.

Watch next: whether model APIs expose native multi-sample voting, how agreement signals feed routing and escalation in production agents, and how voting compares with a single longer reasoning budget at equal cost.

Frequently asked questions

How many samples does self-consistency need?

The gain is largest over the first few samples and flattens after that. Start with 5, test 10 and 20 on your data, and stop where accuracy no longer improves enough to justify the extra output tokens.

Does self-consistency work at temperature zero?

No. With greedy decoding every sample is the same, so the vote is just one answer repeated. You need sampling so that reasoning paths differ.

Is weighted voting better than majority voting?

The paper found that weighting paths by their normalised probability performed about the same as a plain majority vote. Most implementations use the simple vote.

Can I use self-consistency for code or long text?

Not with exact matching. For code, run the candidates against tests or vote on their outputs; for long text, use a judge-based variant such as universal self-consistency, and validate the judge.

How is it different from Tree of Thoughts?

Self-consistency samples complete reasoning chains independently and votes at the end. Tree of Thoughts evaluates partial steps and prunes or expands branches during the search, which costs far more calls.

Summary

Self-consistency replaces one greedy chain of thought with several sampled ones and returns the most common final answer. The 2022 paper reported gains over chain-of-thought prompting of 17.9 points on GSM8K, 11.0 on SVAMP, 12.2 on AQuA, 6.4 on StrategyQA and 3.9 on ARC-challenge, with a plain majority vote working as well as weighted schemes. Its costs are extra output tokens, not extra latency if samples run in parallel, and its vote share gives a useful confidence signal for routing. It works when answers can be compared and the model's most common answer is right; it cannot fix a model that is consistently wrong.

Sources

Cite this article

Kelahmet, Ö. C. (2026, November 24). Self-consistency explained: sample many reasoning paths, vote, and know when it pays. Özer Cem KELAHMET. https://www.ozercemkelahmet.com/articles/self-consistency-majority-vote-reasoning

BibTeX
@online{kelahmet2026self,
  author = {Kelahmet, {\"O}zer Cem},
  title  = {{Self-consistency explained: sample many reasoning paths, vote, and know when it pays}},
  year   = {2026},
  month  = {nov},
  url    = {https://www.ozercemkelahmet.com/articles/self-consistency-majority-vote-reasoning}
}
Version historyfirst version
  1. Published

Factual corrections are listed here with what changed. Wording and formatting edits are not listed.

Last updated Nov 24, 2026
Type to search.
    ↑↓ navigate↵ open