esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

What Is DPO?

What Direct Preference Optimization (DPO) is, how it learns from pairs of answers without a reward model, and where it falls short, explained simply for your AI interview.

In short

DPO, or Direct Preference Optimization, trains a language model on pairs of answers to the same prompt, one preferred and one rejected, with no separate reward model or reinforcement learning loop. It is simpler than RLHF, but it is only as good as its pairs.

11 min readAdvancedCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

DPO stands for Direct Preference Optimization. You give the model pairs of answers to the same prompt, one that people preferred and one they rejected. Training pushes the model toward the preferred answer, measured against a frozen copy of the starting model. So there is no separate reward model and no reinforcement learning loop. It is simpler than RLHF, the older method that uses a reward model and reinforcement learning, but the pairs have to be good, because the model learns from them exactly as they are.

What is DPO, in plain words?

A language model can write fluent text. Alignment is the work of making its answers match what people actually want, such as correct facts, a clear tone and a safe refusal when needed. DPO is one way to do that.

DPO takes pairs of answers to the same prompt. A person has picked the better one, and training nudges the model toward the kind of answer that was picked.

Think of a new hire at a bank's call centre who learns from a senior colleague's red pen. The senior does not write a manual of scores. They mark two draft replies to the same customer, one better than the other, and the new hire adjusts. Here, a support bot gets two replies to a late-fee question: one with the current fee, one with last year's. The labeller picks the current one, and that pick is the training signal.

Key words

Preference pair
Two answers to the same prompt, with one marked as the one people prefer.
Reward model
A separate model that scores answers. RLHF needs one, DPO does not.
Reference model
A frozen copy of the starting model, used as the anchor during training.
RLHF
Reinforcement learning from human feedback: a reward model plus a reinforcement learning loop.

How does DPO learn from a pair of answers?

Each training update uses a batch of pairs, plus the frozen reference copy. The diagram follows one pair through the update, and the training compares how each copy treats the two answers.

How one preference pair trains the model

Question with 2 answers

one marked preferred, one rejected

Two copies of the model

Model being trained

the one that gets updated

Frozen reference model

starting copy, never updated

Preference margin

how far the good answer pulled ahead

Better answers

wrong answers become rarer

  1. 1The pair goes to the model being trained.
  2. 2The same pair goes to the frozen copy too.
  3. 3The trained model's view of both answers goes into the margin.
  4. 4The reference's view joins it, so the update stays close to the start.
  5. 5Training mostly lowers the rejected answer's odds, and lifts the preferred one's.
One pair goes to two copies of the model: the one being trained and a frozen reference. The margin compares how each treats the two answers. Training moves the model so the preferred answer gains ground.

DPO's loss is built from that margin. If the trained model prefers the good answer more than the reference does, the loss falls. The beta setting controls how tightly the model is held to the reference. OpenAI's guide describes beta as a number that controls how strictly the new model adheres to its previous behaviour, versus aligning with the provided preferences.

Tip

Asked what DPO trains on, say the pair. Asked what it removes, say the reward model and the reinforcement learning loop.

How is DPO different from RLHF?

  • RLHF

    Two moving parts

    A reward model is trained first. Then reinforcement learning tunes the model against it. Both need careful settings, and training can become unstable.

  • DPO

    One training step

    The model learns straight from the pairs with a simple loss. No reward model, and no sampling loop during training.

  • The catch

    Pairs decide the result

    DPO is only as good as its pairs. If labellers prefer the wrong answer, the model learns the wrong habit.

  • “allowing us to solve the standard RLHF problem with only a simple classification loss”

    Rafailov et al., the DPO paper

  • “In practice, this is typically achieved by suppressing the likelihood of dispreferred completions rather than by increasing the likelihood of preferred ones.”

    Hugging Face TRL documentation

The DPO paper says its experiments show DPO can align models with human preferences as well as or better than existing methods. It reports that DPO matches or improves response quality in summarisation and single-turn dialogue. PPO is a common reinforcement learning method used inside RLHF, and the paper says DPO exceeds PPO-based RLHF at controlling sentiment.

What does one DPO training step look like?

