Skip to content
mentoor

Topic 5 of 5 · 5 min read

Sampling many answers and choosing

Goal: Use several samples of the same request to gauge a model's uncertainty and pick an answer by majority vote or a check.

Randomness is useful when you sample several answers and look at how much they agree: agreement is a clue that the model is on firm ground, and disagreement is a warning.

Check yourself · 1 of 3

You ask a model the same factual question five times and get five different answers. What does this most likely tell you?

Choose one answer

Why it matters

A single reply can sound sure even when the model is guessing. Asking the same question several times shows what a single reply hides. If five runs give five different numbers, you have learned that the model does not really know. That costs a few extra calls and can save you from acting on a made-up answer.

Three ways to use many samples

  1. Regenerate and compare. Press regenerate a few times, or send the request again. Facts that stay the same each time are more likely to be solid. Facts that change are suspect. This is a rough check, not a proof.
  2. Majority vote (self-consistency). For questions with a short final answer, such as a number or a label, sample several answers with some randomness, then take the most common one. Research on reasoning tasks found this beats a single answer (see the self-consistency paper). Use a temperature above zero here, because identical copies add nothing.
  3. Best-of-n with a check. Generate n candidates, then choose by a test you can run: unit tests for code, a validator for JSON, a calculator for sums, or a second model or person as judge. A checker you trust is stronger than a vote.

Limits to remember

  • Agreement is not truth. A model can give the same wrong answer five times if the error is built into what it learned.
  • Cost grows with every sample. Use it where a mistake is expensive.
  • Majority vote needs short, comparable answers. For long text, compare key claims instead.

Before and after

Before: Ask once, "What is the refund window in our policy?" and paste the reply into an email.

After: Ask five times with the policy text attached. Four say 30 days, one says 14. Check the policy for the number, find 30, and note that the odd run was wrong.

Run Answer
1 30 days
2 30 days
3 14 days
4 30 days
5 30 days

Four of five agree, and a source check confirms it.

What goes wrong

  • Voting at temperature zero, which gives five copies of one answer.
  • Treating a unanimous vote as proof.
  • Voting on long free text, where no two answers match exactly.
  • Skipping the check you could have run, such as unit tests.

Examples

Voting on a labelled batch

A support team asks a model to label one ticket five times at temperature 0.7: billing, billing, bug, billing, billing. Billing wins four to one. The disagreement on the single run flags the ticket as a bit unclear, and the team routes it for a quick human look because the ticket sits on the line between two labels.

Best-of-n for code

Ask for four versions of a date-parsing function. Run the same unit tests on all four. Keep the one that passes, or the simplest of those that pass. The tests decide, not the model's confidence.

Key points

  • Several samples of one request show how much the model agrees with itself.
  • Majority voting over sampled answers is a known way to improve results on tasks with short final answers.
  • Voting needs some randomness; at temperature zero the samples are copies.
  • Best-of-n works best with a check you trust, such as unit tests or a validator.
  • Agreement is a clue, not proof, because a model can repeat the same mistake.

Common mistakes

  • Sampling at temperature zero and expecting variety.
  • Reading a unanimous answer as certain.
  • Taking a majority vote over long free-form text.
  • Choosing the best sample by how confident it sounds instead of by a check.

Check yourself · 2 of 3

You want to use majority voting on a maths word problem. Which setup makes sense?

Choose one answer

Check yourself · 3 of 3

You generate four versions of a function and have a test suite. What is the best way to choose?

Choose one answer

Practice items, not counted towards your mastery.

Start here