DPO: How Stanford Researchers Replaced RL Training With a Single Classification Loss
2026-08-05
Training a language model to follow instructions and behave helpfully requires more than pretraining on text. The model needs to learn what humans prefer: responses that are accurate, harmless, and useful rather than verbose, evasive, or toxic. The dominant approach for years was Reinforcement Learning from Human Feedback (RLHF), specifically using Proximal Policy Optimization (PPO). RLHF works well but involves three sequential training phases, requires keeping four models in memory simultaneously, and is notoriously difficult to stabilize. In May 2023, a team at Stanford published a paper showing that the entire RL stage can be skipped. The optimal policy is already implicit in the preference data. You can extract it with a binary classification objective. That paper introduced Direct Preference Optimization, or DPO.
The paper: authors and central claim
The paper 'Direct Preference Optimization: Your Language Model is Secretly a Reward Model' (arXiv:2305.18290) was submitted on May 29, 2023 by Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. The first three authors are listed as equal contributors. The senior authors, Manning and Finn, are prominent Stanford researchers in natural language processing and meta-learning respectively. The paper was accepted at NeurIPS 2023.
The title's claim, that the language model is secretly a reward model, is the mathematical core of the paper. Standard RLHF treats the reward model and the policy as separate objects. The reward model is trained first on human preference data (pairs of responses labeled with which one humans preferred). The policy is then optimized with PPO to maximize the reward model's score, subject to a KL divergence penalty that keeps the policy from drifting too far from the supervised fine-tuned reference model. The DPO paper shows that this two-step process has a closed-form solution. Under the same KL-constrained objective that RLHF optimizes, the optimal policy can be written analytically as a function of the reference policy and the true reward. Substituting that expression back into the reward function means the reward model can be written entirely in terms of the policy and the reference policy. Training the policy to satisfy human preferences then reduces to a binary cross-entropy loss over preference pairs, with no reward model and no RL loop.
Why RLHF with PPO is expensive
To understand why DPO's simplification matters, it helps to map out what PPO-based RLHF requires at training time. First, a supervised fine-tuning (SFT) step trains the base model on demonstration data to produce an instruction-following reference model. Second, a separate reward model is trained from scratch on preference pairs, typically using the SFT model as a starting point with a regression head attached. Third, the PPO training loop runs: the policy (initialized from SFT) generates responses, the reward model scores them, and PPO updates the policy to increase scored reward while a KL penalty anchors the policy to the reference model. During this loop, four models are active: the policy being trained, a frozen copy of the reference policy for computing the KL term, the reward model, and a value model (critic) required by PPO to estimate expected future reward. For a 7-billion-parameter model, keeping all four in memory simultaneously requires careful memory management even on high-end hardware.
Beyond memory, PPO is sensitive to hyperparameters. The clip ratio that limits policy update size, the KL penalty coefficient beta, the advantage normalization approach, and the batch size all interact in ways that can cause training instability. The reward model is also a separate artifact that can be overoptimized: a policy will eventually find inputs that get high reward model scores without being genuinely good responses, a failure mode called reward hacking. DPO sidesteps the entire apparatus by collapsing the reward model into the policy parameterization and removing the RL loop entirely.
How the DPO loss works
The DPO training objective takes preference pairs as input. Each pair consists of a prompt x, a preferred response y-winner, and a rejected response y-loser. The loss increases the relative log-probability of the preferred response under the policy compared to the reference model, while decreasing the relative log-probability of the rejected response. More precisely, the loss is a logistic function of the difference in log-probability ratios for the two responses: log-prob of winner under policy minus log-prob of winner under reference, minus log-prob of loser under policy plus log-prob of loser under reference. The beta hyperparameter scales the strength of the implicit KL constraint. A higher beta means the loss penalizes deviations from the reference model more strongly.
Crucially, DPO is offline. The policy does not generate any samples during training. It processes the fixed preference dataset once per epoch and updates its weights based on how it scores each response relative to the reference model. This eliminates the generation step that makes PPO slow: no rollouts, no scoring, no critic updates between gradient steps. A DPO fine-tuning run on a 7-billion-parameter model can complete in hours on a single node of A100s, whereas a comparable PPO run requires more hardware and careful monitoring.
What the original paper showed
The DPO paper evaluated three tasks: sentiment-controlled generation (making a GPT-2 model generate positive movie reviews), summarization (fine-tuning GPT-J-6B on the TL;DR summarization preference dataset), and single-turn dialogue (fine-tuning Pythia-2.8B on the Anthropic HH-RLHF dataset). Results were measured by win rates against reference responses scored by GPT-4 or by human evaluators, and by the reward model score on held-out preference data.
- Sentiment control: DPO matched or exceeded PPO-based RLHF (with reward model) at all KL budget levels on the sentiment task. At low KL budgets (meaning the policy stayed close to the reference), DPO outperformed PPO clearly.
- Summarization: DPO achieved a win rate against the reference that was comparable to the best PPO baseline, with no reward model training step required.
- Single-turn dialogue: DPO matched or improved over PPO baselines when measured by the learned reward model score, while being more stable to train.
- Best-of-N sampling (a strong inference-time baseline that generates N candidates and picks the highest-scoring one) outperformed both DPO and PPO at large N, illustrating the compute-quality tradeoff at inference time.
- DPO training ran substantially faster than PPO in wall-clock time because it required no generation step and no value model update during the training loop.
Adoption and limitations
DPO spread quickly after the paper was published because it dramatically lowered the infrastructure cost of preference fine-tuning. Mistral AI used a DPO variant for Mistral 7B Instruct v0.1, one of the first open models to match much larger instruction-tuned models on standard benchmarks. The Hugging Face TRL library added DPO support in late 2023, making it accessible with a few lines of Python. Many subsequent open-weight aligned models were trained with DPO or iterative variants of it.
The main limitation of offline DPO is distribution shift. The preference dataset was collected from a specific model at a specific point in training. As the policy being trained drifts from that reference distribution, the preference labels may become less accurate guides for further improvement. A 2024 paper titled 'Is DPO Superior to PPO for LLM Alignment?' found that well-tuned PPO with advantage normalization and large batch sizes outperforms standard DPO on dialogue and code generation tasks. On the challenging CodeContest benchmark, a 34-billion-parameter PPO model improved from 16.4% to 22.4% on the pass@1000 metric, a result the authors found DPO could not match. Iterative DPO, where the policy generates new response pairs, they are scored by a reward model, and the dataset is refreshed, partially addresses the distribution shift issue at the cost of reintroducing some of the infrastructure that offline DPO eliminated.
DPO also cannot use online rewards directly. A PPO-based system can incorporate any differentiable or black-box reward signal at training time: a code execution result, a math verifier, a toxicity classifier. DPO requires offline preference pairs and cannot incorporate new reward signals without first collecting more preference data. For tasks where automatic verification is cheap (math, code), RLVR methods such as those used in DeepSeek-R1 have displaced DPO as the preferred fine-tuning approach.
What DPO changed for the field
Before DPO, building an aligned language model from a pretrained base required either a large infrastructure investment (reward model training plus PPO) or accepting a significantly weaker baseline (pure supervised fine-tuning on demonstrations). DPO opened a middle path: preference-based alignment with the training complexity of a standard fine-tuning run. That shift made preference fine-tuning accessible to research groups and practitioners without large compute clusters, and it accelerated the pace at which new alignment ideas could be tested and iterated. The DPO paper has been cited thousands of times and spawned a family of variants including IPO (Identity Preference Optimization), KTO, and ORPO, each addressing one of DPO's identified failure modes while preserving its core simplicity. PromptingIndex covers alignment fine-tuning approaches tested across Claude, ChatGPT, and open models, including how DPO-trained and PPO-trained models differ in practice on adversarial and edge-case prompts.
Put these ideas to work.
Browse the prompt library