AI Glossary / AI foundations / Advanced
Direct preference optimization (DPO)
Definition
Direct preference optimization (DPO) is a method for adjusting a language model so its answers match human preferences, using pairs of responses where people marked one as better than the other. It trains the model directly on those pairs with a simple loss function. It does not need a separate reward model or a reinforcement learning loop, which earlier approaches such as RLHF required.
What it means
After a language model is first trained on text, it can write fluently but may not answer the way a business wants. It may be too wordy, too casual, or too quick to agree with the user. One fix is to show it examples of good behavior. Another is to show it pairs of answers and say which one people preferred. DPO is a way to learn from those pairs.
For a business reader, the useful point is that DPO makes preference training simpler and cheaper to run than the older method. It does not change what the model knows. It changes which kinds of answers the model is more likely to give. The quality of the result depends almost entirely on the quality and consistency of the preference data.
How it works
The process starts with a dataset of prompts. For each prompt, there is one chosen response and one rejected response. These can come from human reviewers, or from rules and other models acting as judges. The team also keeps a frozen copy of the starting model, called the reference model.
During training, the model is nudged to make the chosen response more likely and the rejected response less likely, compared with how the reference model rates them. A setting often called beta controls how far the model may drift from the reference. A small beta allows large changes. A large beta keeps the model close to where it started. The loss is computed directly from the pairs, so there is no reward model to build and no sampling loop to manage.
In the older RLHF approach, a separate reward model is trained to score answers, and the language model is then tuned against that score with reinforcement learning. DPO reaches a similar goal with fewer moving parts. Practice varies. Some teams run supervised fine-tuning first and DPO second, and some use related variants. DPO can still go wrong. A model may learn surface habits in the data, such as favoring longer answers, if the preference labels reward them.
Three practical examples
- Finance team: A finance team uses an internal assistant to draft variance commentary. Reviewers compare two drafts for each prompt and mark the one that is shorter, cites the ledger line, and avoids speculation. DPO on those pairs moves the assistant toward that house style.
- Retailer: A retailer runs a product-description writer. Merchandisers pick the better of two descriptions, preferring accurate sizing details and a plain tone over hype. After DPO, the writer produces fewer exaggerated claims that the legal team would have to strip out.
- Support desk: A support desk wants replies that admit uncertainty instead of guessing. Agents mark the response that says it needs to check an order status over the one that invents a delivery date. DPO makes the cautious reply the more likely one.
Think of it this way
Think of a new employee whose manager shows them two versions of the same email and says, this one is better. After enough pairs, the employee writes more like the preferred version without being given a rulebook. The analogy stops working because a person understands why one email is better, while the model only adjusts its probabilities to match patterns in the pairs.
Worked example
A team has 2,000 preference pairs. Reviewers label them, and the team then audits a sample. Of the 2,000 pairs, 1,700 are clear and 300 are contradictory because reviewers disagreed. The team drops the 300 contradictory pairs and keeps 1,700. That is 1,700 divided by 2,000, or 85 percent of the data.
The team tests the model on 400 held-out prompts, with two reviewers judging each pair of outputs blind. Before DPO, the base model's answer was preferred on 160 prompts, which is 160 divided by 400, or 40 percent. After DPO, the tuned model's answer was preferred on 260 prompts, which is 260 divided by 400, or 65 percent. The gain is 65 minus 40, or 25 percentage points.
The team also checks average answer length. It rose from 120 words to 180 words, a 50 percent increase (60 extra words divided by 120). That suggests part of the gain may come from reviewers liking longer answers. The team adds 300 new pairs where the shorter answer wins and retrains.
Illustrative case study
Fictional case: Harbor Lane Insurance, a made-up mid-sized insurer, wanted its claims assistant to explain decisions in plain language. The team collected preference pairs from claims staff and ran DPO on a small open model. In testing, the tuned assistant won most side-by-side comparisons. In a pilot, though, supervisors noticed it often sounded confident about coverage when the policy wording was unclear.
The team traced the cause to the data. Reviewers had favored polished, assured answers, so the model learned that confidence wins. The team added new pairs in which the preferred answer flagged ambiguity and told the customer a human adjuster would confirm. It also raised the beta setting to keep the model closer to its starting behavior. After retraining, the assistant hedged where the policy text was vague, and supervisors approved a wider rollout with a sampled human review of outputs.
Common misconceptions and mistakes
DPO teaches the model new facts. It does not add knowledge; it shifts which kinds of answers the model prefers, so factual gaps need other fixes such as better source material.
DPO removes the need for human judgment. People still decide what counts as better, and weak or inconsistent labels produce a model that copies those flaws.
DPO is always better than RLHF. It is simpler to run, but results depend on the task and the data, and some teams still prefer reinforcement learning approaches.
A higher win rate means a safer model. Preference scores measure what reviewers liked, which can include length or tone, so safety and accuracy need their own tests.
Business use
Most businesses will not run DPO themselves. They will use models from vendors that already applied it, or ask a vendor or internal team to tune a model on their own preference data. If you do start, begin with a narrow task, such as report summaries or customer replies, and collect a few hundred to a few thousand pairs with clear written criteria. Keep a held-out test set that the training never touches, and have reviewers compare outputs blind.
Measure win rate against the base model, but also track answer length, error rates, refusals, and any policy breaches. Costs include reviewer time, compute for training, and the effort to maintain the dataset as needs change. Risks include baked-in bias from reviewers, models that learn to please rather than inform, and drift if the data does not match real use. Document the data and the criteria so you can explain and audit the model later.
People also ask
How is DPO different from RLHF?
RLHF trains a separate reward model and then tunes the language model against it with reinforcement learning. DPO skips both steps and trains directly on the preference pairs.
Do I need a lot of data to use DPO?
Not necessarily. Quality and consistency matter more than volume, and a few thousand well-labeled pairs can be enough for a narrow task. Needs vary by model and goal.
Can DPO make a model more accurate?
Only indirectly. It can make the model prefer careful, well-sourced answers if the pairs reward that, but it does not add facts the model lacks.
Check your understanding
What two kinds of response does each training example in DPO contain?
Answer: A chosen response and a rejected response for the same prompt.
In the worked example, how many pairs remained after the team removed the contradictory ones?
Answer: 1,700 pairs, which is 85 percent of the original 2,000.
In the worked example, what was the gain in preference win rate after DPO?
Answer: It rose from 40 percent to 65 percent, a gain of 25 percentage points.
What does the beta setting control?
Answer: How far the tuned model may drift from the reference model; a larger beta keeps it closer.
Related terms
- RLHF
- Fine-tuning
- Supervised fine-tuning
- Reward model
- Alignment
- Reference model
- Preference data
- Large language model
Learn next
Read the entries on RLHF and supervised fine-tuning to see the steps DPO sits beside. Then look at preference data and alignment to understand why label quality shapes the result. A good practical step is to write down the criteria your reviewers would use to decide which of two answers is better.
More in AI foundations
- Data annotation - Data annotation is the process of adding labels, tags or notes to raw data such as text, images, audio, video or records, so that a machine learning system...
- Data labeling - Data labeling is the process of attaching tags, categories, scores or other annotations to raw data such as text, images, audio or records, so that a...
- Deep learning - Deep learning is a branch of machine learning that learns representations through multiple layers of computation.
- Embodied AI - Embodied AI is artificial intelligence that has a physical body, such as a robot, a vehicle or a machine with sensors and moving parts, and learns or acts...
- Encoder-decoder model - An encoder-decoder model is a neural network design with two connected parts. The encoder reads an input and turns it into an internal representation.
- Expert system - An expert system is a computer program designed to apply specialized knowledge to problems within a defined domain.
Sources
Ouyang et al., Training language models to follow instructions with human feedback: https://arxiv.org/abs/2203.02155 Google, Machine Learning Glossary: https://developers.google.com/machine-learning/glossary Goodfellow, Bengio and Courville, Deep Learning: https://www.deeplearningbook.org/ The sources were consulted for background on preference-based tuning and general machine learning terminology; the examples, analogy, worked example and case are original educational illustrations. Checked 5 Nov 2026.
Previous: Diphthong Next: Direct sampling