Unit 5 of 10 · about 4 hours · explain
Policy, reference, critic, reward and verifier roles, and SFT as initialization
Swapping two roles (reference versus policy, critic versus reward) compiles fine and trains the wrong objective.
You'll be able to
- Assign each tensor in an RLHF step to exactly one of policy, reference, critic, reward model or verifier.
- Explain SFT as behavior-cloned initialization and why RL starts from it rather than the base model.
- Track base, SFT, reference and trainable-policy identity across stages, naming what is frozen.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Three steps and the recipe walkthroughRLHF Book - Introduction, Training Overview and Instruction Tuning
RLHF in Three Steps and Walkthrough of an RLHF Recipe: SFT foundation, reward model as scalar signal, RL stage shifting parameters toward good tokens
- Four collaborating rolesHands-on Modern RL - Chapter 13 RLHF Pipeline
The four-role table (Actor/policy, frozen SFT Reference, Reward, Critic) with The Role of the Reference Model (page read 2026-10-14)
- SFT initialization and the KL coefficientTraining Language Models to Follow Instructions with Human Feedback
Section 3.5 (demonstration, comparison, PPO steps) with Appendix C.4 of arXiv:2203.02155v1: RL policies initialize from SFT, the KL reward uses the same SFT model, , 256k episodes over about 31k prompts
- SFT objective and checkpoint reuseStanford CS224R 2026 LLM RL Default Project
Sections 1.2.5 and 1.3.1 (pp. 6 and 7): dataset roles, the completion-only SFT objective eq. 6, and the official SFT checkpoint for later stages
Read as a design specification. The course action items are not your assignment.
Focus on
- Policy acts and learns. Reference is a frozen copy that only scores drift. Reward model (or verifier) scores outcomes and never supplies gradients directly. Critic predicts values to cut variance and is the only role that may need training alongside the policy.
- SFT is behavior cloning on demonstrations: same next-token loss as pretraining, loss on completions only. It installs the assistant format that RL then refines.
- Identity is a chain: base model, SFT checkpoint, reference frozen from SFT, policy initialized from SFT. After the first RL step the policy is no longer the reference.
- This sharpens the earlier behavior-cloning unit (reinforcement-learning/deep-imitation-offline-ope/behavior-cloning-likelihood): SFT inherits its compounding-shift limits, which is why on-policy RL stages follow.
Common mistakes · 3
- Letting the reference track the policy. The KL term then measures drift from a moving target and stops constraining anything.
- Starting RL from the base model. Without the SFT format prior, sampling wastes budget on non-answers and the reward signal drowns in format noise.
- Merging the critic and the reward model. The reward model is frozen outside the update; the critic is trained inside it, costs memory, and needs its own targets.
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.Which roles need gradients in PPO-style RLHF, and which are frozen?Answer
Policy and critic train. Reference and reward model are frozen. The verifier is fixed code or a fixed model outside training entirely.
2.Why does InstructGPT compute the KL reward against the SFT model rather than the base model?Answer
The SFT model is the optimization start point with the assistant format. KL against it preserves that format while reward chasing; KL against base would permit forgetting instruction following.
3.SFT and the start of RL share an objective on completions. What changes at the RL stage?Answer
SFT imitates fixed demonstrations per token. RL samples its own completions and reinforces them by outcome score, so the data distribution follows the policy instead of the demonstration set.
4.Where does the value network initialize, and why does the choice matter?Answer
Commonly from the reward model (InstructGPT and Tulu 3) or from the SFT checkpoint with a fresh value head. A random start delays convergence because early value predictions, and hence advantages, are noise.
You're done when
You can label every model call in an RL step with its role, checkpoint and frozen-or-trainable status.
Only when you can do this without notes.
Leads to
Notes
Resources · 4 for this unit, 6 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.
- 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.
- 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.
Also in this section
- 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.
- 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.
- 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.
- 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.