Concepts / Reward Models and Verifiers

Reward Models and Verifiers

A language model rarely has to produce only one answer.

  • Programming

Choosing One Answer From Several Candidates

A language model rarely has to produce only one answer. When you sample several candidate outputs for the same prompt, a practical question appears: which candidate should the system return? There are two broad options. One is to show several candidates to a person and let that person pick the one that suits them. The other is to build an automatic rule that ranks the candidates and keeps the top one. This article is about the second option, the scoring rules that let software choose.

Every rule covered here starts from the same raw material. Each token in a candidate has a probability that the model computed while generating it, so every candidate carries a trail of numbers. The methods differ in how they combine that trail into a single score. In one family of methods, they replace the trail with a separate scoring model. As you read, keep one question in mind: if two candidates have different lengths, will the scoring rule treat them fairly?

How a Whole Output Gets a Probability

The most direct selection rule is to pick the output with the highest probability. An output is a sequence of tokens, and the probability of the whole sequence is built from the per-token probabilities. The rule is that the probability of an output equals the product of the probabilities of all the tokens in it. Each new token multiplies the running total by one more factor.

Formula
Formula, step by step
  1. 1
    P(y) is the probability of the whole output y.
  2. 2
    T is the number of tokens in the output.
  3. 3
    The product multiplies one factor for each token position t from 1 to T.
  4. 4
    Each factor P(y_t | y_{<t}) is the probability of token t given all the tokens before it.

The later factors are conditional. The probability of the second token is a probability given the first token, and the probability of the third token is given the first two. The product therefore reflects the whole chain of choices that produced the sequence, not three independent guesses. Because every factor is a number between 0 and 1, each added token can only keep the total the same or make it smaller.

1 token: 0.5running probability2 tokens: 0.20.5 x 0.43 tokens: 0.10.2 x 0.5multiply by 0.4multiply by 0.5
As each new token is appended, the running probability of the whole output shrinks, because every new token multiplies the total by a factor below 1.

The diagram uses an invented three-token candidate whose token probabilities are 0.5, 0.4, and 0.5. The first token alone has probability 0.5. Adding the second token gives 0.5 times 0.4, which is 0.2. Adding the third gives 0.2 times 0.5, which is 0.1. The total went down at every step. This is why a longer output tends to have a smaller raw probability than a shorter one, even when each of its individual tokens is fairly likely.

Why the Logarithm Turns Products Into Sums

Multiplying many small numbers is awkward in practice, so working with probabilities on a log scale is easier. The key fact is that the logarithm of a product equals the sum of the logarithms. Taking the log of a sequence probability therefore turns the chain of multiplications into a chain of additions. The log probability of a sequence is the sum of the log probabilities of its tokens.

Formula
0.5log 0.5 = -0.69x 0.4+ log 0.4 = -0.92x 0.5+ log 0.5 = -0.690.1product-2.30running sum
The same three-token candidate can be scored by multiplying its probabilities or by adding their logarithms. Both routes end at the same information, but the log route is a running sum.

The before column multiplies three factors to get 0.1. The after column takes the natural logarithm of each factor and adds the results, arriving at about -2.30. This is the same quantity, because the natural log of 0.1 is about -2.30. The benefit is practical: a running sum of log values is easier to compute and keeps numbers in a comfortable range, instead of shrinking toward zero with every multiplication. The source does not specify a logarithm base, and the choice of base does not change which candidate ranks highest, so the arithmetic in this article uses natural logarithms.

Key point

Every probability lies between 0 and 1, and the logarithm of any number in that range is negative. So each token contributes a negative amount to the sum. The more tokens there are, the more negative the total tends to become. Keep this sign in mind, because it drives the length problem in the next section.

Why Raw Sums Favor Short Outputs

Once outputs are scored by summed log probability, longer outputs face a structural disadvantage. Each additional token adds another negative term, so a long candidate's total usually sits lower than a short candidate's total. If the selection rule simply took the highest sum, it would keep favoring brevity, even when a longer output is the better answer. The sum measures how many tokens there were as much as how likely each one was.

Averaging to Remove the Length Bias

The fix is to normalize by length. Dividing the summed log probability by the number of tokens gives the average log probability. This measures how strongly each token contributed on average, rather than how many tokens there were. The selection method then picks the candidate with the highest average. The source reports that this is the approach the OpenAI API uses, as of its writing.

Formula

What do you think happens?

Candidate A has 2 tokens with probabilities 0.5 and 0.4. Candidate B has 4 tokens, each with probability 0.6. Under average log probability, which candidate is selected?

  • Candidate A

  • Candidate B

Reveal answer
Answer:

Candidate B

Candidate A's average is (ln 0.5 + ln 0.4) / 2, about -0.80. Candidate B's average is 4 times ln 0.6 divided by 4, which equals ln 0.6, about -0.51. The higher average is -0.51, so B is selected even though it has more tokens.

A: 0.2selectedA: -1.61selectedA: -0.80not selectedB: 0.1296not selectedB: -2.04not selectedB: -0.51selected
Short candidate A and long candidate B are scored three ways. Raw probability and summed log probability both pick A. Average log probability picks B.

Worked Comparison of Two Candidates

Worked example

Ranking a short and a long candidate

