The Nightly Build.
Paper of the Day

DPO makes the policy its own reward model and drops RLHF's RL loop

Rafailov and colleagues proved the swap targets the same KL-constrained objective as PPO-based RLHF, and no later work overturns that theorem, though the record after it locates DPO's real cost in offline practice.

Direct Preference Optimization: Your Language Model is Secretly a Reward Model

Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, Chelsea Finn · NeurIPS 2023 (arXiv:2305.18290) · 2023

Read the paper
While large-scale unsupervised language models (LMs) learn broad world knowledge and some reasoning skills, achieving precise control of their behavior is difficult due to the completely unsupervised nature of their training. Existing methods for gaining such steerability collect human labels of the relative quality of model generations and fine-tune the unsupervised LM to align with these preferences, often with reinforcement learning from human feedback (RLHF). However, RLHF is a complex and often unstable procedure, first fitting a reward model that reflects the human preferences, and then fine-tuning the large unsupervised LM using reinforcement learning to maximize this estimated reward without drifting too far from the original model. In this paper we introduce a new parameterization of the reward model in RLHF that enables extraction of the corresponding optimal policy in closed form, allowing us to solve the standard RLHF problem with only a simple classification loss. The resulting algorithm, which we call Direct Preference Optimization (DPO), is stable, performant, and computationally lightweight, eliminating the need for sampling from the LM during fine-tuning or performing significant hyperparameter tuning. Our experiments show that DPO can fine-tune LMs to align with human preferences as well as or better than existing methods. Notably, fine-tuning with DPO exceeds PPO-based RLHF in ability to control sentiment of generations, and matches or improves response quality in summarization and single-turn dialogue while being substantially simpler to implement and train.1

RLHF gets there in two stages and a reinforcement-learning loop

The alignment recipe an ML engineer already knows from InstructGPT runs in two stages. First it fits a reward model to human preference labels, training a network to score a completion the way the raters did. Then it holds that reward model fixed and optimizes the language model against it with reinforcement learning, usually PPO. A KL penalty keeps the policy from wandering away from the fine-tuned starting point.23 The second stage is the expensive one. It samples completions from the current policy in the training loop, scores them with the reward model, and backpropagates a policy-gradient update. A run therefore carries a separate reward network, an online sampling loop, and the hyperparameters that keep PPO stable.1

Direct Preference Optimization keeps the objective and deletes the machinery. It reaches the policy that the two-stage pipeline is trying to produce, but it never fits an explicit reward model and never runs a reinforcement-learning loop. The whole method is one supervised classification loss over pairs of completions, of the same shape the reward model was trained with, applied directly to the language model.1

Two side-by-side schematics. Left, labeled RLHF: preference data feeds a reward model trained by maximum likelihood, then a reinforcement-learning loop samples completions, labels rewards, and updates an LM policy. Right, labeled DPO: the same preference data feeds a single maximum-likelihood objective straight into the final language model, with no reward model and no reinforcement-learning loop.
Fig. 1 · RLHF fits a reward model and then optimizes the policy against it with reinforcement learning; DPO trains the policy on the preference pairs directly, with one classification objective and no RL loop.1

The claim is not that DPO approximates RLHF. It is that DPO optimizes the same objective RLHF does. The derivation below shows why no separate reward model is needed: the policy already carries one.

The objective both methods are really solving

Start with what the reward model represents. RLHF assumes human preferences follow a Bradley-Terry model: given a prompt and two completions, the probability a rater prefers the first is a logistic function of the difference between their latent rewards.4

p^{*}(y_1 \succ y_2 \mid x) = \frac{\exp\bigl(r^{*}(x,y_1)\bigr)}{\exp\bigl(r^{*}(x,y_1)\bigr) + \exp\bigl(r^{*}(x,y_2)\bigr)}

The reward model is fit by minimizing the negative log-likelihood of that classifier over the preference dataset, which is a plain logistic regression on the reward gap between the preferred completion y_w and the dispreferred one y_l.1 With a reward model r_\phi in hand, the second stage optimizes the policy against it under a KL constraint. This is the objective everything in the paper turns on.

