MORAIDICTIONNAIRE IA
Entraînement

Direct Preference Optimization (DPO) (DPO)

Align a language model with human preferences without training a separate reward model.

Direct Preference Optimization (DPO) is an alignment method that teaches a language model to prefer "good" answers over "bad" ones — directly, without the machinery of reinforcement learning. Where the classic RLHF recipe first trains a reward model and then optimizes it with an algorithm like PPO, DPO reformulates the problem to fine-tune the language model in a single step, from pairs of responses ranked by humans.

The core intuition

The founding insight is mathematical: the optimal reward model in RLHF has a closed form that can be expressed directly in terms of the policy (the model) and a reference policy. We can therefore skip the intermediate reward model and optimize a simple classification loss over preferences.

For a pair (preferred answer $y_w$, rejected answer $y_l$) given a prompt $x$, the objective is:

$$\mathcal{L}{\text{DPO}} = -\mathbb{E}\left[\log \sigma\left(\beta \log \frac{\pi\theta(y_w|x)}{\pi_{\text{ref}}(y_w|x)} - \beta \log \frac{\pi_\theta(y_l|x)}{\pi_{\text{ref}}(y_l|x)}\right)\right]$$

where $\pi_{\text{ref}}$ is the frozen reference model, $\beta$ controls the allowed deviation, and $\sigma$ is the sigmoid.

DPO vs. classic RLHF

Criterion RLHF (PPO) DPO
Reward model Yes, separate No
Training stages Multiple Single
Stability Tricky to tune More robust
Compute cost High Lower

Why it matters

DPO turns alignment — once reserved for well-resourced labs — into an accessible fine-tuning step.

Explore the full AI dictionary →