Part XVII — LLM Post-Training: SFT, DPO, GRPO & Reasoning / Test-Time Compute · Chapter 10

Train a reasoning model using GRPO & verifiable rewards

Hook

Two chapters back, RLVR replaced a learned reward model with a verifier that just checks the answer. One chapter back, GRPO replaced a learned critic with the group's own mean and standard deviation. Training a reasoning model isn't a third idea on top of those two — it's just running both, back to back, on one batch of sampled responses.

Intuition

What is 12 x 7? (correct answer: 84)

Five responses, sampled from the same policy, to one arithmetic problem. Step through them — each one gets checked against the true answer exactly, no reward model anywhere in the loop.

Formalize

One training step, two formulas, no new machinery:

ri=1[verify(yi)=correct]Ai=rimean(r1,,rG)std(r1,,rG)r_i = \mathbb{1}[\,\text{verify}(y_i) = \text{correct}\,] \qquad\qquad A_i = \frac{r_i - \text{mean}(r_1,\dots,r_G)}{\text{std}(r_1,\dots,r_G)}
  • yiy_i — sampled response ii from the current policy, one of GG responses to the same prompt.
  • rir_i — RLVR's reward for response ii: exactly 11 if the verifier accepts it, 00 otherwise.
  • AiA_i — GRPO's advantage for response ii: reward normalized against the group's own mean and standard deviation.
  1. Sample a group

    Draw GG responses to one prompt from the policy being trained — here, G=5G=5 responses to one arithmetic problem.

  2. Verify each one (RLVR)

    Check every response against ground truth with an exact-match verifier. No reward model fit on preference data, nothing to reward-hack.

  3. Normalize within the group (GRPO)

    Turn those binary rewards into advantages using the group's own mean and standard deviation as the baseline — no critic network trained anywhere.

Play

Same 5 responses, two views. The reward bars are flat and binary — four 11s, one 00. The advantage bars are not: the four correct responses each get a modest +0.5+0.5, but the one wrong response gets 2.0-2.0 — four times the magnitude, purely because being wrong was rare in this group. That reshaping is GRPO's entire contribution, applied directly to RLVR's output.

Worked example

Five sampled responses to "What is 12 x 7?" (correct answer: 8484): four answer "8484", one answers "9191".

  1. Verify (RLVR)
    • "8484" appears four times → reward 11 each
    • "9191" → wrong → reward 00

    Rewards: [1,1,1,1,0][1, 1, 1, 1, 0].

  2. Group statistics
    • Mean =(1+1+1+1+0)/5=4/5=0.8= (1+1+1+1+0)/5 = 4/5 = 0.8
    • This is a Bernoulli group, so variance =0.8×0.2=0.16= 0.8 \times 0.2 = 0.16
    • std=0.16=0.4\text{std} = \sqrt{0.16} = 0.4
  3. Advantage (GRPO)
    • Each correct response: A=(10.8)/0.4=0.5A = (1-0.8)/0.4 = 0.5
    • The one wrong response: A=(00.8)/0.4=2.0A = (0-0.8)/0.4 = -2.0
  4. Nothing else was trained

    No reward model, no value network — every number above came from a verifier and five samples' own statistics.

Checkpoint

Find the response the verifier marks wrong -- the one with the most negative GRPO advantage.

Pick a response to try it
Summary
ri=1[verify(yi)=correct]Ai=rimean(r1,,rG)std(r1,,rG)r_i = \mathbb{1}[\,\text{verify}(y_i) = \text{correct}\,] \qquad\qquad A_i = \frac{r_i - \text{mean}(r_1,\dots,r_G)}{\text{std}(r_1,\dots,r_G)}

This is the whole recipe behind training a model like DeepSeek-R1 to reason: sample a group of responses, verify each one exactly wherever a verifier exists, and normalize those rewards against the group's own statistics instead of a trained critic's guess. Nothing here is new — it's RLVR's verifier feeding GRPO's advantage, on one batch of samples, repeated across many batches until the policy reliably produces verifiably correct reasoning.