\max_{\pi_\theta}\ \mathbb{E}_{x \sim \mathcal{D},\, y \sim \pi_\theta(y \mid x)}\bigl[\, r_\phi(x,y) \,\bigr] \;-\; \beta\, \mathbb{D}_{\mathrm{KL}}\!\bigl[\, \pi_\theta(y \mid x) \,\|\, \pi_{\mathrm{ref}}(y \mid x) \,\bigr]
Maximize expected reward while a coefficient \beta charges the policy for every nat of KL divergence it spends drifting from the reference model \pi_{\mathrm{ref}}.1

RLHF cannot maximize this directly. The reward sits inside an expectation over the policy's own samples, and there is no gradient path from the policy through a discrete sampled completion back to its parameters. That is the gap reinforcement learning fills: PPO estimates the gradient from sampled completions instead of taking it in closed form.3 The sampling loop is the price of not being able to solve the objective analytically.

The objective has a closed-form optimum nobody can evaluate

The KL-constrained objective is not, in fact, opaque. For a fixed reward function it has a known optimal policy, a result standard in the reinforcement-learning-as-inference literature that the paper restates for its own reward.1 The optimum reweights the reference model by the exponentiated reward.

\pi_r(y \mid x) = \frac{1}{Z(x)}\, \pi_{\mathrm{ref}}(y \mid x)\, \exp\!\Bigl( \tfrac{1}{\beta}\, r(x,y) \Bigr), \qquad Z(x) = \sum_{y} \pi_{\mathrm{ref}}(y \mid x)\, \exp\!\Bigl( \tfrac{1}{\beta}\, r(x,y) \Bigr)
The optimal policy tilts the reference distribution toward high-reward completions, with the temperature set by \beta; the normalizer Z(x) sums over every completion.1

The derivation of that form is short, and the reparameterization to come reuses its one moving part. Write the objective as a minimization, then divide the exponentiated-reward expression by its own sum so it becomes a valid distribution. The objective collapses into a KL divergence from the policy to that distribution, minus a term in Z(x). A KL divergence is minimized at zero when its two arguments are equal, and Z(x) does not depend on the policy. So the optimum is reached exactly when the policy equals the reweighted reference above. The step is licensed by that one fact: Z(x) is a constant the minimization over \pi_\theta can ignore.1

The catch is Z(x) itself. It sums over every completion the model could produce, which for a language model is every string, so it cannot be computed or even estimated cheaply. The exact optimal policy is written down and unusable in the same line. RLHF's response is to give up on the closed form and approximate the objective with sampling. DPO's response is the opposite.

Reading the reward off the policy

Instead of solving for the policy given the reward, solve for the reward given the policy. The optimal-policy equation is a relationship between a reward and its policy, and it can be rearranged so the reward stands alone. Taking logs and isolating r(x,y) gives the reparameterization.

r(x,y) = \beta \log \frac{\pi_r(y \mid x)}{\pi_{\mathrm{ref}}(y \mid x)} + \beta \log Z(x)

Every reward function can now be expressed through its own optimal policy and the reference policy, plus the same intractable Z(x) as before. Nothing has been approximated. This is an identity, true for any reward and the policy the previous section proved optimal for it. The appendix formalizes what the rearrangement means. Two reward functions that differ only by a function of the prompt, r'(x,y) = r(x,y) + f(x), induce the same Bradley-Terry preferences and the same optimal policy. Rewards therefore fall into equivalence classes, and the log-ratio above is the one member of each class already normalized into a valid policy.1

In plain language

The paper's title is the literal content of this step. A policy trained against the reference model defines a reward, its own log-probability ratio scaled by \beta, and that reward is a genuine member of the Bradley-Terry equivalence class the reward model was fit to. There is no separate reward network to recover because the policy is already carrying one.1

One loss, and a gradient that knows when it is wrong

The reparameterization still carries Z(x), so on its own it has traded one intractable quantity for another. What removes it is substituting the reparameterized reward back into the Bradley-Terry model. The preference probability depends only on the difference of two rewards at the same prompt, and \beta \log Z(x) is identical for both completions, so it cancels.1

