TL;DR
Standard RLHF first trains a Reward Model on human preference pairs, then runs reinforcement learning to make the language model score well under that reward. Rafailov and colleagues show that the same objective has a closed-form optimal policy. Substituting that policy into the preference model turns the whole pipeline into one binary classification loss on the language model itself. They call the method Direct Preference Optimization (DPO).
Where you'll see it: the preference-tuning step after supervised fine-tuning in many open chat models, and any team that wants RLHF-style alignment without running a PPO loop.
The problem
By 2023 it was established that a Language Model could be steered toward human preferences by fine-tuning on comparisons of its outputs. The usual recipe, from InstructGPT and earlier work on summarisation and instruction-following, was three stages: supervised fine-tuning, fitting a reward model with a Bradley-Terry loss, and then reinforcement learning with PPO against that reward. The KL penalty to a reference model kept the policy from drifting.
The paper's complaint is practical. The RL stage needs samples from the policy during training, several models in memory at once (policy, reference, reward, value), and many sensitive hyperparameters. The authors describe it as complex and often unstable. Their question is whether the reward model and the RL step are necessary at all, or whether the preference data can train the policy directly.
Key idea
flowchart LR A[Preference pairs] -->|RLHF| B[Fit reward model] --> C[PPO against reward with KL penalty] --> D[Policy] A -->|DPO| E[One classification loss on log ratios to the reference] --> D
The reward model and the optimal policy are tied together. For the KL-regularised reward objective, the best policy reweights the reference model by the exponentiated reward. You can invert that relation and write any reward as a scaled log ratio between a policy and the reference, plus a term that depends only on the prompt. The Bradley-Terry preference model depends only on reward differences, so the prompt term cancels. What is left is a preference probability written in terms of the policy.
So the policy can play the role of the reward. Its log probabilities, measured against a frozen reference, define an implicit reward. Training it to rank preferred answers above rejected ones is a single supervised objective. The intuition: the language model already contains its own scoring function. Learning from comparisons means adjusting that function directly.
The method
Let be a frozen reference model, usually the supervised fine-tuned model. The preference data is a set of triples : a prompt, a preferred answer, and a rejected answer. Let be the logistic function and the strength of the KL penalty.
The RLHF objective and its optimum
The paper starts from the standard KL-constrained objective,
The KL divergence term keeps the policy near the reference, and sets the trade-off. Rewriting the expectation as a KL-style term and applying Gibbs' inequality (Appendix A.1) gives the optimum
The partition function is a sum over all possible answers, so it is intractable for language. This is why RLHF needs an RL loop rather than a closed-form solution.
Inverting the relation
Taking logarithms and rearranging gives
Insert this into the Bradley-Terry probability for the true reward . The difference of two rewards for the same prompt cancels the term, because it is the same for both answers:
This is the paper's equation 6 (Appendix A.2 derives it). The unknown now appears instead of .
The objective
Replace by the trained model and maximise the likelihood of the labels. This gives
The paper's Section 5.1 shows that this reparameterisation loses nothing. Any reward class consistent with Bradley-Terry can be written as for some . Two reward functions that differ by a prompt-only term give the same optimal policy, so the constraint picks one representative per class without restricting the class.
The gradient
Differentiating the loss (Appendix A.4) gives
where is the implicit reward. The bracket raises the probability of the preferred answer and lowers that of the rejected one. The sigmoid factor weights each pair by how wrongly the implicit reward orders it. The paper reports that dropping this weight, using a naive probability-ratio objective, can make the model degenerate (the paper points to Appendix Table 3, which shows samples from the related unlikelihood baseline).
Training recipe
Appendix B gives a short PyTorch implementation of the loss. Each step needs the log probabilities of both answers under the policy and under the frozen reference, with no sampling. Default settings are , batch size 64, RMSprop with learning rate , and a linear warm-up over 150 steps. For TL;DR summarisation the paper uses . The text says was not meaningfully tuned for summarisation.
Results
The experiments cover three open-ended tasks. In controlled sentiment generation, the prompt is an IMDb review prefix and the goal is positive sentiment, scored by a pretrained classifier. The base model is GPT-2-large. In summarisation, the input is a Reddit forum post and the output a TL;DR summary, using a GPT-J 6B supervised model. In single-turn dialogue, the data is the Anthropic Helpful and Harmless set of about 170k dialogues, with Pythia-2.8B as the base model.
- Reward against KL. In the sentiment task the authors run 22 training runs across methods and hyperparameters and plot reward against KL from the reference. DPO gives the highest reward at each KL value. The paper says it beats PPO even when PPO is given the true reward (PPO-GT).
- Summarisation. Win rate against the reference summary, judged by GPT-4, is about 61% for DPO at temperature 0, against 57% for PPO at its best temperature. DPO stays strong across sampling temperatures, while PPO degrades toward the base model at high temperature.
- Dialogue. DPO is the only method that improves over the preferred completions in the test set. It matches or beats best-of-128 sampling from the supervised model, a baseline that costs 128 samples per query at test time.
- Out of distribution. On CNN/DailyMail news articles, win rate against ground-truth summaries is 0.36 for DPO and 0.26 for PPO at temperature 0 (Table 1). The paper presents this as initial evidence, not a full study.
- Human check. The authors compare GPT-4 judgments with human raters on TL;DR. Human agreement with GPT-4 (67% for the concise prompt on the DPO comparison) is close to human-human agreement (65%). In head-to-head human judgment, DPO at temperature 0.25 beats PPO at temperature 0 58% of the time.
The headline claim is not that DPO is best on every number. It is that DPO reaches PPO-level or better results on these tasks with almost no tuning and far less machinery. The GPT-4 win rates depend on the judge prompt, and the paper says so.
Why it mattered
The paper turned preference learning into a supervised training problem. Teams could run it with a standard training loop, one reference model, and a preference dataset, which lowered the cost of alignment experiments a great deal. Many later open models used DPO or close variants as a preference-tuning stage in place of PPO. The idea of reading a policy as an implicit reward also became a common lens for studying alignment objectives.
The paper's own limitations are worth keeping in mind. It tests models up to 6B parameters. It leaves open how reward over-optimisation appears when there is no explicit reward model, and it does not settle whether DPO generalises as well as PPO on new distributions. Its evaluation relies on GPT-4 as judge, and the authors note that judge prompts change the win rates.
Reading guide
Read the paper in this order, with the lessons that cover each step:
- Abstract and Section 1. The motivation for RLHF and its cost. Needs Reinforcement Learning from Human Feedback (RLHF) and Training Language Models to Follow Instructions with Human Feedback.
- Section 3, Preliminaries. The three-stage RLHF pipeline, the Bradley-Terry loss and the KL-constrained objective. Needs Reward Model, Bradley–Terry Model, Kullback–Leibler Divergence, Proximal Policy Optimization (PPO) and Policy Gradient.
- Section 4, The method. The closed-form optimum, the log-ratio reparameterisation, the loss and the gradient. Needs Direct Preference Optimization, Sigmoid Function, Logarithm, Cross-Entropy Loss and Maximum Likelihood Estimation.
- Section 5.1, Theory. Why the reparameterisation loses no generality. Needs Softmax for the partition function and Bradley–Terry Model again for the equivalence classes.
- Section 5.2, Instability of actor-critic methods. Needs Advantage Function and Proximal Policy Optimization (PPO).
- Section 6, Experiments. Win rates, KL frontiers and the GPT-4 judge. Needs Language Model, Fine-Tuning and Kullback–Leibler Divergence.
- Appendices A and B. Derivations and the implementation. Read A.1 and A.2 before Section 5 if the algebra is unclear.
Check yourself
QuestionWhat quantity in the RLHF objective makes the optimal policy hard to compute directly, and how does DPO avoid computing it?Show answer
The partition function sums over every possible answer, which is intractable for language. DPO never computes it. Substituting the log-ratio form of the reward into the Bradley-Terry model makes the term appear in both answers' rewards, so it cancels in the difference that the preference probability depends on.
QuestionFor one pair, the implicit reward margin (which already includes ) is 0.3. What is the DPO loss for that pair? Give the number to three decimals.Show answer
The loss is . Here . Then . A margin of zero gives the chance-level loss , so this pair has already moved the model toward the right ranking.
QuestionWhy does the DPO gradient weight a pair by the sigmoid of its implicit reward margin, and what would go wrong without that weight?Show answer
The weight is near one when the model ranks the pair the wrong way round and near zero when it already ranks the preferred answer well above the rejected one. Without it, every pair gets the same push, including pairs the model already ranks correctly. The paper says a naive version without this weighting can make the language model degenerate, though the evidence it cites (Appendix Table 3) is a table of samples from a related unlikelihood baseline.
QuestionA team has a preference dataset and 8 GPUs but no RL infrastructure. Their policy and reference model are both 7B parameters. What does DPO need in memory and what does it not need compared with PPO-based RLHF?Show answer
DPO needs the policy being trained and a frozen reference, both in memory, plus the preference pairs. It does not need a separate reward model, a value network, or sampling from the policy during training. PPO needs the policy, the reference, a reward model and a value function, and it generates new samples in its training loop. The DPO setup is therefore lighter and simpler to run, although each step still computes log probabilities through two 7B models.
QuestionThe paper compares GPT-4 win rates against human judgments. Why does that comparison matter for the summarisation results?Show answer
The summarisation numbers are GPT-4 win rates, which are only useful as a proxy if GPT-4 agrees with people. The authors found human agreement with GPT-4 close to human-human agreement, and that the concise judge prompt tracks human preference better. Without that check, the 61% vs 57% comparison would rest on an untested judge.
Sources
- Rafailov, Sharma, Mitchell, Ermon, Manning, Finn (2023), arXiv: https://arxiv.org/abs/2305.18290
- Ouyang et al. (2022), InstructGPT: https://arxiv.org/abs/2203.02155
- Christiano et al. (2017), Deep RL from human preferences: https://arxiv.org/abs/1706.03741
- Bradley–Terry model (Wikipedia): https://en.wikipedia.org/wiki/Bradley%E2%80%93Terry_model