Direct Preference Optimization [ftip-003L]
✍️sourceAGENTDRAFTED
Direct Preference Optimization [ftip-003L]
✍️sourceAGENTDRAFTED
Direct Preference Optimization rewrites a KL-regularized reward objective as a policy loss on preference pairs. The derivation proceeds through an optimal-policy identity, a reward--policy reparameterization, and a Bradley--Terry comparison probability. Keeping those steps separate makes its assumptions and its difference from reward-model PPO visible.
Notation 1. Temperature and reference-policy log ratios [ftip-003M]AGENTDRAFTED
Notation 1. Temperature and reference-policy log ratios [ftip-003M]AGENTDRAFTED
Let \(\beta >0\) be the KL coefficient, \(\pi _{\mathrm {ref}}\) a fixed reference policy, and \(\pi _\theta \) a trainable policy with support contained in that of the reference on the responses under study. Define the reference-relative log likelihood
\[ \ell _\theta (x,y) =\log \frac {\pi _\theta (y\mid x)}{\pi _{\mathrm {ref}}(y\mid x)} \]and, for a comparison observation, the paired difference
\[ \Delta _\theta (x,y^+,y^-) =\ell _\theta (x,y^+)-\ell _\theta (x,y^-). \]
Definition 2. Direct preference training stage [rafailov2023direct, Section 4] [ftip-003N]AGENTDRAFTED
Definition 2. Direct preference training stage [rafailov2023direct, Section 4] [ftip-003N]AGENTDRAFTED
Direct preference training starts from a fixed reference policy and a dataset of preferred and dispreferred responses. It evaluates a binary cross-entropy loss formed from the trainable policy's reference-relative log likelihoods and updates the policy directly.
This stage does not separately fit a scalar reward network, sample online rollouts for PPO, or train a value function. Its loss nevertheless comes from a particular reward-model and KL-regularized optimization derivation.
Definition 3. Optimal KL-regularized policy [rafailov2023direct, Section 4, equation (4)] [ftip-003O]AGENTDRAFTED
Definition 3. Optimal KL-regularized policy [rafailov2023direct, Section 4, equation (4)] [ftip-003O]AGENTDRAFTED
For a reward \(r(x,y)\), reference policy \(\pi _{\mathrm {ref}}\), and \(\beta >0\), the optimizer of the per-prompt KL-regularized reward objective has the form
\[ \pi _r(y\mid x) =\frac {1}{Z_r(x)}\, \pi _{\mathrm {ref}}(y\mid x) \exp \left (\frac {r(x,y)}{\beta }\right ), \]where
\[ Z_r(x)=\sum _y\pi _{\mathrm {ref}}(y\mid x) \exp \left (\frac {r(x,y)}{\beta }\right ) \]normalizes the policy on the response space. The identity assumes that the normalizer is finite and uses the same reference policy as the underlying objective.
Definition 4. Reward--policy reparameterization [rafailov2023direct, Section 4, equation (5)] [ftip-003P]AGENTDRAFTED
Definition 4. Reward--policy reparameterization [rafailov2023direct, Section 4, equation (5)] [ftip-003P]AGENTDRAFTED
Rearranging the optimal-policy identity of Definition 3 gives
\[ r(x,y) =\beta \log \frac {\pi _r(y\mid x)}{\pi _{\mathrm {ref}}(y\mid x)} +\beta \log Z_r(x). \]The final term depends on the prompt but not on the response. It cancels from pairwise reward differences, matching the additive non-identifiability of Bradley--Terry scores described in Remark [ftip-002S].
Definition 5. Policy-ratio preference probability [rafailov2023direct, Section 4, equation (6)] [ftip-003Q]AGENTDRAFTED
Definition 5. Policy-ratio preference probability [rafailov2023direct, Section 4, equation (6)] [ftip-003Q]AGENTDRAFTED
Substituting the reward--policy reparameterization into the Bradley--Terry law yields
\[ \Pr _\theta (y^+\succ y^-\mid x) =\sigma \left (\beta \, \Delta _\theta (x,y^+,y^-) \right ), \]where \(\Delta _\theta \) is defined in Notation 1. The prompt-dependent normalizer cancels because the two responses share the same prompt.
Definition 6. Direct Preference Optimization loss [rafailov2023direct, Section 4, equation (7)] [ftip-003R]AGENTDRAFTED
Definition 6. Direct Preference Optimization loss [rafailov2023direct, Section 4, equation (7)] [ftip-003R]AGENTDRAFTED
For comparison observations from \(\mathcal D_{\mathrm {pref}}\), the Direct Preference Optimization loss is
\[ L_{\mathrm {DPO}}(\theta ) =-\mathbb E_{(x,y^+,y^-,j)\sim \mathcal D_{\mathrm {pref}}} \left [ \log \sigma \left (\beta \, \Delta _\theta (x,y^+,y^-) \right ) \right ]. \]The empirical loss is evaluated on a fixed comparison dataset. The temperature, reference policy, record weights, and handling of ties or abstentions are part of the training specification.
Example 7. A Direct Preference Optimization log-ratio calculation [ftip-003S]AGENTDRAFTED
Example 7. A Direct Preference Optimization log-ratio calculation [ftip-003S]AGENTDRAFTED
Four declared policy probabilities determine the log-ratio margin in one DPO loss term.
Let \(\pi _\theta (y^+\mid x)=0.6\), \(\pi _{\rm ref}(y^+\mid x)=0.3\), \(\pi _\theta (y^-\mid x)=0.2\), and \(\pi _{\rm ref}(y^-\mid x)=0.4\). With \(\beta =1/2\), the DPO logit is \[ z=\beta \left [\log 2-\log (1/2)\right ] =\tfrac 12\log 4=\log 2. \] Hence \(\sigma (z)=2/3\) and the one-pair negative log-likelihood is \(-\log \sigma (z)=\log (3/2)\approx 0.405\).
Substitution into Equation (7) of [rafailov2023direct, Section 4] verifies one loss term. Consistency of the pairwise data, suitability of the reference policy, and improvement in independent utility are separate questions.
Remark 8. Assumptions behind the DPO derivation [rafailov2023direct, Section 4 and Appendix A.1--A.2] [ftip-003T]AGENTDRAFTED
Remark 8. Assumptions behind the DPO derivation [rafailov2023direct, Section 4 and Appendix A.1--A.2] [ftip-003T]AGENTDRAFTED
The derivation uses a fixed reference policy, a finite KL-regularized optimum, and a Bradley--Terry model for pairwise preferences. The relevant policy probabilities must be positive wherever their logarithmic ratios are evaluated.
The algebra eliminates the prompt-dependent reward offset, not every source of reward-model misspecification. Heterogeneous or nontransitive preferences, adaptive data collection, support mismatch, and finite-sample optimization remain separate questions.
Remark 9. How DPO differs from reward-model PPO [rafailov2023direct, Sections 3--4] [ftip-003U]AGENTDRAFTED
Remark 9. How DPO differs from reward-model PPO [rafailov2023direct, Sections 3--4] [ftip-003U]AGENTDRAFTED
DPO optimizes a policy directly on a fixed preference dataset. Reward-model PPO instead fits an explicit scalar reward predictor, generates policy rollouts, estimates advantages, and applies a policy-gradient update. DPO therefore removes the separately represented reward and online PPO loop from that training stage.
The methods still share ingredients: comparison data, a reference policy, a KL coefficient or temperature, and assumptions connecting comparisons with latent reward. Neither method defines preference optimization in general, and their data and compute requirements are not causally interchangeable.