Interactive AI Lesson• 2 min
The Alignment Problem & Preference Optimization
Comparing SFT (Supervised Fine-Tuning), RLHF with PPO, and Direct Preference Optimization (DPO).
Live — computed in your browser
Yesz=4.284.3%
Noz=2.110.3%
Maybez=1.03.4%
Perhapsz=0.41.9%
The Alignment Triad: Helpful, Honest, Harmless (HHH)
A raw base LLM trained only on internet text predicts the most probable continuation—which may be toxic, biased, or untruthful. Alignment steers models to follow user intent safely.
Evolution of Alignment Methods:
- SFT (Supervised Fine-Tuning): Training on curated (Instruction, Ideal Answer) pairs.
- RLHF (Reinforcement Learning from Human Feedback):
- Humans rank multiple model responses (y_win > y_lose).
- A Reward Model is trained to score responses.
- PPO (Proximal Policy Optimization) optimizes the LLM policy against the reward model with a KL-divergence penalty.
- DPO (Direct Preference Optimization - Rafailov et al., 2023):
- Derives a closed-form mathematical substitution that optimizes the policy directly on preference pairs without needing a separate reward model or complex reinforcement learning loops!
Example — text
DPO Loss Formulation:
L_DPO(pi_theta; pi_ref) = -E_{(x, y_w, y_l)} [ log sigma( beta * log( pi_theta(y_w|x) / pi_ref(y_w|x) ) - beta * log( pi_theta(y_l|x) / pi_ref(y_l|x) ) ) ]
Where:
- x: Input prompt
- y_w: Winning (preferred) response
- y_l: Losing (rejected) response
- pi_ref: Frozen reference policy model
- beta: Regularization parameter controlling deviation from referenceKnowledge Checkpoint
What major architectural advantage does Direct Preference Optimization (DPO) have over traditional RLHF with PPO?
Read to the end of the lesson