XYZNOT

Papers · arXiv 2305.18290

Direct Preference Optimization: Your Language Model is Secretly a Reward Model

Published cs.LGcs.AIcs.CL arXivPDF

Read with translation and AI

Summary in three lines

  1. Standard RLHF pipelines are complex, computationally heavy, and unstable because they require training a separate reward model and running reinforcement learning (e.g., PPO) with online policy sampling.
  2. DPO reparameterizes the Bradley-Terry preference model analytically using the closed-form optimal policy of the KL-constrained RL objective, optimizing the policy directly with a binary cross-entropy loss.
  3. On Reddit TL;DR summarization, DPO reaches a ~61% win rate against reference completions (vs. 57% for PPO) and dominates PPO across the reward-KL frontier in sentiment control.

Abstract

While large-scale unsupervised language models (LMs) learn broad world knowledge and some reasoning skills, achieving precise control of their behavior is difficult due to the completely unsupervised nature of their training. Existing methods for gaining such steerability collect human labels of the relative quality of model generations and fine-tune the unsupervised LM to align with these preferences, often with reinforcement learning from human feedback (RLHF). However, RLHF is a complex and often unstable procedure, first fitting a reward model that reflects the human preferences, and then fine-tuning the large unsupervised LM using reinforcement learning to maximize this estimated reward without drifting too far from the original model. In this paper we introduce a new parameterization of the reward model in RLHF that enables extraction of the corresponding optimal policy in closed form, allowing us to solve the standard RLHF problem with only a simple classification loss. The resulting algorithm, which we call Direct Preference Optimization (DPO), is stable, performant, and computationally lightweight, eliminating the need for sampling from the LM during fine-tuning or performing significant hyperparameter tuning. Our experiments show that DPO can fine-tune LMs to align with human preferences as well as or better than existing methods. Notably, fine-tuning with DPO exceeds PPO-based RLHF in ability to control sentiment of generations, and matches or improves response quality in summarization and single-turn dialogue while being substantially simpler to implement and train.

Reading guide

Problem and motivation

Large language models (LMs) acquire vast world knowledge during unsupervised pre-training, but steering their outputs toward helpful and safe behaviors remains challenging. Standard Reinforcement Learning from Human Feedback (RLHF) pipelines tackle this in three stages: Supervised Fine-Tuning (SFT), fitting a reward model on pairwise preferences via maximum likelihood under a Bradley-Terry model, and policy optimization via reinforcement learning (typically PPO) to maximize estimated reward while enforcing a Kullback-Leibler (KL) divergence penalty relative to a reference policy .

However, RLHF with actor-critic RL algorithms is notoriously complex, brittle, sensitive to hyperparameters, and computationally costly because it requires training multiple models (actor, critic, reference, reward model) and sampling generations in the training loop.

Key ideas

  • Analytic mapping between policy and reward: The optimal solution to the KL-constrained reward maximization objective has a known closed-form representation: .
  • Reward reparameterization: Rearranging this identity allows the ground-truth reward to be expressed through the optimal policy: .
  • Cancellation of the partition function: Under pairwise comparison models like Bradley-Terry, preference probabilities depend only on the difference in rewards . The unknown prompt-dependent partition function cancels out entirely.
  • Implicit reward modeling: Instead of optimizing an explicit scalar reward network and running RL, DPO fits the policy directly via maximum likelihood on static preference pairs .

Method (with the key equations)

Under the Bradley-Terry preference model, the probability that completion is preferred over given prompt is:

Substituting the policy-implied reward yields the Direct Preference Optimization (DPO) objective:

The gradient with respect to policy parameters is:

Here, the gradient increases the likelihood of and decreases the likelihood of . The dynamic scalar weight scales the update based on how incorrectly the implicit reward currently scores the pair, preventing model degeneration that occurs with unweighted likelihood objectives.

