Unit 1 of 13 · about 4 hours · explain, implement

Reinforcement learning with verifiable rewards and math, code and structured tasks

Verifiable tasks let RL train on correctness instead of preference. The reward is code, so its gating and format rules decide what the policy learns.

You'll be able to

  • Explain why RLVR replaces a learned reward model with a verification function on math, code and structured tasks, and state what the verifier checks.
  • Build a boxed-answer and unit-test reward on fixed completions, with all-pass gating and a stated partial-credit rule.
  • Compute group-relative advantages from fixed rollout rewards with a stated standard-deviation convention.

Covers

Reinforcement learning with verifiable rewardsMath, code and structured-output task environments
1

Read

In this order, only the parts listed

0 of 3 done

  1. RLVR and verifiable task rewardsRLHF Book - Reasoning, Synthetic Data, Tools and Evaluation

    The Role of RLVR: verification-function loop, math prime-sum with boxed 77 check and fib unit-test gating with all-pass to 1 else 0 plus a partial-credit variant; RL Training vs Inference-Time Scaling for the train-versus-test compute boundary; Common Practices: offline difficulty filtering with 16 samples and a 20 to 80 percent band (page read 2026-10-14)

  2. MATH subset and the RLVR reward functionBuild a Reasoning Model (From Scratch) - Chapters 3, 6 and 8

    Chapter 6, Sections 6.1.2, 6.4 and 6.6, printed pp.185-200: 12k MATH training split with MATH-500 excluded, sample_response rollouts, reward_rlvr with fallback=None so boxed format is required

    Run the verifier and reward on CPU with short prompts first. Use your GPU for the GRPO loop with a small group and short completions.

  3. Tulu 3 RLVR stageTulu 3: Pushing Frontiers in Open Language Model Post-Training

    Section 6, RLVR Recipe and Analyses, arXiv:2411.15124v5: SFT then DPO then RLVR with verifiable math and constraint rewards; read the recipe and infrastructure, not the 8B and 70B numbers as targets

2

Focus on

  • RLVR pays 1 on verified correct else 0, with all-pass gating for tests. Partial credit is a different estimand, so state which rule is used.
  • Boxed format is part of the reward when fallback=None. Track format and correctness rewards as separate terms.
  • The MATH-500 exclusion prevents train-test leakage. A verifier does not fix contaminated data.
  • RLVR revisits the same prompts for hundreds of epochs while SFT uses 1 or 2. Length growth is a side effect, not proof of reasoning.
Common mistakes · 3
  • Treating a longer trace as a better trace. Length rises under RLVR by default, so check correctness per token budget.
  • Taking the first boxed answer or a number-regex fallback as correct. The book takes the last boxed answer and requires the box when fallback=None.
  • Porting Listing 6.8 to NumPy with default ddof=0 and expecting 0.8659. NumPy gives about 1.0 (0.9998 with the same 1e-4) because the book uses unbiased torch.std.
3

Try it yourself

Closed-book, before checking anything

From a blank file, score 5 fixed math completions with boxed extraction plus grade_answer and 3 fixed code completions with all-pass unit-test gating. Then compute advantages for rewards [1.0, 1.0, 0.0, 0.0] with mean subtraction and unbiased torch.std plus 1e-4 to get [0.8659, 0.8659, -0.8659, -0.8659].
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.A fib solution passes 2 of 3 asserts under all-pass gating. What reward does it get?Answer

    0. Only all-pass gives 1. Proportional credit is a separate rule with its own gradient.

  2. 2.Why does the book set fallback=None in reward_rlvr?Answer

    A correct number outside a box then scores 0. Format compliance becomes part of the reward.

  3. 3.Compute advantages for rewards [1.0, 1.0, 0.0, 0.0] with unbiased standard deviation plus 1e-4.Answer

    Mean 0.5 and standard deviation about 0.5774 give [0.8659, 0.8659, -0.8659, -0.8659].

  4. 4.Why does RLVR run hundreds of epochs over the same prompts while SFT uses 1 or 2?Answer

    RLVR reinforces rare correct behaviors into robust ones by revisiting. SFT matches completions. Gains must still be checked on held-out prompts.

5

Practice

  • Build a Reasoning Model: verifier and RLVR reward on Qwen3 0.6B

    Chapter 3, Sections 3.4 to 3.7 with Listing 3.11 cases; Chapter 6, Listings 6.6 to 6.8; run the verifier on CPU, then the MATH-subset rollout on your GPU with a small group and short completions

    Match the Listing 3.11 grades exactly before running rollouts. Keep MATH-500 held out.

