Skip to main content
AI / MLTraining & TuningDiagramAdvanced

DPO

KO: DPO·EN: DPO·JA: DPO·Direct Preference Optimization

An alignment algorithm that directly optimizes an LLM on chosen vs. rejected response pairs via a simple closed-form classification loss, eliminating the separate reward model and RL loop of RLHF

Table of Contents

Structure Diagram

RLHF (PPO) vs DPO (Direct Preference Optimization)
RLHF / PPOReward Model + RL

4 models in VRAM · Online rollouts

  • StabilitySensitive tuning & rollout variance
  • ComputeVery high (online generation + critic)
  • Best ForFrontier scale & verifiable rewards
DPODirect Preference Opt

No reward model · Simple binary loss

  • StabilityStable supervised-like optimization
  • ComputeLow (pairs cleanly with LoRA/QLoRA)
  • Best ForEnterprise style, tone & error suppression
Quick Answer

What is DPO?

An alignment algorithm that directly optimizes an LLM on chosen vs. rejected response pairs via a simple closed-form classification loss, eliminating the separate reward model and RL loop of RLHF. It is a core concept in Training & Tuning within AI / ML.

Core Principles

DPO (Direct Preference Optimization) algebraically reparameterizes the RLHF objective to eliminate the explicit Reward Model and PPO sampling loop altogether.

Given preference pairs (prompt, chosen, rejected), DPO optimizes a simple binary cross-entropy-style loss that increases the relative log-probability of chosen over rejected compared to a frozen reference model.

Practical Takeaways

  • Always run SFT before DPO: Initialize both the policy and frozen reference model from an SFT checkpoint so the preference data stays close to the model's distribution.
  • Use tiny learning rates and tune beta: Set beta around 0.1–0.5 and learning rates an order of magnitude lower than SFT (5e-7 to 5e-6) to prevent degeneration.
  • Mine hard negatives from your own model: Pairing your current SFT model's actual failure outputs as rejected with human-corrected chosen answers yields the strongest gains.

Notable Examples

  • Llama 3, Zephyr & Qwen Post-Training: Leverage DPO (and variants like SimPO/ORPO) for stable, cost-effective preference alignment.
  • Production Feedback Loops: Convert thumbs-down corrections from support agents into daily (chosen, rejected) DPO datasets.
  • SQL & Code Repair: Use failing queries as rejected and passing executions as chosen to cut syntax errors.