---
title: Describe the classic RLHF pipeline. What is the KL penalty for, and what is reward hacking?
url: https://gurkanozkan.ai/learn/questions/applied-llm-ft-04/
markdown: https://gurkanozkan.ai/learn/questions/applied-llm-ft-04.md
kind: question
role: Applied LLM
stage: Technical
difficulty: Hard
json: https://gurkanozkan.ai/api/learn/questions/applied-llm-ft-04.json
robots: noindex
---

# Describe the classic RLHF pipeline. What is the KL penalty for, and what is reward hacking?

Applied LLM · Technical · Hard

Theme reported publicly: [PolyAI](https://simplify.jobs/p/ea4b6d9e-bd59-4d61-87cf-8cf25d557b79/Senior-Research-Scientist), [Cohere](https://www.aced.io/experiences/cohere-staff-machine-learning-engineer-interview-b49af6)

## Answer

*Model answer, written in a candidate's voice*

### In short

- SFT model is initialized, then humans rank pairs of outputs; a reward model is trained with a Bradley–Terry loss on chosen vs rejected responses.
- PPO optimizes the policy against the reward model, usually with a KL penalty to a frozen reference policy.
- KL penalty keeps the policy near the reference, limiting reward-model exploitation and preserving fluency/diversity.
- Reward hacking is when outputs score high under the reward model but are not actually better for humans, e.g. longer, flattering, or sycophantic answers.
- Mitigations: KL control, reward-model ensembles, length/style controls, fresh preference data, and held-out human evaluation.
- PPO is expensive and unstable: policy, reference, reward, and value models in memory, with sensitive hyperparameters.
- Alternatives include DPO, AI feedback/constitution-based methods, and verifiable rewards where correctness can be checked.

### In full

The classic RLHF pipeline starts with an SFT model, collects pairwise human preferences over its outputs, trains a reward model with a Bradley–Terry loss so the chosen response is scored higher than the rejected one, then uses PPO to optimize the policy against that reward model. The KL penalty is added to the reward, typically as reward minus beta times KL from the policy to a frozen reference, and it keeps the policy close enough to the reference that it does not drift into degenerate or off-distribution text while still improving on the reward model. Its real purpose is not to make the reward model perfect but to limit exploitation of its errors and preserve fluency and reasonable behaviour. Reward hacking is when the policy finds outputs the reward model loves but humans do not, such as overly long, flattering, or sycophantic answers; mitigations include KL control, reward-model ensembles, length/style controls, fresh preference data, and held-out human evals. PPO is also costly and finicky because it needs policy, reference, reward, and value models in memory and can be unstable. In practice, teams also consider DPO, AI feedback or constitution-based methods, and verifiable rewards when correctness can be checked directly.

*Corrected by an independent AI reviewer.*

## What a strong answer covers

- SFT model → pairwise human preferences → reward model (Bradley–Terry loss) → policy optimisation (PPO) against the reward model
- KL penalty to a frozen reference keeps the policy close, limits exploitation of reward-model errors and preserves fluency
- Reward hacking: outputs the reward model loves but people don't (length, flattery, sycophancy); mitigations include KL, reward-model ensembles, length control, fresh preference data, held-out human evals
- PPO cost: policy, reference, reward and value models in memory; instability
- Alternatives: DPO, AI feedback / constitution-based methods, verifiable rewards

## Common mistakes

- Treating the reward model as ground truth
- forgetting the reference model

## Topic guides

- [Reinforcement learning and preference optimisation](https://gurkanozkan.ai/learn/topics/reinforcement-learning.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
