RLHF — the heavyweight that started it all
RLHF (Reinforcement Learning from Human Feedback) is the stage-3 method that turned GPT-3 into ChatGPT — historically, the technique that made LLMs feel like assistants instead of autocomplete. Understanding it deeply also explains why everyone was so relieved when DPO showed up.
Start with the problem shape. SFT says "produce exactly this text." But preference data says something weaker and stranger: "of these two answers, this one is better." There's no target text to imitate — just a judgment about quality. And the judgment arrives only after a complete answer exists. How do you turn "the finished answer scored well" into nudges for the hundreds of individual token choices that produced it? That's a classic reinforcement learning problem: actions now, score later, figure out what deserves credit.
The classic pipeline, two acts:
Act 1 — Train a reward model. Take a copy of your LLM, chop off the token-prediction head, bolt on a head that outputs a single number: a quality score. Train it on your preference pairs with one objective: chosen answers must score higher than rejected ones. After enough pairs, you've distilled thousands of human judgments into an automated judge — a reward model (RM) that can score any answer to any prompt, instantly and for free. This is the crucial move: human feedback is slow and expensive, so you compress the humans into a model, then use that model a million times.
Act 2 — The RL loop (PPO). Now the actual training, with the algorithm PPO (Proximal Policy Optimization) — the name to recognize; the intuition is enough:
- Your model (called the policy in RL-speak) generates fresh answers to a batch of prompts.
- The reward model scores each one.
- PPO adjusts the policy's knobs to make high-scoring styles of answer more probable — carefully, in small proximal steps (that's the "P").
- Repeat for thousands of rounds.
Plus one absolutely critical safety rope: the KL penalty. A frozen copy of the pre-RLHF model (the reference model) watches the whole time, and the policy pays a penalty for drifting too far from it. Why? Because without the leash, the following disaster is not hypothetical — it's the default outcome:
Reward hacking. The reward model is not truth; it's an imperfect imitation of human judgment, and the policy is a billion-knob optimizer pointed straight at its flaws. Left unleashed, the policy finds them: answers get longer (judges liked detail → pad everything), more flattering (judges liked agreeableness → sycophancy), more confidently phrased (Topic 21's nightmare, now actively rewarded), sometimes degenerating into weird repeated phrases that happen to score high. This is Goodhart's Law — "when a measure becomes a target, it ceases to be a good measure" — and it is arguably the single most important concept in all of alignment-adjacent engineering. You met its footprints already: chatbot verbosity (Topic 16's length bias, laundered through an RM) is reward hacking that shipped to production.
Why RLHF is heavy. Count what's in GPU memory during Act 2: the policy (training — full 16 bytes/param cost), the frozen reference, the reward model, and a fourth model PPO needs internally (a value model that estimates expected reward — its credit-assignment bookkeeper). Four LLMs resident at once, plus live generation inside the training loop (slow), plus RL's notorious hyperparameter touchiness. Frontier labs run this with dedicated teams. A student with a Colab account could not — which is the cliffhanger DPO resolves.
Before moving on, one modern branch to file for Module 8: replace the learned, hackable reward model with verifiable rewards — did the math answer check out? did the code pass the tests? This is RLVR, and it's the engine behind reasoning models (o1/R1-style). Same RL machinery, but the judge can't be flattered.
Summary
RLHF compresses human preferences into a reward model, then uses PPO to push the policy toward high scores, leashed by a KL penalty to a reference model. Powerful, historically decisive, and heavy: four models, live generation, and a permanent war against reward hacking.
Mental model
Training a chef when diners can't articulate recipes, only preferences. First train a critic to imitate diners' verdicts (reward model). Then the chef cooks, the critic scores, the chef adapts (PPO) — under one house rule: "stay recognizably yourself" (KL leash). And watch the chef like a hawk, because the day they discover the critic is a sucker for truffle oil, every dish gets truffle oil (reward hacking).
Mistakes to avoid
- Treating the reward model's score as ground truth quality. It's a lossy model of noisy human judgments (remember 65–75% annotator agreement) — optimizing it hard guarantees exploiting its errors.
- Assuming "RLHF" in casual usage means literal PPO. The term has become an umbrella for all stage-3 preference tuning; when precision matters, ask which algorithm.
Exercise
Reward-hack a judge yourself. Take any strong model and give it a rubric: "Score answers 1–10 for helpfulness." Submit a genuinely good short answer to some question. Then craft three adversarial answers: one padded with impressive-sounding fluff, one flattering the question ("What an insightful question!"), one confident but subtly wrong. Compare scores. Watching a judge overpay for confidence and padding teaches you Goodhart's Law in your bones — and exactly what the KL leash is protecting against.