Candidate A has 2 tokens with probabilities 0.5 and 0.4. Candidate B has 4 tokens, each with probability 0.6. Compare them using raw probability, summed log probability, and average log probability.

  1. 1
    Raw probability of A

    Multiply the token probabilities: 0.5 times 0.4 equals 0.2.

  2. 2
    Raw probability of B

    Multiply four factors of 0.6: 0.6 to the power 4 equals 0.1296.

  3. 3
    Summed log probability of A

    Add the logs: ln 0.5 is about -0.69 and ln 0.4 is about -0.92, so the sum is about -1.61. This equals ln 0.2.

  4. 4
    Summed log probability of B

    Add four copies of ln 0.6, about -0.51 each, giving about -2.04.

  5. 5
    Average log probability of A

    Divide -1.61 by 2 tokens to get about -0.80.

  6. 6
    Average log probability of B

    Divide -2.04 by 4 tokens to get about -0.51.

  7. 7
    Select the winner

    Raw probability and summed log probability both select A. Average log probability selects B, because it compares how strongly each token contributed rather than the total length-penalized sum.

Result

The rule you choose decides the winner. Average log probability selects the longer candidate B, while the two total-based rules select the shorter candidate A.

Scoring Candidates With a Reward Model

Probability-based rules depend only on the numbers the model already produced. A different family of methods uses a separate model, called a reward model, to score each candidate. The reward model examines each output and assigns it a score, and the system selects the output with the highest score. The source describes this as the same idea as the verifiers discussed in the previous section.

Candidate 1Reward modelScores for eachcandidateHighest scoreselectedCandidate 2Candidate 3scores each outputcompare and keep top
Several candidate outputs pass through the reward model, each receives a score, and the output with the highest score is selected.

The source does not describe how the reward model is built internally. What matters for selection is the interface: each candidate goes in, a score comes out, and the comparison is simply which score is highest. Because the scoring step is separate from the model that generated the candidates, it can judge outputs using criteria that the raw token probabilities do not capture directly.

Verifiers, Production Use, and Test Time Compute

The source gives several industry illustrations. Stitch Fix and Grab both select the outputs their reward models or verifiers score highly. Nextdoor reported that using a reward model was the key factor in improving the performance of its application in 2023. These examples show that the scoring step is used in production, not only in research.

OpenAI trained verifiers to help models pick the best solutions to math problems. The source reports that a verifier significantly boosted performance, and that the boost was roughly the same as a 30 times increase in model size. In the source's illustration, a 100-million-parameter model with a verifier could perform on par with a 3-billion-parameter model without one.

Selection methods also connect to test time compute, which refers to the computational resources used during inference, when the model is producing outputs rather than being trained. Allocating more compute at inference can mean generating more candidate outputs and then selecting among them. The source notes that scaling test time compute can be more efficient than scaling model parameters, citing DeepMind's research. Every selection method in this article is one way of spending that budget, because each one needs candidates to compare.

Common Errors When Comparing Candidates

  • Common mistake

    Ranking candidates by raw probability when they have different lengths

    What it looks like

    Choosing the 2-token candidate with probability 0.2 over the 4-token candidate with probability 0.1296, without asking whether the longer one is the better answer.

    Why it fails

    A raw product shrinks with every token, so length alone pushes long outputs down the ranking.

    Do this instead

    Use average log probability when comparing outputs of different lengths.

  • Common mistake

    Mixing up the summed log probability and the average log probability

    What it looks like

    Comparing a sum of -2.04 for a 4-token output against a sum of -1.61 for a 2-token output, then calling the first one a stronger candidate.

    Why it fails

    The sum still contains the length effect, so it answers a different question than the average does.

    Do this instead

    Decide which rule you are using before comparing, and divide by the token count when you want a length-fair comparison.

  • Common mistake

    Treating a more negative log value as a bigger or better score

    What it looks like

    Reading -2.04 as larger than -1.61 because 2.04 has more digits.

    Why it fails

    Log probabilities of numbers between 0 and 1 are negative, and the higher value is the one closer to zero.

    Do this instead

    Compare log values by their position on the number line, where -1.61 is greater than -2.04.

  • Common mistake

    Assuming the token probabilities are independent

    What it looks like

    Multiplying the per-token probabilities as if each token had no connection to the ones before it.

    Why it fails

    Each later factor is conditional on the earlier tokens, so the product describes a chain of choices.

    Do this instead

    Read each factor as a probability given the prefix, and interpret the whole product as the chain that produced the sequence.

  • Common mistake

    Treating a reward model score as a probability that the output is correct, when the source only describes it as a score used to pick the highest one

Practice Ranking Two Candidates

MEDIUM

Candidate C has 5 tokens, each with probability 0.7. Using Candidate A from the worked example (token probabilities 0.5 and 0.4), determine which candidate wins under raw probability, under summed log probability, and under average log probability. Explain why the answer differs between the rules.

Hints
  • Raw probability of C is 0.7 raised to the power 5. Compare it with the value 0.2 for A.
  • For summed log probability, add five copies of ln 0.7, which is about -0.36 each. Compare the total with about -1.61 for A.
  • For average log probability, divide the summed value of C by 5. Notice that this equals ln 0.7 itself.
  • The rules disagree because the two total-based rules penalize the extra tokens, while the average does not.

Key Takeaways

  • The probability of a whole output is the product of its token probabilities, so each added token multiplies the running total by a factor below 1.
  • Taking logarithms turns that product into a sum of log probabilities, which is easier to compute, and the log values for probabilities between 0 and 1 are negative.
  • Summed log probability is biased toward short outputs, because each extra token adds another negative term; dividing by the number of tokens gives the average log probability, which corrects that bias.
  • A reward model assigns each candidate a score, and the system selects the highest-scoring output; the source reports this scoring step is used in production and that verifiers improved math performance.

More concepts starting with R