Alignment: RLHF and DPO

Supervised fine-tuning teaches a model to produce a correct answer; alignment teaches it to produce the answer people actually prefer. That shift — from "right" to "better" — is what turned raw language models into helpful assistants, and the move from RLHF's complex machinery to DPO's direct approach made it something ordinary teams can do.

The fine-tuning spectrum post placed alignment at the far end: shaping which of several valid responses a model should prefer, using comparison data rather than single correct outputs. This is how models are made helpful, harmless, and on-tone — qualities SFT can’t easily express as input→output pairs. This post covers the two dominant approaches: RLHF, the powerful-but-complex original, and DPO, the simpler method that made preference tuning practical.

Why SFT isn’t enough

SFT (from earlier posts) trains on input→output examples: for this input, produce this output. That’s perfect for teaching a format or a narrow skill. But some qualities can’t be captured as a single “correct” output, because they’re about preference among valid responses:

You can’t easily write these as SFT examples, because there isn’t one right answer — there’s a better one. What you can provide is comparisons: shown two responses, humans say which is preferred. Alignment learns from those comparisons to make the model produce responses people prefer. This is the “helpfulness and harmlessness” training that turns a capable-but-raw model into a good assistant, and it’s why aligned models feel so much more usable than base ones.

RLHF: the original approach

RLHF (Reinforcement Learning from Human Feedback) was the breakthrough method (behind the instruction-following assistant models that popularized LLMs), and it works in three stages:

1. SFT          — start with a supervised fine-tuned model (does the task)
2. Reward model — collect human preference comparisons (A vs B);
                  train a separate "reward model" to predict which
                  response humans prefer (a learned scorer of quality)
3. RL           — use reinforcement learning (e.g. PPO) to optimize the
                  LLM to maximize the reward model's score, while staying
                  close to the original (a penalty keeps it from drifting)

The idea is elegant: since you can’t write a formula for “a good response,” you learn one — a reward model trained on human preferences — then use RL to push the LLM toward responses that reward model rates highly. It works, and it produced the first genuinely helpful assistant models.

But RLHF is complex and fragile:

RLHF’s power came with a barrier: it was hard enough that mostly well-resourced labs could do it reliably. That’s the gap DPO closed.

DPO: alignment made direct

Direct Preference Optimization (DPO) achieves the goal of RLHF — a model aligned to human preferences — but without the reward model and without reinforcement learning. Its insight is mathematical: the RLHF objective (optimize a policy against a reward model derived from preference data) can be rewritten so that you optimize the language model directly on the preference comparisons with a simple, stable, supervised-style loss.

RLHF:  preferences → train reward model → RL-optimize LLM against it   (3 stages, RL)

DPO:   preferences → directly optimize LLM to prefer chosen over rejected  (1 stage, no RL)

In DPO, you feed the model the same preference data (for each prompt, a chosen and a rejected response) and train it directly to make the chosen response more likely and the rejected less likely, relative to a reference model. The consequences are why DPO largely displaced RLHF for most teams:

DPO made preference alignment something ordinary teams can actually do, the same way LoRA/QLoRA made SFT accessible. It’s the default starting point for alignment today, with RLHF (and its variants) reserved for cases that need the full machinery. (Other preference methods in the same family — ORPO, KTO, and others — offer further variations, but DPO is the widely-adopted baseline.)

Where alignment fits in your pipeline

Alignment is an addition to, not a replacement for, the earlier stages — the typical order:

  1. SFT first — teach the model the task and basic behavior with input→output examples. Alignment assumes a model that already does the task.
  2. Then align (DPO, or RLHF if warranted) — refine which responses it prefers, using preference comparisons, to make it more helpful/harmless/on-tone.

And the data reality from the last post applies doubly: alignment needs preference data (comparisons of responses), which is a different and often harder-to-collect asset than SFT’s input→output pairs. You need pairs of responses with a judgment of which is better — from humans, or increasingly from a strong model acting as judge (with the same caveat that AI-generated judgments must be checked). Collecting good preference data is the main practical cost of alignment.

Do you even need alignment?

Be honest about whether your project needs this stage, because it adds cost:

Alignment is the polish that turns a correct model into a genuinely good one — but only worth it when that polish is what your application needs. With the model trained and aligned, the remaining question is the one every fine-tune must answer honestly: did it actually work? That’s the next post — evaluation.

Key takeaways

Further reading

Sources & References