Özer Cem KELAHMETKELAHMET
AI Simulations · Agents

Self-consistency: how voting over sampled reasoning paths lifts accuracy, and where it stops

Self-consistency samples many chains of thought for one question and keeps the answer most of them reach. Thirty GSM8K-style problems show why the vote climbs from 55.9% to 75.9% with 40 paths, why some questions can never be won, and what each extra path costs.

Download Markdown

Interactive simulation. It needs JavaScript; the text below explains what it shows.

What you are looking at

Each row is one grade-school maths question in the style of GSM8K. Two numbers describe how a model behaves on it when you sample its chain of thought at temperature 0.7. The column p is the chance that one sampled path ends at the correct answer. The column conc is the share of the wrong paths that land on the same wrong answer, the tempting mistake; the remaining wrong paths scatter over many different answers.

The mean of p is 55.9%, close to the 56.5% that PaLM-540B scored on GSM8K with greedy chain-of-thought decoding in the self-consistency paper. With the default of k = 40 sampled paths, the majority vote is right on 75.9% of the questions, a gain of 20.0 points. The paper reports 74.4% for the same model and setting, a gain of 17.9 points.

The chart puts the model and the data together. The dashed diagonal is one path, the solid curve is the vote over k paths and the second dashed curve is the vote over 5 paths, each drawn for the average wrong-answer concentration. The dots are the thirty questions with their vote accuracy at the current k. The bars show the same per-question accuracy, so you can see which questions the vote fixes and which it makes worse. Press play on the iteration to add paths one at a time and watch the accuracy climb: 55.9% with one path, 69.6% with 5, 72.5% with 10, 74.6% with 20 and 75.9% with 40.

The algorithm

Self-consistency (Wang et al., 2022) replaces greedy decoding in chain-of-thought prompting with three steps: sample m reasoning paths, read the final answer a_i from each, and return the answer with the most votes:

$$\hat a = \arg\max_a \sum_{i=1}^{m} \mathbb{1}(a_i = a)$$

The paper sampled 40 paths per question, at T = 0.7 with top-k 40 for PaLM-540B and T = 0.7 without truncation for GPT-3.

To see why voting helps, count votes for one question. Each path votes for the correct answer with probability p, for the tempting wrong answer with probability q = conc × (1 − p), and for some scattered answer with the remaining probability r = 1 − p − q. The vote margin of one path, correct minus tempting, has mean μ = p − q and standard deviation σ = √(p + q − μ²). Over k independent paths the margin grows like kμ while its noise grows only like √k σ, so the chance that the correct answer comes out on top is approximately

$$A(k) \approx \Phi\!\left(\frac{k\mu - r/2}{\sqrt{k}\,\sigma}\right)$$

The r/2 term is a small correction for the scattered answers, which can tie or beat the correct one when k is small. With one path the vote is just that path, so the simulation uses A(1) = p exactly. I checked the approximation against a direct simulation of the vote with 10 scattered wrong answers: on this set it gives 69.6% at k = 5 against 69.0% simulated, 72.5% against 72.7% at k = 10, and 75.9% against 76.1% at k = 40.

The same formula shows the limit. If p is above q, the margin is positive and A(k) goes to 1. If the tempting wrong answer is more likely than the right one, A(k) goes to 0: more paths make the vote more confidently wrong.

Worked example, question 16: p = 0.54 and conc = 0.7, so q = 0.7 × 0.46 = 0.322, r = 0.138, μ = 0.218 and σ = √(0.54 + 0.322 − 0.0475) = 0.902. With k = 40 the score is (40 × 0.218 − 0.069) / (√40 × 0.902) = 1.516, and Φ(1.516) = 93.5%. One path solves this question 54% of the time; 5 paths 69.4%; 40 paths 93.5%. Question 19 goes the other way: p = 0.46 but q = 0.486, so its vote accuracy falls from 46% to 43.1% at 40 paths.

Things to try

  • Move k from 1 to 5. Most of the gain arrives early: accuracy goes from 55.9% to 69.6%, while the cost per 1,000 questions goes from $2.50 to $12.50 at 250 tokens per path and $10 per million output tokens.
  • Push k to 64. Accuracy only reaches 76.4%, and the cost is $160 per 1,000 questions. The last 24 paths buy half a point.
  • Look at the ceiling. Eight questions have q above p, so in the long run only 73.3% of the questions can be won. At k = 40 the vote is still above that limit because near-tie questions such as 19 and 23 are still close to coin flips; as k grows they are lost too.
  • Raise conc on a few of the easy questions until q passes p and watch their bars drop. A model that makes the same mistake every time is not helped by voting, only one that makes different mistakes.
  • Move the agreement cut. At 0.6, 46.7% of the questions have a winning answer expected to collect at least 60% of the votes; at 0.8 only 23.3%. The low-agreement questions are the ones to escalate.

How it works in real systems

Self-consistency is the simplest form of test-time compute: spend more tokens at inference instead of training a bigger model. In agents it appears as voting over several plans or several tool-call results, and as the self-consistency score inside the value function of Language Agent Tree Search. It needs a final answer that can be compared exactly, such as a number, a label or a choice; for free text you need a judge or a similarity measure to group answers.

The cost is linear in k, so production systems rarely run 40 paths on every request. Common patterns are adaptive sampling (stop once the leading answer has an unbeatable lead), using the vote share as a confidence score to route low-agreement questions to a larger model, as in the cascade simulation, and lowering the sampling temperature when paths are too diverse to agree. Voting differs from pass@k, which counts a question as solved if any of the k attempts is right and needs a verifier to pick it out; majority voting needs no verifier but is capped by the questions where the model's most common answer is wrong. For retries that learn from failure, see Reflexion, and for a longer explanation with code, the self-consistency article.

Sources

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