# What Is Self-Consistency?

> What self-consistency is, why asking a model several times and taking a vote can beat one answer, and what it costs, explained simply for your AI interview.

**In short:** Self-consistency means asking a model the same question several times, each run with its step-by-step working, then keeping the final answer most runs agree on. A 2022 paper by Xuezhi Wang and colleagues showed clear gains on maths and reasoning tests. Each extra run is another model call, so it costs more.

AI and LLM interview question Q090, Prompt and context engineering. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-is-self-consistency

## Say it in 30 seconds

Self-consistency means I ask the model the same hard question several times, and each run writes out its working. Then I keep the answer most runs reach. Wang and colleagues showed it beats a single answer on maths and reasoning tests. The cost is clear: five runs means five model calls. So I use it where a wrong number costs money, and I send a split vote to a person.

## Say it in 2 minutes

A language model can get a question right in one run and wrong in the next. Chain of thought helps, because the model writes its working before the answer. But one run is still one guess. Self-consistency samples several different working paths, then looks at the final answers and keeps the one that comes up most.

Here is how I would set it up for a refund bot. The question goes to the model five times. Say three runs say 1800, one says 1620 and one says 2000. The vote picks 1800 with 60 percent agreement. The idea behind it is that a hard problem often has several routes to one correct answer, so runs that land in the same place deserve more trust.

The limits matter. The vote needs answers you can compare, like a number or a label, so it suits refunds, classification and lookups, not free essays. It can't fix a fact the model doesn't know, because five runs can repeat one mistake. And every extra run is another model call, so the authors suggest starting with a small number of paths, such as five or ten.

So I use it where a wrong answer costs money, and I set a threshold. If the agreement is low, the bot hands the case to a person rather than paying out.

## What is self-consistency, in plain words?

A language model writes its answer one word at a time, and at the usual settings it picks each word with some randomness. So ask it the same question twice and you may get two different answers. Self-consistency turns that into a tool.

Think of a claims assessor at an insurance firm. Before a payout goes out, three colleagues work out the figure on their own. If two agree and one doesn't, the team pays the figure most of them reached. A refund bot can do this too: it works out the same refund five times, and pays the figure most of the runs reach, if enough of them agree.

- **Chain of thought:** Asking the model to write its steps before the final answer.
- **Sampling:** Letting the model pick words with some randomness, so each run can differ.
- **Reasoning path:** One full run of working, from the question to the final answer.
- **Majority vote:** Counting the final answers and keeping the one that appears most.
- **Greedy decoding:** Always picking the single most likely next word, so one run gives one answer.

## How does self-consistency work, step by step?

Self-consistency builds on chain of thought prompting. Chain of thought asks the model to produce "a series of intermediate reasoning steps" before it answers. Self-consistency keeps that prompt and changes how the answer is picked.

1. **Ask for step-by-step working:** Use a chain of thought prompt, so every run writes its reasoning before the answer.
2. **Sample several paths:** Run the same prompt several times. Sampling means each run can take a slightly different path.
3. **Pull out the final answers:** Set the working aside and keep only the last answer from each run.
4. **Vote:** Keep the answer that appears most often, and note how strong the agreement was.

*Diagram, Sample, count, pick: Five runs of the same question each give a final answer. The counter keeps the most common one, and the case goes to a person when agreement is under 80 percent.*
1. The same question goes to the model five times.
2. All five final answers reach the counter.
3. The top answer has 60% of the votes, below the bar, so a person checks.

Here it is in a few lines of Python. There is no real model in it, only five answers a refund bot could give, so you can see the counting itself.

```python
# A refund bot answers the same question five times (made-up numbers, no real model).
# Each run ends in one answer, and the code counts them.
from collections import Counter

runs = [
    "refund 1800",
    "refund 1800",
    "refund 1620",
    "refund 1800",
    "refund 2000",
]

votes = Counter(runs)
answer, count = votes.most_common(1)[0]
share = count / len(runs)
print(votes)
print("Chosen:", answer)
print(f"Agreement: {count} of {len(runs)} ({share:.0%})")
if share < 0.8:
    print("Too split: send to a human")
```

Output:

```text
Counter({'refund 1800': 3, 'refund 1620': 1, 'refund 2000': 1})
Chosen: refund 1800
Agreement: 3 of 5 (60%)
Too split: send to a human
```

