Chapter 05 · Preference optimization

Direct preference optimization & its family

One line of algebra turns RLHF into a classification loss. This chapter derives it, takes it apart, follows the dozen variants it spawned, and explains why the frontier went back to sampling from the model anyway.

⏱ 80 min8 interactivesPrereq: 03, 04
In one breath
  • The KL-regularized RLHF optimum $\pi^*\propto\piref\,e^{r/\beta}$ can be inverted: $r=\beta\log\frac{\pi^*}{\piref}+\beta\log Z(x)$. In a Bradley–Terry likelihood the intractable $\beta\log Z(x)$ cancels, so you can fit the policy directly to preference pairs with a logistic loss. That is DPO.
  • DPO's gradient is "raise the chosen, lower the rejected", weighted by $\sigma(\hat r_l-\hat r_w)$: pairs the implicit reward already orders correctly stop mattering. $\beta$ is both the KL strength and the inverse temperature of that implicit reward.
  • What DPO constrains is a difference of log-ratios on the data. Everything else is free: the chosen log-prob usually goes down (likelihood displacement), mass can flow to responses that appear in no pair, deterministic labels push the margin to infinity (IPO's critique), and length is a cheap way to win.
  • The variants are patches to specific holes: IPO/cDPO bound the margin, DPO-Positive and NLL terms anchor the chosen, SimPO/R-DPO handle length, KTO drops the pairing, ORPO and SimPO drop the reference, and online/iterative DPO, OAIF, SPPO and friends put the sampling loop back.
  • The biggest gap between DPO and RLHF is not the loss but the data distribution: offline pairs from other models versus fresh samples from the current policy. Open recipes in 2024 used DPO as a cheap stage; by 2025–2026 most pipelines that can afford it run online RL (often with verifiable rewards) and keep DPO-style losses for specific jobs.

§1Why "direct"? What DPO removes from RLHF

Classic RLHF trains a reward model, then runs an RL loop that keeps generating text from the policy, scoring it, and updating. DPO asks: if the optimal policy of that RL problem has a closed form, can we skip the reward model and the loop?

Recall the pipeline from Chapter 04. Stage one fits a reward model $r_\phi$ on human comparisons with a Bradley–Terry loss (Chapter 03). Stage two maximizes $\E[r_\phi]-\beta\,\KL(\pi\|\piref)$ with PPO, which in practice means four networks in memory (policy, reference, reward model, critic), autoregressive generation inside the training loop, and a long list of stabilizing tricks. Rafailov et al. (2023) observed that the second stage has a known solution in function space, and that you can fold the first stage into it. The result is a supervised-looking loss on a fixed file of pairs: no reward model, no critic, no sampling.

Analogy · the chef and the binder

RLHF is a chef who cooks a dish, hands it to a trained food critic for a score, adjusts, and cooks again, hundreds of times. DPO is the same chef sitting down with a binder of past verdicts ("dish A beat dish B") and adjusting the recipe directly from the binder, never cooking. It is far cheaper. Where it breaks: the binder's dishes were mostly cooked by other chefs. Nothing in it tells you how your new dishes would be judged, and that gap is the subject of half this chapter.

Press Play. Watch where the data comes from in each lane: in RLHF the policy generates its own training data every iteration (the loop arrow); in DPO the data file never changes and the reference is frozen, so its log-probs can be computed once and cached.

Notice what is not on the DPO side. The reward model is gone, but not because the reward was unnecessary: it has been absorbed into the policy as an implicit reward. Generation is gone too, and that loss is real: the model never sees (and is never corrected on) its own outputs during training. Keep both facts in mind; the rest of the chapter is largely about their consequences.

§2The derivation, one step at a time

Four moves: solve the KL-regularized problem, invert the solution for the reward, plug the reward into Bradley–Terry, and watch the partition function disappear.

Move 1: the closed form. For a fixed prompt $x$, write the objective as a single expectation under $\pi$ and complete it into a KL divergence. Define $Z(x)=\sum_y\piref(y|x)\,e^{r(x,y)/\beta}$ and $\pi^*(y|x)=\piref(y|x)\,e^{r(x,y)/\beta}/Z(x)$. Then

$$\E_{y\sim\pi}\big[r(x,y)\big]-\beta\,\KL(\pi\|\piref)=-\beta\,\E_{y\sim\pi}\Big[\log\frac{\pi(y|x)}{\piref(y|x)\,e^{r(x,y)/\beta}}\Big]=-\beta\,\KL\big(\pi\,\|\,\pi^*\big)+\beta\log Z(x).$$

The last term does not depend on $\pi$, and KL is non-negative and zero only at equality, so the unique maximizer is $\pi=\pi^*$. (This is Gibbs' inequality; Chapter 04 builds intuition for the "tilt".) The catch is $Z(x)$: a sum over every possible string. You cannot normalize, so you cannot sample from $\pi^*$, which is why RLHF uses RL to approximate it.

Move 2: invert. Take logs of the closed form and solve for the reward:

$$r(x,y)=\beta\log\frac{\pi^*(y|x)}{\piref(y|x)}+\beta\log Z(x).$$

Read this as a change of variables: any reward function corresponds to exactly one optimal policy (given $\piref,\beta$), and that policy, together with the unknown per-prompt constant $\beta\log Z(x)$, determines the reward back.

Move 3: plug into Bradley–Terry. The preference model only ever sees reward differences between two responses to the same prompt: $p(y_w\succ y_l|x)=\sigma\big(r(x,y_w)-r(x,y_l)\big)$. Substitute Move 2 for both rewards, and the two copies of $\beta\log Z(x)$ (same $x$!) subtract to zero.

Move 4: fit the policy instead of the reward. Parametrize $\pi^*$ by our model $\pit$ and maximize the likelihood of the observed preferences. The scrollytelling figure walks through it.

The objective. Maximize expected reward while staying close (in KL) to the reference policy $\piref$, usually the SFT model. $\beta$ sets the exchange rate between reward and KL.

Its optimum is a tilt. The best policy reweights the reference by $e^{r/\beta}$ and renormalizes. The normalizer $Z(x)$ is a sum over all strings: intractable. RLHF gets around it by sampling with RL.

Invert it. Take logs and solve for $r$. The reward is $\beta$ times the log-ratio of optimal to reference policy, plus a per-prompt constant $\beta\log Z(x)$. In the picture, that constant is the gold block sitting on top of every response's reward for this prompt.

Bradley–Terry only looks at differences. The probability that $y_w$ beats $y_l$ is a sigmoid of the reward gap. The bracket in the picture is the only thing the human label constrains.

The constant cancels. Both rewards carry the same $\beta\log Z(x)$ because both responses answer the same prompt. Watch the gold block grow and shrink: the gap $\Delta$ never changes. The intractable term is gone, exactly, not approximately.

Fit the policy. Replace $\pi^*$ by the trainable $\pit$ and minimize the negative log-likelihood of the preferences. What remains needs four log-probabilities per pair: policy and reference, on the chosen and the rejected response. No sampling, no reward model.

The implicit reward. Read the loss backwards: $\hat r_\theta=\beta\log\frac{\pit}{\piref}$ is a reward model hiding inside your policy, defined only up to a per-prompt shift $f(x)$. Comparisons within a prompt are meaningful; comparing $\hat r_\theta$ across prompts is not.

$$\mathcal L_{\text{DPO}}(\theta)=-\,\E_{\htmlClass{t-d}{(x,y_w,y_l)\sim\mathcal D}}\Big[\log\htmlClass{t-s}{\sigma}\Big(\htmlClass{t-b}{\beta}\log\frac{\htmlClass{t-p}{\pit(y_w|x)}}{\htmlClass{t-r}{\piref(y_w|x)}}-\htmlClass{t-b}{\beta}\log\frac{\htmlClass{t-p}{\pit(y_l|x)}}{\htmlClass{t-r}{\piref(y_l|x)}}\Big)\Big]$$
  • Fixed dataset of prompts with a preferred $y_w$ and a dispreferred $y_l$. Nobody samples from $\pit$.
  • Policy log-probs: sums of token log-probs over the completion only.
  • Reference log-probs: frozen; computable once and cached.
  • β: KL strength in the original problem, and the scale of the implicit reward.
  • Logistic link: Bradley–Terry. Swap it out and you get much of the family in §7.
Analogy · the stage nobody measured

Two people stand on a stage of unknown height. You want to know who is taller. You do not need the stage height: it adds equally to both. $\beta\log Z(x)$ is the stage. Where it breaks: each prompt has its own stage. Comparing implicit rewards of answers to different prompts is like comparing people on different stages, which is why $\hat r_\theta$ is a fine ranker within a prompt and a poor absolute scorer across prompts.

The DPO paper also proves that this reparametrization loses nothing: every equivalence class of reward functions (rewards that differ only by a function of $x$, which Bradley–Terry cannot distinguish anyway) contains exactly one reward of the form $\beta\log\frac{\pi(y|x)}{\piref(y|x)}$ for some policy $\pi$. So "fit a reward, then find its optimal policy" and "fit the policy directly" optimize over the same set, in the population limit. The same trick extends to Plackett–Luce rankings over $K$ responses. Keep the qualifier in italics in mind: with finite, off-policy data the two procedures diverge, and §6 is about how.

Why does the partition function $Z(x)$ cancel in the DPO derivation?
The cancellation is exact and relies on two facts: the preference model is a function of $r(x,y_w)-r(x,y_l)$, and both responses share the prompt $x$. That is also why DPO needs paired data on the same prompt; KTO (§7) has to estimate a substitute for $Z$ because it does not.

The gradient, and why it focuses on mistakes

Write $\hat r_w=\beta\log\frac{\pit(y_w|x)}{\piref(y_w|x)}$ and $\hat r_l$ likewise, and let $u=\hat r_w-\hat r_l$. Since $\frac{d}{du}\big[-\log\sigma(u)\big]=-\sigma(-u)$ and $\nabla_\theta u=\beta\big(\nabla_\theta\log\pit(y_w|x)-\nabla_\theta\log\pit(y_l|x)\big)$ (the reference terms are constants):

$$\nabla_\theta\mathcal L_{\text{DPO}}=-\beta\,\E_{\mathcal D}\Big[\,\htmlClass{t-w}{\sigma\big(\hat r_l-\hat r_w\big)}\,\big(\htmlClass{t-up}{\nabla_\theta\log\pit(y_w|x)}-\htmlClass{t-dn}{\nabla_\theta\log\pit(y_l|x)}\big)\Big]$$
  • Weight: near 1 when the implicit reward orders the pair wrongly, near 0 when it orders it confidently right.
  • Push up the chosen response's log-likelihood (descent on $\mathcal L$ moves along $-\nabla\mathcal L$).
  • Push down the rejected response's log-likelihood.

Without the weight, this is "unlikelihood on the rejected plus likelihood on the chosen", and the DPO paper reports that this naive version makes the model degenerate. The weight is what the KL term buys you: once a pair is ordered with a margin of a few units of $1/\beta$, it stops contributing. In terms of the raw log-ratio margin $h=\log\frac{\pit(y_w)}{\piref(y_w)}-\log\frac{\pit(y_l)}{\piref(y_l)}$, the weight is $\sigma(-\beta h)$, so it falls to $0.1$ at $h=\ln 9/\beta$. With the common $\beta=0.1$, that is about 22 nats. Twenty-two nats of log-ratio is an enormous move for a sequence probability; this is one reason sequence log-probs can move by tens of nats during DPO training.

Each dot is a pair in a toy batch, placed at its current margin; dot size is its gradient weight (hover a dot for its numbers). The gold marker is where the weight has fallen to 0.1, at $h=\ln 9/\beta$: about 22 nats at the default $\beta=0.1$. Drag "training progress" right: as margins grow, the gradient concentrates on the few pairs still misordered (red). Then raise β: the curve steepens and pairs are "satisfied" after a few nats; lower it and DPO behaves more like the unweighted contrast.

Analogy · the tutor who skips what you know

A good tutor spends the hour on the problems you get wrong, not on the ones you already ace. DPO's weight is that tutor, and $\beta$ decides what counts as "already acing it". Where it breaks: the tutor's judgement is the implicit reward, not the truth. If a label is wrong (and annotators disagree with each other a lot on chat preferences), the tutor will obsess over that pair forever, because the model "keeps getting it wrong". That is exactly what cDPO and robust DPO (§4) fix.

What β means, three ways

A subtlety that is easy to miss: in DPO, $\beta$ does not enforce a KL budget the way it does in PPO. In PPO the KL penalty is evaluated on the policy's own samples at every step. In DPO, $\beta$ only shapes a loss on fixed data; nothing measures the KL on the responses the model will actually produce. §4 and §6 show how that difference bites.

The implicit reward is a reward model you can query

After training, $\hat r_\theta(x,y)=\beta\log\frac{\pit(y|x)}{\piref(y|x)}$ scores any response. RewardBench-style evaluations do exactly that with DPO checkpoints. Two identities make it concrete. Averaged over the policy's own samples, $\E_{\pit}[\hat r_\theta]=\beta\,\KL(\pit\|\piref)\ge0$; averaged over the reference's samples, $\E_{\piref}[\hat r_\theta]=-\beta\,\KL(\piref\|\pit)\le0$. So "implicit rewards going negative" on reference-like data is not a bug, it is arithmetic. And the argmax of $\hat r$ need not be the policy's most likely response: a rare response the policy boosted a lot relative to the reference gets a huge implicit reward while still being improbable.

Drag the orange policy bars (the others renormalize). Try the "Rare gem" column: lift it from 2% to 8% and it gets the largest implicit reward while remaining unlikely. Check the readouts: the policy-weighted average of r̂ is always β·KL ≥ 0, the reference-weighted average is always ≤ 0. Try the "displaced" preset: a refusal now has the highest implicit reward.

Pitfall · reading the training curves

TRL and most trainers log rewards/chosen and rewards/rejected, which are $\hat r_w$ and $\hat r_l$. It is normal for both to go negative while the margin grows. It is not automatically fine: a chosen reward that keeps falling means the chosen log-prob is falling, and probability mass is going somewhere you are not measuring. Always log logps/chosen and sample generations.

§3Likelihood displacement: where does the probability go?

DPO only asks the chosen response to beat the rejected one by a margin. It is perfectly happy if both get less likely, and in practice they usually do.

The phenomenon was noticed early by practitioners (log-probs of chosen responses falling during DPO) and has since been analysed carefully. Pal et al. (2024, "Smaug") show theoretically that standard DPO can reduce the likelihood of the preferred response, especially when the two responses have a small edit distance. Feng et al. (2024) analyse the gradient field and find DPO decreases the probability of dispreferred data faster than it increases that of preferred data. Rafailov et al. (2024, "From $r$ to $Q^*$") argue that when DPO starts from an SFT model, the implicit rewards of both chosen and rejected should fall: the expected implicit reward under the reference's own samples is $-\beta\KL(\piref\|\pit)$, which is zero at the start and strictly negative once the policy has moved, and preference data the SFT model was trained to fit looks like reference samples. Razin et al. (2024) name the effect likelihood displacement and show it can be harmful: training a model to prefer "No" over "Never" can sharply raise the probability of "Yes", and in their experiments DPO on refusal data drove Llama-3-8B-Instruct's refusal rate from 74.4% to 33.4%.

The first-order story

Let $g_w=\nabla_\theta\log\pit(y_w|x)$ and $g_l=\nabla_\theta\log\pit(y_l|x)$. One gradient step on one pair moves $\theta$ by $\eta\,c\,(g_w-g_l)$ with $c=\beta\,\sigma(\hat r_l-\hat r_w)>0$. To first order, the change in the chosen log-prob is

$$\Delta\log\pit(y_w|x)\approx\eta\,c\,\big(\|g_w\|^2-\langle g_w,g_l\rangle\big).$$

This is negative whenever $\langle g_w,g_l\rangle>\|g_w\|^2$: when the two responses look alike to the model (their gradients are aligned) and the rejected one has the larger gradient norm. And any third response $y'$ changes by $\eta c\,\langle g_{y'},\,g_w-g_l\rangle$: the mass goes to whatever response is best aligned with the difference direction, which can be a response that appears in no pair at all. Razin et al. make this precise with a centered hidden-embedding similarity (CHES) score between chosen and rejected, and show that filtering out high-CHES pairs mitigates the unintended unalignment.

Key idea · displacement needs shared parameters

In a purely tabular softmax (one free logit per response), the gradient of $\log\pi(y_w)-\log\pi(y_l)$ with respect to the logits is $e_w-e_l$: the normalizer terms cancel, the chosen logit goes up, the rejected goes down, and no other logit moves. The chosen probability can only rise. Displacement is a representation phenomenon: it appears because real responses share parameters, so pushing two similar responses apart drags along everything nearby. That is why the trainer below uses a log-linear policy with shared features.

Eight canned responses live at points in a 2-D feature space; the policy is $\pi(y)\propto e^{b_y+\theta\cdot\phi_y}$, starting at the reference ($\theta=0$); training uses exact gradients. Default: one near-duplicate pair (A ≻ B). DPO separates them by pushing θ along φA−φB, which points at F, a response in no pair: both A and B collapse and F takes the mass. Switch to IPO (bounded, but A still drops), DPO-Positive (A held near its reference), DPO+NLL (A rescued by becoming an imitation target: watch the KL), then try "distinct pairs", where DPO behaves the way you'd hope.

Analogy · the waterbed

Probability is a waterbed: press down on one spot and the water rises somewhere else. DPO presses down on the rejected response and only asks that the chosen be higher than the rejected. If the chosen sits right next to the rejected on the bed, pressing one presses both, and the water rises in a corner nobody was looking at. Where it breaks: on a real waterbed the water goes everywhere; in a network it goes along the specific direction $g_w-g_l$ in representation space, which is why the displaced mass can land on a semantically specific response ("Yes" instead of "No") rather than spreading out.

Fixes, and what each one actually does

What the frontier says

Displacement is still active research. DPO-Shift (Yang et al., 2025) trades margin for chosen probability with a shift parameter; Jian et al. (2025) report that the displaced mass lands on out-of-distribution responses and that in one of their reasoning setups SimPO's accuracy dropped from 73.5% to 37.5%. A useful framing from Ren & Sutherland (2024): a negative gradient on a response the model already finds unlikely "squeezes" probability toward the model's current argmax, so running DPO for too long can make even the desired outputs less likely.

A tabular softmax policy (one free logit per response) is trained with DPO on a single pair $(y_w,y_l)$. What happens to $\pi(y_w)$?
With independent logits there is no notion of "similar": the softmax normalizer cancels in $\log\pi(y_w)-\log\pi(y_l)$. Raising $z_w$ and lowering $z_l$ raises $\pi(y_w)$. Displacement requires shared parameters (or the same response appearing as chosen in one pair and rejected in another).

§4Overfitting: deterministic preferences, IPO and noisy labels

The logistic loss is never satisfied. On a pair that is always labelled the same way, DPO's optimum sends the margin to infinity, and the KL "regularizer" has nothing to say about it.

Azar et al. (2023) put this sharply. Suppose for some pair the true preference is deterministic: $p^*(y\succ y')=1$. Bradley–Terry can only represent probability one with an infinite reward gap, so the DPO solution has $\pi(y')=0$ whatever $\beta$ is. In their words, the KL regularization "becomes weaker and weaker the more deterministic the preferences". This is not only about truly deterministic preferences: with finite data, if a pair is observed once, the empirical preference is 0 or 1, and DPO fits it as if deterministic. In RLHF the same data trains a reward model that is itself regularized (early stopping, finite capacity, ensembling), and then the KL penalty on the policy's own samples bounds how far the policy goes; in DPO the empirical preference is consumed directly.

Analogy · the rumor amplifier

Tell a student once that "A is better than B" and DPO's student concludes that B is infinitely worse and must never be said again. IPO's student writes down "A is better than B by about this much" and stops there. Where it breaks: "about this much" is the same fixed margin for every pair, whether the preference was unanimous or a coin flip. IPO bounds the overconfidence; it does not know which pairs deserve confidence.

ΨPO and IPO

Azar et al. define a general objective, $\Psi$PO: maximize $\E_{x,\,y\sim\pi,\,y'\sim\mu}\big[\Psi\big(p^*(y\succ y'|x)\big)\big]-\tau\,\KL(\pi\|\piref)$ for a non-decreasing $\Psi$. With $\Psi(p)=\log\frac{p}{1-p}$ and Bradley–Terry preferences, this recovers the RLHF/DPO objective; the unboundedness of the logit near $p=1$ is the source of the problem. With $\Psi$ the identity, preferences enter bounded, and the sampled loss becomes a regression of the log-ratio margin onto a constant:

