DPO, KTO & Direct Alignment Methods
Aligning LLMs without RL: Direct Preference Optimization, Kahneman-Tversky Optimization, IPO, ORPO, SimPO — the mathematics of preference-based training without reward models or PPO.
Prerequisites
Table of Contents
- Learning Objectives
- Notation
- Core Intuition
- DPO: Direct Preference Optimization
- DPO Derivation from RLHF
- IPO: Identity Preference Optimization
- KTO: Kahneman-Tversky Optimization
- ORPO: Odds Ratio Preference Optimization
- SimPO: Simple Preference Optimization
- Comparison & Selection Guide
- Common Pitfalls
- Summary
- Exercises
Learning Objectives
- Derive DPO from the RLHF objective (closed-form solution).
- Explain the implicit reward model in DPO.
- Compare DPO, IPO, KTO, ORPO, and SimPO objectives.
- Identify when each method is preferred (data types, scale, compute).
- Implement DPO training and diagnose common failure modes.
Notation
- — policy being trained
- — reference policy (frozen SFT model)
- — prompt, preferred response, dispreferred response
Core Intuition
RLHF is expensive (4 models, PPO instability). DPO asks: can we directly optimize preferences WITHOUT explicitly training a reward model or running RL? The answer: yes. The optimal RLHF policy has a closed-form relationship to the reward — we can rearrange to get a loss that directly trains the policy from preference pairs, using only standard cross-entropy-style optimization.
DPO Training
DPO: Direct Preference Optimization
Rafailov et al. (2023): The DPO loss:
Interpretation: Increase the probability of preferred response (relative to reference) AND decrease the probability of dispreferred response.
The implicit reward:
DPO doesn't need an explicit reward model — the policy itself defines an implicit one.
DPO Derivation from RLHF
Start with RLHF objective:
Optimal policy (closed form):
Rearrange to express reward in terms of policy:
Substitute into Bradley-Terry preference model:
The cancels. Replace with the learnable and minimize negative log-likelihood → equation (1).
IPO: Identity Preference Optimization
Azar et al. (2023): DPO can overfit because the sigmoid saturates. IPO uses a squared loss:
Advantage: Non-saturating gradient. Even when the model is "correct" (prefers ), it still gets gradient signal pushing toward the exact margin.
Disadvantage: Can be too aggressive (pushes past the preference boundary).
KTO: Kahneman-Tversky Optimization
Ethayarajh et al. (2024): Doesn't require PAIRS — only needs individual responses labeled as "good" or "bad":
where and is a baseline.
Key advantage: No need for paired comparisons. Can use: thumbs-up/down data, user engagement signals, or binary quality labels.
When to use: When you have lots of binary feedback but not pairwise comparisons (e.g., user ratings on a chatbot).
ORPO: Odds Ratio Preference Optimization
Hong et al. (2024): No reference model needed. Combines SFT and alignment in one objective:
where .
Advantage: Single training stage (no separate SFT → DPO). No reference model in memory. Simpler implementation.
SimPO: Simple Preference Optimization
Meng et al. (2024): Use average log-probability instead of sum (length-normalized):
where is a target margin.
No reference model: Uses the policy's own length-normalized probability as the implicit reward.
Advantage: Removes length bias (common in DPO where longer responses get lower log-prob). No reference model needed in memory.
Comparison & Selection Guide
| Method | Needs Pairs | Needs Ref Model | Training Stages | Memory |
|---|---|---|---|---|
| RLHF | Yes | Yes (+ RM + value) | 3 (SFT→RM→PPO) | 4x model |
| DPO | Yes | Yes | 2 (SFT→DPO) | 2x model |
| IPO | Yes | Yes | 2 | 2x model |
| KTO | No (binary) | Yes | 2 | 2x model |
| ORPO | Yes | No | 1 | 1x model |
| SimPO | Yes | No | 1 | 1x model |
Recommendation:
- Maximum quality: RLHF (if you can afford it).
- Standard alignment: DPO (best balance of quality and simplicity).
- Binary feedback only: KTO.
- Minimum complexity: SimPO or ORPO (single stage, no reference).
Common Pitfalls
Pitfall 1. Using a stale reference model. The reference should be the SFT model used BEFORE DPO, not an arbitrary checkpoint. Using the wrong reference misaligns the implicit reward.
Pitfall 2. too low in DPO. The model diverges far from the reference, producing reward-hacked outputs (similar to RLHF overoptimization). Start with and tune.
Pitfall 3. Preference data quality. DPO is VERY sensitive to label noise. If 20% of preferences are flipped (human disagreement), DPO quality degrades significantly. Clean data is essential.
Summary
- DPO: Direct optimization from preferences; implicit reward model; 2x memory.
- IPO: Non-saturating loss; more stable gradients; prevents overconfidence.
- KTO: Works with binary (good/bad) labels; no pairs needed.
- ORPO/SimPO: No reference model; single training stage; simplest implementation.
- All methods avoid the complexity/instability of PPO.
- DPO matches RLHF quality in most benchmarks at 2-3x lower cost.
Exercises
Exercise 1. Derive equation (1) step by step from the RLHF objective.
Exercise 2. For DPO with : if and , compute the loss value and gradient direction.
Exercise 3. Compare the memory requirements of DPO vs RLHF for a 70B model. How much GPU memory is saved?
Exercise 4. Design a KTO training pipeline using only thumbs-up/down data from a deployed chatbot. Specify data collection, filtering, and training details.
Exercise 5. Prove that DPO and RLHF have the same optimal policy (the derivation shows they're equivalent at convergence).