AI 101 — What is DPO (direct preference optimization)?

Share
AI 101 — What is DPO (direct preference optimization)?

Direct preference optimization (DPO) is a way to teach a language model what people prefer by showing it pairs of answers — one better, one worse — and shifting its odds toward the better one, without building a separate reward model or running a reinforcement-learning loop.

It is the least glamorous and most widely used step in modern post-training. When a downloaded model turns out more agreeable, better formatted, and less prone to lecturing than its raw base checkpoint, a DPO stage is usually part of why. The method came from a Stanford team in May 2023 under a title that still explains the trick better than any summary: your language model is secretly a reward model.

Why it matters right now

Preference tuning is where a text predictor becomes an assistant, and it is also where the industry's two camps now split.

Reasoning models get their long chains of thought from reinforcement learning against checkable answers — math that either solves or does not, code that passes or fails. But most of what makes an assistant pleasant to use is not checkable: tone, length, formatting, when to refuse, when to ask a clarifying question. That layer is still built from human comparisons, and DPO is the cheap, stable way to use them. Meta's Llama 3 report describes six rounds of post-training built on supervised fine-tuning, rejection sampling and DPO, and says the team tried PPO as well but found DPO needed less compute at large scale and scored better on instruction following, according to the paper.

The economics matter as much as the quality: a lab without a thousand-GPU cluster can still run DPO on a single node, a large part of why open-weight fine-tunes proliferated.

The mental model

RLHF has three moving parts: human comparisons, a reward model trained to predict them, then reinforcement learning to push the model toward high reward while a penalty keeps it near the original. It works, and it is fussy: the RL stage is unstable and you sample text inside the training loop. DPO has none of that machinery — no reward model, no sampler, no RL.

DPO's insight is that the reward model is redundant. Under the standard RLHF objective, the best policy you could ever reach has a closed-form relationship to the reward — so you can turn the equation around and write the reward in terms of the model's own probabilities. The reward model vanishes, and what is left is a simple classification loss over pairs.

In plain terms: raise the model's probability of the chosen answer, lower the probability of the rejected one, and measure both against a frozen copy of the model as it was before training. That frozen copy is the anchor: without it, the model could raise every probability and satisfy the loss without learning anything, and the ratio also limits how far one run can drift. A single number, beta, sets the strength of that leash; Llama 3 used 0.1.

The paper's results were modest but clear: DPO matched or beat PPO-based RLHF on summarization and single-turn dialogue, and beat it at controlling the sentiment of generated text, the authors wrote. It also trained Zephyr-7B, one of the first open chat models built this way, as Hugging Face's walkthrough recounts.

The tennis coach

Picture a coach who cannot describe a good serve in words but can always tell you which of two serves was better.

Under RLHF, you first get the coach to write down a scorecard — a rule for grading any serve — and have the player practise against the scorecard. The player ends up optimising for a copy of the coach's taste, and the copying is where things go wrong.

Under DPO, you skip the scorecard. The coach watches pairs of serves and the player's technique updates directly from each comparison. Fewer moving parts, no separate artifact to be wrong.

The analogy shows the method's two limits. The player only learns from serves already on the video — DPO is offline, so it cannot invent a technique nobody filmed. And if the coach's taste is narrow, the player gets very good at pleasing that one coach, which is exactly the reward hacking problem.

Common misconceptions

"DPO is just fine-tuning on the answers people liked." No. Supervised fine-tuning copies the winner; DPO contrasts winner against loser, and the reference model keeps the update anchored. Dropping the pairs and the anchor changes the method into something much weaker.

"DPO replaced RLHF." It solves the same problem more cheaply, but offline. It cannot explore, so it cannot discover answers better than the ones in its dataset — which is why reasoning training moved to online RL with verifiable rewards, the approach behind GRPO. DPO remains the standard tool for behaviour, and RL for capability.

"DPO is free." The reward model and the RL loop are gone, but preference data is still the expensive part: someone has to read two answers and pick one, thousands of times. You also hold two models in memory — the one being trained and the frozen reference.

"DPO makes a model smarter." Like RLHF, it shapes behaviour, not knowledge. A DPO-tuned model can still be wrong; it is just wrong in a more agreeable voice.

"DPO is one algorithm." It is a family. IPO adds a regularisation term because DPO overfits preference sets quickly; KTO works from unpaired thumbs-up and thumbs-down; ORPO and SimPO fold the preference step into fine-tuning. Hugging Face found DPO and IPO roughly level on paired data, both ahead of KTO.

Where to learn more

The original paper is short and readable — the derivation is the whole argument. Hugging Face's preference-tuning post is the practical companion, with loss functions side by side and code. For a production recipe, section 4.1.4 of the Llama 3 paper is candid about the small modifications that made DPO stable at scale.

Related reading: What is RLHF? is the method DPO simplifies · What is fine-tuning? covers the wider post-training stage · and what is reward hacking? explains the failure mode both methods share.

If a model could learn your taste from a hundred comparisons, what would you most want it to pick up — and what would you rather it never learned? Write to us via our contact page.

Get SiliconNoon in your inbox

One email a day with the AI stories that matter — what happened, the numbers, and why it matters. No spam, unsubscribe in one click.

Read more

AI 101 — What is GRPO (group relative policy optimization)?

AI 101 — What is GRPO (group relative policy optimization)?

GRPO is the reinforcement-learning method behind most open reasoning models: instead of training a second neural network to judge how good each answer is, it has the model answer the same question many times and rewards whichever answers beat the group's own average. The name is an initialism nobody says out loud — group relative policy optimization — but the idea fits in a sentence, and once you have it a lot of recent AI news stops sounding like alchemy.

AI 101 — What is supervised learning?

AI 101 — What is supervised learning?

Supervised learning is teaching a model from labelled examples: you show it thousands of inputs, each paired with the correct answer, and it works out the rule that turns one into the other. The label is the whole trick. Nobody writes the rule down — the model infers it from enough answer keys. That is worth stating plainly because the phrase sounds more mysterious than it is. A supervised model is a student with a stack of past exam papers, each with the marking already done.

AI 101 — What is gradient descent?

AI 101 — What is gradient descent?

Gradient descent is the loop almost every AI model runs to get better: measure how wrong its answers are, work out which direction would make the error smaller, and nudge every one of its numbers a little that way. Then do it again — millions of times. That is the whole idea. It is older than the computer, it fits on a napkin, and it is still what happens inside a training run that costs tens of millions of dollars and burns through a power station's worth of electricity. Why it matters…