RLHF, Bradley–Terry and DPO
The preference model, the KL-regularised RL objective, its closed-form optimum, and the algebra that turns it into a supervised loss.
Preferences to rewards
Given a prompt and two responses , assume there is a latent reward with
Given preference data (winner, loser), the reward model is fit by maximum likelihood:
For any , the rewards and induce identical preference probabilities, hence identical likelihood. Consequently the reward learned from preference data alone is determined only up to such a shift.
The RLHF objective and its optimum
Consider
The maximiser is
Key idea
Two observations from the proof. First, the KL-regularised RL problem has a closed-form solution — a Gibbs/Boltzmann reweighting of the reference policy. The reason RLHF is implemented with PPO rather than by writing down this formula is purely computational: is a sum over all sequences and is intractable. Second, the prompt-dependent shift from the identifiability proposition changes and by matching factors, so is unchanged — the unidentifiability is harmless here.
DPO
Under the Bradley–Terry model and the KL-regularised objective, the reward is recoverable from the optimal policy:
and substituting into the Bradley–Terry likelihood cancels , giving the objective
which involves no reward model and no sampling from .
Key idea
The whole of DPO is: the reward is a reparameterisation of the policy, and Bradley–Terry only ever uses reward differences, so the intractable normaliser drops out. No new optimisation theory, no new statistical assumption beyond those already in RLHF — a change of variables. It is a good example of how far algebra can go before any analysis is needed.
The DPO gradient, and what it does
Differentiate the logistic loss. Write the implicit reward margin as Δ.
The derivative of −log σ(Δ) is −σ(−Δ) times the derivative of Δ.
The update is a contrastive step on the two responses.
Read the two factors. The bracket raises the log-probability of the winner and lowers that of the loser — an ordinary supervised signal.
This is an automatic hard-example weighting, with no scheduling.
The weight σ(−Δ) is large exactly when the current model ranks the pair wrongly, so mis-ranked pairs dominate the gradient and already-correct pairs contribute little.
Empirical observation — a regularity seen in experiments. No theorem on this page establishes it in general.
DPO removes the separately-trained reward model and the on-policy RL loop, and is markedly simpler and cheaper. It is not equivalent to RLHF in practice.
What this does not say
The derivation is exact, but it establishes the equivalence at the optimum, for the exact Bradley–Terry model, with unlimited preference data. Several things differ in practice:
- Off-distribution behaviour. RLHF's reward model is queried on samples from the current policy, so it supplies a signal on responses that the preference dataset never contained. DPO only ever sees the fixed pairs, so the implicit reward is unconstrained off the preference distribution, and the optimised policy can drift into regions where nothing pins it down.
- The Bradley–Terry assumption is inherited, not removed. Both methods assume preferences are generated by a single latent scalar reward with a logistic link. Non-transitive or heterogeneous human preferences violate this, and no amount of data fixes it.
- The KL constraint is enforced differently. In RLHF it is an explicit penalty on samples; in DPO it is implicit in the parameterisation, and the effective constraint is weaker on unseen responses.
- Empirically the two give different behaviour, with DPO sometimes reducing output diversity more sharply and being more sensitive to the quality of . Which is better depends on the setting, and the literature has not converged.
Heuristic — a reasoning shortcut that predicts the right answer in the regimes discussed here. It is not a proof and can fail outside them.
As the optimal policy concentrates on — the maximiser of the learned reward, which is a finite-sample estimate. That maximiser is typically an adversarial input to the reward model rather than a good response.
What this does not say
This is Goodhart's law with a mathematical form. The learned approximates well on the preference distribution, and the optimiser's job is to find points where they differ most — precisely the points where the approximation is untested. The KL term is a proximity constraint keeping the policy inside the region where was fit.
What is not available: a theorem bounding the true reward of the optimised policy in terms of the reward model's error and . Such a bound would need a uniform error guarantee for over the region reachable at a given KL budget, and the available uniform convergence tools are vacuous at this scale. Choosing is therefore empirical, and reward hacking is diagnosed after the fact rather than prevented by design.
Problems
Closed form of the KL-regularised RL optimumProof · Graduate · 1 hour Derive the DPO objectiveProof · Graduate · 1 hour Rewards are identifiable only up to a prompt-dependent shiftProof · Intermediate · 30 min The DPO gradient is a weighted contrastive stepProof · Advanced · 30 minReferences
- PaperRalph A. Bradley and Milton E. Terry (1952). Rank Analysis of Incomplete Block Designs
- PaperPaul F. Christiano, Jan Leike, Tom B. Brown, Miljan Martic, Shane Legg and Dario Amodei (2017). Deep Reinforcement Learning from Human Preferences
- PaperLong Ouyang and collaborators (2022). Training language models to follow instructions with human feedback
- PaperRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning, Stefano Ermon and Chelsea Finn (2023). Direct Preference Optimization: Your Language Model is Secretly a Reward Model
- PaperJohn Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford and Oleg Klimov (2017). Proximal Policy Optimization Algorithms
These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.
Results stated on this page
- DefinitionBradley–Terry preference modelThe probability that one response is preferred is the logistic function of the reward difference.
- PropositionThe reward is identifiable only up to a prompt-dependent shiftproof includedBradley-Terry depends on reward differences, so any function of the prompt alone can be added without changing the likelihood.
- TheoremClosed form of the KL-regularised RL optimumproof includedThe optimal policy is the reference policy reweighted by the exponentiated reward.
- TheoremThe DPO objectiveproof includedInverting the closed-form optimum expresses the reward in terms of the policy, turning RLHF into a supervised classification loss.
- Empirical observationWhat DPO does and does not replaceDPO removes the reward model and the RL loop but inherits the Bradley-Terry assumption and behaves differently off the preference distribution.
- HeuristicReward hacking and the role of the KL termThe KL penalty is what keeps the optimised policy inside the region where the learned reward is trustworthy.
Problems (4)
All problemsPapers that use this mathematics
Training language models to follow instructions with human feedback
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll L. Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray and others · 2022
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, Chelsea Finn · 2023