You're done when

Your verifier matches Listing 3.11 on every case, your gating and fallback choices are written down, and your hand advantages match the 0.8659 values.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section
  • RLHF Book - Reasoning, Synthetic Data, Tools and EvaluationNathan Lambert · primary

    Study Chapter 7 (reasoning and inference-time scaling), Chapter 12 (synthetic data and on-policy distillation), Chapter 13 (tool use), Chapter 14 (over-optimization) and Chapter 16 (evaluation). Build a claim map separating RLVR learning, inference-time search, on-policy distillation, tool trajectories, reward overoptimization and independent evaluation.

  • Build a Reasoning Model (From Scratch) - Chapters 3, 6 and 8Sebastian Raschka (Manning) · support

    Use Chapter 3 (a math verifier: boxed-answer extraction, normalization and equivalence checks), Chapter 6 (RLVR with GRPO on a MATH subset) and Chapter 8 (distillation from filtered rollouts) as the smallest verifier-to-distillation path on Qwen3 0.6B.

  • Tulu 3: Pushing Frontiers in Open Language Model Post-TrainingLambert et al. (Ai2, 2024) · support

    Read the RLVR section: verifiable rewards for math, instruction following and constraints, and how the RLVR stage sits after SFT and DPO. Compare its recipe with R1-Zero on what is rewarded and what is held out.

Also in this section

  • RLHF Book Course - Lectures 5, 7, 11 and 12Nathan Lambert · required

    Use Lecture 5 (the rise of reasoning models), Lecture 7 (synthetic data and modern post-training), Lecture 11 (tool use and the road to agents) and Lecture 12 (frontier model evaluation). Tie every mechanism to a distinct data and compute budget.

  • DeepSeek-R1 Technical ReportDeepSeek AI · required

    Read version 2 of the report (January 2026; the Nature 2025 paper is the peer-reviewed version): the R1-Zero and R1 training pipeline, reward design, observed behaviors and limitations. Reproduce only a reduced verifier-driven question and test whether longer sampling or selection explains the observed gain.

  • STaR: Bootstrapping Reasoning With ReasoningZelikman et al. (NeurIPS 2022) · support

    Read the generate, filter by correctness and fine-tune loop and the rationalization step. Use it as the rejection fine-tuning control that an RL method must beat at matched samples.

  • RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement LearningWang et al. (2025) · support

    Read the multi-turn trajectory formulation and the training instabilities it reports for agent RL (collapse into repetitive reasoning). Use it to design the diagnostics for a small multi-turn environment.

  • Stanford CS224R 2026 LLM RL Default Project - ExtensionStanford University · required

    Use the specification sections on SFT, IPO, RLOO, evaluation and one extension such as off-policy sampling, test-time inference, exploration, self-play or tool reasoning. Build independent code on a distinct task and respect all course restrictions.

  • Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - LLM RL Default Final ProjectUC Berkeley · support

    Read the default project for open-ended instruction following: offline DPO, IPO and AOT, online GRPO, Dr. GRPO and GSPO, and judge-based win rates against a frozen base. Use it as a second extension menu; its compute assumes cloud GPUs and a paid judge model.

  • Hands-on Modern RL - Reasoning, Agentic RL and SafetyWalking Labs · support

    Use the build-an-agentic-training-system page (a from-scratch trainer exercise), one reasoning or search control and the reward-hacking evaluation chapter selectively. Skip the pages that need API keys or several GPUs and the frontier surveys. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its code/chapterNN folders do not follow the site chapter numbers.

  • veRLByteDance · support

    Inspect the hybrid-controller architecture, worker roles, supported algorithms and examples at commit 8718ca3 after single-device losses pass. Trace one rollout from generation through reward and update, record policy lag and run only hardware-compatible examples.

  • LLM Post-Training Laboratory - Final IntegrationRoadmap-Final · required

    Finish the bounded rollout and verification queue, reasoning or tool extension, independent clean and adversarial evaluation, reward-hacking postmortem, policy-lag and throughput records, clean reproduction and one prespecified negative or positive result.

  • Reinforcement Learning CheckpointRoadmap-Final · support

    Take the checkpoint closed-note after the integrated project. Pass the estimator and state reconstruction, unseen failure diagnosis, matched-budget comparison, external evaluation and research-readiness clauses.