Advanced

DPO: skipping the reward model

Direct Preference Optimization converts preference pairs into a classification-like objective over policy and reference log-probabilities.

Updated

1

Concept

PPO-based RLHF has a long chain: collect preferences, fit a reward model, sample from a policy, estimate advantages, update a value model, constrain the policy, and repeat. Direct Preference Optimization (DPO) starts from a mathematical relationship between a KL-regularized optimal policy and its reward. It rearranges that relationship so the policy itself can be trained directly on preference pairs, without fitting an explicit reward model or running a conventional RL loop.

Each example still contains a prompt xx, preferred response y+y^+, and rejected response yy^-. DPO uses a trainable policy πθ\pi_\theta and frozen reference πref\pi_{ref}. For each response, it sums token log-probabilities conditioned on the prompt. The relevant margin compares how much more the trainable policy favors each response than the reference does:

m=β[logπθ(y+x)πref(y+x)logπθ(yx)πref(yx)].m=\beta\left[ \log\frac{\pi_\theta(y^+\mid x)}{\pi_{ref}(y^+\mid x)}- \log\frac{\pi_\theta(y^-\mid x)}{\pi_{ref}(y^-\mid x)} \right].

The loss logσ(m)-\log\sigma(m) increases the chosen response’s relative advantage and decreases the rejected response’s. The coefficient β\beta controls the strength of the reference-relative preference scale in the standard formulation. Implementation conventions can invert or reparameterize it, so copying a numeric setting across libraries without checking definitions is unsafe.

The word relative is crucial. DPO does not merely maximize the chosen response’s raw likelihood. It asks the policy to favor it more than the reference policy already did, compared with the rejected response. The reference supplies an anchor analogous to KL regularization in the derivation. If policy and reference are accidentally the same live object, or if log-probabilities are computed under different chat templates, the intended objective breaks.

DPO is operationally attractive. Training resembles supervised learning over fixed sequences: perform forward passes, gather response-token log-probabilities, compute a pairwise loss, and backpropagate. There are no on-policy rollout workers, no learned value head, and no explicit reward-model checkpoint. This can reduce engineering complexity and variance.

But “skipping the reward model” does not skip preferences. All weaknesses of the comparison data remain: annotator disagreement, length bias, limited prompt coverage, stale candidate policies, and mislabeled examples. DPO can overfit stylistic shortcuts. It can also reduce likelihood for rejected responses that contain useful portions, because the label applies to the full sequence rather than identifying the exact failing span.

Offline data creates a further boundary. Standard DPO does not sample the changing policy and ask for new judgments during training. If the policy moves into unseen behavior, the fixed dataset offers no direct feedback there. Iterative variants can regenerate candidates and collect new pairs, but that restores a data-production loop even if it still avoids PPO.

Sequence length and reduction choices deserve attention. Summed log-probabilities naturally scale with the number of response tokens; alternative normalization can change incentives. Padding must be masked, prompt tokens excluded consistently, and chosen/rejected truncation must not delete the evidence that determined the label. Logging margins, accuracies, lengths, and reference divergences helps reveal silent failures.

The durable mental model is pairwise policy shaping. DPO makes the desired response more characteristic of the new policy relative to a fixed baseline, and makes the rejected response less so. It replaces a learned scalar judge and online optimizer with an elegant offline loss—but the human judgments, reference choice, and evaluation remain the real specification.

2

Explain it like I am five

Instead of hiring a critic, teaching the critic to assign scores, and then training a chef to chase those scores, a cooking school compares two plates directly. It asks the chef to make the preferred plate more characteristic of their new style than of their old cookbook, while pushing the rejected plate the other way. DPO removes the separate critic, but the pair labels and the old cookbook still determine what is learned.

3

Teach it back

Explain what quantities DPO compares for a chosen and rejected response and what is lost by removing online reward-model optimization.

Minimum: 80 characters and 15 words. Your text stays only in this browser.

Saved only on this device.

Show a model answer

DPO compares each response's log-probability under the trainable policy relative to its log-probability under a fixed reference policy. The logistic objective increases the chosen response's relative margin over the rejected one. It avoids training a separate reward model and running PPO rollouts, but standard offline DPO learns only from the supplied pairs; it does not automatically explore new policy outputs or accept arbitrary non-pairwise rewards.

4

Check your understanding

1. What role does the reference model play in standard DPO?
Answer and explanation

It anchors relative log-probability changes for chosen and rejected responses — DPO measures how the policy changes response likelihood relative to a fixed reference, creating an implicit regularization anchor.

2. Which statement is a limitation of ordinary offline DPO?
Answer and explanation

It is constrained by the coverage and quality of existing preference pairs — Without fresh sampling and labeling, the learner cannot directly correct blind spots outside the recorded comparison distribution.

Complete the teach-back and answer the quiz correctly to finish this lesson.

Sources

  1. Rafael Rafailov et al. (2023). Direct Preference Optimization: Your Language Model is Secretly a Reward Model.