NLP Lineage

29 May 2023 · Alignment

DPO

Direct Preference Optimization

R. Rafailov, A. Sharma, E. Mitchell, S. Ermon, C. Manning, C. Finn

Date
29 May 2023
What the date marks
arXiv submission
Kind
Training method
Organisation
Stanford
Access
Apache 2.0
Other dates
NeurIPS 2023
Threads
In the guided tour
Chapter 6. Teaching models what people want
Learning phases
2. How LLMs are trained

A milestone: 1 later milestone descends directly from it, and its descendants reach 7 of the 10 threads. How levels are decided

Drafted with Claude from the paper on 15 October 2026; reviewed by Zeeshan Arif. Read from arxiv.org (arXiv version 3 (July 2024) of the NeurIPS 2023 conference paper).

What it changed

It showed that a language model can be trained on human preferences with one simple classification loss, with no separate reward model and no reinforcement learning, while aiming at the same goal as RLHF.

The problem before it

Reinforcement learning from human feedback (RLHF), as used for summarisation and in InstructGPT, works in three stages:

  1. Fine-tune a pretrained model on good examples (supervised fine-tuning).
  2. Show people pairs of the model’s answers, ask which is better, and train a separate reward model to predict their choices.
  3. Use reinforcement learning, usually PPO, to make the model produce answers with a high reward, while a penalty stops it from moving too far from the starting model.

The authors call this “complex and often unstable”. Stage 3 trains several models, and the model must keep generating new text during training, which is costly. It also needs careful tuning.

The idea

The mechanism. The goal in stage 3 (high reward, but not too far from the starting model) has a known best solution: the starting model’s probabilities, multiplied by a factor that grows with the reward. The authors turn this around. If you know the best model, you can read off the reward: it is the log of how much more likely the model makes an answer than the starting model does, times a constant.

So the language model itself can stand for the reward model. Put this “implicit reward” into the standard formula for preferences between two answers, and an awkward normalising term cancels out. What remains is a loss that depends only on the model being trained and the frozen starting model.

DPO (Direct Preference Optimization) trains on a fixed set of preference pairs: a prompt, a preferred answer and a rejected answer. For each pair, it raises the probability of the preferred answer and lowers that of the rejected one, both measured relative to the starting model. Pairs that the model currently ranks the wrong way get more weight. The authors show that without this weighting, a simpler version can make the model degenerate.

There is no reward model to train, no sampling from the model during training, and no reinforcement learning. The appendix gives the whole loss in about 10 lines of PyTorch.

The notation. RLHF maximises E[r(x, y)] - β · KL(π_θ || π_ref): the reward of answers y to prompts x, minus a penalty for moving away from the reference model π_ref. Its best solution is π*(y | x) ∝ π_ref(y | x) · exp(r(x, y) / β). Rearranged, r(x, y) = β log(π*(y | x) / π_ref(y | x)) + β log Z(x). The DPO loss, for a preferred answer y_w and a rejected answer y_l, is -log σ(β log(π_θ(y_w | x) / π_ref(y_w | x)) - β log(π_θ(y_l | x) / π_ref(y_l | x))), where σ is the logistic function. Z(x) has cancelled.

What it showed

Reported in the paper. We read version 3 of the arXiv paper. It was published at NeurIPS 2023, a peer-reviewed conference. The models have up to 6 billion parameters. For summaries and dialogue, quality is judged by GPT-4, which the authors checked against people.

Limits, and what came later

The limits come from the paper:

Later work built on it directly. Llama 3.1 used direct preference optimisation in its post-training.

What to know first

How to read it

The main text is 10 pages. The appendix has the derivations and the code.

  1. Read section 1 with Figure 1, which compares the RLHF and DPO pipelines.
  2. Read section 3 for the RLHF stages.
  3. Read section 4 slowly. Equations 4 to 7 are the core, and “What does the DPO update do?” explains the gradient in words.
  4. Read section 6 with Figures 2 and 3.
  5. Look at the code in Appendix B.

Section 5 and the proofs can wait. Expect about 1.5 to 2 hours for the parts above (an estimate).

In brief, from the research data

Before it

Preference alignment meant training a reward model then running PPO against it.

The problem

That pipeline is unstable, memory-hungry and hard to reproduce outside well-resourced labs.

What it introduced

Algebra showing the RL objective can be optimised directly on preference pairs, with no reward model and no RL loop.

Why it matters

It made alignment a straightforward fine-tuning job, which is why open models could align themselves at all.

What modern models inherit

Preference optimisation as a simple loss rather than an RL system.

What came next

Adopted in Llama 3's post-training and across the open ecosystem.

To understand it

Learn

  • Preference pairs
  • Why DPO needs no reward model
  • The KL constraint to the base model

Helpful first

The InstructGPT pipeline.

Before and after

The milestones it descends from, and the milestones that descend from it. Work developed alongside it is not counted. Weak links are left out unless you include them.

Before: where it came from

