LLMS & TRANSFORMERS · INTERVIEW QUESTION
What is DPO (Direct Preference Optimization)? How does it compare to RLHF?
🟡 intermediate · RLHF & Alignment
Hint: DPO eliminates the reward model. Think about the loss function.
Answer
DPO directly optimizes a language model on preference pairs without training a separate reward model or using RL. The insight: the optimal policy under RLHF's KL-constrained reward maximization has a closed-form solution that maps reward to log-probability ratios. DPO's loss: L = -log σ(β log(π_θ(y_w|x)/π_ref(y_w|x)) - β log(π_θ(y_l|x)/π_ref(y_l|x))) where y_w is the preferred and y_l is the dispreferred response. Advantages over RLHF:
- No reward model training
- No RL optimization (simpler)
- More stable training
- Lower compute.
Limitations: may be less expressive than RL, sensitive to data quality, doesn't explicitly learn a reward function for other uses.
Related questions
- Explain RLHF (Reinforcement Learning from Human Feedback). What are the key steps and challenges?
- Explain the self-attention mechanism in detail. What are Q, K, V and why do we use scaled dot-product attention?
- Explain positional encoding in Transformers. Compare sinusoidal, learned, RoPE, and ALiBi.
- Explain the difference between LoRA, full fine-tuning, and prompt tuning. When would you use each?
- What is chain-of-thought prompting? Why does it improve reasoning?