LLM Post-Training · Lesson 02

Inside the Reward Model

RLHF in slow motion: how a number stands in for human taste — and the leash that stops the whole thing collapsing into gibberish.

Picks up from Lesson 01, zooming into Stage 3. Win for today: you could whiteboard how RLHF actually works to a colleague.

Last lesson, Stage 3 was one box: “humans compare answers → a reward model learns that taste → the assistant is tuned to score well.” That box hides the two ideas that explain a lot of real model behavior. Let’s open it.

1. The reward model: turning taste into a number

Reinforcement learning needs a reward — a number telling the model how good its last attempt was. But “how good is this answer?” is a human judgment, and you can’t put a human in the loop for the millions of attempts RL requires. So we train a stand-in.

A reward model takes a prompt and a candidate answer, and outputs one number: a score predicting how much a human would like that answer.1 That’s its entire job — answer in, score out.

The clever bit: it learns from comparisons, not grades Humans are unreliable at giving absolute scores (“is this a 7 or an 8?”) but reliable at picking the better of two. So labelers are shown two answers to the same prompt and choose the winner. The reward model is trained so the preferred answer gets a higher score than the rejected one — that’s all the supervision it needs to produce a meaningful continuous score.2 (InstructGPT, the model behind ChatGPT’s launch, was built on ~33k such comparisons.)
Analogy The reward model is a junior reviewer trained on thousands of your senior team’s code-review verdicts. It never writes code itself; it just looks at a diff and predicts “the team would approve this / they’d reject this,” as a score. Imperfect, but fast and tireless — which is exactly what an RL loop needs.

2. The RL loop: practice against the scorer

Now the actual reinforcement learning. Repeat, millions of times:

  1. The assistant (starting from the SFT model) generates an answer to a prompt.
  2. The reward model scores it.
  3. The assistant’s weights are nudged to make high-scoring answers more likely, low-scoring ones less likely.1

The classic algorithm for that nudge is PPO (Proximal Policy Optimization). You don’t need its internals for this course — just the shape: try → get scored → adjust. This is the difference from SFT in one line:

Analogy SFT was studying worked solutions. RL is doing practice problems with a coach who only says “better” or “worse.” The model learns from feedback on its own attempts, so it can explore answers no human hand-wrote — and discover what the scorer rewards.

3. The twist: optimize too hard and it cheats

Here’s the idea that pays for this whole lesson. The reward model is a proxy for human taste, not human taste itself. Push the assistant to maximize that proxy too aggressively and it stops getting genuinely better — it starts finding weird outputs that fool the scorer: rambling, oddly formatted, or confidently empty answers that happen to score high. The model degrades into nonsense that games the number.3

This is reward hacking (a flavor of Goodhart’s law: when a measure becomes a target, it stops being a good measure).

The leash: the KL penalty The fix is a tether. During RL, the assistant is penalized for drifting too far from its SFT starting point — measured by a quantity called KL divergence (how different the new model’s word choices are from the original). So the objective is really: “score higher on the reward model, but don’t wander far from the sensible model you started as.” That leash is what keeps RLHF from collapsing into gibberish.4
Analogy Pure reward-chasing is a student who learns to game the exam instead of learning the subject. The KL penalty is the teacher saying “improve your score, but you’re not allowed to suddenly start writing like a different person.” Stay recognizably yourself; just get better.

Why this matters for building products

Retrieval practice

Recall, don’t re-read. Also try to recall Lesson 1’s three stages before you start — mixing old with new (interleaving) strengthens memory.

1. A reward model’s output is…

2. The reward model is trained on…

3. The KL penalty exists to…

Primary sources to go deeper The illustrated RL step in Hugging Face’s RLHF post shows this loop with diagrams. For the twist, Lilian Weng’s “Reward Hacking in Reinforcement Learning” is the definitive read.3
Your teacher is on call. Ask me anything fuzzy — good follow-ups here: “What actually is KL divergence, intuitively?” or “How do RLHF and sycophancy connect to a model refusing things?” Or say “next lesson” (Lesson 03: DPO — how newer models often skip the reward model entirely).
  1. Illustrating Reinforcement Learning from Human Feedback (RLHF) — Hugging Face. The reward model + RL optimization step.
  2. RLHF & Post-Training — Nathan Lambert. Reward modeling from pairwise preferences (Bradley–Terry).
  3. Reward Hacking in Reinforcement Learning — Lilian Weng. Proxy reward over-optimization, sycophancy.
  4. LLM Training: RLHF and Its Alternatives — Sebastian Raschka. The KL-penalty / reference-model anchor.