Home / Fundamentals / Post-training & Alignment

Post-training & AlignmentSeniorQuestion 4 of 7

How is a reward model trained, and how do you detect and prevent reward hacking?

30-second answer

Collect preference comparisons and train the SFT model with a scalar head under the Bradley–Terry loss −log σ(r(x, y_w) − r(x, y_l)). Its accuracy on held-out pairs is typically only 65–75%, and optimizing hard against it exploits its errors: longer answers, sycophancy, confident tone, formatting tricks. Gold-reward quality rises then falls as the policy moves away (in KL) from the reference. Prevent it with a KL penalty, early stopping on a held-out gold judge, reward-model ensembles, length control, refreshing the reward model on new policy samples, rule-based or verifiable rewards where possible, and reading samples.

Try answering out loud before reading on. The walkthrough below is paced for a 40-minute interview round.

0–5 min Clarify and frame

Framing: "I'll cover preference data, the Bradley–Terry model and training details, how good reward models are, then reward hacking: what it looks like, why it happens, and how to detect and prevent it."

5–15 min Core explanation

Data: prompts from real usage and targeted categories; two or more responses sampled from current policies (diversity matters); labels from trained annotators following guidelines, or AI judges following written principles (RLAIF / constitutional approaches). Collect ties and "both bad" labels, and per-aspect ratings (helpfulness, honesty, harmlessness) when useful.

Model: usually the SFT model with the LM head replaced by a scalar head, reading the final token's hidden state.

Loss (Bradley–Terry):

L = −E[ log σ( r(x, y_w) − r(x, y_l) ) ]

Details:

  • Only differences are learned; normalize rewards (e.g. zero-mean on a reference set) before RL.
  • One epoch is common; reward models overfit quickly.
  • Margin terms when labels have strength ("much better").
  • Held-out pairwise accuracy is typically ~65–75%, bounded by annotator agreement.

15–25 min Deep dive: reward hacking

The policy optimizes the proxy r_φ, not the true objective. Pushed hard, it finds inputs where the reward model is wrong.

Overoptimization curve: as the policy moves away from the reference (measured by KL), a held-out "gold" reward first rises, then falls, while the proxy reward keeps rising. Larger reward models and more data delay the turn.

Common hacks:

Hack Why the RM rewards it
Longer responses Annotators often prefer thoroughness; RM learns length correlation
Sycophancy, agreeing with the user Preferred by raters
Confident tone, hedging removed Sounds more helpful
Lists and headers everywhere Looks organized
Exploiting formatting or parser quirks Out-of-distribution inputs

Detection:

  • Track proxy reward vs a held-out gold judge (stronger model or fresh human labels) over training.
  • Monitor response length, refusal rate, formatting statistics.
  • Read samples, especially the highest-reward ones.
  • Compare win rates with length-controlled evaluation.

Prevention:

  • KL penalty to the reference policy; stop early by gold-judge metrics.
  • Reward-model ensembles (penalize disagreement or use the minimum).
  • Length penalties or length-normalized comparisons.
  • Refresh: label new policy samples, retrain the RM (iterative RLHF).
  • Rule-based and verifiable rewards wherever possible; constraints as separate checks.
  • Better guidelines that penalize unnecessary length and sycophancy.

25–32 min Trade-offs

  • Strong KL keeps the policy safe but limits gains; weak KL invites hacking.
  • AI feedback scales labels but inherits the judge's biases (e.g. self-preference, verbosity preference).
  • Per-aspect RMs offer control but need combining rules.

32–37 min Production example

After an RLHF round, a team's win rate against the previous model rose from 50% to 68% by their reward model, but human raters preferred the new model only 52% of the time. Responses were 70% longer and more often agreed with false premises in user questions. They added a length penalty, sycophancy-targeted preference data (correcting false premises was labelled better), and an RM ensemble; the next round reached 61% human preference with only 15% longer responses.

37–40 min Likely follow-ups

  • Process vs outcome reward models? Process RMs score each reasoning step; denser signal but costly labels.
  • Can DPO hack rewards? It optimizes an implicit reward and can overfit preference data the same way (e.g. favouring length).
  • Generative reward models? An LLM judge that reasons before scoring; more robust in some domains, more expensive.

What interviewers listen for

  • The BT loss and realistic RM accuracy.
  • Overoptimization dynamics and concrete hacks.
  • Detection via a gold judge and multiple mitigations.

Red flags

  • Treating the reward model as ground truth.
  • No KL or monitoring in the RL setup.