Seyed Masoud Hosseini · Overview · Study log · Weekly summaries · Ideas · Search · Transcript · RSS feed

NLP with Deep Learning · Lecture 16 of 23 · 1:08:57

Lecture 15: After DPO, with Nathan Lambert

Stanford CS224N: NLP with Deep Learning | Spring 2024 | Lecture 15 - After DPO by Nathan Lambert on YouTube

Study guide

What this lecture covers

Nathan Lambert, a post-training researcher at the Allen Institute for AI, gives a guest lecture on what has happened in language model alignment since Direct Preference Optimization (DPO) became popular. The lecture answers a practical question: DPO is now the default way researchers fine-tune models on human preferences, so what should the field work on next? It sits near the end of the course's sequence on post-training, after the class has already covered supervised fine-tuning and the basic RLHF objective.

After watching, you should be able to explain the difference between instruction tuning, RLHF, and DPO, describe how a preference-based reward model is trained and evaluated, and summarize the empirical tradeoffs between DPO and PPO that Lambert's team found when trying to reproduce industry results with limited compute.

Key ideas

  • Instruction tuning vs. supervised fine-tuning: instruction tuning trains a model to follow instructions and is closely tied to RLHF, while supervised fine-tuning is a more domain-specific technique.
  • RLHF objective: a policy is optimized to maximize a learned reward while a KL-divergence term keeps it close to the original model, preventing over-optimization.
  • Reward models: trained on pairwise preference data (a prompt with a chosen and a rejected completion) using a loss that widens the score gap between the two outputs.
  • DPO: replaces the separate reward model and RL update with a single loss computed directly from log-probability ratios between a trained policy and a frozen reference model, making it far simpler to implement than PPO.
  • RewardBench: an evaluation suite Lambert's team built to score reward models directly, because there was no standard way to check whether a reward model actually captures what it should.
  • Online vs. offline data: online methods (like PPO) generate and re-label data from the current policy during training; DPO is typically trained once on a fixed, offline preference dataset.
  • Reward hacking: a powerful optimizer will exploit any gap between the true objective and its reward model, which is why reward evaluation and monitoring matter.

Walkthrough

Why post-training is the current frontier (0:05)

Lambert opens by arguing that the balance of effort in large language model development has shifted from pre-training toward post-training. He notes that companies like Meta buy far more human preference data for post-training than exists in public datasets such as Chatbot Arena, which shapes what independent researchers can realistically attempt. He traces a short history of language modeling from early autoregressive models through the Transformer, GPT-2 scaling laws, and the "Stochastic Parrots" critique, up to ChatGPT's release, arguing that pre-training alone was not sufficient to produce a model like ChatGPT: RLHF-style fine-tuning was also necessary.

Definitions: instruction tuning, alignment, and RLHF (7:11)

The lecture distinguishes several overlapping terms. Instruction fine-tuning trains a model to follow instructions using the same autoregressive loss as pre-training, often on stack-overflow- or Reddit-style question-answer data. Alignment is the broader goal of matching model behavior to what a user wants, and RLHF is one specific technique for it, built on preference data collected by asking people (or models) to rank outputs.

From RLHF math to DPO's shortcut (10:14)

Lambert walks through the standard RLHF objective: maximize reward subject to a KL constraint against a reference policy. Traditional RLHF trains a separate reward model using the Bradley-Terry preference model, then optimizes the policy against it with an algorithm like PPO. DPO instead reformulates the same optimization so that gradient ascent can be applied directly, without training a separate reward model network or building the surrounding RL infrastructure. He shows that DPO still implicitly defines a reward as a ratio of log-probabilities between the trained policy and the reference model, which matters for later discussion of evaluating DPO models.

How the field moved from the DPO paper to DPO models (15:17)

The DPO paper was published months before the community started training well-known models with it. Lambert traces the path: early instruction-tuned models like Alpaca and Vicuna used synthetic and ShareGPT-derived data; the Open Assistant project produced one of the first carefully collected human preference datasets; and an RLHF model from CarperAI showed early promise but was not widely adopted. The turning point was the Zephyr model in September 2023, trained on the synthetically labeled UltraFeedback dataset with an unusually low learning rate, which convinced the community DPO worked. AI2's Tulu 2 project then showed the same recipe scaled to 70-billion-parameter models, after which DPO-tuned "instruct" models became standard across many startups.

Evaluating reward models with RewardBench (24:25)

Because no standard tool existed to evaluate reward models directly, Lambert's team built RewardBench: a set of prompts with manually created chosen and rejected answers, used to check whether a reward model agrees with human judgment. He shows how the leaderboard shifted quickly as more labs submitted models, describes using "LLM as a judge" as one baseline, and highlights a subtly hard category called "chat hard" built from prompts and near-miss rephrasings, which remains unsaturated even as easier categories do. He also shows that DPO models can only be scored correctly as reward models if their reference-model checkpoint is available, which many public releases omit, and that safety-focused categories reveal a split between models that refuse too much and models that refuse too little.

Comparing DPO and PPO empirically (39:35)

