Unit 3 of 9 · about 5 hours · implement, measure
Reward-model loss, held-out ranking accuracy, calibration and slices
A reward model that orders pairs well can still fail policy optimization through tiny margins, shifted scales or length bias. Training and evaluation must measure all three before any policy update.
You'll be able to
- Implement the pairwise loss with a last-token scalar head and train one epoch on a tiny preference set on CPU first.
- Measure held-out pairwise accuracy, mean and median margin and reward-length correlation on prompt-split data.
- Distinguish ranking accuracy from score calibration, using Maximum likelihood and MAP estimation and the calibration and ranking units you already did.
Covers
Read
In this order, only the parts listed
0 of 4 done
- Reward-model architecture, training and first full protocolRLHF Book - Reward Models, Preferences and Evaluation
The Default Reward Model Architecture (last-token scalar head); Implementation Example (
BradleyTerryRewardModelwith last non-padding hidden state); one-epoch training practice; Suggested Experiments item 1 (train a Bradley-Terry model on UltraFeedback withreward_models/configs/preference_rm.yaml) - Reward-model data splits, scale and acceptance checksHands-on Modern RL - RLHF Evaluation and Process Rewards
Step 2: Data Splitting By Prompt (
split_by_prompt); Reward Scale (RewardNormalizeron a fixed calibration set); What to Look At (rm_eval_metricswith accuracy, margins and length correlation); Adversarial Testing stress cases (page read 2026-10-14) - First large-scale comparison-trained reward modelLearning to Summarize from Human Feedback
arXiv:2009.01325v3, Sections 1 to 3 (comparison collection, reward training, policy optimization) and the human-evaluation protocol with the length analysis
- Reward-model metrics and their course targetsHands-on Modern RL - RLHF Evaluation and Process Rewards
Per-Stage Metrics: pairwise accuracy with a typical 65 to 75 percent course target (annotators agree only about 80 percent), reward margin, and a reward-length correlation above 0.5 in absolute value as a length-hacking signal (page read 2026-10-14)
Treat the targets as course guardrails for small runs, not constants that transfer across rubrics.
Focus on
- Read the loss as maximum likelihood over chosen and rejected pairs, as in Maximum likelihood and MAP estimation. The head reads the last non-padding hidden state and one scalar leaves the model per sequence.
- Split by prompt, never by pair. Pairs from one prompt scattered across train and held-out sets share prompts and responses, which inflates accuracy.
- Report accuracy with the margin distribution and the reward-length correlation. Tiny margins give PPO a weak noisy signal even at acceptable accuracy, and strong length correlation means the data taught longer-is-better.
- Fix the reward scale on a calibration set before policy training. Batch statistics drift with the actor, while scores such as 2 versus 1 and 20 versus 10 order identically but drive PPO differently.
Common mistakes · 3
- Chasing 100 percent held-out accuracy. Humans disagree on many pairs: on a subset of its summarization comparisons, Stiennon et al. measured labeler-researcher agreement at 77 percent and researcher-researcher agreement at 73 percent. Near-perfect accuracy on human labels points to a leaky split or overfitting.
- Reading large margins as calibration. A large gap can come from overfitting, and ranking accuracy never promises calibrated probabilities; use Calibration curves and Platt or isotonic recalibration and ROC AUC, average precision, log loss and Brier score where probabilities matter.
- Training past one or two epochs by default. Preference sets are small relative to backbone size, so validation accuracy usually peaks early and then drops.
Try it yourself
Closed-book, before checking anything
[2.0, 0.2, 1.0, 0.0] and rejected rewards [0.5, 0.1, 1.5, -0.5]: margins [1.5, 0.1, -0.5, 0.5], accuracy 0.75, mean margin 0.4 and mean loss 0.5735. Then state the split, scale and slice checks that must pass before PPO.Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Why must the held-out split separate prompts rather than pairs?Answer
Pairs from one prompt share the prompt and often share responses. Splitting pairs leaks both sides of the distribution into training, while a prompt split tests generalization to unseen prompts.
2.Accuracy is 0.90 but the median margin is 0.05. Should PPO start?Answer
No. Ordering without separation gives a weak noisy reward signal. Inspect the margin distribution, check for overfitting, and fix the data before optimizing.
3.Reward-length correlation is 0.8 on held-out pairs. What caused it and what is the fix?Answer
Chosen responses are systematically longer, so the model learned longer-is-better. Add rejected long-filler pairs against concise chosen answers and retrain, as the data-flywheel fix describes.
4.Two reward models output (2, 1) and (20, 10) on the same pair. Do they agree, and does PPO behave the same?Answer
They order the pair identically but drive PPO differently: the small scale is drowned by the KL penalty and the large scale dominates it. Normalize on a fixed calibration set first.
Practice
- Hands-on Modern RL 13.4: prompt split, normalizer and RM metrics on tiny local pairs
Run
split_by_prompt,RewardNormalizerandrm_eval_metricson a few hand-written pairs, then run the Adversarial Testing stress cases (page read 2026-10-14)Runs on CPU. Report accuracy, mean and median margin and length correlation, plus which stress case outscores a correct terse answer.
- RLHF Book Suggested Experiment 1: train a Bradley-Terry model on UltraFeedback
uv run python -m reward_models.train_preference_rm --config reward_models/configs/preference_rm.yamlon a copy of the YAML withsamplesandmodel_idlowered firstPlan on your GPU: the YAML defaults to
device: cuda, a 0.6B backbone and W&B logging, so setuse_wandb: falsein the copied YAML for an offline run. Watch the chosen and rejected margin in the logs before any policy training.
You're done when
Your tiny CPU run reports accuracy, margins and length correlation on a prompt split, and you can reject a high-accuracy model for collapsed margins or length bias with numbers.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 7 more in the section
- RLHF Book - Reward Models, Preferences and EvaluationNathan Lambert · primary
Study Chapter 5 (reward modeling: Bradley-Terry loss, outcome, process and generative reward models), Chapters 10 and 11 (preferences and preference data), Chapter 14 (over-optimization) and Chapter 16 (evaluation). Implement the pairwise reward loss, compare outcome, process and generative reward roles, and build an adversarial feedback audit covering preference bias, reward shift and overoptimization.
- Learning to Summarize from Human FeedbackStiennon et al. (NeurIPS 2020) · support
Read the reward-model and policy-training protocol, the KL penalty and the length analysis. Use it as the first full example of a reward model trained on comparisons and then optimized against.
- Hands-on Modern RL - RLHF Evaluation and Process RewardsWalking Labs · support
Use the outcome-versus-process page (its discounted ORM and PRM returns are worth recomputing by hand) and the process-reward and search chapter as an implementation map for verifier tests. Check claims against the original sources. 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 2, 8 and 9Nathan Lambert · required
Use Lecture 2 (instruction tuning, reward models and rejection sampling), Lecture 8 (preferences and preference data) and Lecture 9 (over-optimization). Reproduce the reward-data-to-score path and keep rejection sampling as a non-RL selection baseline for later online optimization.
- Deep Reinforcement Learning from Human PreferencesDeepMind and OpenAI · required
Study the preference-query, reward-learning and policy-optimization loop. Reproduce a tiny preference model or simulator and measure how label noise or policy shift changes reward accuracy and control quality.
- Scaling Laws for Reward Model OveroptimizationGao, Schulman and Hilton (ICML 2023) · required
Read the gold-reward setup and the proxy-versus-gold curves for best-of- and RL as the KL distance grows. Reproduce the shape at toy scale: a small proxy reward model, a known gold reward and best-of- selection.
- Let's Verify Step by StepLightman et al. (2023) · support
Read how process supervision labels steps, how the process reward model scores a solution and how outcome and process supervision compare under best-of- selection. Define step boundaries for your own task before training any process scorer.
- Constitutional AI: Harmlessness from AI FeedbackAnthropic · support
Study supervised self-critique, AI preference feedback and RL from AI feedback. Implement a bounded rubric-conditioned comparison exercise and test judge correlation and principle ambiguity rather than reproducing the full pipeline.
- Stanford CS224R 2026 - Reward LearningStanford University · support
Study Lecture 08 (reward learning,
slides/08_cs224r_reward_learning_2026.pdf) with its Christiano et al. reading, and Section 1.2 of the default project guidelines for preference and verifier datasets. Use fixed chosen and rejected examples and a hidden adversarial split; write independent implementations. - LLM Post-Training Laboratory - Reward and Adversarial EvaluationRoadmap-Final · required
Complete the pairwise reward model, held-out and calibration analysis, deterministic verifier, judge-bias audit, reward-hacking probes and the required case where proxy reward improves while independent behavior worsens.