1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Preference Optimization

RLHF, DPO and RLAIF explained by what each one removes: how preference pairs teach judgement that demonstrations cannot, and why reward hacking and length bias are predictable.

Last updated

After this section you can

  • Explain why ranking two answers collects signal that writing one ideal answer cannot
  • Place RLHF, DPO and RLAIF on the two axes that separate them — the optimiser and the labeller
  • Recognise reward hacking, length bias and over-refusal as predictable artefacts of this stage
07

Preference Optimization

Supervised fine-tuning teaches a model to imitate an answer. Preference optimization teaches it which of two answers people actually wanted — which turns out to be both cheaper to collect and able to express things a demonstration cannot.

THE CENTRAL IDEA

Writing one ideal answer is hard and slow. Looking at two answers and saying which is better is easy and fast — and it captures qualities nobody can write down cleanly: the right amount of hedging, when to refuse, how long an answer should be, whether a tone lands. This is the stage that turns an instruction-follower into something people want to talk to, and it is why a model’s personality is a training artefact, not a prompt artefact.

One pipeline, two independent things you can drop
RLHF PROMPTS a set of inputs SAMPLE model writes A and B HUMAN RANKS which is better? REWARD MODEL learns to score RL LOOP optimise the score TUNED MODEL The full pipeline. Two models in play and an RL loop to babysit. DPO PROMPTS SAMPLE HUMAN RANKS DIRECT LOSS ON THE PAIRS no reward model, no RL loop TUNED MODEL Changes the optimiser. One model, an ordinary training loop, far less to go wrong. RLAIF PROMPTS SAMPLE AI JUDGE RANKS against written rules REWARD MODEL RL LOOP TUNED MODEL Changes the labeller. Orthogonal to DPO — you can run a direct loss on AI-ranked pairs.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium