TL;DR
A solution verifier is a model that reads a finished answer to a problem and estimates the Probability that the answer is correct. It is trained on answers whose correctness is already known, so it learns to tell right answers from wrong ones. A system can then generate many candidate answers, score each with the verifier, and keep the one with the highest score.
Builds on: Best-of-N Sampling, Cross-Entropy Loss, Sigmoid Function · Leads to: process reward models (the step-level extension), reward models (the preference-trained alternative)
Where it's used
Language models make mistakes on multi-step problems, and a single sampled answer is often wrong even when the model can produce the right one. A verifier turns that spare capacity into accuracy: sample many answers, let the verifier pick. The idea was made concrete in 2021 by Cobbe and co-authors at OpenAI, who trained verifiers on about 8,500 grade-school math word problems (the GSM8K dataset). They reported that a verifier chosen from many samples beat a fine-tuned model that answered only once. Since then, sampling-and-verifying has become a standard way to spend extra compute at test time on math and code, where a candidate can be checked.
How it works
A generator that samples one answer gives an answer with some chance of being correct, call it . Sampling answers (best-of-N sampling) raises the chance that at least one is correct, but someone must still choose which one to report. Choosing by majority vote needs no extra model, but it fails when the right answer is rare among the samples. Choosing by a scorer needs a scorer that can tell right from wrong on answers it has never seen, and that is what the verifier is trained to do.
- Collect labelled answers. For each training problem, sample several answers from a generator and check each final answer against the known correct result. Each answer gets a label: correct or incorrect.
- Give the verifier one answer at a time. The verifier reads the problem and one candidate answer, and produces one number, a score .
- Turn the score into a probability. A sigmoid maps the score to a number between and . Read that number as the verifier's estimate that the answer is correct.
- Train with cross-entropy. Compare the estimate with the label. The loss is large when the verifier is confident and wrong, and small when it is right. Gradient descent adjusts the verifier's weights to lower this loss over all labelled answers.
- Use the verifier at test time. For a new problem, sample answers, score each one, and report the answer with the highest estimated probability.
Tiny instance of step 3 and 4. Suppose the verifier has one feature, when every arithmetic check in an answer passes and otherwise, plus a bias. Start with weight and bias , so the first estimate is for every answer. A correct answer with gives an error of . After one step of size , the weight and bias both become . The new estimate for that answer is . Check: the estimate moved from toward the label , as it should.
flowchart LR A["Problem"] --> B["Generator samples N answers"] B --> C["Verifier scores each answer"] C --> D["Keep the highest score"] D --> E["Reported answer"]
The math
Step 3 in symbols: the score and the estimate
Let the verifier map a problem and an answer to a score , where is a feature vector and , are learned. The estimated probability of correctness is
Here is the sigmoid, which maps any real score into the open interval from to . The form is that of logistic regression applied to learned features .
Step 4 in symbols: the training loss
Each labelled answer has a label if the answer is correct and otherwise. The cross-entropy loss for one answer is
Over a dataset of labelled answers, training minimises the average of . The gradient of this loss with respect to the score is , so the update is and , where is the learning rate.
Step 5 in symbols: choosing among samples
Given samples for a problem , the reported answer is
If the verifier were perfect and the samples were independent with success probability each, the chance that the reported answer is correct would be the chance that at least one sample is correct:
This is the ceiling a verifier can reach. A real verifier falls short of it, and the samples are not independent.
Worked examples
- Start with and . The score is for every answer, so .
- Take a correct answer with feature . Its label is .
- Compute the loss. .
- Compute the gradient factor. .
- Update with learning rate . The weight becomes , and the bias becomes .
- Compute the new score. .
- Compute the new estimate. .
- Recompute the loss. , down from .
- Interpret. One step moved the estimate toward the correct label and reduced the loss, which is all gradient descent promises for a single example.
A verifier gives these scores to four sampled answers: .
- Convert each score with the sigmoid. .
- Continue the conversions. , and .
- Pick the largest estimate. It is , from the first candidate.
- Report that answer, and note the stakes. If the first answer was in fact wrong, its loss under cross-entropy would be . A confident wrong answer is expensive during training, which is why the loss pushes the verifier to be careful.
- Interpret. The selection did not need the estimates to be calibrated, only ordered correctly. A verifier that ranks the correct answer above the wrong ones is useful even if its numbers are off.
Suppose a generator solves a given problem correctly with probability on each independent sample, and a verifier could pick out a correct sample whenever one exists.
- Write the ceiling for samples: .
- For : , so the ceiling is .
- For : , so the ceiling is .
- Compare. Going from 4 samples to 8 doubles the compute and raises the ceiling by about .
- Interpret. The gain is real but shrinks as grows, and the number is an upper bound. Samples from one model on one problem are correlated, so the true ceiling is lower.
Try it: a generator has . How many samples are needed for the ceiling to reach ?
Answer: we need , so . Then , so samples.
Common mistakes and tradeoffs
It is tempting to think a verifier is the same as a reward model. In fact a reward model is usually trained on human preference comparisons between two answers, while a verifier is trained on whether an answer is correct. The two can be combined, but they answer different questions.
It is tempting to think a high verifier score means the answer is right. In fact the score is an estimate. A verifier can learn surface cues such as length or formatting that correlate with correctness in its training data, and then fail on answers that look different.
It is tempting to think a verifier that checks only the final answer is enough. In fact a correct final answer can come from wrong step-by-step reasoning. A process reward model scores each step and can locate the error, at the cost of step-level labels.
When to use a learned verifier: you have many answers to score, you have labels for correctness, and no exact checker exists. When not to use it: when a program can check the answer exactly, such as running unit tests or recomputing arithmetic, because an exact check is more reliable and cheaper. Alternatives include majority voting over samples, which needs no extra model but fails when the right answer is rare, and the reward-model route, which needs preference data rather than correctness labels.
History
Choosing the best of several outputs with a learned scorer is much older than language models. Reranking candidate translations or parses with a trained scoring function was common in machine translation and parsing long before 2021. The new step in the verifier work was training the scorer on whether a whole solution was correct, and then using that score to choose among many samples from a large generator.
Recap
- A solution verifier estimates the probability that a finished answer is correct, using a sigmoid over a learned score.
- It is trained with cross-entropy on answers labelled correct or incorrect, the same loss used for any binary classifier.
- At test time, sample answers (best-of-N) and keep the one with the highest estimate. The gain is bounded by for a perfect verifier.
- Its limits are surface cues and final-answer-only scoring. Read next: process reward models for step-level scoring, and reward models for the preference-trained alternative.
Check yourself
QuestionRecall: what does a solution verifier output for one answer, and what is that output read as?Show answer
QuestionComputation: a verifier gives an answer the score . What is its estimated probability, and what is the cross-entropy loss if the answer is actually correct?Show answer
QuestionWhy: why does choosing the answer with the highest score need the verifier to rank answers well, not to give exact probabilities?Show answer
QuestionApplied: a team uses a verifier trained on short arithmetic answers and then deploys it on long multi-step proofs. Give one reason its scores might mislead them.Show answer
Sources
- Karl Cobbe and co-authors, "Training Verifiers to Solve Math Word Problems", arXiv:2110.14168. https://arxiv.org/abs/2110.14168
- Charlie Snell and co-authors, "Scaling LLM Test-Time Compute Optimally", arXiv:2408.03314. https://arxiv.org/abs/2408.03314