RLHF and DPO
Q: Explain RLHF. What does DPO change?
- Collect preference pairs (prompt, chosen, rejected) from humans or AI feedback.
- Train a reward model
r(x, y)with a Bradley–Terry loss:−log σ(r(chosen) − r(rejected)). - Optimize the policy with PPO to maximize reward minus a KL penalty to the SFT model (prevents reward hacking / drifting into gibberish).
DPO skips the explicit reward model and RL loop: a closed-form derivation turns the same objective into a simple classification-style loss on preference pairs, using the frozen reference model's log-probs. Simpler and more stable; widely used along with variants (IPO, KTO, ORPO). RL with verifiable rewards (unit tests, math answers) powers modern reasoning models.