Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
DPO drops both the separate reward model and the PPO loop, yet (under its assumptions) hits the same optimum as RLHF. Walk through the closed-form trick that makes this possible. What role does β play, and what's the reference policy?
DPO inverts the KL-regularised RL optimum to write the reward as a log-ratio of policy to reference, then substitutes it into Bradley-Terry, leaving one classification loss on preference pairs.
Imagine grading essays by first training a judge, then coaching a writer to please that judge. That two-stage dance is RLHF: train a reward model, then run reinforcement learning against it. DPO notices something clever. There is a known formula linking the best possible writer to the judge's scores, so you can run the formula backwards. The writer's own behaviour reveals what the judge's scores must have been. Once you express the score that way, you plug it straight into the rule for which essay people preferred, and the judge cancels out of the math entirely. Now you just nudge the writer to make preferred essays more likely than rejected ones, using a simple comparison on pairs you already labelled. No separate judge, no fiddly reinforcement loop, just one steady training pass.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: shared Bradley-Terry setup + closed-form RL optimum + inverting reward to a log-ratio + partition cancellation + final DPO loss + beta and reference + offline vs on-policy caveats.
| Aspect | RLHF (reward model + PPO) | DPO |
|---|---|---|
| Reward model | Explicit network trained first | Implicit, the log-ratio of policy to reference |
| Optimisation | Online PPO with sampled rollouts | Offline supervised-style loss on pairs |
| Models in memory | Policy, reference, reward, often a critic | Policy plus frozen reference only |
| Stability and cost | Sample-hungry, tuning-heavy | Cheaper, more stable, easier to run |
| Exploration | Can sample new responses on-policy | Limited to the fixed preference dataset |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying DPO has no reward at all. It carries an implicit reward, the log-ratio of policy to reference, that is never fit as a separate network but still drives the whole loss.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.