$$\mathcal L_{\text{IPO}}=\E_{\mathcal D}\Big[\Big(h_\theta(x,y_w,y_l)-\frac{1}{2\tau}\Big)^2\Big],\qquad h_\theta=\log\frac{\pit(y_w|x)\,\piref(y_l|x)}{\pit(y_l|x)\,\piref(y_w|x)}.$$

Two things to notice. The loss has a finite minimizer, $h^*=1/(2\tau)$, so pairs that already have that margin are pushed back. And, unlike DPO, its gradient is not self-normalizing: it is linear in the distance to the target. Libraries such as TRL expose IPO with $\beta$ in the role of $\tau$; the target margin is then $1/(2\beta)$, i.e. 5 nats at $\beta=0.1$.

Label noise: cDPO and robust DPO

If each label is flipped with probability $\varepsilon$, the right target for $p(y_w\succ y_l)$ is $1-\varepsilon$, not 1. Mitchell's note (2023) turns this into conservative DPO:

$$\mathcal L_{\text{cDPO}}=-(1-\varepsilon)\log\sigma(\beta h)-\varepsilon\log\sigma(-\beta h),$$

which is exactly binary cross-entropy with label smoothing. Its gradient vanishes when $\sigma(\beta h)=1-\varepsilon$, i.e. at $h^*=\frac1\beta\ln\frac{1-\varepsilon}{\varepsilon}$; as the note puts it, "For normal DPO, the gradient is never zero!" Robust DPO (Chowdhury et al., 2024) instead builds an unbiased estimator of the clean loss, $\big[(1-\varepsilon)\mathcal L(y_w,y_l)-\varepsilon\,\mathcal L(y_l,y_w)\big]/(1-2\varepsilon)$, and proves a sub-optimality bound that degrades as $1/(1-2\varepsilon)$. Note the minus sign: cDPO and rDPO are different losses, though both take $\varepsilon$ as a hyperparameter (TRL exposes $\varepsilon$ as label_smoothing for its robust loss).