DPO has 34 documented ancestors across 6 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 14 turning points among them.

DPO has 34 documented ancestors across 6 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

DPO has 36 recorded ancestors, including indirect ones, across 6 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 14 turning points among them.

DPO has 36 recorded ancestors, including indirect ones, across 6 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

  1. 2023DPOThis milestone.
  2. 2022InstructGPT Turning pointDPO built directly on thisChapter 6. Teaching models what people want
  3. 2021FLANInstructGPT was influenced by thisChapter 6. Teaching models what people want
  4. 2020RLHF for summarisation Turning pointDPO built directly on thisChapter 6. Teaching models what people want
  5. 2020GPT-3 Turning pointInstructGPT built directly on thisChapter 5. Scale becomes a science
  6. 2020Scaling laws Turning pointGPT-3 was influenced by thisChapter 5. Scale becomes a science
  7. 2019T5 Turning pointFLAN was influenced by thisChapter 4. Pretrain once, use everywhere
  8. 2019C4 Turning pointT5 was influenced by thisChapter 4. Pretrain once, use everywhere
  9. 2019RLHF for LMsRLHF for summarisation built directly on thisChapter 6. Teaching models what people want
  10. 2019Sparse Transformer Turning pointGPT-3 built directly on thisChapter 4. Pretrain once, use everywhere
  11. 2019GPT-2 Turning pointGPT-3 built directly on this
    RLHF for LMs built directly on this
    Chapter 4. Pretrain once, use everywhere
  12. 2019WebTextGPT-2 was influenced by thisChapter 4. Pretrain once, use everywhere
  13. 2018BERT Turning pointT5 was influenced by thisChapter 4. Pretrain once, use everywhere
  14. 2018SentencePieceT5 built directly on thisChapter 4. Pretrain once, use everywhere
  15. 2018GPT-1GPT-2 built directly on thisChapter 4. Pretrain once, use everywhere
  16. 2018ELMoBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  17. 2018ULMFiTBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  18. 2017CoVeELMo was influenced by thisChapter 3. Attention, then only attention
  19. 2017RLHF originRLHF for summarisation built directly on thisChapter 6. Teaching models what people want
  20. 2017Transformer Turning pointGPT-2 built directly on this
    Sparse Transformer built directly on this
    T5 built directly on this
    Chapter 3. Attention, then only attention
  21. 2016Layer normGPT-2 built directly on thisChapter 3. Attention, then only attention
  22. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  23. 2015LM pretraining Turning pointBERT was influenced by this
    GPT-1 was influenced by this
    Chapter 2. Words become vectors
  24. 2015BPE tokenizationGPT-2 built directly on thisChapter 2. Words become vectors
  25. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  26. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  27. 2014GloVeELMo built directly on thisChapter 2. Words become vectors
  28. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  29. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  30. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  31. 2013word2vecELMo was influenced by thisChapter 2. Words become vectors
  32. 2011NLP from scratchELMo was influenced by thisChapter 1. Language as probability
  33. 2003Neural LMNLP from scratch was influenced by this
    word2vec was influenced by this
    Chapter 1. Language as probability
  34. 1997LSTM Turning pointSeq2seq built directly on this
    ELMo built directly on this
    Chapter 1. Language as probability
  35. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability
  1. 2023DPOThis milestone.
  2. 2022InstructGPT Turning pointDPO built directly on thisChapter 6. Teaching models what people want
  3. 2021FLANInstructGPT was influenced by thisChapter 6. Teaching models what people want
  4. 2020RLHF for summarisation Turning pointDPO built directly on thisChapter 6. Teaching models what people want
  5. 2020GPT-3 Turning pointInstructGPT built directly on thisChapter 5. Scale becomes a science
  6. 2020Scaling laws Turning pointGPT-3 was influenced by thisChapter 5. Scale becomes a science
  7. 2019T5 Turning pointFLAN was influenced by thisChapter 4. Pretrain once, use everywhere
  8. 2019C4 Turning pointT5 was influenced by thisChapter 4. Pretrain once, use everywhere
  9. 2019RLHF for LMsRLHF for summarisation built directly on thisChapter 6. Teaching models what people want
  10. 2019Sparse Transformer Turning pointGPT-3 built directly on thisChapter 4. Pretrain once, use everywhere
  11. 2019GPT-2 Turning pointGPT-3 built directly on this
    RLHF for LMs built directly on this
    Chapter 4. Pretrain once, use everywhere
  12. 2019WebTextGPT-2 was influenced by thisChapter 4. Pretrain once, use everywhere
  13. 2019Transformer-XLSparse Transformer was influenced by this (indirect influence)Chapter 4. Pretrain once, use everywhere
  14. 2018BERT Turning pointT5 was influenced by thisChapter 4. Pretrain once, use everywhere
  15. 2018SentencePieceT5 built directly on thisChapter 4. Pretrain once, use everywhere
  16. 2018GPT-1GPT-2 built directly on thisChapter 4. Pretrain once, use everywhere
  17. 2018ELMoBERT was influenced by this
    GPT-1 was influenced by this (indirect influence)
    Chapter 4. Pretrain once, use everywhere
  18. 2018ULMFiTBERT was influenced by this
    GPT-1 was influenced by this (indirect influence)
    Chapter 4. Pretrain once, use everywhere
  19. 2017CoVeELMo was influenced by thisChapter 3. Attention, then only attention
  20. 2017RLHF originRLHF for summarisation built directly on thisChapter 6. Teaching models what people want
  21. 2017Transformer Turning pointGPT-2 built directly on this
    Sparse Transformer built directly on this
    T5 built directly on this
    Chapter 3. Attention, then only attention
  22. 2017ConvS2STransformer was influenced by this (indirect influence)Chapter 3. Attention, then only attention
  23. 2016Layer normGPT-2 built directly on thisChapter 3. Attention, then only attention
  24. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  25. 2015LM pretraining Turning pointBERT was influenced by this
    GPT-1 was influenced by this
    Chapter 2. Words become vectors
  26. 2015BPE tokenizationGPT-2 built directly on thisChapter 2. Words become vectors
  27. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  28. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  29. 2014GloVeELMo built directly on thisChapter 2. Words become vectors
  30. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  31. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  32. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  33. 2013word2vecELMo was influenced by thisChapter 2. Words become vectors
  34. 2011NLP from scratchELMo was influenced by thisChapter 1. Language as probability
  35. 2003Neural LMNLP from scratch was influenced by this
    word2vec was influenced by this
    Chapter 1. Language as probability
  36. 1997LSTM Turning pointSeq2seq built directly on this
    ELMo built directly on this
    Chapter 1. Language as probability
  37. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability

