What is direct preference optimisation (DPO)?
Direct preference optimisation is an alignment method that fine-tunes a language model directly from pairs of preferred and rejected answers to the same prompt, using a single classification-like loss without training a separate reward model or running a reinforcement learning loop.
Unlike classic RLHF, which first trains a reward model from preferences then updates the model against it with a reinforcement learning method such as Proximal Policy Optimisation, DPO merges both stages into one offline preference-training stage, usually run after supervised fine-tuning.
- Topic
- Machine learning, models and training
- Also known as
- DPO, direct preference optimization
- Origin
- 2023, Rafailov et al.
How direct preference optimisation (DPO) works
- Each example holds a prompt, a preferred answer and a rejected answer.
- The model being trained and a frozen reference model are compared on the probabilities they give the two answers.
- The loss raises the relative probability of the preferred answer while lowering that of the rejected one.
- A coefficient limits how far the model may drift from the reference model.
In more detail
The loss function and the role of beta
The DPO loss increases the log-probability margin between the preferred and rejected responses, measured against the frozen reference model and controlled by the coefficient beta. Higher beta keeps the model closer to the reference, whereas lower beta permits stronger adaptation at higher risk of over-optimisation or style drift.
SFT as a prerequisite and DPO with one model in memory
DPO typically follows an initial SFT phase on the target style and tasks so the reference model already sits in the desired distribution. In memory-constrained on-premise setups, teams avoid loading two full copies of the model by either precomputing reference log-probabilities offline or training with LoRA and disabling the adapter temporarily to get reference outputs from the shared base weights.
Likelihood displacement, offline limits and newer variants
Offline DPO suffers from known failure modes: likelihood displacement (the absolute probability of both preferred and rejected answers dropping while their margin widens) and sensitivity to distribution shift compared to online RL methods. To address these issues, recent workflows frequently adopt iterative or online DPO or reference-free and reasoning-oriented alternatives such as SimPO, KTO, ORPO and GRPO.
Commonly confused terms
| Term | How it differs |
|---|---|
| Supervised fine-tuning (SFT) | SFT teaches a model to imitate single high-quality demonstration answers via cross-entropy loss and normally precedes alignment, whereas DPO contrasts preferred and rejected answer pairs relative to a reference model to shape preferences and suppress unwanted responses. |
Why direct preference optimisation (DPO) matters for on-premises AI
Needing no reward model or reinforcement learning loop, DPO is simpler to set up than the classic approach, loads fewer models into memory and can train more stably. This makes alignment feasible with in-house GPU capacity. When the organisation's own experts label the preference pairs, both data and training stay inside. Results depend heavily on consistent preference data, so labelling guidelines are written in advance.
A healthcare provider aligns its internal knowledge assistant with DPO, using pairs where doctors marked which of two answers to the same question they preferred; training runs on an in-house server with results measured on an evaluation set.
Common questions
How does DPO differ from RLHF?
Classic RLHF trains a reward model first, then updates the model with reinforcement learning. DPO updates the model directly from preference pairs in one offline training stage.
What data does DPO need?
Pairs showing which of two answers to the same prompt was preferred. Consistent labelling determines the quality of the result.
Related terms
- Reinforcement learning from human feedback
- Reward model
- Proximal Policy Optimisation
- Kahneman-Tversky Optimisation
- Odds Ratio Preference Optimisation
- AI alignment
Sources
- Rafailov et al., Direct Preference Optimization: Your Language Model is Secretly a Reward Model, 2023
- Ouyang et al., Training language models to follow instructions with human feedback, 2022
In the glossary: Glossary, D to L