Here is a small, made-up example of the loss for one pair from the bank's bot. The numbers stand in for how likely the model finds each answer. We pretend the reference holds the starting view, and the training moves the answers apart.

Python
# One made-up preference pair from a bank's support bot. The numbers are made up too: each is how
# likely the model finds an answer, on a log scale. The reference is a frozen copy of the start.
import math

BETA = 0.1  # how tightly the model is held to its start: higher keeps it closer

def dpo_loss(model_good, model_bad, ref_good, ref_bad):
    # Did the model move toward the good answer more than the reference did?
    margin = (model_good - ref_good) - (model_bad - ref_bad)
    chance_right = 1 / (1 + math.exp(-BETA * margin))  # sigmoid: squashes to 0..1
    return -math.log(chance_right)  # small when the good answer is clearly ahead

ref_good, ref_bad = -12.5, -10.5  # the frozen reference's view of the two answers
print("Start, model equals reference:", round(dpo_loss(ref_good, ref_bad, ref_good, ref_bad), 3))
for shift in [1.0, 2.0]:
    # Training moves probability toward the good answer and away from the bad one.
    loss = dpo_loss(ref_good + shift, ref_bad - shift, ref_good, ref_bad)
    print(f"After training, shift {shift}: loss {loss:.3f}")

Output

Start, model equals reference: 0.693
After training, shift 1.0: loss 0.598
After training, shift 2.0: loss 0.513

At the start, the trained model equals the reference, so the margin is zero and the loss is about 0.69. Each shift makes the good answer more likely and the rejected one less likely, so the loss falls to about 0.60 and then 0.51. A real run has many pairs and thousands of steps, but the logic is the same.

How would you choose between DPO and RLHF for a bank's bot?

The bank wants fewer wrong fee answers, and it has staff who can mark pairs. A sensible plan starts with the data and ends with a person checking the result.

  1. 1

    Start with good answers

    Supervised training on preferred responses before a DPO job can help, as OpenAI's guide suggests. OpenAI is winding down its fine-tuning platform, so check that your provider still runs DPO jobs before you plan around one.

  2. 2

    Check every pair

    Compare each pair with the current fee sheet. A pair that marks an old fee as preferred would teach the wrong fact.

  3. 3

    Train with a careful beta

    Hold back some pairs for testing, and try more than one beta value rather than trusting the first run.

  4. 4

    Measure, then keep a person in the loop

    Count wrong fee answers before and after. Keep human review for anything that touches money or a customer's account.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: learn from pairs of answers, one preferred, one rejected.
  • What it removes: the reward model and the reinforcement learning loop in RLHF.
  • The reference model: a frozen copy that anchors the update.
  • The beta setting: how strictly the model keeps its old behaviour.
  • The limit: it is only as good as its pairs, and the data needs checking.
  • Practical steps: a supervised start, clean pairs, held-out tests.

Common traps

  • Trap"DPO always beats RLHF."

    BetterThe DPO paper says DPO performs as well as or better than existing methods on the tasks it tested. Results depend on the data and the task.

  • Trap"More pairs always means a better model."

    BetterPairs only help when they are correct and cover the real cases. Noisy labels teach the wrong habit.

  • Trap"With no reward model, the data needs no checks."

    BetterWithout a reward model, the pairs still decide the result, so check them before training.

Can you spot the problem in the pairs?

Spot the bad pair

Your team is building DPO pairs for a bank's fee-answer bot. Which pair should not go into training?

Quick check

A bank wants its support bot to prefer correct answers, and it has staff-marked pairs of answers. Which method learns straight from those pairs, without a separate reward model?

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q288What is RLHF?10 min
  2. Q289What is a reward model?11 min
  3. Q307How do you collect preference data?Coming soon
  4. Q290What is PPO in RLHF, simply?Coming soon
  5. Q294How do you prepare a fine-tuning dataset?11 min
  6. Q297How do you spot overfitting during fine-tuning?11 min

Last updated on 26 November 2026

Fine-tuning a model on your team's own feedback?

I design and build AI products and agents, including the interface and the system behind them. Book a short call and tell me what you need.