The vote picks 1800 with 60 percent agreement. That is under the 80 percent line in the code, so the case goes to a person. The code does the counting. The model only supplies the five answers.

## Why does a vote beat one answer, and where does it fail?

The paper's authors state the intuition directly. A hard problem usually has several ways of reasoning to one correct answer, and runs that agree have earned more trust. The paper reports real gains: "boosts the performance of chain-of-thought prompting with a striking margin", including +17.9% absolute accuracy gains on GSM8K with PaLM-540B, a dataset of grade school maths word problems.

> "Self-consistency leverages the intuition that a complex reasoning problem typically admits multiple different ways of thinking leading to its unique correct answer." (Wang and colleagues, 2022)
>
> "One limitation of self-consistency is that it incurs more computation cost." (Wang and colleagues, on limits)

The vote is only as good as the answers it counts. Five runs that repeat the same mistake still agree, so the vote gives false confidence. Self-consistency cuts down random slips. It cannot supply a fact the model never learned.

- **Fits: Short answers you can count.** A number, a label, yes or no, or one chosen option. Runs can be compared and counted.
- **Doesn't fit: Long free text.** Essays and summaries have no single answer to count, so there is nothing to vote on.

The cost is the extra runs. The authors suggest starting with a small number of paths, such as five or ten, because most of the gain shows up early and the performance levels off after that.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] A plain definition: sample several chain of thought runs, then vote on the final answer.
- [ ] Why it helps: runs that reach the same answer by different routes earn trust.
- [ ] The fit: short answers you can count, not free text.
- [ ] The cost: one model call per run, so it costs more, and the authors suggest starting with five or ten paths.
- [ ] The limit: it repeats a mistake if the model doesn't know the fact.
- [ ] A threshold: low agreement goes to a person.

**Common traps**

- Trap: "More samples always means a better answer." Better: More samples help until the answers settle. After that you pay for very little gain.
- Trap: "Five runs agreeing means it must be right." Better: Agreement can hide a shared error. The model can repeat one mistake five times.
- Trap: "It works the same on essays." Better: The vote needs answers you can compare. A long essay gives you nothing to count.

## Can you pick the right use?

**Pick the right task:** Which task suits self-consistency best?

A. Writing a warm welcome note for new customers
B. Working out a refund amount that has one correct figure
C. Brainstorming ten names for a new product line
D. Summarising a long policy document in a friendly tone

**Answer:** B. A refund has one right figure, so runs can be compared and counted. Names and summaries have many good answers, so there is nothing to vote on.

**Quick check:** A refund bot's five runs split 3, 1 and 1. What is the safest move?

A. Pay the figure from the first run
B. Pay the most common figure if agreement is high, else ask a person
C. Pay the highest figure to be generous
D. Run it once more and pay whatever comes back

**Answer:** B. A 3 of 5 split is weak agreement. A vote helps, but money at risk needs a threshold, and a person when the runs disagree.

## Can you answer these from memory?

**Flash cards**

- **What is self-consistency?** Several runs with step-by-step working, then keep the answer most runs agree on.
- **What does it sample?** Several different reasoning paths from the same prompt.
- **What is the vote?** Counting the final answers and keeping the most common one.
- **What does it suit?** Short answers you can count: numbers, labels, chosen options.
- **What is the main cost?** More model calls. The paper calls it more computation cost.
- **What can't it fix?** A missing fact. Five runs can repeat the same mistake.

## Likely follow-up questions

- Q078 What is chain-of-thought, and when does it help? https://designervenkat.online/interview/ai/what-is-chain-of-thought-prompting
- Q091 What is ReAct prompting? https://designervenkat.online/interview/ai/what-is-react-prompting
- Q092 What is prompt chaining? https://designervenkat.online/interview/ai/what-is-prompt-chaining
- Q013 Greedy vs beam search vs sampling? https://designervenkat.online/interview/ai/greedy-vs-beam-search-vs-sampling
- Q010 What does temperature control? https://designervenkat.online/interview/ai/what-does-temperature-control

## Learn it in depth

- [Chain-of-thought prompting](https://designervenkat.online/learn/ai-engineering/chain-of-thought)
