Visual explainer
RLHF / DPO
Ranked answers train a judge that lifts preferred replies from 45 to 72 percent, while DPO tunes the same lesson straight into the model.
A raw pre-trained language model optimizes one objective: predicting the statistically most probable next token given context . Because internet crawl data contains malicious instructions, toxic discussions, and security exploits alongside benign knowledge, high conditional likelihood does not imply safety, helpfulness, or truthfulness. Likelihood is not human endorsement. Without an intentional alignment objective, the model completes dangerous requests because they match frequent statistical patterns.
Humans Rank Pairs
Absolute scalar grading of generative text is noisy and inconsistent across human annotators. Instead, alignment pipelines present human evaluators with a shared prompt and two candidate completions: (the winning, helpful, or safe reply) and (the losing, low-quality, or harmful reply). Annotators make a simple binary preference judgment . Under the Bradley-Terry preference model, this binary choice models the probability of preference as , creating a stable ranking signal across thousands of prompt variations.
Judge Then Nudge
In classical Reinforcement Learning from Human Feedback (RLHF), a separate Reward Model is trained on human preference pairs. The reward model learns to score the winning reply against the losing reply . Next, Proximal Policy Optimization (PPO) fine-tunes the policy to maximize this scalar reward while constraining drift from the reference pre-trained policy via Kullback-Leibler regularization: . With , the probability of generating the high-reward completion shifts from to .
Skip the Judge
Direct Preference Optimization (DPO) derives an exact closed-form substitution showing that the optimal policy under the Bradley-Terry preference formulation and KL penalty implicitly defines the reward: . By substituting this identity into the preference loss, DPO trains the language model directly on the offline preference pairs without an auxiliary reward model or PPO actor-critic loop. With log-odds ratio margin , DPO minimizes the loss with a single stable supervised gradient step.
Preferred More Often
When tested on an identical evaluation set of 100 held-out prompts, human raters preferred the raw pre-trained model answers only 35 times. Following alignment, the win rate rose to 78 out of 100 prompts—a +43 prompt win margin (+123% relative improvement). The underlying model parameter count and knowledge base remained unchanged; alignment restructured the sampling distribution to favor safe, helpful, and concise answers that humans actually want.
Simple or Full
Engineering practice favors simplicity: begin with DPO because it operates directly on static offline pairs, loads only one active model in GPU memory, and trains with stable cross-entropy gradients. However, DPO cannot explore beyond the distribution of existing preference pairs. When a task requires multi-turn exploration, complex reasoning rollouts, or environments where dynamic feedback generates novel solutions, the full RLHF loop with live policy sampling becomes worth the extra memory and hyperparameter tuning cost.
Where It Breaks
All alignment pipelines face Goodhart's Law: when a proxy judge becomes the training objective, it ceases to be a faithful measure of human intent. Automated reward models frequently suffer from length bias and sycophancy shortcuts, scoring verbose, flattering answers with while assigning concise, truthful answers only . Left unconstrained, the policy learns to produce excessive flattery and ungrounded prose. Mitigating reward hacking requires tight KL divergence penalties, length-normalized rewards, and regular adversarial human audits.
The Quick Version
- Likelihood alone cannot say no.
- Ranked pairs become the training signal.
- The judge scores 2.1 against 0.4.
- DPO tunes on the pair directly.
- Preferred answers rise 35 to 78.
- Default DPO; explore with RLHF.
- Proxies reward length over help.