Blog · Tue Jul 07 2026 08:00:00 GMT+0800 (Singapore Standard Time) · llm

DPO: Direct Preference Optimization

DPO (Rafailov et al., 2023) is the method I now reach for by default when aligning a model. It delivers what RLHF gives you — a model that prefers responses humans like — but without a separate reward model and without an unstable RL training loop. I'm writing this because DPO quietly became the workhorse of open-model alignment, and understanding it saves you from a lot of PPO pain.

The problem with RLHF's complexity

Recall RLHF: train a reward model from preferences, then run PPO to maximize it under a KL constraint. That's four models in flight (policy, reference, reward, value) and RL is finicky — reward hacking, collapse, hyperparameter hell. For most teams, that overhead isn't worth it.

DPO's key insight

DPO noticed something elegant: under the RLHF objective, the optimal policy has a closed form in terms of the reward and the reference policy. And the reward itself can be expressed in terms of the optimal policy. So instead of:

preferences → reward model → PPO → aligned policy

you can directly optimize the policy on the preference pairs with a single, stable classification-style loss — no reward model, no RL.

The loss, intuitively

Given a prompt and a "chosen" vs "rejected" response pair, DPO trains the policy to increase the likelihood of the chosen one and decrease the rejected one, relative to a frozen reference model:

loss = -log σ( β · (log π(chosen)/π_ref(chosen)
                   - log π(rejected)/π_ref(rejected) ) )
  • π is the policy you're training; π_ref is the frozen starting model.
  • The log π / log π_ref ratio is the implicit reward — DPO derives it from the policy itself.
  • β controls how strongly you enforce the preference vs. stay near the reference.

That's it. It's a standard supervised-style update (no sampling, no value network, no KL-in-RL gymnastics), so it trains like a normal fine-tune — stable and predictable.

Why this is a big deal in practice

  • No reward model to train or get wrong. The reward-model bugs (distributional shift, hacking) mostly disappear because there's no free-standing reward model.
  • Stable and cheap. It's essentially a weighted fine-tune; you can run it on modest hardware, often with LoRA on top.
  • Easy to debug. Loss goes down monotonically like normal training; no mysterious RL reward curves.
  • Quality is competitive with RLHF on standard preference benchmarks.

I've aligned 7B–13B models with DPO+LoRA where full RLHF would've been impractical, and the results were solid for most tasks.

Practical notes

  • Data quality dominates. DPO is only as good as your (chosen, rejected) pairs. Noisy or mislabeled preferences → a confused model. Curate carefully.
  • β matters. Too low → model ignores preference; too high → it barely moves from reference. Tune it.
  • LoRA + DPO is a great combo: train a tiny adapter, keep the base frozen as reference.
  • It still can't invent capability the base model lacks — same limit as all alignment methods.
  • Pair with a good SFT first; DPO refines style/preference, it doesn't teach skills from zero.

Limitations

  • DPO optimizes the training preferences; if your preference data doesn't cover a behavior, DPO won't instill it.
  • It can still produce verbose/sycophantic tendencies if the preference data rewards those (same root cause as RLHF).
  • For extremely subtle or adversarial alignment, some still prefer RLHF's flexibility — but that's the exception.

My take

DPO is the "make alignment boring" breakthrough, and boring is good. It took a fragile, four-model RL pipeline and collapsed it into a single stable loss over preference pairs — which means most teams can align a model without a research infra. If you're aligning an open-weight model, start with SFT then DPO (ideally DPO+LoRA); reserve full RLHF for when you have evidence you need it. The mental model: DPO = "nudge the model toward chosen answers and away from rejected ones, relative to where it started." Simple, stable, effective.