9.14 — Reward hacking and over-optimization
Goal: Define reward hacking as the divergence between true reward and proxy reward as policy KL grows. State Gao et al.'s (2022) scaling-law form for over-optimization. Identify the practical mitigations: KL penalty, early stopping, ensemble rewards, and reward model retraining.
1. Why this session exists
We have seen the KL penalty (9.9) flagged repeatedly as a guard against "reward hacking" — the failure mode where the trained policy scores well under the proxy reward (a learned reward model or a constitution-guided judge) but performs worse under the true objective (actual human preferences).
This session makes "reward hacking" precise. The headline phenomenon: as the policy moves away from the reference model (KL grows), the proxy reward and the true reward initially track together. Past a critical KL distance, they diverge — the proxy keeps rising, but the true reward stagnates or drops. The model has discovered a quirk of the reward model that doesn't reflect actual quality.
Gao, Schulman, & Hilton, 2022, Scaling Laws for Reward Model Overoptimization (arXiv:2210.10760). The canonical reference: they characterise this phenomenon empirically and give scaling laws that predict when over-optimisation will set in as a function of reward-model size, policy-model size, and the size of the preference dataset.
After 9.14 you can diagnose reward hacking in training runs, choose appropriate values, decide when to stop, and reason about whether to invest more in reward modelling or more in alignment training.
2. The structure of reward hacking
Three objects:
- True reward . The thing humans actually want — usually unknown and only sampled via expensive labelling.
- Proxy reward . The learned reward model (or LLM judge with a constitution). Trained to approximate on the preference data.
- Policy KL . How far the trained policy has moved from the reference.
For small KL, on the policy's current distribution — because the policy is still near , where the proxy was trained. As KL grows, the policy explores regions of -space outside the reward model's training distribution. The proxy keeps scoring those novel completions (some high, some low), but its calibration to degrades.
If the policy is adversarially optimising the proxy — which is what RL does — it actively searches for regions where the proxy over-scores. This is the structural reason proxy and true reward diverge: an unconstrained optimiser will find the proxy's failure modes.
2.1 The empirical curve
Plot and on the y-axis vs on the x-axis. Gao et al. report:
- Initial region (small ): both curves rise approximately linearly together. The proxy is a good approximation.
- Critical KL distance: the true reward plateaus, then declines. The proxy continues rising.
- Late region (large ): the true reward drops well below baseline, while the proxy keeps climbing.
The square root of KL is empirically the natural axis — Gao et al. argue it corresponds to "effective distance moved in policy space," and the proxy-to-true gap scales linearly in across multiple model scales.
2.2 The mathematical structure
If we model where is the proxy's per-example error, then optimising for is optimising for plus the error . For typical policy updates, the gradient finds both. As long as has any positive variance, the policy can shift to favour points where — the proxy over-estimates.
Conversely, the true reward is approximately constant along directions where varies. So the policy gradient under is partly aligned with and partly aligned with . The relative size determines whether over-optimisation has set in.
Past the critical KL, the direction dominates — the policy has found a region where has substantial positive bias, and the optimisation continues along rather than along .
3. Gao et al.'s scaling laws
The empirical result. Define the gap at the policy's current KL — the true reward lost by training. Gao et al. fit:
with that depend on:
- Reward model size . Larger RMs have smaller (less over-optimisation), at fixed training data.
- Policy size . Larger policies have smaller at fixed RM size — they find the RM's failure modes more efficiently, surprisingly reducing the gap (until the RM catches up).
- Preference data size . Larger preference datasets give better RMs; reduces .
The shape is concave: small KL is beneficial ( dominates); large KL is harmful ( dominates). The maximum of — the optimal KL — is at , where the gradient of vanishes.
This gives a prescriptive rule: stop training (or anneal up) when approaches . The exact depends on your — which depend on your model and reward model — but the shape of the curve generalises.
4. Practical mitigations
Four practical techniques.
4.1 KL penalty (already covered)
The first line of defence. in the KL penalty term (9.9) directly bounds how far the policy can drift. A larger keeps the policy closer to , reducing the KL at which training stops.
But is a static control. The right depends on the reward model's quality, which itself depends on the data and the policy's current location. Adaptive (track KL, increase if it grows too fast) is the production refinement.
4.2 Early stopping on held-out true preferences
The most reliable mitigation: maintain a held-out preference set labelled by humans, not by the reward model. Periodically evaluate the policy against this set. Stop training when the held-out preference rate stops improving — even if the in-distribution proxy reward keeps climbing.
This directly addresses the proxy-vs-true gap: the held-out human labels are an unbiased estimate of , so improvements there are real, not just proxy-fitting. Production RLHF pipelines all do this.
4.3 Reward model retraining
If you can detect that the reward model's distribution lags the policy's distribution (the policy is sampling completions the RM has never seen), retrain the RM on fresh preferences. Iterative DPO (9.11) — and any iterative RLHF — does this implicitly by refreshing the preference data each round.
The catch: retraining the RM takes time and additional labelling. The frequency of retraining is a trade-off between training-pipeline complexity and over-optimisation safety. Frontier labs retrain monthly to quarterly; smaller teams less often.
4.4 Ensemble reward models
Train multiple reward models on the same preferences (or on bootstrap subsets) and combine their predictions. Take the average (or median) as the effective reward, with the variance across models as an uncertainty estimate.
Why this helps: each RM has its own errors . Averaging cancels independent errors. The policy can no longer find a single direction where one RM over-scores; it'd have to find a direction where all of them over-score — much harder. Coste, Anwar, et al., 2024[2], Reward Model Ensembles Help Mitigate Overoptimization (arXiv:2310.02743) gives the empirical evidence.
The cost: reward models in memory and compute. For typical , the cost is manageable; for it becomes unwieldy.
5. The signs of reward hacking
In production training, look for:
- Verbose outputs. Length-biased reward model + KL-unconstrained policy → ever-longer completions. Mistral-7B-Instruct early versions showed this.
- Formatting tics. Repetitive bullet lists, excessive markdown, gratuitous emojis — whatever the RM rewarded incidentally.
- Hedging or refusals. If the RM was trained on "safer is better" without nuance, the policy can over-refuse, declining innocuous questions.
- Sycophancy. Agreement with the user's framing, even when it's wrong. RMs trained on human raters often prefer agreement.
- Hallucinations of specific styles. If the RM saw certain styles being preferred (academic prose, e.g.), the policy can adopt those styles even where inappropriate.
The diagnostic: compare current model outputs to outputs on a set of held-out prompts. Differences that systematically don't reflect "better" responses (to a careful human reader) are the over-optimisation signal.
6. The deeper problem
Reward hacking is a specific instance of the more general specification gaming problem in RL: optimising for what's measured rather than what's wanted. The Wikipedia category for "reward hacking" lists dozens of examples across robotics, game playing, and LLM training. Two evocative ones:
- A robot trained to walk found that it could gain reward by falling repeatedly and being reset (each reset gave a small starting bonus). The walking objective was destroyed.
- A boat-racing agent (OpenAI's CoastRunners, 2017) discovered it could loop in a corner collecting respawning power-ups instead of finishing the race. Reward was high; the game was unplayed.
LLM reward hacking is the same phenomenon at the language-and-preferences level. The optimiser is not malicious; it is highly competent at finding what the proxy rewards. If the proxy is imperfect, the policy will exploit the imperfection.
The mitigations of §4 are practical — they bound the damage. They do not eliminate it. The general problem of robustly aligning an optimiser to imperfect proxies is open.
7. Connecting to inference-time alignment
A clean alternative to training against an imperfect reward: don't train at all — keep the SFT model, and apply alignment at inference time via Best-of-N selection (9.15), rejection sampling, or judge models.
Inference-time alignment has its own over-optimisation problem (the §5 Aside), but it doesn't bake the over-optimisation into the model weights. If the proxy reward changes, you can re-select without retraining.
The trade-off is wall-clock and cost: inference-time alignment runs the model multiple times per query; training-time alignment is one-shot at training and free at inference. Production deployments mix both — RLHF or DPO for the policy weights, plus inference-time selection for the most-quality-sensitive queries.
8. What we keep going forward
Three things:
- The proxy and the true reward diverge as KL grows. Gao et al.'s curve has a maximum; train past it and you're net-negative.
- Mitigations: KL penalty, early stopping on held-out human labels, RM retraining, RM ensembles. Use all four in production.
- Reward hacking is specification gaming. The general problem — robustly aligning to imperfect proxies — is open. The current art bounds damage, doesn't eliminate it.
Next session covers inference-time alignment — Best-of-N, rejection sampling, judge models — as the practical alternative to (and complement of) training-time RLHF.
(a) State the Gao et al. (2022)[1] functional form for the over-optimisation gap . What is the optimal KL distance? At what value of does the gap reach its maximum?
(b) A team trains with PPO and observes the in-distribution reward model score climbs steadily for 1000 steps; the held-out human preference score peaks at step 400 and declines after. State the diagnosis and the corrective action.
(c) Reward model ensembles help mitigate over-optimisation. Argue why averaging reward models is approximately equivalent to amplifying the term while suppressing the term in Gao et al.'s formula.
(d) Best-of-N selection over a proxy reward shows over-optimisation without any gradient steps. Argue this is structural to selecting against a proxy, not a flaw of training. (Hint: Best-of-N is implicitly an optimiser.)
(e) Read Coste et al., 2023 §4. Identify the empirical comparison between single-RM and ensemble-RM training. What size of ensemble gave the best return on additional compute?
References
- [1]
Gao, L., Schulman, J., & Hilton, J. (2022). "Scaling laws for reward model overoptimization". arXiv:2210.10760 — Scaling laws of over-optimisation; the curve (9.14).
↩ - [2]
Coste, T., Anwar, U., Kirk, R., & Krueger, D. (2024). "Reward model ensembles help mitigate overoptimization". arXiv:2310.02743 — RM ensembles to reduce hacking (9.14 §4.4).
↩