Hello again. In the previous lesson, you traced classical RLHF: preference pairs train a reward model; PPO then optimizes an instruction-tuned policy against that learned reward while a KL penalty limits drift from the SFT reference model. The central systems cost was the online loop: generate rollouts, score them with reward and reference models, store per-token metadata, and run conservative policy updates.
This lesson asks whether that machinery is always necessary. You will derive the operational idea behind Direct Preference Optimization (DPO), compare it with PPO-based RLHF, and make a defensible method choice from product constraints rather than treating either technique as universally superior.
The architectural difference: indirect versus direct preference learning
Both RLHF and DPO begin with the same basic human-feedback artifact:
where is a prompt, is the completion a labeler preferred, and is the rejected completion.
Classical RLHF turns this dataset into a learned scoring function:
Then it samples new responses from the current policy and uses PPO to increase expected reward, subject to a reference-policy KL constraint.
DPO removes the middle stages. Rather than:
- fitting an explicit reward model;
- repeatedly sampling policy rollouts;
- optimizing the policy with reinforcement learning,
DPO trains the policy directly from the winning and losing completion pairs. It treats preference alignment as a classification-like objective over pairs.

The visual is intentionally simplified, so keep one important implementation distinction in mind:
- DPO eliminates a separately trained reward model and PPO rollout loop.
- DPO does not eliminate the frozen reference model. During training, it still compares the trainable policy’s probabilities with those of a reference policy, usually the SFT checkpoint.
- DPO updates one trainable policy, but a practical implementation may still need reference-model forward passes or cached reference log probabilities.
This distinction matters for infrastructure planning. “DPO is one model” is true in the sense of one model being trained, not necessarily in the sense of one model ever loaded or evaluated.
Direct Preference Optimization (DPO) - How to fine-tune LLMs directly without reinforcement learning
Watch Direct Preference Optimization (DPO) – How to fine-tune LLMs directly without reinforcement learning from Luis Serrano Academy for a visual account of the architectural simplification and the role of the reference model.
Start with the direct idea, which introduces why DPO bypasses a separately trained reward model. Then watch the final objective for the connection among KL regularization, the reference model, and the preferred-versus-rejected likelihood comparison. Focus on the distinction between removing an explicit reward-model training stage and removing the need to control behavioral drift.
What DPO optimizes
For a full response , the language model assigns an autoregressive sequence probability:
As in SFT, loss is applied only to completion tokens, not to the prompt or padding. But DPO has no single “gold” completion to imitate. Instead, it asks a relative question:
Has the trainable policy increased the probability of the chosen response relative to the reference policy, while decreasing that relative probability for the rejected response?
Define a reference-relative preference margin:
The standard DPO loss is:
Minimizing this loss makes the margin larger. In practical language:
- Increase the chosen completion’s probability relative to its probability under the reference.
- Decrease the rejected completion’s probability relative to its probability under the reference.
- Do not merely maximize the raw likelihood of all chosen answers, as ordinary SFT would.
The phrase “relative to the reference” is doing substantial work. Suppose the SFT model already strongly prefers the desired behavior. DPO needs little change. Conversely, if a preference pair identifies a systematic weakness of the SFT model, DPO applies pressure to change that relative ordering.
Why the reward model can disappear
The DPO derivation starts from the same idealized objective seen in RLHF:
Under the Bradley-Terry model of pairwise preferences, the optimal policy and its reward function can be related mathematically. The reward can be expressed, up to a prompt-dependent constant, in terms of the policy-to-reference log-probability ratio:
For a pair of responses to the same prompt, that unknown prompt-dependent constant cancels. This permits fitting the policy directly with a binary cross-entropy preference loss.
The key conclusion is not that “DPO has no reward.” Rather:
DPO represents reward implicitly through the policy’s probability change relative to the reference, instead of fitting and optimizing a separate reward-model artifact.
Direct Preference Optimization: Your Language Model is Secretly a Reward Model
Read the DPO paper by Rafailov and colleagues for the original argument that a KL-constrained reward-maximization objective can be optimized directly from preference pairs.
First, in the Abstract and Section 1, read the motivation to identify exactly which parts of the RLHF stack DPO removes. Then go to Section 4, “Direct Preference Optimization.” Read from the paragraph beginning the change of variables, through Equation 7. Do not get stuck on reproducing every algebraic step; follow why pairwise reward differences let the intractable partition function cancel. Finally, read the short explanation after Equation 7, beginning the gradient interpretation: DPO increases likelihood of preferred completions and decreases likelihood of rejected ones, with stronger emphasis on currently misordered pairs.
The role of : adaptation versus preservation
DPO’s plays a role analogous to the preference-improvement versus reference-preservation trade-off in KL-regularized RLHF.
At the level of the underlying constrained objective:
- A more conservative setting keeps the final policy closer to the reference policy.
- A more adaptive setting permits a larger behavioral shift to satisfy the preference data.
In the loss implementation, scales the reference-relative preference margin inside the sigmoid. Its observed effect also interacts with learning rate, number of epochs, dataset size and quality, and optimizer settings. So it should be tuned by evaluating actual output behavior, not by assuming that a single numerical setting transfers across models or datasets.
A useful operational interpretation is:
| Signal | What it indicates |
|---|---|
| DPO loss falls | The model increasingly orders training pairs in the desired direction. |
| Chosen-minus-rejected margin rises | The model is fitting preference distinctions more strongly. |
| Reference KL rises | The deployed model’s behavior is moving farther from SFT. |
| Held-out preference win rate rises | The alignment change generalizes to unseen labeled comparisons. |
| Human quality or safety falls despite better training metrics | The optimization is exploiting a dataset artifact or drifting beyond useful behavior. |
Like PPO’s reward-model score, a low DPO loss is not product validation. It says the model fits the observed pairwise ordering; it does not establish that the preference data covers production usage or that its rubric captures truth, safety, task success, and user trust.
RLHF and DPO: compare the training systems
The most useful comparison is not “old versus new,” but online reward optimization versus offline direct preference fitting.
| Dimension | PPO-based RLHF | DPO |
|---|---|---|
| Starting feedback | Preference pairs, often after SFT | Preference pairs, usually after SFT |
| Trainable artifacts | Policy and typically a value model; reward model trained beforehand | Policy only |
| Frozen training artifacts | Reference policy and reward model | Reference policy |
| Training-time generation | Required: fresh on-policy rollouts | Not required for each optimization step |
| Objective signal | Reward-model score, advantage estimates, KL penalty | Relative probability of chosen versus rejected responses |
| Core optimization | Reinforcement learning, often PPO | Supervised-learning-like pairwise loss |
| Systems complexity | Rollout serving, reward/reference inference, critic, PPO synchronization and stability | Standard distributed training over a static preference dataset, plus reference log probabilities |
| Exploration during training | Yes: policy samples new outputs | No: learning is limited to the collected pair distribution |
| Main failure mode | Reward-model exploitation, unstable RL updates, excessive policy drift | Overfitting preference artifacts, distribution gaps, excessive reference drift |
| Best fit | Online or trajectory-level optimization with reliable evaluators | Efficient alignment to well-covered, static pairwise preferences |
Compute and platform implications
The RLHF loop is substantially more demanding than DPO because it includes autoregressive generation in its inner training cycle. That has consequences beyond total FLOPs:
- RLHF rollout workers face decode-style inference behavior, where each new token depends on the preceding one. It has lower arithmetic intensity and is often bandwidth-bound.
- The policy, reference, reward model, and critic can create a difficult memory-planning problem. Their states need not all be separate full copies, but the architecture must explicitly manage them.
- On-policy rollouts must be synchronized with the policy version that generated them. Stale rollouts, queueing delays, and variable output lengths complicate throughput and reproducibility.
- DPO resembles an offline sequence-training job. It still needs long sequence forward/backward passes and may have a frozen reference-model cost, but it avoids rollout scheduling, per-token PPO metadata, reward inference on generated outputs, and critic training.
That does not mean DPO is “free.” If reference log probabilities are computed online, the reference forward pass adds material cost. A common engineering strategy is to precompute them for a fixed dataset, when model versioning and storage allow. This reduces runtime compute but ties the dataset to a specific immutable reference checkpoint and tokenizer.
Where DPO is the better choice
Choose DPO first when all of the following are broadly true:
- The base or SFT model already performs the task. The goal is to choose among plausible responses, not teach an absent capability.
- The desired behavior is subjective or stylistic. Tone, professionalism, concise helpfulness, brand voice, policy phrasing, and response clarity have multiple acceptable outputs.
- You can collect representative chosen/rejected pairs. The preference corpus includes difficult prompts and known failure modes, not only easy examples.
- Fast, stable, reproducible iteration matters. You want to run experiments using a conventional distributed training stack rather than operate an online RL system.
- The required behavior can be adequately specified by static comparisons.
Consider a customer-support assistant. It already retrieves correct account information and follows support workflows, but its answers are sometimes curt, overly verbose, or inconsistent with brand guidance. Reviewers can reliably choose the better answer among two factually acceptable candidates.
Select DPO. The product need is preference shaping, not exploration of a new sequential strategy. A carefully designed preference dataset can teach tone, clarity, concise explanation, and compliant refusal behavior with far less training-system complexity than PPO-based RLHF.
This decision has a precondition: labelers must judge facts and policy compliance separately from writing style. Otherwise, the model may learn superficial signals such as “longer answer sounds more helpful” or “more disclaimers sound safer.”
Where RLHF remains justified
Choose PPO-based RLHF, or a related online reinforcement-learning approach, when the product constraint demands learning from generated trajectories and an evaluative signal that static pairs cannot cover well.
Common indicators include:
- A reliable reward model, programmatic grader, simulator, or verifier can score newly generated behavior.
- The model needs to explore response strategies that do not already appear in a static pairwise dataset.
- Quality depends on multi-step reasoning, tool use, environment interaction, or terminal task success.
- You need to continually collect feedback on the current policy because behavior and traffic distributions change.
- You need a separately deployable scorer for tasks such as candidate reranking, data curation, or active preference collection.
For example, consider a coding-agent product that must modify a repository, run tests, inspect failures, and revise its approach. The key business metric is not merely whether a reviewer prefers one textual explanation. It is whether the final patch passes tests, respects resource limits, and avoids unsafe changes.
Select an online RL-style approach if you have a trustworthy automated evaluator. New policy samples can reveal strategies that a static preference set did not contain, and test outcomes can provide direct task-level feedback. DPO can still improve response style or train on comparisons among prior trajectories, but it cannot itself explore new solutions during optimization.
This is a product and systems decision: the expected quality gain from online exploration must justify the cost and operational risk of reward modeling, rollout infrastructure, and RL stability work.
Neither method removes the data problem
DPO often appears safer because it does not optimize a separately learned reward model on fresh samples. That is a useful simplification, but it is not a guarantee against misalignment.
Suppose labelers consistently prefer longer answers, even when the extra material adds little value. Both methods can amplify this proxy:
- In RLHF, a reward model may learn that length predicts preference and PPO can search aggressively for length.
- In DPO, the pairwise objective can directly reinforce the same correlation in the static corpus.
The Stanford lecture reports this kind of behavior: preference datasets with mild length bias can produce increasingly verbose DPO outputs as optimization proceeds. The lesson is broader than verbosity:
Preference optimization amplifies patterns in the preference data. It does not determine whether those patterns represent the product’s actual objective.
For both DPO and RLHF, monitor:
- held-out pairwise preference accuracy or win rate, sliced by task and risk category;
- reference-policy KL;
- answer length and length-normalized task quality;
- refusal, safety, factuality, format, and repetition metrics;
- adversarial and production-like human evaluation;
- regression suites for capabilities the SFT model already handled well.
When DPO regresses despite improving its training loss, the first response should not be “train longer.” Inspect label quality, preference conflicts, formatting consistency, response length distributions, data-source mixtures, and whether prompts reflect production traffic.
A Staff-level selection framework
At an interview, state the constraint first, then the method, then the safeguards.
| Product constraint | Recommended default | Why | Non-negotiable safeguard |
|---|---|---|---|
| Brand tone and helpfulness for an existing assistant | DPO | Static pairwise judgments directly express the desired distinction; low operational complexity | Held-out human preference and policy-compliance evaluation |
| Rapid post-training iteration under limited GPU and platform capacity | DPO | Avoids rollout generation, reward-model training, critic training, and PPO tuning | Track reference drift and regressions, not only DPO loss |
| A trustworthy executable grader for difficult tasks | Online RL or RLHF-style optimization | Can optimize outcomes on fresh sampled trajectories and explore better strategies | Validate the grader against humans and monitor exploitation |
| Dynamic user distribution with a feedback loop | Iterative data collection; often online methods | Static DPO data will age as the deployed policy and traffic evolve | Consent-aware sampling, slice-based evaluation, rollback plan |
| Need a reusable response scorer for reranking or data triage | RLHF reward-model path may be useful | An explicit reward model is independently usable as a scoring artifact | Test scorer calibration and out-of-distribution behavior |
| Limited preference coverage for a fundamentally new task | Neither alone is sufficient | Preference optimization cannot reliably create a capability absent from the base model | Improve demonstrations, retrieval, tools, or task data first |
A concise recommendation for the customer-support case would sound like this:
“I would begin with SFT followed by DPO because the model already knows the support domain and the main objective is subjective response quality. DPO gives us a simpler, more reproducible training pipeline than PPO-based RLHF. I would construct pairs that control for factual correctness, slice evaluation by policy and user segment, track KL and verbosity, and retain a rollback checkpoint. I would only incur an online RLHF stack if static comparisons stopped capturing material production failures or if we introduced a reliable outcome-based reward signal.”
Key takeaways
DPO and PPO-based RLHF can start from the same chosen/rejected preference pairs, but they optimize them through very different systems. RLHF trains an explicit reward model and uses online RL to optimize fresh policy rollouts. DPO directly trains the policy to raise the chosen completion’s likelihood relative to both the rejected completion and a frozen reference policy.
DPO is usually the strong default for efficient offline alignment when an already capable model needs better tone, style, safety behavior, or other nuanced preferences that can be represented in a well-designed pairwise dataset. It removes reward-model and PPO complexity, but not the need for a reference model, rigorous evaluation, or high-quality labels.
RLHF remains justified where fresh exploration and evaluable task outcomes matter: multi-step trajectories, reliable graders, evolving environments, or cases where a separately trained reward model has independent value. Neither method solves weak preference data; both can amplify label artifacts and must be judged by product-relevant evaluations rather than training loss alone.
The next module moves from post-training algorithms to the systems required to run large training jobs: communication volume, parallelism choices, sharding, failures, and experiment platforms.
Can't find a good explanation? Sign up and we'll make it for you
Sign up