p^{*}(y_1 \succ y_2 \mid x) = \sigma\!\Bigl( \beta \log \frac{\pi^{*}(y_1 \mid x)}{\pi_{\mathrm{ref}}(y_1 \mid x)} - \beta \log \frac{\pi^{*}(y_2 \mid x)}{\pi_{\mathrm{ref}}(y_2 \mid x)} \Bigr)

The intractable normalizer is gone because the step that removed it needed only that Z(x) be the same for two completions of one prompt, which it is by construction. The preference model is now written entirely in terms of the policy and the reference model. Fitting it by maximum likelihood, exactly as the reward model was fit, gives the DPO loss.

\mathcal{L}_{\mathrm{DPO}}(\pi_\theta; \pi_{\mathrm{ref}}) = -\,\mathbb{E}_{\htmlClass{nb-mc4}{(x,\,y_w,\,y_l)\sim\mathcal{D}}}\Bigl[\, \htmlClass{nb-mc3}{\log \sigma}\Bigl( \htmlClass{nb-mc1}{\beta \log \tfrac{\pi_\theta(y_w \mid x)}{\pi_{\mathrm{ref}}(y_w \mid x)}} - \htmlClass{nb-mc2}{\beta \log \tfrac{\pi_\theta(y_l \mid x)}{\pi_{\mathrm{ref}}(y_l \mid x)}} \Bigr) \Bigr]
  • \beta \log \tfrac{\pi_\theta(y_w \mid x)}{\pi_{\mathrm{ref}}(y_w \mid x)}The implicit reward of the preferred completion: the policy's log-probability ratio against the reference, scaled by \beta.
  • \beta \log \tfrac{\pi_\theta(y_l \mid x)}{\pi_{\mathrm{ref}}(y_l \mid x)}The same implicit reward for the dispreferred completion.
  • \log \sigmaThe Bradley-Terry logistic loss, unchanged from the reward model: push the reward gap so the preferred completion wins.
  • (x,\,y_w,\,y_l)\sim\mathcal{D}One prompt with a preferred and a dispreferred completion, the same preference data RLHF trains its reward model on.
The whole method: a binary-cross-entropy loss on preference pairs, read as a classifier over the policy's own implicit reward.1

The gradient says what the loss does to the model. Writing \hat{r}_\theta(x,y) = \beta \log \tfrac{\pi_\theta(y\mid x)}{\pi_{\mathrm{ref}}(y\mid x)} for the implicit reward, the update raises the log-probability of the preferred completion and lowers that of the dispreferred one, weighted by how badly the current implicit reward orders the pair.

\nabla_\theta \mathcal{L}_{\mathrm{DPO}} = -\beta\, \mathbb{E}_{(x,y_w,y_l) \sim \mathcal{D}} \Bigl[\, \underbrace{\sigma\bigl( \hat{r}_\theta(x,y_l) - \hat{r}_\theta(x,y_w) \bigr)}_{\text{weight, large when the ordering is wrong}} \bigl( \nabla_\theta \log \pi(y_w \mid x) - \nabla_\theta \log \pi(y_l \mid x) \bigr) \Bigr]
The per-example weight is the probability the implicit reward assigns to the wrong ordering; it is near one when the model already ranks the dispreferred completion higher, and near zero once the pair is ordered correctly.1

That weight is not cosmetic. Drop it and the objective becomes a naive ratio that the paper reports drives the model to degenerate, an ablation the authors keep in the appendix because the failure is easy to reach.1 DPO is a classifier that spends gradient in proportion to how wrongly the policy, read as a reward model, currently ranks the pair in front of it.

The reward model the pipeline trains was already recoverable from the policy it was training.

What the experiments actually settle

