Self-Consistency
Ask the model the same hard question five times with room to wander, then take the answer that shows up most. One-off slips get outvoted.
Why Does This Exist?
A single chain of thought run is brittle. The model writes one line after another, and each line builds on the last, so one early slip poisons everything after it. Ask once and you get whatever that single roll produced, good or bad.
You have felt this already. Ask the same tricky word problem twice and you can get two different chains of working with two different answers. That is not a bug you can prompt away. Sampling is how these models write, and temperature sampling sets how far each run may wander.
Self-consistency accepts the wander and tames it by counting. You sample a handful of full chains from the same prompt, pull the short final answer out of each, and keep the answer with the most votes. A slip that strikes one path in five loses 1 to 4. That is the whole trick, and it works best where a wrong step hurts and the answer is short enough to count.
This page covers that vote: how to sample, how to count, and one hand-checked example. The single chain itself lives in chain of thought. Branching, scoring, and backtracking belong to tree of thoughts. Fixing up one draft instead of voting across many belongs to reflection and self-correction.
You need one prerequisite and nothing else. A chain-of-thought prompt asks for the working before the answer, so later tokens can read earlier steps. If that idea is new, read chain of thought first, then come back. Those few minutes buy you the rest of this page.
Think of It Like This
Five students, one word problem, separate desks
Your teacher hands the same word problem to five students at separate desks. Same question, no copying, and each student must show their working. Four fill half a page in four different ways and all circle 13. The fifth rushes, skips the final line, and circles 26.
You collect the sheets and count the circled numbers instead of grading every line. Four independent routes reaching one total beats one rushed sheet, so you go with 13 and set the outlier aside.
Where it stops: the students have five different brains. Your five sampled paths share one brain, the same weights. If the model has a blind spot, all five can take the same wrong turn, and then the vote just repeats the error with confidence. Voting filters one-off slips. It does not fix a shared misunderstanding.
How It Actually Works
One prompt, several tries, one tally. The pieces are small, so here each gets a name before you use it.
Sample several chains from one prompt
You send one prompt . In plain words, is the full prompt: the question plus an instruction such as think step by step and finish with a line reading Final Answer followed by the number. You draw completions from the model distribution . Here is how many paths you sample, five in our example. Each is the written working of path number . Each is the short final answer pulled from that path. is the temperature knob, and is the next-token distribution it shapes.
This only works when sits above zero. At the model always picks the top token, so five calls return the same chain five times and the vote is theater you paid for five times. In practice something like is common: high enough that the wording and the route vary, low enough that the arithmetic stays sane. The knob itself is the topic of temperature sampling, so you will not find its math here.
Keep the answer that appears most
Long chains never match word for word, so you never compare full texts. You parse each path down to its short answer using the fixed format you demanded up front, then you normalize trivial differences such as extra spaces. Then you count. Write for the little function that equals when path gave answer and otherwise, and let be its sum over all paths:
The winner is the answer with the largest count:
In plain words, is simply the value that showed up most. Five paths, five short answers, one tally. No judge model, no scoring rubric, just the mode.
Worked example
You ask this: you start with 32 apples, give half to Mary, buy 10 more, then split everything evenly with John. How many do you keep?
Work it once by hand so the fixture is honest. Half of 32 is 16 given away, leaving . Buying 10 more gives . Splitting 26 evenly gives . The correct keep is 13.
Now sample paths at . Four paths take different routes through the same arithmetic and each finishes with Final Answer: 13. The third path works cleanly until the last line, forgets the final split, and finishes with Final Answer: 26. The parsed answers read . Counts come out as and , so with , that is 80 percent of the vote. The diagram above draws exactly this tally: four plain paths landing on 13, one highlighted wrong path landing on 26, and the winning chip for 13.
The price is plain too. Five paths cost about five times the tokens of one greedy call. Running them side by side cuts the wait but never the bill. So spend this budget where a one-off slip hurts: multi-step math, logic puzzles, questions with a short checkable answer. Skip it for summarization, chit-chat, or anything with no canonical short form to count.
The assumption underneath is that mistakes land roughly independently and the right answer is the single most likely outcome. When that fails, the vote fails with it. If the model misreads the question at its core, all five paths repeat the misread and the wrong answer can win 5 to 0. Voting narrows random slips. It does not cure a shared blind spot.
Code
The point of this snippet is the tally, not the sampling. Given five parsed answers, this is the count behind the worked example above.
from collections import Counter
def majority_vote(answers: list[str]) -> tuple[str, int]: counts: Counter[str] = Counter(answers) winner, votes = counts.most_common(1)[0] return winner, votes
answers: list[str] = ["13", "13", "26", "13", "13"]print(Counter(answers)) # -> Counter({'13': 4, '26': 1})print(majority_vote(answers)) # -> ('13', 4)print(f"{4 / 5:.0%}") # -> 80%The tally agrees with the hand count: 13 holds four of five votes, which is 80 percent, and 26 holds the one leftover vote.
Watch Out For
Temperature zero turns five paid calls into one answer
The symptom is easy to spot. All five chains come back identical, almost word for word, and the vote reads 5 to 0 every time while the bill reads five times a single call. You bought redundancy and received repetition.
The cause is a temperature of zero. A greedy setting always picks the top token, so there is no diversity for the vote to work with. Set somewhere around 0.5 to 0.7 instead, then confirm the chains actually differ in wording before you trust the tally. Keep the answer format strict so parsing still works, and do not push so high the arithmetic falls apart.
A clean majority can still be confidently wrong
The symptom is a tidy margin behind a bad answer. Four paths repeat the same misread and outvote the one path that read carefully, or a free-form task never produces two identical answers so every count sits at 1 and the winner is noise. A 2-2-1 split with no clear mode is the same warning in miniature.
The cause is a shared blind spot, a loose answer format, or a tie with no real winner. Do not treat every majority as truth. Demand a margin such as at least 3 of 5, normalize answers before counting, and hand-check the winning chain when the stakes are real. If answers will not collapse to a short form, or the vote keeps splitting, fix one draft with reflection and self-correction or search branches properly with tree of thoughts instead of voting.
The Quick Version
- Self-consistency samples the same chain-of-thought prompt several times at nonzero temperature, then keeps the most common final answer.
- The final answer is a plain majority: the value with the largest count over the parsed answers through .
- In the worked example, the answers [13, 13, 26, 13, 13] give 13 four of five votes, which is 80 percent.
- It costs about five times the tokens of one call, so save it for multi-step reasoning with a short checkable answer.
- It filters one-off slips, not shared blind spots: when every path misreads the question the same way, the wrong answer wins the vote.