Lambert describes unpublished work from his team directly comparing DPO and PPO starting from an instruction-tuned Llama 2 13B model. Switching datasets (from Anthropic's helpful-harmless data to UltraFeedback) produced larger gains than switching algorithms: PPO outperformed DPO by roughly one percent on average, at the cost of much greater implementation complexity, slower training (because PPO must generate fresh completions during training), and many more hyperparameters to tune. Scaling up the reward model or adding more code and reasoning prompts did not reliably improve the final policy.

Online data and where the field is heading (46:40)

The lecture closes by distinguishing what makes PPO different from DPO: PPO generates fresh completions from the current policy and can refresh preference labels over time, while DPO is normally trained once on a fixed dataset assembled from many different models' outputs. Lambert surveys recent methods that try to add "online" updates to DPO, such as self-rewarding models and discriminator-guided DPO, and speculates that Meta's Llama 3 post-training pipeline (which combines supervised fine-tuning, rejection sampling, PPO, and DPO) likely mixes methods depending on how much data and time is available. He ends by naming open problems: better evaluation, more diverse preference datasets, alignment of smaller models, and personalization. A Q&A follows covering reward hacking, alternatives to pairwise preferences, and how to build new preference datasets.

Before you watch

  • Review the course's earlier lectures on the RLHF training objective and the DPO derivation, since this talk assumes familiarity with both.
  • Some background in reinforcement learning terms like policy, reward, and KL divergence will make the middle section easier to follow.

Check your understanding

  1. What problem does DPO solve compared to the standard RLHF pipeline of training a reward model and then running PPO?
  2. Why did DPO models take several months after the paper's release to become widely used, and what changed with Zephyr?
  3. Why does scoring a DPO model as a reward model require access to its reference-model checkpoint?
  4. According to the lecture's experiments, what mattered more for model quality: switching from DPO to PPO, or switching the training dataset?
  5. What distinguishes "online" preference learning from the offline setting DPO is normally trained in?

Vocabulary

post-training (noun)
The stage after pretraining where a model is adapted to follow instructions and preferences.
Post-training has become the current frontier of language model research.
instruction tuning (noun)
Training a model on instruction-and-answer pairs to make it follow directions.
Instruction tuning uses the same loss as pretraining but on different data.
alignment (noun)
The broader goal of making a model's behavior match what users actually want.
Alignment is a wider goal that RLHF is one technique for achieving.
preference data (noun)
Data showing which of two outputs a human or model prefers.
Preference data is collected by asking people to rank pairs of answers.
reward model (noun)
A model trained to predict how much a human would prefer one response over another.
A reward model is trained using pairwise preference data.
KL constraint (noun)
A limit that keeps a trained model's behavior close to its starting point.
The KL constraint prevents the policy from drifting too far during training.
PPO (noun)
A reinforcement learning algorithm commonly used to optimize a policy against a reward model.
PPO requires generating fresh completions during training.
DPO (Direct Preference Optimization) (noun)
A method that fine-tunes a model directly on preference data without a separate reward model or RL loop.
DPO is much simpler to implement than PPO.
reference policy (noun)
The original, unmodified model used as a comparison point during training.
DPO computes rewards relative to a frozen reference policy.
log-probability ratio (noun)
A comparison of how likely two models are to produce the same output.
DPO's implicit reward comes from a log-probability ratio between two models.
RewardBench (noun)
An evaluation suite built to test how well a reward model matches human judgment.
RewardBench gave the field a standard way to score reward models.
checkpoint (noun)
A saved snapshot of a model's parameters at a point during training.
Some public releases don't include the reference-model checkpoint.
reward hacking (noun)
Exploiting flaws in a reward model to score well without truly performing better.
Reward hacking is a risk whenever a strong optimizer chases a reward model.
online learning (noun)
A training approach that generates new data from the current model as training proceeds.
Online learning lets PPO refresh its data during training.
offline data (noun)
A fixed dataset collected once and used for training without further updates.
DPO is typically trained once on offline data.
rejection sampling (noun)
Generating multiple outputs and keeping only the ones that meet a chosen standard.
Rejection sampling is one step in Llama 3's post-training pipeline.
hyperparameter (noun)
A setting chosen before training that controls how the training process behaves.
PPO requires tuning many more hyperparameters than DPO.
frontier (noun)
The most advanced, current edge of a field of research.
Post-training has become the current frontier of language model development.
autoregressive (adjective)
Describing a model that predicts the next item in a sequence from the previous ones.
Early language models were simple autoregressive models.
scaling law (noun)
A pattern showing how model performance changes as size or data grows.
GPT-2's scaling laws are part of the history Lambert traces.
leaderboard (noun)
A ranked list showing how different models or systems perform.
The RewardBench leaderboard shifted quickly as more labs submitted models.
unsaturated (adjective)
Still leaving room for improvement, not yet at its maximum score.
The 'chat hard' category remains unsaturated even as easier ones do not.
refuse (verb)
To decline to answer or do something.
Some models refuse too much, while others refuse too little.
speculate (verb)
To form a guess about something without being certain.
Lambert speculates that Llama 3 mixes several post-training methods.
personalization (noun)
Adapting something to fit an individual person's needs or preferences.
Personalization is named as one of the field's open problems.
domain-specific (adjective)
Designed for one particular subject area rather than general use.
Supervised fine-tuning is described as a more domain-specific technique.
turning point (noun)
A moment when a situation begins to change significantly.
The Zephyr model was the turning point that convinced the community DPO worked.
subtly (adverb)
In a way that is not obvious or easy to notice.
The 'chat hard' category is subtly harder than the other evaluation categories.
implicit (adjective)
Suggested or present without being directly stated.
DPO defines an implicit reward from a ratio of log-probabilities.

From the YouTube description

For more information about Stanford's online Artificial Intelligence programs, visit: https://stanford.io/ai

This lecture covers life after DPO.

To learn more about enrolling in this course, visit: https://online.stanford.edu/courses/cs224n-natural-language-processing-deep-learning

To follow along with the course schedule and syllabus, visit: hhttps://web.stanford.edu/class/archive/cs/cs224n/cs224n.1246/

Professor Christopher Manning
Thomas M. Siebel Professor in Machine Learning, Professor of Linguistics and of Computer Science
Director, Stanford Artificial Intelligence Laboratory (SAIL)

← Lecture 14: Reasoning and Language Model Agents · Lecture 16: ConvNets and Tree Recursive Neural Networks →