AlgoViz

Training reasoning models and allocating test-time compute

hard 6 min

A training reward changes the policy that will later generate answers.

Video lesson · Chapter 1 of 4

Three attempts, one chosen answer

0:00 / 3:42

Theory

Read or listen first. About 2 min.

What it is

A training reward changes the policy that will later generate answers. A verifier used during inference can instead score several candidates from an unchanged policy. These choices have different costs and failure modes. Tasks with exact or executable checks can supply verifiable rewards. Open-ended tasks often require weaker proxies whose mistakes the policy can learn to exploit.

Why it exists

In group-relative policy optimization, responses sampled for a prompt receive relative advantage estimates from their rewards. The optimizer uses these estimates with constraints on policy updates. At inference, one can spend a fixed budget on a longer attempt, multiple independent attempts or a search with verification. Test which allocation helps on the target distribution and count the verifier cost.

Spend a fixed budget on three candidate answers

Reward checker → Updated policy (reward signal). Updated policy → Candidate pool (fixed policy). Candidate pool → Verifier (candidate answers)
Reward checker → Updated policy (reward signal). Updated policy → Candidate pool (fixed policy). Candidate pool → Verifier (candidate answers)

Inside this chapter

Chapter sources
Verifiable rewards and shortcuts
A deterministic checker is valuable only to the extent its predicate matches the task. Hold out cases that expose partial solutions and score the realized outcome. Agreement with a weak checker may increase even while task correctness falls.

Reinforcement learning optimises exactly what the checker scores, so any gap between the checker and the real task becomes a target. Format-only checks reward well-formatted wrong answers; unit tests that miss edge cases reward code that passes only the tests. Keep a held-out set judged by a stricter standard, and watch for the training reward rising while that stricter score stalls or falls.

Example. An arithmetic format checker rewards the string format of all three candidates, including the two with incorrect sums. Add a numerical equality check.

Another example. A SQL agent is rewarded when its query runs without error. It learns to return SELECT 1, which always runs. Comparing result rows with a trusted answer closes the gap.

A checker that tests the outcome, not the look

With only the format check, all three candidates in the example earn reward 1, including the two wrong sums.
Group-relative learning
Sample multiple completions for one prompt, compare their rewards within the group and update the generation policy using the learning objective. If every sample has the same reward, a relative signal can provide little information for that group.

Instead of training a separate value model to say what a normal score is, group-relative methods sample several answers to the same prompt and use the group's own average as the baseline. Answers above average are reinforced, those below are discouraged. When every answer gets the same reward, whether all right or all wrong, the advantages are zero and that prompt teaches nothing, so prompt difficulty needs to sit where the model sometimes succeeds.

Example. Rewards of 0, 0 and 1 distinguish one successful approach. Three identical rewards cannot rank those three answers.

Advantage relative to the group

Ai=ri−mean⁡(r1,…,rG)std⁡(r1,…,rG)+ϵA_i=\frac{r_i-\operatorname{mean}(r_1,\dots,r_G)}{\operatorname{std}(r_1,\dots,r_G)+\epsilon}
Rewards 0, 0, 1 have mean 1/3 and standard deviation about 0.471, giving advantages of about -0.71, -0.71 and +1.41. Rewards 1, 1, 1 give 0 for all three.
Verification and budget at inference
Candidate diversity, verifier reliability and task difficulty determine the value of additional attempts. Correlated candidates can repeat the same error. Keep separate metrics for whether a correct answer was generated and whether the selector chose it.

Extra attempts help only if they are different enough to include a correct answer that a single attempt would miss, and if the selector can recognise it. Samples from one model at low temperature tend to share mistakes. A verifier with its own bias, such as preferring longer working, can pick a confident wrong candidate over a terse right one. Splitting coverage (any correct in the pool) from selection accuracy (correct one chosen) shows which part to improve.

Example. Three 300-token attempts and a 100-token verifier fit a 1,000-token budget. A verifier that favors verbosity may select the wrong candidate even when the right one exists.

Spending a 1,000-token budget
  1. 1Attempt 1: 300 tokenssum = 412
  2. 2Attempt 2: 300 tokenssum = 421
  3. 3Attempt 3: 300 tokenssum = 412
  4. 4Verifier: 100 tokensscores and picks one
  5. 5Selected answerright only if verifier is

Illustrative values. Track whether the right answer was in the pool and whether it was chosen.

Majority vote over samples
Sample several independent reasoning paths, extract each final answer and return the most common one. It needs no verifier, only answers that can be compared for equality.

Voting helps when errors are scattered and the correct answer is the most common outcome. It fails when the model is consistently wrong, because then the vote just confirms the error with more confidence. The vote share is a useful confidence signal: a 5 of 5 agreement and a 2 of 5 plurality deserve different handling.

Example. Five samples answer 42, 42, 41, 42 and 40. The vote returns 42 with three of five votes.

Five paths, one vote

Works for short exact answers. Free-form text needs a way to decide when two answers are the same.
Outcome versus process rewards
An outcome reward scores only the final answer. A process reward scores intermediate steps, which gives denser feedback but requires a reliable way to judge each step.

Outcome rewards suit tasks with exact or executable answers. Process rewards can guide search and credit assignment on long problems, but a learned step scorer is another proxy, and a policy can learn to write steps that look valid to it. Many systems use process scores to rank candidates at inference and outcome checks to train.

Example. For a multi-step proof, an outcome reward says only right or wrong at the end; a process reward can flag the step where an invalid inference first appears.

Outcome reward

  • Cheap when answers can be checked exactly
  • Hard to game if the checker is sound
  • Sparse: one signal per attempt

Process reward

  • Dense feedback on each step
  • Needs step labels or a trained step scorer
  • The step scorer itself can be gamed

How it works

Step through the idea, or press Play.

Step 1 of 4

Reward checker. Score sampled solutions

Understand it

Worked example

Spend a fixed budget on three candidate answers

  1. 1

    Score sampled solutions

    During training, compare proposed answers with the trusted task outcome and inspect systematic shortcuts.

  2. 2

    Save the post-trained checkpoint

    Relative advantages change future sampling. Freeze one revision before comparing inference strategies.

  3. 3

    Generate three bounded attempts

    Log the candidate set and remaining budget for selection. An experiment can compare this with one long attempt.

  4. 4

    Select and check an answer

    Report candidate-set coverage and final selected accuracy separately.

Follow the handoffs

In group-relative policy optimization, responses sampled for a prompt receive relative advantage estimates from their rewards. The optimizer uses these estimates with constraints on policy updates. At inference, one can spend a fixed budget on a longer attempt, multiple independent attempts or a search with verification. Test which allocation helps on the target distribution and count the verifier cost.

Coverage and selection, scored separately

CandidateTokensCorrect?Verifier scoreSelected?
A300no0.81 (long working)yes
B300yes0.64no
C300no0.55no
Verifier100
Illustrative values. Coverage succeeded (B was correct); selection failed. Fix the verifier, not the generator.

Attribute the failure

Logging the full candidate set is what makes this split possible.

Summary

The whole topic in one minute.

The set contains a correct solution. The verifier or decision rule did not select it.

In group-relative policy optimization, responses sampled for a prompt receive relative advantage estimates from their rewards. The optimizer uses these estimates with constraints on policy updates. At inference, one can spend a fixed budget on a longer attempt, multiple independent attempts or a search with verification. Test which allocation helps on the target distribution and count the verifier cost.

Sources