﻿# DPO learns a preference through relative answer likelihood

DPO learns from chosen and rejected answers relative to a reference policy. Understand sequence log-probability margins without treating preferences as token-level truth labels.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/dpo-preference-log-probability-margin/
Language: en

Direct Preference Optimization trains a policy from pairs of preferred and dispreferred responses to a prompt. Its central object is a relative sequence-level comparison against a reference policy. This differs from simply marking every token in the preferred answer as good and every token in the rejected answer as bad.

## Sequence scores accumulate conditional log probabilities

For an answer under a prompt, the autoregressive model assigns conditional probabilities to successive answer tokens. Their log probabilities add to a sequence score under the chosen masking and boundary conventions. DPO uses scores for both responses rather than a single next-token event. Correct prompt-answer alignment and consistent treatment of ending tokens therefore matter. A score also depends on the response length and the actual tokens, so a preference loss should be interpreted through its stated formula rather than an informal claim that it only compares semantic quality.

## The reference anchors a relative margin

The DPO formulation compares the policy’s chosen-versus-rejected log-probability difference with the corresponding difference under a reference policy, with a declared scaling parameter. The reference is not a database of true answers. It provides an anchor in the optimization formulation. Imagine two valid summaries where annotators prefer the clearer one: supervision asks for that relative preference, not a proof that every phrase in the other summary is false. Shared tokens can occur in both responses and participate through their conditional sequence probabilities.

## Preference data define what is favored

A chosen label can reflect helpfulness, style, safety judgments or another annotation rule. DPO does not infer a universal preference criterion independently of the dataset. Inconsistent pairs and selection biases therefore affect the learned behavior. The derivation connects a particular preference-modeling and regularized-policy formulation to a direct optimization objective; it is not a blanket claim that every human value is captured by pairwise ranking. State how pairs were collected and what annotators were asked to prefer before interpreting the training outcome.

## Inspect margins and evaluate generated behavior

For a tiny fixture, record prompt boundaries and chosen and rejected sequence scores for both policy and reference. Reconstruct the loss under the documented scaling rule. Then assess held-out preference behavior and task correctness separately under the intended decoding settings. A lower pairwise training loss does not guarantee improved factual accuracy or absence of regressions outside the preference distribution. Preserving the reference checkpoint and pair-construction recipe makes the optimization understandable and separates a formula implementation error from the substantive limitations of the supervision.

## Primary research and implementation references

- [Direct Preference Optimization](https://arxiv.org/abs/2305.18290).

- [Training Language Models to Follow Instructions with Human Feedback](https://arxiv.org/abs/2203.02155).

- [PyTorch: CrossEntropyLoss](https://docs.pytorch.org/docs/2.15/generated/torch.nn.CrossEntropyLoss.html).

## Related engineering context

[Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/).