DPO keeps falling forever (no tick mark: no finite minimizer). IPO is a parabola around 1/(2β); cDPO bottoms out at ln((1−ε)/ε)/β; hinge (SLiC-style, in log-ratio form) is flat past 1/β; SimPO is DPO shifted right by γ/β; KTO's sigmoid saturates on both sides, so it also ignores examples that are hopelessly wrong. Move β and ε and watch the targets move.

Pitfall · multiple epochs

Because the DPO loss never saturates, more epochs keep pushing margins up and moving the policy away from the reference. Zephyr's authors observed that overfitting after one DPO epoch (perfect training accuracy) did not hurt MT-Bench or AlpacaEval in their setting, and trained 3 epochs; Rafailov et al. (2024) find that direct alignment algorithms over-optimize much like RLHF does at higher KL budgets, often "before even a single epoch of the dataset is completed". Both can be true; the safe reading is that the training loss tells you nothing about when to stop. Track KL to the reference on held-out generations and an external judge.

§5Length: the easiest way to win a preference

Human and AI judges tend to prefer longer answers. DPO faithfully learns whatever predicts the label, and length predicts it.

Park et al. (2024, "Disentangling Length from Quality in Direct Preference Optimization") document that DPO models grow verbose and tie the effect to out-of-distribution bootstrapping: the implicit reward extrapolates "longer is better" to lengths the data never contained. Their fix, R-DPO, adds a length term to the Bradley–Terry logit,

$$\mathcal L_{\text{R-DPO}}=-\E\Big[\log\sigma\Big(\beta\log\tfrac{\pit(y_w|x)}{\piref(y_w|x)}-\beta\log\tfrac{\pit(y_l|x)}{\piref(y_l|x)}+\big(\alpha|y_w|-\alpha|y_l|\big)\Big)\Big],$$

derived from modelling the observed reward as $r=\beta\log\frac{\pi}{\piref}+\beta\log Z+\alpha|y|$: an explicit length term "explains away" the length-driven part of the preference, so the policy's log-ratio does not have to. They report up to 20% improvement in win rates when controlling for length.