After: what it led to

DPO has 10 documented descendants across 3 chapters, reaching forward to Qwen3.8 in 2026. Showing its direct descendants.

DPO has 10 documented descendants across 3 chapters, reaching forward to Qwen3.8 in 2026. Showing all of them.

DPO has 15 recorded descendants, including indirect ones, across 3 chapters, reaching forward to Qwen3.8 in 2026. Showing its direct descendants.

DPO has 15 recorded descendants, including indirect ones, across 3 chapters, reaching forward to Qwen3.8 in 2026. Showing all of them.

  1. 2023DPOThis milestone.
  2. 2024Llama 3.1 405Bbuilt directly on DPOChapter 8. The weights get out
  3. 2024DeepSeek-V3was influenced by Llama 3.1 405BChapter 8. The weights get out
  4. 2025DeepSeek-R1built directly on DeepSeek-V3Chapter 12. Thinking longer
  5. 2025Llama 4succeeded Llama 3.1 405BChapter 8. The weights get out
  6. 2025Qwen3was influenced by DeepSeek-R1Chapter 8. The weights get out
  7. 2025DeepSeek-V3.2built directly on DeepSeek-V3Chapter 10. Reading more than you remember
  8. 2026Qwen3.5built directly on Qwen3Chapter 8. The weights get out
  9. 2026Muse Sparksucceeded Llama 4Chapter 8. The weights get out
  10. 2026DeepSeek-V4was influenced by DeepSeek-V3Chapter 8. The weights get out
  11. 2026Qwen3.8built directly on Qwen3.5Chapter 8. The weights get out
  1. 2023DPOThis milestone.
  2. 2024Llama 3.1 405Bbuilt directly on DPOChapter 8. The weights get out
  3. 2024DeepSeek-V3was influenced by Llama 3.1 405BChapter 8. The weights get out
  4. 2025DeepSeek-R1built directly on DeepSeek-V3Chapter 12. Thinking longer
  5. 2025Llama 4succeeded Llama 3.1 405BChapter 8. The weights get out
  6. 2025Qwen3was influenced by DeepSeek-R1Chapter 8. The weights get out
  7. 2025Kimi K2was influenced by DeepSeek-V3 (indirect influence)Chapter 8. The weights get out
  8. 2025gpt-osswas influenced by DeepSeek-R1 (indirect influence)Chapter 8. The weights get out
  9. 2025GLM-4.5was influenced by DeepSeek-R1 (indirect influence)Chapter 8. The weights get out
  10. 2025DeepSeek-V3.2built directly on DeepSeek-V3Chapter 10. Reading more than you remember
  11. 2026Qwen3.5built directly on Qwen3Chapter 8. The weights get out
  12. 2026Muse Sparksucceeded Llama 4Chapter 8. The weights get out
  13. 2026DeepSeek-V4was influenced by DeepSeek-V3Chapter 8. The weights get out
  14. 2026GLM-5.2built directly on GLM-4.5Chapter 8. The weights get out
  15. 2026Kimi K3built directly on Kimi K2Chapter 8. The weights get out
  16. 2026Qwen3.8built directly on Qwen3.5Chapter 8. The weights get out

Direct links and their sources

Where it came from

Built directly on

What it led to

Built on directly by