Unit 10 of 10 · about 4 hours · measure
Rollout compute accounting and learned change versus inference-time selection
More samples almost always score higher. Without accounting, selection looks like learning and papers look like your results.
You'll be able to
- Account rollout tokens, verifier calls, latency and compute for a sampling run in a budget table.
- Separate learned policy change from inference-time selection (best-of-N, self-consistency, search) at matched compute.
- State which reported numbers are your measurements and which are paper setups you cite.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Test-time versus training-time scalingRLHF Book Course - Lectures 0 and 1
Slides 54 and 55 of 70 (verifiable rewards and the Classical/RLHF/RLVR table) with slides 57 to 59 of 70 (the o1-preview scaling plot, o1 test-time scaling and o1 training-time scaling)
- Elicitation and frontier compute numbersRLHF Book - Introduction, Training Overview and Instruction Tuning
An Intuition for Post-Training: the elicitation theory with the DeepSeek R1 numbers (147K H800 GPU hours RL against 2.8M pretraining) and the Olmo 3.1 run (4 weeks on 200 GPUs)
- Rejection sampling as selection baselineRLHF Book - Introduction, Training Overview and Instruction Tuning
Training Process Step by Step (generate, score, fine-tune on selected completions) and Related: Best-of-N Sampling: selection without weight updates
- Measurement contractLLM Post-Training Laboratory - Baseline and State Contract
Milestones B and E with Measurement requirements: tokens per second, rollout and update queues, invalid and failure counts, and matched or disclosed budgets
Focus on
- Count everything selection spends: prompt plus completion tokens per draw, number of draws, verifier or reward calls, and latency. Verifier calls are compute too.
- Learned change moves weights and persists across prompts; selection spends compute per prompt and vanishes with it. Compare them only at matched total sampling budget.
- Do the accounting on pre-generated rollouts on CPU first. A live update loop comes second and stays conditional on your GPU.
- Frontier GPU-hour figures are the paper's setup on the paper's hardware. Cite them with the setup named; your table holds your measurements.
Common mistakes · 3
- Comparing a best-of-4 policy against a greedy baseline and calling the gap learning. The gap is selection over 4 draws; the fair baseline samples 4 too.
- Omitting verifier cost from the budget. A verifier call per rollout can dominate short completions and flips which method is cheaper.
- Presenting DeepSeek or Olmo GPU hours as your plan. Those figures bound what is possible at frontier scale; your evidence is your measured tokens, calls and latency.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Why must the best-of-N baseline match the RL method's total draws rather than its greedy output?Answer
Best-of-N gains come from taking the max over draws. Matching draws equalizes the selection advantage, so any remaining gap must come from the policy itself.
2.A run reports higher reward with 4 times the rollouts and no baseline. What is missing?Answer
A matched-compute control: the same budget spent on best-of-N or self-consistency with the starting policy. Without it, sampling explains the gain.
3.Where do verifier calls appear in the budget table, and why separately from tokens?Answer
As calls per rollout beside token counts. They scale with draws rather than length, use different hardware, and can dominate short-completion costs.
4.Self-consistency over 3 samples beats one RL-finetuned greedy decode. Which do you ship?Answer
Neither on that evidence alone. The comparison mixes 3 draws against 1; rerun both at matched draws, then weigh persistent weight change against per-prompt selection cost.
You're done when
Your budget table accounts every token and verifier call, and every claimed improvement names the matched-compute selection baseline it beat.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 7 more in the section
- RLHF Book - Introduction, Training Overview and Instruction TuningNathan Lambert · primary
Study Chapter 1 (introduction), Chapter 3 (training overview: problem formulation and canonical recipes), Chapter 4 (instruction tuning: chat templates and implementation details) and Appendix A (definitions) at https://rlhfbook.com/c/. Map every RLHF component into the track trajectory schema, then implement assistant-only sequence log probabilities and completion masks against hand examples.
- RLHF Book Course - Lectures 0 and 1Nathan Lambert · required
Watch Lecture 0 (the ML foundations of post-training, including KL) and Lecture 1 (overview of Chapters 1 to 3), with slides under https://rlhfbook.com/teach/course/. Produce a component and state-ownership diagram tied to executable tests, not a second set of general notes.
- LLM Post-Training Laboratory - Baseline and State ContractRoadmap-Final · required
Build or reuse the laboratory frozen base, SFT and evaluation baseline plus immutable tokenizer, template, model, policy and rollout manifests. Complete fixed log-probability, mask and state-identity tests only in this stage.
Also in this section
- Training Language Models to Follow Instructions with Human FeedbackOpenAI · required
Study the demonstration, comparison, reward-model and PPO pipeline plus evaluation design. Reconstruct the data and policy dependencies and state which results cannot be inferred from the paper at small scale.
- KL Estimators - Schulman's Note and the RLHF Book CodeJohn Schulman; Nathan Lambert · required
Read John Schulman's note "Approximating KL Divergence" (on joschu.net, linked from the code) for the three Monte Carlo estimators , , and their bias and variance, then the
approx_kl1,approx_kl2andapprox_kl3functions in this file at commit 1042143. Compute all three on sampled tokens from two small policies whose exact KL you know, and say which one each library you use reports. - Berkeley CS 185/285 Deep Reinforcement Learning (Spring 2026) - LLM RLUC Berkeley · support
Slides are public at https://rail.eecs.berkeley.edu/deeprlcourse/static/slides/lec-N.pdf; current videos are not, and the public Fall 2023 playlist numbers lectures differently. Study Lecture 14 (LLM RL) for the language-model-as-policy formulation and how it maps onto the policy-gradient lectures.
- Build a Reasoning Model (From Scratch) - Chapters 2 to 5Sebastian Raschka (Manning) · support
Use Chapter 2 (loading Qwen3 0.6B and a minimal generation function), Chapter 4 (temperature, top-p and self-consistency) and Chapter 5 (token probabilities to log probabilities and sequence scores) as a code companion for log-probability, mask and inference-policy oracles. Chapters 2 to 5 run on a CPU.
- Stanford CS224R 2026 LLM RL Default ProjectStanford University · support
Read Sections 1.1 through 1.4 for the Countdown task, distinct SFT, preference and verifier datasets, objective boundaries and evaluation. Use it as a design specification and write independent code; do not submit, copy or publish Stanford course solutions.
- Hands-on Modern RL - Chapter 13 RLHF PipelineWalking Labs · support
Use the base-model-to-assistant page and the PPO-RLHF loop page for the pipeline and the token-level ratio, clip and KL order of operations. Its KL sketch is the simple log-ratio difference; audit masks and log probabilities independently and defer scale engineering to RL-12. Pin commit 9231bab of walkinglabs/hands-on-modern-rl; its
code/chapterNNfolders do not follow the site chapter numbers. - TRL GRPO Trainer - KL estimation and lossHugging Face · reference
Read Estimating the KL divergence for the k3 formula with the reference-over-policy ratio, and the default KL-coefficient note. Use it as the correct-ratio reference beside the RLHF Book code estimators.