A derivation that reaches the same objective on paper still has to be shown reaching comparable policies in practice. The paper's cleanest test is the one where the reward is known exactly. In controlled sentiment generation on IMDb prefixes, the preference pairs come from a pre-trained sentiment classifier. The ground-truth reward is therefore available, and the trade-off between reward and KL divergence to the reference is exactly computable. Plotting expected reward against KL, DPO's frontier sits above every baseline at every KL value, including PPO and a PPO variant given access to the ground-truth reward.1 For the same drift from the reference model, DPO buys more of what the objective was asking for.

Scatter plot titled IMDb Sentiment Generation. The x-axis is KL divergence from the reference policy, from 0 to 20; the y-axis is reward, from about 0.4 to 1.0. The DPO points form the highest frontier, reaching reward near 1.0 at low KL, above PPO, PPO-GT, Unlikelihood, and Preferred-FT, which all sit lower for the same KL.
Fig. 2 · On IMDb sentiment control, where the reward is a known classifier, DPO attains the highest expected reward at every level of KL divergence, above both PPO and the ground-truth-reward PPO variant.1

On tasks where the reward is not known, the paper evaluates win rates judged by GPT-4. Summarizing Reddit TL;DR posts with a GPT-J policy, DPO peaks near a 61% win rate against the human reference summaries at sampling temperature zero. That beats PPO's 57% best case, and it holds as the temperature rises while PPO collapses toward the base model.1 The comparison the reader can hold is temperature robustness. PPO's advantage lives at one temperature and evaporates off it; DPO's does not.

Line plot titled TL;DR Summarization Win Rate vs Reference. The x-axis is sampling temperature from 0 to 1; the y-axis is win rate. DPO starts near 0.61 and declines gently to about 0.4. PPO starts near 0.57 at temperature 0 and falls steeply to below 0.1 at temperature 1. A dashed line marks a win rate of 0.5.
Fig. 3 · On TL;DR summarization, DPO's GPT-4 win rate peaks near 61% and stays high across sampling temperatures, while PPO peaks near 57% at temperature zero and falls off sharply as temperature rises.1

Single-turn dialogue on the Anthropic Helpful-Harmless data uses a Pythia-2.8B policy, with the win rate measured against the dataset's own preferred responses. DPO starts below that chosen-response baseline at the lowest temperature and rises above it as temperature climbs, overtaking the compute-heavy Best-of-128 reference at the top of the range. Among the methods trained here, the paper reports DPO as the only one to improve over the chosen responses.1

Line plot titled Anthropic-HH Dialogue Win Rate vs Chosen. The x-axis is sampling temperature from 0.25 to 1; the y-axis is win rate. DPO rises from about 0.37 to above 0.6, crossing above a dashed 0.5 baseline line and above Best of 128, which stays near 0.55. Preferred-FT sits near 0.3 to 0.43 and Pythia-2.8B near 0.16 to 0.25.
Fig. 4 · On Anthropic-HH one-step dialogue, DPO's win rate against the dataset's preferred responses rises from below the chosen-response line at low temperature to above it as temperature climbs, ending above the compute-heavy Best-of-128 reference.1

The paper also runs one out-of-distribution test, and it is the result to watch, because it is where the later record disagrees. Policies trained on Reddit TL;DR are evaluated zero-transfer on CNN/DailyMail news articles, and DPO's GPT-4 win rate against the ground-truth summaries lands above PPO's at both temperatures tested.

Out-of-distribution win rate against ground-truth summaries: TL;DR-trained policies evaluated zero-transfer on CNN/DailyMail news.1
Method temp 0 temp 0.25
DPO 0.36 0.31
PPO 0.26 0.23

The authors read this table cautiously, calling it an initial result that suggests DPO can generalize similarly to PPO-based models and asking for more comprehensive study.1 It is one transfer of a single trained pair of policies.

The theorem held; the practice got contested

One distinction has to stay fixed through everything that follows. DPO's central result is that its loss optimizes the same KL-constrained objective as RLHF, and no later work overturns it. Nobody has shown the objective-level equivalence is wrong. What the record after the paper contests is narrower and more consequential for a practitioner: what offline DPO, trained on a fixed preference set with no on-policy sampling, actually reaches compared to on-policy RLHF.

