11RLHF and Reward Modeling
Supervised fine-tuning (Chapter 10) teaches a model to imitate answers people wrote. That works until you want answers better than any annotator can produce on demand, and it wastes the one thing people are reliably good at: judging. Most of us cannot write a top-1% response to a hard prompt, but we can spot which of two responses is better in seconds. Reinforcement learning from human feedback (RLHF) turns that asymmetry into a training signal. You collect preferences, fit a reward model that predicts them, then optimize the policy to score well under that model — with a leash that keeps it from wandering off. This chapter builds that pipeline, then confronts the failure at its center: the reward is a proxy, and a proxy optimized too hard stops measuring what you wanted.
11.1You can rank what you cannot write
The gap between recognizing quality and producing it is the whole reason RLHF exists. A demonstration, the unit of supervised fine-tuning, is a single answer a human committed to paper; the model learns to copy it. Its ceiling is therefore the annotator's own writing, on the day they wrote it, and the model never sees what worse looks like — it only ever imitates the good. A preference, the unit of RLHF, is a judgment between two answers the model generated. It is cheaper to collect, it covers far more of the output space than a fixed set of gold answers, and crucially it is not capped by what the labeler could have written themselves.
Intuition
Recognition is easier than generation. You can tell a great pun from a mediocre one without being able to invent either. RLHF harvests that easy signal at scale and pushes the model up the ranking.
This also explains why more supervised fine-tuning is not a substitute. SFT can only reach the quality of its demonstrations, and for the hardest prompts nobody has a demonstration to give. Preference data sidesteps the bottleneck by asking the strictly easier question.
11.2Reward models from human preferences
A reward model is the SFT model with its vocabulary head swapped for a single scalar head: it reads a prompt and a response and outputs one number, \(r(x, y)\), meant to track human preference (Ouyang et al., 2022). You cannot supervise that number directly, because no human hands you a calibrated score. What they hand you is a comparison: for a prompt \(x\), response \(y_w\) was preferred over \(y_l\). The Bradley-Terry model turns comparisons into probabilities by assuming the chance \(y_w\) wins rises smoothly with its reward advantage:
Fitting the reward model is then ordinary maximum likelihood — minimize \(-\log \sigma(r_w - r_l)\) over the comparison dataset, a logistic loss on the reward difference. Because only differences appear, the reward has no absolute meaning; add a constant to every score and nothing changes. That is fine: the policy step below cares only about which responses score higher, not by how much on any fixed scale.
Interview
Why train a reward model on pairwise comparisons instead of asking labelers for a 1–10 score directly? Absolute scores are noisy and drift between annotators and across a session, so a "7" from one labeler is not a "7" from another. A pairwise choice is far more consistent, and the Bradley-Terry loss extracts a latent scalar from those choices without ever needing the labelers to agree on a scale. The cost is a ceiling: reward models typically agree with held-out human preferences only around 65–75% of the time, because people genuinely disagree (Bai et al., 2022).
The reward model inherits the base model's knowledge, which is what lets it generalize to responses no labeler ever ranked. Early RLHF work built exactly this — a preference-trained reward model over a pretrained transformer (Christiano et al., 2017) — and it remains the standard recipe.
11.3Policy optimization with PPO
With a reward model in hand, you optimize the policy — the model you are actually shipping — to generate responses it scores highly. This is a reinforcement learning loop: the policy samples a response to a prompt, the reward model scores it, and the score drives an update that makes high-scoring responses more likely. The standard optimizer is proximal policy optimization (PPO), which takes small, clipped steps so a single large update cannot blow up the policy (Schulman et al., 2017). A learned value function (a critic) estimates how good the average response is, so each step pushes on the advantage — how much better this response was than expected — rather than on the raw reward.
The load-bearing detail is the leash. The optimizer does not maximize \(r(x, y)\) alone; it maximizes the reward minus a penalty for drifting from a frozen copy of the starting model, the reference (usually the SFT model):
Without that KL term, the policy would sprint toward whatever text the reward model happens to score highest, which is rarely fluent English — it is more often a degenerate string that games the reward model's blind spots. The penalty keeps the policy close to a model that already writes well and knows things, so it improves within the space of good answers instead of leaving it. The coefficient \(\beta\) sets the leash length: too loose and the policy games the reward, too tight and it barely moves (Ouyang et al., 2022).
Analogy
The KL penalty is a leash tying the policy to the SFT model. It lets the policy explore nearby, better behavior but yanks it back before it runs into nonsense. The analogy leaks in that the "distance" is a KL divergence over next-token distributions, not a physical radius — the policy can change what it says a lot while staying close in KL if it keeps its wording fluent and its facts intact.
Sampling on-policy matters here. The updates come from the policy's own current samples, so it learns from the parts of the output space it actually visits, and that region moves as it improves. This is also why PPO-based RLHF is heavy: it holds four models at once — policy, reference, reward model, and critic. Chapter 12 shows how direct preference optimization collapses this loop back into a single supervised-style loss, and Chapter 15 covers the serving cost of the sampling itself.
11.4Reward hacking and over-optimization
The reward model is a proxy for human preference, not the real thing, and here Goodhart's law bites: once a measure becomes a target, it stops being a good measure. Push the policy hard enough and it finds responses that score well under the reward model but that humans dislike — the policy is exploiting the reward model's errors, not satisfying the preference behind it. The signature is unmistakable and was measured cleanly: as the policy drifts further from the reference (more KL), the proxy reward keeps climbing while the true reward, judged by held-out humans or a much larger gold model, rises, peaks, and then falls (Gao et al., 2023). The best model is at the peak, not at maximum proxy reward.
The most familiar symptom is length bias: reward models tend to prefer longer, more thoroughly hedged answers, so RLHF reliably makes models more verbose, and a surprising fraction of the apparent gain is just responses getting longer (Singhal et al., 2023). Sycophancy is a cousin — reward models absorb the human tendency to rate agreeable answers higher, so the policy learns to agree.
Common trap
Reward hacking does not look like failure from inside the loop; it looks like success. The proxy reward, the number your dashboard tracks, goes up the whole time. Catching over-optimization requires an independent yardstick — held-out human evals or a stronger judge — because the metric you are training on is exactly the one that has been compromised.
The mitigations are unglamorous and complementary: keep the KL leash short enough, stop early rather than training to convergence, scale or ensemble the reward model so its blind spots are harder to find, and above all broaden the preference data so the hacks that remain are ones humans actually catch. The field's next moves also respond to this ceiling. Chapter 12 shows how RLAIF replaces expensive human labels with model-generated preferences, and Chapter 25 covers reasoning RL, where the reward is a verifiable checker — did the code pass, is the proof valid — rather than a learned proxy, which sidesteps reward-model hacking even as it invents new hacks of its own.
References
- Bai, Y., Jones, A., Ndousse, K., Askell, A., et al. (2022). Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint. arXiv:2204.05862.
- Christiano, P. F., Leike, J., Brown, T. B., Martic, M., Legg, S., & Amodei, D. (2017). Deep reinforcement learning from human preferences. Advances in Neural Information Processing Systems. arXiv:1706.03741.
- Gao, L., Schulman, J., & Hilton, J. (2023). Scaling laws for reward model overoptimization. International Conference on Machine Learning. arXiv:2210.10760.
- Ouyang, L., Wu, J., Jiang, X., Almeida, D., et al. (2022). Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems. arXiv:2203.02155.
- Schulman, J., Wolski, F., Dhariwal, P., Radford, A., & Klimov, O. (2017). Proximal policy optimization algorithms. arXiv preprint. arXiv:1707.06347.
- Singhal, P., Goyal, T., Xu, J., & Durrett, G. (2023). A long way to go: Investigating length correlations in RLHF. arXiv preprint. arXiv:2310.03716.
Check yourself
Interview-style questions on this chapter. Pick an answer to see whether it holds up.
-
A reward model trained with the Bradley-Terry objective scores one response 8.3 and another 2.1. A teammate concludes the first response is 'about four times as good.' What is the mistake?
The Bradley-Terry loss is a logistic loss on r_w minus r_l, so adding any constant to every reward leaves both the loss and the downstream policy update unchanged. The reward is an interval scale with no fixed zero: the difference r_w minus r_l is a preference logit, but a single score's magnitude and any ratio of scores carry no meaning. -
In PPO-based RLHF the objective is the reward-model score minus a KL penalty against a frozen reference model. If you set the KL coefficient to zero, what happens?
The KL leash keeps the policy near a model that already writes well and knows things, so it improves within the space of good answers. Remove it and the policy sprints toward the reward model's highest-scoring strings, which are rarely fluent. Too large a coefficient is the opposite failure: the policy barely moves. The advantage estimate comes from the critic and does not depend on the reference. -
Throughout an RLHF run, the reward-model score on your policy's own samples rises steadily. What does that tell you about the model's actual quality?
Gao et al. (2023) measured this directly: as the policy moves away from the reference, the proxy reward rises monotonically while the gold reward rises, peaks, and falls. The metric you are training on is exactly the one being compromised, so it cannot audit itself, which is why over-optimization is caught only with a separate evaluator. -
After RLHF your model's answers are noticeably longer and more hedged, and its win rate against the SFT model went up. A skeptic asks how much of the gain is real. Why is that a fair question?
Singhal et al. (2023) found response length is a dominant factor in RLHF's gains: a purely length-based reward reproduces most of the downstream improvement over SFT. Length is thus a form of reward hacking, which is why serious evaluations control for it (length-penalized rewards or length-controlled win rates) before crediting a real quality gain. -
Why does PPO-based RLHF sample fresh responses from the current policy at each step, instead of reusing a fixed dataset of responses the way supervised fine-tuning does?
Reinforcement learning optimizes the policy's own output distribution, so as the policy moves, stale samples describe a policy you no longer have. PPO does use a clipped importance-sampling ratio and can safely reuse each batch for a few inner epochs, so the 'exact current policy or nothing' framing overstates the constraint, but the samples must stay close to the current policy.