Direct Preference Optimization
Is there a faster way than training a reward model and then running PPO? Often, yes: skip the separate reward model in the training loss and optimize the policy directly from preference pairs.
Direct Preference Optimization, or DPO, uses a single supervised-style objective over a prompt , a preferred answer , a rejected answer , a reference model , and the current model .
For each pair, define the model's log-odds preference for the chosen answer:
and the reference model's log-odds:
The question is: how much more does the current model prefer the chosen answer compared with the reference model?
Direct Preference Optimization
Compare chosen-versus-rejected log odds
DPO treats each preference pair like a supervised example, then asks whether the current model prefers the chosen answer more than the reference model did.
Preference pair
x: Explain why KL control matters during RLHF.
Preferred y+
Reward pulls the policy toward helpful outputs, while KL keeps it near the trusted reference.
Rejected y-
Just maximize the reward score as much as possible.
What the subtraction means
Δlog πφ measures how much the current model prefers y+ over y-.
Δlog πref measures how much the reference model already preferred y+ over y-.
DPO trains on the difference between those two margins: did the current model improve beyond the reference?
Current model πφ
Move these to see how the trained model scores the same chosen/rejected pair.
Reference model πref
This is usually the SFT model. DPO uses it as the comparison baseline.
Current margin
Δlog πφ = log πφ(y+ | x) - log πφ(y- | x) = 1.6
Reference margin
Δlog πref = log πref(y+ | x) - log πref(y- | x) = 0.7
DPO signal
0.9
DPO objective signal: log σ(β · (Δlog πφ - Δlog πref))
The current model has learned a stronger preference for the chosen answer than the reference had.
With β = 1.0, the smooth win score is 0.71.
The DPO objective maximizes:
The sigmoid acts like a smooth win score, and the log turns it into a stable loss. The temperature controls how sharply the objective separates winners from losers. The reference model is a built-in regularizer: it keeps style and safety anchors in the objective without writing an explicit KL term.
DPO Intuition
If the policy already prefers over more than the reference does, then and the term inside is positive. If it prefers the chosen answer less than the reference does, the term is negative and DPO pushes the policy toward the preferred answer.
DPO friends
IPO
Inverse preference optimization with an alternative derivation and regularization view
ORPO
Preference optimization that adds constraints to preserve instruction-following
RRHF
Rank-based loss using listwise or ranking signals
KTO
Targets calibrated log-odds and preference margins
Tips for DPO
- Choose a strong reference model, often the SFT policy
- Calibrate on held-out win-rate
- Mix near-ties and adversarial pairs
- Randomize order during data collection
- Evaluate with win-rate, safety slices, and qualitative critique review
What does DPO compare in its objective?