Results (with the most important numbers)

  • Controlled Sentiment Generation (IMDb + GPT-2-large): DPO strictly dominates PPO across the entire reward-KL frontier, achieving higher reward at every level of sequence-level KL divergence from , even outperforming PPO provided with ground-truth oracle rewards (PPO-GT).
  • TL;DR Summarization (GPT-J 6B):
    • At temperature 0.0, DPO achieves an approximate 61% win rate against reference completions evaluated by GPT-4, compared to 57% for PPO (at its optimal temperature 0.0).
    • In a human study comparing head-to-head summaries on TL;DR, DPO completions at temperature 0.25 were preferred 58% of the time over PPO completions at temperature 0.0.
    • DPO maintains stability across temperatures, whereas PPO degrades sharply toward the base model at temperature 1.0.
  • Out-of-Distribution Generalization (CNN/DailyMail): Evaluated zero-shot on CNN/DailyMail news articles without further fine-tuning, DPO achieves a 0.36 win rate against ground-truth summaries at temperature 0 (vs. 0.26 for PPO), and 0.31 at temperature 0.25 (vs. 0.23 for PPO).
  • Single-turn Dialogue (Anthropic HH + Pythia-2.8B): DPO is the only computationally lightweight method tested that outperforms the preferred test-set completions, matching or slightly outperforming a computationally expensive Best-of-128 sampling baseline.

Limitations and open questions

  • Out-of-distribution generalization: While initial tests on CNN/DailyMail show strong transfer, the paper notes more study is needed to understand how direct policy optimization compares to learning an explicit generalizable reward model over broader shifts.
  • Reward over-optimization: The authors observe slight performance decreases late in training during dialogue experiments, leaving open whether and how classic "reward hacking" or over-optimization occurs within implicit reward models.
  • Unlabeled data utilization: Unlike PPO, which can generate on arbitrary unlabeled prompts during RL rollouts, standard DPO is an offline algorithm trained on paired comparisons; extending it via self-labeling or iterative collection is an open area.
  • Evaluation dependencies: Automated evaluation relied heavily on GPT-4 prompt phrasing (concise prompt vs. simple prompt), highlighting sensitivity in LLM-as-a-judge methodologies.

Key terms

Direct Preference Optimization (DPO)
An algorithm that aligns language models to preferences using a binary cross-entropy loss directly over policy log ratios, bypassing explicit reward modeling and reinforcement learning.
Bradley-Terry model
A probabilistic model for paired comparisons stipulating that the probability of preferring completion over depends on the logistic sigmoid of their reward difference.
KL-constrained reward maximization
The standard RLHF optimization objective that balances maximizing expected reward while penalizing the Kullback-Leibler divergence between the learned policy and a reference policy.
implicit reward
The reward function mathematically implied by the language model policy relative to a reference model.
reference policy (\pi_{\text{ref}})
The baseline language model—typically the supervised fine-tuned (SFT) model—used to constrain policy drift and define the implicit reward.
Best of N
A test-time decoding baseline that samples completions from a policy and selects the candidate with the highest score from a learned reward model.
Plackett-Luce model
A generalized ranking model for sets of more than two items, from which the Bradley-Terry model arises as a pairwise special case.
unlikelihood training
A baseline training technique that maximizes the likelihood of preferred completions while directly penalizing the token likelihood of dispreferred completions.

Questions

Why does DPO not require estimating the partition function Z(x)?

The partition function depends solely on the prompt and the reference policy, not on the completion . Because pairwise preference models (like Bradley-Terry) depend only on the difference between rewards of two completions for the same prompt, cancels out algebraically.

How does DPO avoid policy degeneration compared to naive unlikelihood objectives?

DPO's gradient contains a dynamic weighting term, , which scales the gradient update based on how incorrectly the implicit reward orders the pair. If the model already rates much higher than , the gradient vanishes, preventing unconstrained probability destruction.

Does DPO restrict the expressive capacity of learned reward functions?

No. Theorem 1 proves that under mild assumptions, every reward equivalence class that induces valid preference distributions under Bradley-Terry or Plackett-Luce models can be uniquely reparameterized in the form .

How is the reference policy initialized if the original SFT model is unavailable?

When the original SFT checkpoint is unavailable, the authors initialize by training an off-the-shelf LM to maximize the likelihood of the preferred completions in the preference dataset (Preferred-FT), mitigating distribution shift.

The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.

Read with translation and AI