800 synthetic pairs, labelled by an annotator whose preference logit is Δquality + bias·Δ(log-length). A Bradley–Terry fit (DPO's implicit reward, linear here) recovers both weights, and tilting the reference by it makes the policy longer. Raise the bias to watch length explode; then raise R-DPO's α until the learned length weight is near zero. Overshoot α and the policy becomes terse instead. (Toy simplification: length enters as log-length here; R-DPO's term is linear in the raw token count $|y|$.)

The other popular answer is length normalization. Sequence log-probs are sums over tokens, so a long response has a large-magnitude $\log\pi$, and the DPO margin of a pair with very different lengths can be dominated by the length difference. SimPO (Meng et al., 2024) uses the average per-token log-prob as its implicit reward, $\frac{\beta}{|y|}\log\pit(y|x)$, with no reference model; Tülu 3 uses a length-normalized variant of DPO (§8). Normalization changes the geometry, not just the scale: it removes the incentive for the chosen response's sum of log-probs to be driven by its token count.

Pitfall · length-controlled metrics are not optional

LLM judges share the bias. Dubois et al. (2024) built length-controlled AlpacaEval for exactly this reason: regressing out the length difference raised its Spearman correlation with Chatbot Arena from 0.94 to 0.98. A method that "wins" only on uncontrolled win rates has often learned length. Report mean response length next to any win rate.

§6Off-policy data and the DPO–RLHF gap

In the population limit DPO and RLHF have the same optimum. With finite data that was sampled from some other model, they do not, and the difference is mostly about which responses get any training signal at all.

The theory gap: what the loss leaves unconstrained

DPO's loss touches $\pit$ only on the responses in the dataset. Xu et al. (2024, "Is DPO Superior to PPO for LLM Alignment?") show that the set of policies minimizing the DPO loss is a strict superset of the set of PPO solutions: "$\Pi_{\text{PPO}}$ is a proper subset of $\Pi_{\text{DPO}}$". Any policy that matches the right log-ratio differences on the data, and does anything at all on responses outside the data, is a DPO optimum; DPO "might find biased solutions that exploit out-of-distribution responses". PPO, by contrast, samples from the policy, so a response that gains probability gets scored by the reward model and pays KL on the policy's own samples. Their empirical results are stark on code: on CodeContests with Code Llama 34B (10@1k on the test set), SFT reached 15.2%, DPO 0.0%, iterative DPO 3.2%, and PPO 22.4%.

Song et al. (2024) give the cleanest statement in terms of coverage: a global coverage condition (the data must cover everything any candidate policy might do) is necessary and sufficient for offline contrastive methods like DPO to converge, while a weaker partial coverage condition suffices for online RL methods. Their HyPO uses offline data for the preference loss and online samples for the KL term. Swamy et al. (2025, "All Roads Lead to Likelihood") ask why two-stage RLHF beats offline fine-tuning at all, given that a reward model cannot add information; their best-supported explanation is the generation–verification gap: a reward (verifier) is simpler to learn than a good policy, and RL then only has to search among policies optimal for that simple verifier.

Same DPO loss, same β, same model; the only difference is where the pairs come from. Offline: 256 fixed pairs from μ (pink), labelled by the true reward (green). Online: 32 fresh pairs per iteration sampled from the current policy, labelled by the same reward. With μ on the left, offline DPO learns "further right is better" inside μ and piles mass at the edge of its data; online DPO follows its own samples to the peak. Slide μ over the peak: with good coverage, offline does fine.

Analogy · dashcam footage vs driving lessons

Offline DPO learns to drive from a library of dashcam clips of other drivers, each labelled "this clip was better than that one". Online methods put you behind the wheel with an instructor who grades your driving. The footage is cheap and plentiful, but it never shows your own characteristic mistakes, so nothing ever corrects them. Where it breaks: if the footage comes from drivers very much like you (on-policy pairs from your own SFT model), the library is nearly as good as the lessons, at least for the first iteration.

Empirical evidence: sampling and negative gradients

Key idea · loss vs data

The cleanest way to state the 2024–2025 consensus: most of the gap between DPO and RLHF is the data distribution, not the loss. Online DPO (sample from the current policy, label with a reward model or judge, take a DPO step) behaves much more like PPO/GRPO than like offline DPO. Conversely, Sun et al. (2025) show on-policy data is not uniformly better either (in their study it was about 3× as effective as static data for Llama-3 but only 0.4× as effective, i.e. worse, for Zephyr), and SimpleMix (Li et al., 2025) finds on-policy data helps more on math and code and off-policy more on open-ended tasks. "Which samples does the gradient see?" is the first question to ask about any preference method.

You run offline DPO on pairs generated by GPT-4-class models for a 7B student. Validation preference accuracy of the implicit reward rises to 75%, yet generations get worse. Which explanation is most consistent with the literature?
Better classification with worse generation is exactly the pattern Tang et al. (2024) describe for offline methods. Caching reference log-probs is exact (the reference is frozen). Large β would show up as a model that barely moves, not as degraded generations with rising accuracy.

§7The family: one idea per variant

Almost every DPO variant changes one of four things: the link function, the reference, the pairing, or where the samples come from.

Tang et al. (2024, "Generalized Preference Optimization") make the first axis precise: write the offline loss as $\E\big[f\big(\beta\,h_\theta\big)\big]$ for a convex function $f$. Logistic $f(u)=-\log\sigma(u)$ gives DPO, squared $f(u)=(u-1)^2$ gives IPO (with $\beta=2\tau$; up to a constant factor), hinge $f(u)=\max(0,1-u)$ gives SLiC. Different $f$ imply different effective regularization; the "KL" in each is only enforced through the shape of $f$ on the data.

Changing the link: IPO, cDPO, robust DPO, χPO

Covered in §4. One more worth knowing: χPO (Huang et al., 2024) is a "one-line change" to DPO that replaces the log link with $\phi(z)=z+\log z$ applied to $\pi/\piref$ (clipped), which amounts to adding $\chi^2$-divergence regularization to the KL. The $\chi^2$ penalizes moving mass onto responses the reference rarely produces much more harshly than KL does, which the authors show gives guarantees against over-optimization under single-policy coverage.

Dropping the pairing: KTO

Ethayarajh et al. (2024) start from prospect theory: humans value outcomes relative to a reference point, concavely for gains and convexly for losses. KTO needs only a binary signal per response ("desirable" or "undesirable"), not pairs. With $r_\theta=\log\frac{\pit(y|x)}{\piref(y|x)}$ and a reference point $z_0=\KL(\pit\|\piref)$,

$$v(x,y)=\begin{cases}\lambda_D\,\sigma\big(\beta(r_\theta(x,y)-z_0)\big)&y\text{ desirable}\\ \lambda_U\,\sigma\big(\beta(z_0-r_\theta(x,y))\big)&y\text{ undesirable}\end{cases},\qquad \mathcal L_{\text{KTO}}=\E\big[\lambda_y-v(x,y)\big].$$

$z_0$ plays the role that the paired response plays in DPO (a baseline that makes the log-ratio meaningful). It is not backpropagated through and in practice is estimated from mismatched pairs in the batch, $\hat z_0=\max\big(0,\frac1m\sum\log\frac{\pit(y_j|x_i)}{\piref(y_j|x_i)}\big)$, which the authors call "a biased but convenient estimate". Because the value function is a sigmoid rather than a log-sigmoid, KTO's gradient vanishes for examples that are very wrong as well as very right: it is robust to outliers (and noisy labels) by construction, at the price of ignoring hard examples. The paper reports KTO matching or exceeding DPO from 1B to 30B parameters and matching DPO with up to 90% fewer desirable examples (reweighting with $\lambda_D,\lambda_U$; they recommend $\frac{\lambda_D n_D}{\lambda_U n_U}\in[1,\tfrac32]$). The practical appeal: thumbs-up/thumbs-down logs are far more abundant than curated pairs.

Analogy · grading against the class average

DPO grades every answer against one specific rival answer. KTO grades each answer against the class average ($z_0$): did this response move the policy further from the reference than typical? Where it breaks: the "class average" is a noisy, biased batch estimate of a KL, and if the batch is unrepresentative the reference point drifts.

Dropping the reference: ORPO and SimPO

ORPO (Hong et al., 2024) merges SFT and preference optimization into one stage with no reference model: $\mathcal L_{\text{ORPO}}=\mathcal L_{\text{SFT}}(y_w)+\lambda\,\mathcal L_{\text{OR}}$ with $\mathcal L_{\text{OR}}=-\log\sigma\Big(\log\frac{\text{odds}_\theta(y_w|x)}{\text{odds}_\theta(y_l|x)}\Big)$ and $\text{odds}=\frac{P}{1-P}$ (computed on length-normalized likelihoods). The SFT term anchors the chosen; the odds-ratio term pushes the rejected down. No reference means one model in memory and one training run instead of two.

SimPO (Meng et al., 2024) also drops the reference, normalizes by length and adds a target margin:

$$\mathcal L_{\text{SimPO}}=-\E\Big[\log\sigma\Big(\frac{\beta}{|y_w|}\log\pit(y_w|x)-\frac{\beta}{|y_l|}\log\pit(y_l|x)-\gamma\Big)\Big].$$

The argument is that the implicit reward should match the quantity that guides generation (average per-token log-likelihood), not a log-ratio to a reference that plays no role at inference. The authors recommend $\beta\in[2.0,2.5]$ and $\gamma\in[0.5,1.5]$ (with larger $\beta$, e.g. 10, better in some Llama-3-Instruct settings) and report gains over DPO of up to 6.4 points on AlpacaEval 2 and 7.5 on Arena-Hard. The caveat: with no reference, nothing in the loss ties the model to its starting point except the learning rate and the number of steps, so SimPO is more sensitive to both, and it inherits likelihood displacement (§3).

Changing the samples: RSO, iterative/online DPO, OAIF, self-rewarding

RSO (Liu et al., 2023) argues that estimating the optimal policy is best done with preference pairs sampled from (an estimate of) that optimal policy, not from the SFT model or from unrelated models. It trains a reward model, then uses statistical rejection sampling to draw responses approximately from $\pi^*\propto\piref e^{r/\beta}$ and builds pairs from those. Iterative / online DPO (Xiong et al., 2023; Dong et al., 2024, "RLHF Workflow") alternates: sample several responses per prompt from the current policy, rank them with a reward model, take best vs worst as a pair, run DPO, repeat. Xiong et al. give the theory for the KL-regularized contextual bandit in offline, online and hybrid settings. OAIF (Guo et al., 2024) uses an LLM judge as the online annotator, and shows you can steer behaviour (e.g. ask the judge for shorter answers, cutting average response length from about 120 to about 40) just by changing the judge's prompt. Self-Rewarding LMs (Yuan et al., 2024) make the policy its own judge (LLM-as-a-judge) inside iterative DPO, improving both the responses and the judging across iterations.

Leaving Bradley–Terry: Nash learning, SPPO, DNO

Bradley–Terry assumes preferences are transitive and come from a scalar reward. Human preferences are often intransitive. Nash learning from human feedback (Munos et al., 2023) learns a pairwise preference model $\mathcal P(y\succ y'|x)$ and seeks the policy that no other policy is preferred to: the Nash equilibrium of the symmetric game, solved with a mirror-descent algorithm (Nash-MD) with last-iterate convergence to the regularized equilibrium. SPPO (Wu et al., 2024) approximates the equilibrium by self-play: each iteration samples responses from the current policy, estimates each response's win rate against the policy with a preference model, and regresses the log-ratio toward that win rate. With a 0.4B PairRM judge and 60k UltraFeedback prompts, it reports a 28.53% length-controlled win rate against GPT-4-Turbo on AlpacaEval 2.0 for Mistral-7B-Instruct and 38.77% for Llama-3-8B-Instruct. DNO (Rosset et al., 2024) is a batched on-policy algorithm with a regression-style objective in the same spirit. A related line, general preference models (Zhang et al., 2024), embeds responses so that the preference model can represent cyclic preferences. Note the naming collision: Zhang et al.'s "General Preference Optimization" and Tang et al.'s "Generalized Preference Optimization" are different papers.

Reasoning: Step-DPO

A long chain of thought fails at one step. Pairing a whole correct solution with a whole incorrect one gives a weak signal (they share most tokens and differ for many reasons). Step-DPO (Lai et al., 2024) pairs a correct and an incorrect next step given a shared correct prefix, and applies DPO at that granularity. With 10K step-wise pairs and fewer than 500 training steps, it reports a nearly 3% gain on MATH for models over 70B, and Qwen2-72B-Instruct with Step-DPO reaches 70.8% on MATH and 94.0% on GSM8K. Self-generated (on-policy) steps worked better than human- or GPT-4-written ones, the same lesson as §6 in miniature. A free fact behind it: tokens in a shared prefix have identical log-ratios in the chosen and rejected sequences, so they cancel exactly in $h$; DPO's gradient always concentrates at and after the point where the two responses diverge.

History

DPO appeared in May 2023. By early 2024 it had become the default open-source alignment stage (Zephyr, Tülu 2, and many leaderboard models), largely because it ran on the same infrastructure as SFT. 2024 was the year of variants and of failure-mode analyses; 2025 was the year online methods (iterative DPO, GRPO and RLVR, covered in Chapter 06) took the lead in the recipes that could afford them.

The comparison table

MethodLoss on (implicit) marginReference?Pairs?On/offlineKey hyperparametersThe one idea
DPO$-\log\sigma(\beta h)$yesyesoffline$\beta$ (0.01–0.5), lrInvert the KL optimum; $Z$ cancels in BT
IPO$(h-\tfrac{1}{2\tau})^2$yesyesoffline$\tau$ (target margin $1/2\tau$)Bounded $\Psi$: stop at a finite margin
cDPOlabel-smoothed logisticyesyesoffline$\beta$, $\varepsilon$Target $1-\varepsilon$, not 1
rDPO$\frac{(1-\varepsilon)\mathcal L(w,l)-\varepsilon\mathcal L(l,w)}{1-2\varepsilon}$yesyesoffline$\beta$, $\varepsilon$Unbiased loss under label flips
SLiC-HF / hinge$\max(0,\delta-\log\pit(y_w)+\log\pit(y_l))-\lambda\log\pit(y_{\text{ref}})$no (SLiC-HF); yes in the log-ratio form $\max(0,1-\beta h)$yesofflinemargin $\delta$, $\lambda$Calibrate likelihoods with a hinge, anchor with SFT
KTO$\lambda_y-\lambda_y\sigma(\pm\beta(r_\theta-z_0))$yesno (binary labels)offline$\beta$, $\lambda_D,\lambda_U$Prospect theory; reference point $z_0$
ORPO$\mathcal L_{\text{SFT}}-\lambda\log\sigma(\log\text{odds ratio})$noyesoffline$\lambda$SFT + preference in one stage
SimPO$-\log\sigma(\tfrac{\beta}{|y_w|}\log\pi_w-\tfrac{\beta}{|y_l|}\log\pi_l-\gamma)$noyesoffline$\beta$ (2–2.5), $\gamma$ (0.5–1.5), lrReward = avg log-prob; margin
R-DPODPO logit $+\alpha(|y_w|-|y_l|)$yesyesoffline$\beta$, $\alpha$Explain length away
DPO-PositiveDPO logit $-\beta\lambda\max(0,-\log\frac{\pit(y_w)}{\piref(y_w)})$yesyesoffline$\beta$, $\lambda$ (50)Never let the chosen fall below ref
DPO+NLL / RPO$\mathcal L_{\text{DPO}}+\alpha\,\text{NLL}(y_w)$yesyeseither$\beta$, $\alpha$Anchor the chosen with SFT
RSODPO or SLiCyesyessampled from $\approx\pi^*$RM, $\beta$, sample countSample pairs from the optimal policy
Online / iterative DPODPOyes (often refreshed)built on the flyonlineRM/judge, samples per prompt, sync intervalPut the sampling loop back
OAIFDPO / IPO / SLiCyesbuilt on the flyonlinejudge promptLLM judge as online annotator
Self-rewardingDPOyesbuilt on the flyiterativejudge rubric, iterationsThe policy is its own judge
SPPO / NLHF / DNOregress log-ratio to win rate (SPPO)yes (previous iterate)preference modelonlinepreference model, $\eta$Nash equilibrium, no BT
Step-DPODPO on stepsyesstep pairsoffline (self-generated)$\beta$, step segmentationCredit the first wrong step
APOanchored sigmoid termsyesyesofflinevariant (zero/down)Say which way each likelihood should move
χPODPO with link $z+\log z$yesyesoffline$\beta$, clip$\chi^2$ pessimism vs over-optimization
Your product logs contain millions of thumbs-up / thumbs-down ratings on single responses, and almost no side-by-side comparisons. Which method fits the data without inventing pairs?
KTO needs only a desirable/undesirable label per response; its reference point $z_0$ stands in for the paired response. IPO, SimPO and ORPO all need a chosen and a rejected response for the same prompt.

§8What open recipes actually do (2024–2026)

In 2024, DPO was the preference stage of almost every open recipe. By 2025–2026, the recipes that could afford it put online RL at the centre and kept DPO for narrower jobs.

The table summarizes what the technical reports say. Read the β column with care: β = 5 in Tülu 3 and Olmo 3 multiplies a per-token average log-ratio (length-normalized DPO), so it is not comparable with the β = 0.1 of standard DPO on summed log-probs.

Model (report)Preference stageDetails the report gives
Llama 3 (2024)Six rounds of SFT → DPOlr 1e-5, β = 0.1; formatting tokens (headers, termination) masked out of the loss "to stabilize DPO training"; NLL term with coefficient 0.2 on the chosen; preference data mostly from the best models of the previous round, so it "conforms better to the distribution of the policy model". PPO was explored, but "DPO required less compute for large-scale models and performed better, especially on instruction following benchmarks like IFEval".
Nemotron-4 340B (2024)DPO, then three rounds of RPOObserved both chosen and rejected likelihoods "drop consistently" under DPO and added a weighted SFT loss on the chosen; Reward-aware Preference Optimization regresses toward the reward gap of a reward model to avoid overfitting.
Qwen2 (2024)Offline DPO, then online DPOOnline stage: sample several responses from the current policy, a reward model picks the most and least preferred, DPO on those pairs, every episode.
Qwen2.5 (2024)Offline DPO, then online GRPOAbout 150,000 offline pairs (built from execution and answer checks), lr 7e-7, one epoch; then GRPO against a reward model.
Tülu 3 (2024)Length-normalized DPO, then RLVR (PPO)β = 5, lr 5e-7 (8B) / 2e-7 (70B), batch 128, one epoch; a mix of off-policy pairs and pairs with one on-policy response from the Tülu SFT model ("including on-policy data improves aggregated downstream DPO performance"). In their ablation only length-normalized DPO beat the SFT checkpoint overall. Why DPO for preferences: PPO took "roughly 28 hours using two nodes" against "about 4 hours using a single node" for DPO.
OLMo 2 (2025)Tülu 3 recipeDPO with on-policy preference data, then RLVR (PPO for 7B/13B, GRPO for 1B/32B).
Qwen3 (2025)Online RL onlyReasoning RL with GRPO on verifier-checked queries, then general RL with rule-based rewards and reward models. DPO does not appear in the report.
DeepSeek-V3 / R1 (2024–25)Online RL onlyGRPO with rule-based and model-based rewards; R1-Zero is pure RL from the base model.
Llama 4 (2025)Light SFT → online RL → light DPO"SFT and DPO can over-constrain the model, restricting exploration during the online RL stage and leading to suboptimal accuracy, particularly in reasoning, coding, and math"; DPO kept at the end "to handle corner cases related to model response quality".
SmolLM3 (2025)Off-policy APOAnchored Preference Optimization on Tülu 3 preferences plus synthetic pairs: Qwen3-32B outputs as chosen, Qwen3-0.6B outputs as rejected.
Kimi K2 (2025)Online RL onlyVerifiable rewards plus a self-critique rubric reward, in which the model's critic ranks sampled responses pairwise.
Olmo 3 (2025)Delta-learning DPO, then RLVR (GRPO-based)Chosen from Qwen3-32B, rejected from Qwen3-0.6B (thinking mode): "the quality of preference data depends primarily on the quality of the delta between chosen and rejected responses". Length-normalized, β = 5, one epoch; "early stopping is important"; "Delta learning provides a stronger initialization for subsequent RLVR than SFT alone".

Why the frontier went back to sampling

  1. Reasoning made on-policy data non-negotiable. When the target behaviour is "solve problems the model currently fails", the useful training signal lives in the model's own attempts, and verifiers can score them for free. That is RLVR (Chapter 06). Offline pairs from other models carry other models' mistakes.
  2. The offline ceiling is real. §6's evidence (coverage theory, Tang et al.'s classifier-vs-generator gap, Xu et al.'s code results, Lanchantin et al.'s semi-online results) all points the same way. Nathan Lambert's RLHF book summarizes the comparisons: in these reports "DPO algorithms are a hair behind", yet direct alignment algorithms "are still used extensively in leading models due to their simplicity".
  3. The cost argument shrank. DPO's main advantage was running on SFT infrastructure. Once labs had fast inference engines inside the training loop and asynchronous RL systems (Chapter 07), the marginal cost of sampling fell, and Tülu 3's 7× wall-clock gap stopped being decisive for well-resourced teams.
  4. Offline stages can hurt later RL. Llama 4's remark that SFT and DPO "over-constrain the model" before online RL is the clearest public statement. Olmo 3 reports the opposite for its delta-learning DPO (a better RLVR initialization than SFT alone), which suggests the issue is how much the stage narrows the distribution, not the loss per se.
Where DPO still earns its place

A cheap, stable chat-quality and style stage (Tülu 3, OLMo 2); a warm start before RLVR built from reliable strong-vs-weak deltas (Olmo 3, SmolLM3); a final polish after RL (Llama 4); a cheap stand-in for RL in research on open models (Anthropic's open-source replication of its auditing-game model organism trained Llama 3.3 70B "using only Direct Preference Optimization (DPO) on high/low reward completion pairs"); and the inner loss of online loops (Qwen2's online DPO, semi-online DPO).

§9Implementation details that decide whether it works

DPO is twenty lines of loss and a hundred ways to compute the wrong log-probability.

Sequence log-probs with masking

$\log\pit(y|x)=\sum_{t}\log\pit(y_t|x,y_{\lt t})$, summed over completion tokens only. The prompt, padding, and (in multi-turn data) earlier turns are masked out. Llama 3's report adds a further mask: special formatting tokens (header and termination tokens) are masked out of both chosen and rejected responses, because tokens common to both sides create "a conflicting learning objective" and, in their experience, led to behaviours such as tail repetition or abruptly generating termination tokens (§8).

import torch, torch.nn.functional as F

def sequence_logps(model, input_ids, attention_mask, completion_mask):
    """Sum of log p(token) over completion tokens. completion_mask is 1 on response tokens."""
    logits = model(input_ids=input_ids, attention_mask=attention_mask).logits
    logits = logits[:, :-1].float()                      # position t predicts token t+1
    targets = input_ids[:, 1:]
    mask = completion_mask[:, 1:].float()
    logp = torch.gather(F.log_softmax(logits, dim=-1), 2, targets.unsqueeze(-1)).squeeze(-1)
    return (logp * mask).sum(-1), mask.sum(-1)            # (sum log-prob, number of tokens)

def preference_loss(pw, pl, rw, rl, beta=0.1, kind="dpo", eps=0.0, len_w=None, len_l=None, gamma=0.0):
    """pw/pl: policy log-probs of chosen/rejected; rw/rl: reference log-probs (cached is fine)."""
    if kind == "simpo":                                   # reference-free, length-normalized
        u = beta * (pw / len_w - pl / len_l) - gamma
        return -F.logsigmoid(u).mean()
    h = (pw - rw) - (pl - rl)                             # log-ratio margin
    if kind == "ipo":
        return ((h - 1.0 / (2 * beta)) ** 2).mean()
    # DPO, or cDPO when eps > 0 (label smoothing)
    return (-(1 - eps) * F.logsigmoid(beta * h) - eps * F.logsigmoid(-beta * h)).mean()

# logging: implicit rewards (detached)
# rewards_chosen = beta * (pw - rw).detach(); rewards_rejected = beta * (pl - rl).detach()
Pitfall · the step-zero test

At step 0, the policy equals the reference, so every margin is exactly 0 and the DPO loss is exactly $\ln 2\approx0.693$ (IPO: $1/(4\beta^2)$). If your first logged loss is not $0.693$, the policy and reference log-probs are being computed differently: dropout left on in one of them, different precision, different truncation, a chat template mismatch, or cached reference log-probs from a different tokenization. Fix that before anything else.

Reference log-prob caching and memory

Hyperparameters that published runs actually used

SourceLossβLearning rateOther
DPO paper (Rafailov et al., 2023)DPO0.1 (0.5 for TL;DR)1e-6, RMSprop, 150 warmup stepsbatch 64
Zephyr-7B (Tunstall et al., 2023)DPO0.15e-7 peak, 10% warmup, linearbatch 32, 3 epochs (SFT lr was 2e-5)
Smaug (Pal et al., 2024)DPO-Positive0.3—λ = 50
SimPO (Meng et al., 2024)SimPO2.0–2.5 (up to 10)tuned per modelγ = 0.5–1.5
Llama 3 (2024)DPO + 0.2·NLL0.11e-5formatting tokens masked; six rounds
Tülu 3 8B / 70B (2024)length-normalized DPO5 (per-token units)5e-7 / 2e-7batch 128, 1 epoch, warmup 0.1
Olmo 3 7B / 32B Think (2025)length-normalized DPO5 (per-token units)8e-8 / 7e-81 epoch, early stopping
TRL defaults (v1.16)loss_type=["sigmoid"]0.11e-6docs suggest ~1e-5 for LoRA

Two rules of thumb fall out, both with exceptions. First, many open full-parameter recipes run DPO at learning rates one to two orders of magnitude below their SFT rate (Zephyr: 5e-7 vs 2e-5; Tülu 3: 5e-7 and 2e-7): the loss is a difference of large sums, and small parameter changes move it a lot. Llama 3 is the notable exception, using 1e-5 for DPO (the same rate as its SFT), so treat the learning rate as something to sweep, not copy. Second, $\beta$ and learning rate interact. With plain SGD the gradient scales with $\beta$ (§2), so lowering $\beta$ also slows training. With Adam-family optimizers, which normalize away a global gradient scale, that effect largely disappears and $\beta$ acts mainly through the weighting $\sigma(-\beta h)$ and the saturation margin; a run that "moves too little" at small $\beta$ is then more likely a data or learning-rate issue than a $\beta$ issue.

What to monitor

Debugging checklist

"DPO made the model worse: what do you check?" Go in order: step-zero loss = 0.693 (plumbing); logps/chosen trend (displacement); held-out vs train preference accuracy (overfitting); length of generations (length exploitation); the source of the pairs vs the policy's own samples (off-policy); and then, only then, hyperparameters.

§10Frontier & open problems

The open questions have shifted from "which loss?" to "which samples, which judge, and how far can you trust the result?".

What Anthropic has said

No Anthropic publication we found says Claude is trained with DPO. The public descriptions are of the other branch of this chapter's divide: a preference model used as a reward for RL on the model's own samples. The Constitutional AI paper's RL phase samples pairs from the model, has a model judge which is better, trains a preference model on those AI preferences, and then trains "with RL using the preference model as the reward signal" (RLAIF). The character-training post describes a "character" variant of Constitutional AI in which "Claude then ranks its own responses" and a preference model is trained on the result. The Claude 3.7 Sonnet system card describes building pairwise preference data for preference-model training (prefer the least policy-violating response; if neither violates, the more helpful, less refusing one). System cards through Claude Opus 4.6 name RLHF and RL from AI feedback; later cards describe post-training aimed at behaviour that "aligns with the values described in Claude's constitution" without naming algorithms. Anthropic's alignment research does use DPO on open models, for example as the post-training method in its open-source replication of the auditing-game model organism on Llama 3.3 70B. Informed speculation: the published pipeline shape (preference models, AI feedback, RL on fresh samples) puts Anthropic's practice on the online side, with the strengths and costs §6 describes.

A question worth asking

Why would a lab with a lot of compute still choose RL over DPO? The answer is about data, not loss: on-policy samples, a reward or preference model that generalizes to responses the policy actually produces, KL measured where the policy puts mass, and the generation–verification gap. The other half is knowing when DPO is still the right tool (§10).

§11Check yourself

Try each one before opening the answer. The "research" questions have no single right answer; the answers show one good line of reasoning.

Derive the DPO loss from the KL-regularized RLHF objective. core

For fixed $x$: $\E_\pi[r]-\beta\KL(\pi\|\piref)=-\beta\KL(\pi\|\pi^*)+\beta\log Z(x)$ with $\pi^*=\piref e^{r/\beta}/Z$, so $\pi^*$ is optimal. Invert: $r=\beta\log\frac{\pi^*}{\piref}+\beta\log Z(x)$. Bradley–Terry uses $r(x,y_w)-r(x,y_l)$, so $\beta\log Z(x)$ cancels. Parametrize $\pi^*$ by $\pit$ and maximize the preference likelihood: $\mathcal L=-\E\log\sigma\big(\beta\log\frac{\pit(y_w)}{\piref(y_w)}-\beta\log\frac{\pit(y_l)}{\piref(y_l)}\big)$. This rests on the equivalence-class theorem (every reward class has a representative of this form) and holds in the population limit.

Derive the DPO gradient. Why does it "focus on mistakes"? core

With $u=\hat r_w-\hat r_l$, $\nabla\mathcal L=-\sigma(-u)\nabla u=-\beta\,\sigma(\hat r_l-\hat r_w)\,(\nabla\log\pit(y_w)-\nabla\log\pit(y_l))$. The weight is near 1 for pairs the implicit reward misorders and decays like $e^{-\beta h}$ for correctly ordered ones. Without it (unlikelihood + likelihood) the DPO paper reports degeneration. Weight 0.1 at $h=\ln 9/\beta\approx22$ nats for $\beta=0.1$.

What is the DPO loss at step 0, and why is that a useful test? core

$\pit=\piref$, so every margin is 0 and the loss is $-\log\sigma(0)=\ln2\approx0.693$ (IPO: $1/(4\beta^2)$). Any other value means the policy and reference log-probs are computed inconsistently (dropout, precision, template, truncation, stale cache).

Why does the chosen log-probability often decrease during DPO? deep

First order: $\Delta\log\pit(y_w)\approx\eta c(\|g_w\|^2-\langle g_w,g_l\rangle)$, negative when chosen and rejected gradients are aligned and the rejected's is larger. Mass goes to responses aligned with $g_w-g_l$, possibly ones in no pair (Razin et al.: CHES; "No" vs "Never" raising "Yes"). Also, from "$r$ to $Q^*$": if the reference was SFT'd on the chosen data, implicit rewards must fall in expectation because the KL at convergence is positive. In a tabular softmax it cannot happen for a single pair, so it is a shared-representation effect. Fixes: DPOP, NLL term, CHES filtering, APO, early stopping.

Explain Azar et al.'s critique of DPO and what IPO changes. deep

Bradley–Terry maps preference probability 1 to an infinite reward gap, so for deterministic (or empirically deterministic: each pair seen once) preferences the DPO solution sets $\pi(y_l)=0$ regardless of $\beta$; the KL regularizer is ineffective. ΨPO with identity $\Psi$ gives IPO, a squared loss regressing the log-ratio margin to $1/(2\tau)$: finite target, pushes back past it. Limitation: same target for every pair, regardless of how confident the preference really was.

Is DPO's β the same knob as PPO's KL coefficient? deep

Same symbol, same population optimum, different enforcement. In PPO the KL is measured on the policy's own samples each step, so any drift the policy actually exhibits is paid for. In DPO, β only shapes a logistic loss on fixed data: it sets the implicit-reward scale and the margin at which the loss saturates. Nothing measures KL on the responses the model will generate, and deterministic labels make β irrelevant at the optimum (IPO's argument). So "DPO with β=0.1" and "PPO with β=0.1" can end at very different KLs.

Construct a minimal example where DPO's optimum is not RLHF's. research

Three responses, tabular policy, data only compares $y_1$ with $y_2$, with a non-deterministic empirical preference (say 80% for $y_1$) so the DPO optimum is finite. DPO constrains only $\log\frac{\pi(y_1)}{\piref(y_1)}-\log\frac{\pi(y_2)}{\piref(y_2)}$; $\pi(y_3)$ is free, so a policy putting 99% on unseen $y_3$ is a DPO optimum. RLHF fits a reward model that assigns $y_3$ some finite reward (by extrapolation), then the KL-regularized optimum is $\piref e^{r/\beta}/Z$, which keeps $y_3$ near its reference weight unless $r(y_3)$ is high. That is Xu et al.'s "$\Pi_{\text{PPO}}\subsetneq\Pi_{\text{DPO}}$" in miniature. Add that in a real network $y_3$'s fate is decided by representation geometry, which is how displacement picks specific responses.

Design an experiment that separates "the loss matters" from "on-policy data matters". research

A 2×2: data source {fixed offline pairs, fresh on-policy pairs labelled by the same judge} × objective {DPO, GRPO/PPO with that judge as reward}. Match number of judge calls, gradient steps, and final KL (report the reward–KL frontier, not single points). Add a sweep over the generator sync interval (offline = ∞, semi-online = 5–100 steps, online = 1) as Lanchantin et al. do. Evaluate with a judge different from the training judge, length-controlled, plus a verifiable task. Prediction from the literature: the data axis dominates. Controls: same prompts, same SFT start, 3+ seeds with confidence intervals.

You only have thumbs-up / thumbs-down logs. What do you train, and what can go wrong? core

KTO: per-example sigmoid value against a reference point $z_0$ (batch estimate of KL), with $\lambda_D,\lambda_U$ to balance classes ($\lambda_D n_D/\lambda_U n_U\in[1,1.5]$). Pitfalls: biased $z_0$ estimate with small or unrepresentative batches; logs are off-policy (generated by older models) and selection-biased (who clicks); ratings confound helpfulness with tone and length; sigmoid saturation means hard negatives get little gradient.

SimPO and ORPO drop the reference model. What does that cost you, and how do you guard against it? deep

The reference is the only term tying the solution to the starting model; without it, the anchor is implicit (learning rate, steps, ORPO's SFT term). Expect more sensitivity to learning rate and training length, and displacement can still happen (the chosen's average log-prob can fall while the margin grows). Guards: small lr and early stopping on a held-out judge, NLL/SFT term, monitor KL to the start checkpoint on samples, length-controlled evaluation. Upside: half the forward passes and memory, and a reward that matches the decoding criterion.

Why is a DPO model's implicit reward a weak reward model? deep

It is only defined up to a per-prompt shift, so it does not compare across prompts; it is trained with a generation-oriented objective whose optimum is unconstrained off the data; and in practice ranking accuracy on held-out preferences is low (Chen et al.: most preference-tuned models below 60%). Tang et al. even find the opposite trade-off: offline methods give better classifiers but worse generators. If you need a reward model, train one.

How would you use preference optimization for multi-step reasoning? research

Whole-solution pairs give diluted credit (shared prefixes cancel exactly in $h$, but the rest differs for many reasons). Options: Step-DPO (pairs of next steps after a shared correct prefix, self-generated); iterative RPO (on-policy correct vs incorrect solutions, DPO + NLL); or skip pairs and use RL with verifiable rewards (Chapter 06), which is where most 2025–2026 reasoning recipes went. A good answer names how you would detect reward hacking of the verifier and how you would keep entropy from collapsing.

Online DPO has plateaued. What do you try next? research

Diagnose first: is the judge saturated (pairs indistinguishable), hacked (length, style), or is sampling not diverse enough to produce informative pairs? Then: refresh the reference to the current policy (trust region on the last iterate), move from BT to a general preference model with self-play (SPPO/DNO style) if preferences look intransitive, improve pair selection (best-vs-worst of $k$, margin filters), mix in verifiable tasks (Lanchantin et al. find multi-tasking helps), or switch the objective to GRPO/PPO with the judge as reward and compare at matched KL.

In 2026, when would you still pick offline DPO? core

When you need a cheap, stable stage on SFT infrastructure: style and format adjustments, a warm start before online RL, distillation-like "delta" signals from a strong vs weak model (Olmo 3's delta learning), or small models where sampling infrastructure costs more than it buys. Not when the target behaviour depends on the model's own failure modes (reasoning, agentic tasks, safety edge cases), where on-policy data is the point.

DPO's implicit reward
$\hat r_\theta=\beta\log\frac{\pit(y|x)}{\piref(y|x)}$, defined up to a per-prompt shift.
Why $Z(x)$ cancels
BT depends on reward differences within one prompt; both rewards carry the same $\beta\log Z(x)$.
DPO gradient weight
$\sigma(\hat r_l-\hat r_w)=\sigma(-\beta h)$: large on misordered pairs, ~0 on confidently ordered ones.
Loss at step 0
$\ln 2\approx0.693$ (policy = reference, margin 0).
Likelihood displacement
Chosen log-prob falls during DPO; mass flows along $g_w-g_l$, possibly to responses in no pair (Razin et al. 2024).
IPO target margin
$h^*=1/(2\tau)$: squared loss, finite minimizer.
cDPO minimizer
$h^*=\frac1\beta\ln\frac{1-\varepsilon}{\varepsilon}$ (label smoothing ε).
KTO in one line
Unpaired good/bad labels; sigmoid value of $\beta(r_\theta-z_0)$ with $z_0$ a batch KL estimate.
SimPO in one line
Reference-free, average log-prob reward, target margin γ; β≈2–2.5, γ≈0.5–1.5.
ORPO in one line
SFT loss + λ·(−log σ(log odds ratio)); no reference, one stage.
R-DPO
Add $+\alpha(|y_w|-|y_l|)$ to the BT logit so length is explained away.
Xu et al. 2024 in one line
$\Pi_{\text{PPO}}\subsetneq\Pi_{\text{DPO}}$: DPO can exploit OOD responses; PPO won on code (22.4% vs 0.0%).
Coverage result
Offline contrastive needs global coverage; online RL needs only partial (Song et al. 2024).
Semi-online DPO
Re-sync the generator every s steps; online/semi-online DPO ≈ GRPO ≫ offline (Lanchantin et al. 2025).

§12Read next

Direct Preference Optimization: Your Language Model is Secretly a Reward Model
Rafailov et al. · 2023 · NeurIPS
The derivation, the gradient weighting, the equivalence-class theorem. Read §4–5 and Appendix A.
DPOtheory
A General Theoretical Paradigm to Understand Learning from Human Preferences
Azar et al. · 2023 · AISTATS 2024
ΨPO unifies RLHF and DPO; deterministic preferences make DPO ignore the KL; IPO as the fix.
IPOoverfitting
Unintentional Unalignment: Likelihood Displacement in Direct Preference Optimization
Razin et al. · 2024 · ICLR 2025
Why chosen log-probs fall, where the mass goes (CHES), and how it undoes safety training.
displacement
Is DPO Superior to PPO for LLM Alignment? A Comprehensive Study
Xu et al. · 2024 · ICML
DPO's solution set strictly contains PPO's; DPO exploits out-of-distribution responses; PPO wins on code.
DPO vs PPO
Preference Fine-Tuning of LLMs Should Leverage Suboptimal, On-Policy Data
Tajwar et al. · 2024 · ICML
On-policy sampling and negative gradients both help; both are mode-seeking.
on-policy
KTO: Model Alignment as Prospect Theoretic Optimization
Ethayarajh et al. · 2024 · ICML
Unpaired binary feedback with a KL reference point; matches DPO from 1B to 30B.
KTO
SimPO: Simple Preference Optimization with a Reference-Free Reward
Meng et al. · 2024 · NeurIPS
Average log-prob reward, no reference, target margin γ.
SimPOlength
ORPO: Monolithic Preference Optimization without Reference Model
Hong et al. · 2024 · EMNLP
SFT and an odds-ratio preference term in one stage.
ORPO
Disentangling Length from Quality in Direct Preference Optimization
Park et al. · 2024
DPO's verbosity and R-DPO's length term that explains it away.
length
Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive
Pal et al. · 2024
Chosen likelihood can fall, especially for small edit distances; DPOP's hinge prevents it.
DPOPdisplacement
From r to Q*: Your Language Model is Secretly a Q-Function
Rafailov et al. · 2024 · COLM
Token-level reading of DPO; why implicit rewards should decrease during training.
theory
The Importance of Online Data: Understanding Preference Fine-tuning via Coverage
Song et al. · 2024 · NeurIPS
Offline contrastive methods need global coverage; online RL needs only partial coverage.
coveragetheory
Understanding the Performance Gap between Online and Offline Alignment Algorithms
Tang et al. · 2024
Offline policies classify better and generate worse; the gap survives scaling.
online vs offline
Direct Language Model Alignment from Online AI Feedback
Guo et al. · 2024
OAIF: an LLM judge labels fresh policy samples; online beats offline ~66% of the time.
online DPO
Self-Play Preference Optimization for Language Model Alignment
Wu et al. · 2024
Approximate the Nash equilibrium of a general preference game by self-play.
SPPONash
Step-DPO: Step-wise Preference Optimization for Long-chain Reasoning of LLMs
Lai et al. · 2024
Pairs of next steps after a shared correct prefix; self-generated data works best.
reasoning
Bridging Offline and Online Reinforcement Learning for LLMs
Lanchantin et al. · 2025
Semi-online and online DPO match GRPO and beat offline DPO by a wide margin.
semi-online2025
All Roads Lead to Likelihood: The Value of Reinforcement Learning in Fine-Tuning
Swamy et al. · 2025
Why reward model + online RL beats offline fine-tuning: the generation–verification gap.
theory2025
Tülu 3: Pushing Frontiers in Open Language Model Post-Training
Lambert et al. · 2024
The most detailed open ablation of DPO variants, data mixes and hyperparameters, followed by RLVR.
recipe
The Llama 3 Herd of Models
Llama Team, AI @ Meta · 2024
Six rounds of SFT → DPO with masked formatting tokens and an NLL term; why they chose DPO over PPO.
recipe
The Delta Learning Hypothesis: Preference Tuning on Weak Data can Yield Strong Gains
Geng et al. · 2025 · COLM
The signal is in the chosen-minus-rejected delta; weak-vs-weaker pairs teach stronger models.
data2025