The sharpest disagreement is with the table above. Xu et al. built a comprehensive study to answer the question directly. They argue that the set of policies DPO can reach is a superset of what PPO can reach, and that the extra ones include out-of-distribution exploitative solutions. DPO is thus more exposed than PPO to the shift between the preference data and the model's own outputs. With careful tuning their PPO surpasses DPO across the benchmarks they test, reaching state-of-the-art on a hard code-competition suite.5 This does not refute the paper's table so much as outweigh it. It is a single zero-transfer test read one way, against a broader and harder suite with heavy PPO tuning read the other. DPO's own out-of-distribution evidence was thin, and the fuller test that followed reads the shift as a liability where the preliminary result had read it as a strength.

The generation gap is not confined to one benchmark. Tang et al. find a clear and persistent advantage for online alignment over offline methods such as standard DPO at matched budgets. Offline-trained policies get good at classifying pairs but worse at generating. The gap survives both contrastive and non-contrastive losses, and it does not close by scaling the policy network.6 Their result points at on-policy sampling itself, the very loop DPO removed, as the active ingredient rather than the form of the loss.

Two analyses locate failure modes inside the offline loss. Azar et al. show that DPO's substitution of pointwise Bradley-Terry rewards for pairwise preferences can hollow out the KL regularization. When the empirical preference between two completions is near-deterministic, the logistic transform drives the target reward gap toward infinity. The constraint then stops binding regardless of \beta, and the policy collapses toward determinism. Their IPO loss regularizes the policy log-ratio toward a bounded margin so the KL term keeps binding.7 Pal et al. show the gradient's stated behavior can fail on the preferred side. The loss depends only on the relative reward margin, so it can be reduced by pushing the preferred completion's log-probability down, as long as the dispreferred one falls faster. DPO can therefore lower the likelihood of the very response it prefers, most acutely when the two completions differ by a small edit distance. Their DPO-Positive term penalizes the preferred log-probability for dropping below its reference value. It trained the Smaug-72B model, reported as the first open model above 80% average on the Open LLM Leaderboard.8

What holds up
  • The theorem: DPO's loss optimizes the same KL-constrained objective as RLHF, uncontested since publication.1
  • The clean sentiment result, where a known reward makes the reward-vs-KL frontier exact and DPO dominates PPO.1
  • Matching or beating PPO on the paper's summarization and dialogue tasks, at a fraction of the implementation cost.1
What to be careful about
  • Offline DPO trails on-policy alignment at matched budgets, and scaling the policy does not close the gap.6
  • Its reachable policies include out-of-distribution exploitative ones; tuned PPO beat DPO in the fuller comparison.5
  • Near-deterministic preferences can void the KL constraint, and the loss can drive down the preferred response's likelihood.78
Verdict

The derivation is correct and its central claim stands. A language model trained on preference pairs carries an implicit reward, so the RLHF objective can be reached without a reward network or an RL loop. The follow-up record establishes something the theorem does not cover. Reaching the objective's optimum on paper and reaching a good policy from a fixed offline dataset are different achievements, and the difference is on-policy sampling. DPO earned its place as a default because the simpler half of that trade is often enough. The case for keeping the RL loop is now specific and evidenced, in the measured out-of-distribution and generation-quality gaps.56

Sources

  1. arXiv · Rafailov et al., Direct Preference Optimization: Your Language Model is Secretly a Reward Model (NeurIPS 2023)
  2. arXiv · Ouyang et al., Training language models to follow instructions with human feedback (2022)
  3. arXiv · Schulman et al., Proximal Policy Optimization Algorithms (2017)
  4. Biometrika · Bradley & Terry, Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons (1952)
  5. arXiv · Xu et al., Is DPO Superior to PPO for LLM Alignment? A Comprehensive Study (ICML 2024)
  6. arXiv · Tang et al., Understanding the performance gap between online and offline alignment algorithms (2024)
  7. arXiv · Azar et al., A General Theoretical Paradigm to Understand Learning from Human Preferences (2023)
  8. arXiv · Pal et al., Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive (2024)