DPO (Direct Preference Optimization) is a simpler alternative to full PPO-style RLHF. Instead of fitting a separate reward model and then running RL, DPO uses preference data to move the policy toward the preferred answer directly.
Same votes as RLHF. Fewer moving parts.
DPO asks:
Can we teach the policy what humans prefer without building a full RL control tower?
You still need:
You usually do not need a separate live reward-model + PPO loop.
Two-path picture:
“Relative to the reference” is the important phrase.
If you only raise P(chosen) and lower P(rejected), the model can drift into odd wording. DPO asks: compared with the reference intern, are you now more in favor of the winner than the loser? The reference is the anchor — same job KL did in PPO, baked into the loss.
| Benefit | Why it helps |
|---|---|
| Fewer components | Less wiring than reward model + RL |
| Often simpler training | Less tuning pain for many teams |
| Still preference-based | Uses the same chosen/rejected idea |
It does not remove labels. No pairs, no DPO. Dirty pairs → the wrong taste, same as a bad reward model.
for prompt, chosen, rejected in preference_batch:
loss = dpo_loss(policy, reference, prompt, chosen, rejected, beta=0.1)
loss.backward()
optimizer.step()
optimizer.zero_grad()
Read this as the shape of the idea: compare chosen vs rejected under policy and reference, then update.
What the names are doing:
| Piece | Role |
|---|---|
policy |
The model you are aligning |
reference |
Frozen SFT-style anchor |
chosen / rejected |
The human (or rater) vote |
beta |
How strongly to stay near the reference (a KL-like strength) |
In words, the loss likes you more when:
That is “direct”: no separate critic scores r_w and r_l, then PPO. The preference is applied to the policy itself.
DPO aligns a policy directly from chosen/rejected pairs and a reference model, skipping an explicit reward-model-and-RL loop.