DPO: Direct Preference Optimization


Paper: Rafailov, R., et al., Direct Preference Optimization: Your Language Model is Secretly a Reward Model, NeurIPS 2023. arXiv:2305.18290

Why this paper matters

RLHF works, but it is a chore: train a reward model, then run fragile, sample-hungry RL (PPO) on top. DPO collapsed that two-stage pipeline into one supervised-style loss. The insight: the optimal policy of KL-constrained RLHF has a closed form that, once plugged into the Bradley–Terry preference model, turns the whole problem into a simple classification objective. No reward model, no RL sampling, no value network. It is now the default open-weight alignment method — if you fine-tune a model to “behave,” you probably reach for DPO first.

The core idea: the LM is the reward model

Start from the standard RLHF objective (maximize reward, stay near a reference $\pi_{\text{ref}}$ via KL). Its optimal policy has the closed form:

\[\pi^*(y \mid x) = \frac{1}{Z(x)}\,\pi_{\text{ref}}(y \mid x)\,\exp\!\Big(\tfrac{1}{\beta} r(x, y)\Big)\]

Solve this for the reward: $r(x,y) = \beta \log \frac{\pi^*(y\mid x)}{\pi_{\text{ref}}(y\mid x)} + \beta \log Z(x)$. Substitute into Bradley–Terry and the reward model disappears, leaving a loss over preference pairs $(y_w \succ y_l)$:

\[\mathcal{L}_{\text{DPO}} = -\,\mathbb{E}\left[\log \sigma\!\left( \beta \log \frac{\pi_\theta(y_w\mid x)}{\pi_{\text{ref}}(y_w\mid x)} - \beta \log \frac{\pi_\theta(y_l\mid x)}{\pi_{\text{ref}}(y_l\mid x)} \right)\right]\]

Only $\pi_\theta$ and a frozen $\pi_{\text{ref}}$ appear. Updating $\pi_\theta$ to increase the “chosen” over “rejected” log-ratio is training — nothing else.

Why it’s better in practice

Key results

Why it matters today

DPO is the bridge between “I have preference data” and “I have an aligned model.” It’s the practical counterpart to the RLHF-original and InstructGPT posts, and a prerequisite for understanding the whole family of direct-alignment variants (IPO, KTO, ORPO). Read it after the RLHF posts — it’s the “we don’t actually need the RL” chapter.

References

© 2026 Jiawei    粤ICP备18035774号