Bookmarks

DPO — direct preference optimisation

Direct Preference Optimization

A method of fine-tuning a language model on pairs of “better” and “worse” responses that needs neither a separate reward model nor reinforcement learning.

Also: preference optimisation, DPO training

checked 18 Nov

All terms

DPO teaches a model to respond the way people prefer, but more simply than RLHF: instead of a reward model and reinforcement learning, it solves an ordinary classification problem over labelled pairs of responses. It is usually applied after SFT.

How it works

Each prompt has two responses: a preferred one (chosen) and a rejected one (rejected). The model is compared with a frozen copy, the reference model, which is usually the result of SFT. The loss falls as the gap between the probabilities of the preferred and rejected responses, measured relative to the reference model, grows. The beta parameter sets the strength of this signal and how far the model is allowed to drift from the reference.

Data and running training

The TRL library expects chosen and rejected fields in every row, and the prompt is best given as a separate prompt field. A minimal run from the TRL documentation:

python
from datasets import load_datasetfrom trl import DPOTrainer trainer = DPOTrainer(    model="Qwen/Qwen3-0.6B",    train_dataset=load_dataset("trl-lib/ultrafeedback_binarized", split="train"),)trainer.train()

Where the term comes from

The method was proposed by Rafael Rafailov and co-authors in their 2023 paper “Direct Preference Optimization: Your Language Model is Secretly a Reward Model”.

Sources

the term is written from these pages

Verified 18 Nov

Not to be confused with

what it is mixed up with and how it differs

In depth in the references

where the topic is covered in detail