Alignment is the post-training that turns a raw language model into a usable assistant. Pretraining makes a model capable — it can continue any text — but not helpful or harmless. Alignment bends its behaviour toward what humans actually prefer.
Where you meet it
- Every chat assistant you talk to — the "be helpful, refuse harmful requests" layer.
- The gap between a base model on Hugging Face and its
-instructor-chatvariant. - RLHF, DPO, RLAIF, Constitutional AI — all names for ways of doing it.
What it does
It optimises the model against human preferences instead of raw text likelihood. You collect examples of "answer A is better than answer B", and push the model to produce more A-like outputs — without retraining it from scratch.
"Aligned" never means true or safe — only "matches the preferences it was trained on", and someone chose those.
How it works
A pretrained model only predicts the next token; it has no notion of good or safe. Alignment adds two stages on top:
- SFT (supervised fine-tuning). Fine-tune on curated demonstrations — high-quality prompt → answer pairs — so the model learns the format and tone of a helpful reply.
- Preference tuning. SFT alone can't capture "which of two decent answers is better". Two routes:
RLHF does it in two steps. First, humans compare answer pairs, and a reward model r(x, y) learns to predict their choice — a computable scalar stand-in for human judgement. Then the LLM (the policy) is optimised with RL, usually PPO, to maximise that reward, with a KL penalty that leashes it to the SFT model so it improves without drifting:
maximise E[ r(x, y) ] − β · KL( policy ‖ reference )
\_____ reward _____/ \____ stay close ____/
DPO (Direct Preference Optimization) skips the separate reward model and the RL loop. It rewrites the same objective as a single classification-style loss directly on the preference pairs — raising the probability of the chosen answer and lowering the rejected one, while the reference model plays the role of the KL leash:
L = −log σ( β·[ log π(y_win|x)/π_ref(y_win|x)
− log π(y_lose|x)/π_ref(y_lose|x) ] )
Watch out
- Reward hacking & sycophancy. Optimise a proxy hard enough and the model games it — padding, hedging, or just telling you what you want to hear instead of what's true.
- Whose preferences? The preference data and the annotators who wrote it bake in specific values and biases. "Aligned" always means aligned to someone.
- Alignment tax. Aligning can slightly dent raw capabilities; the KL penalty exists partly to limit that.
- DPO is simpler and more stable (no reward model, no RL), but it's not free — it has its own trade-offs and is more sensitive to the exact preference data.
- "Aligned" ≠ safe or truthful. It means "matches the preferences it was trained on" — which can still be wrong, biased, or confidently false.
Go deeper
- Ouyang et al. — InstructGPT: Training language models to follow instructions with human feedback
- Rafailov et al. — Direct Preference Optimization (DPO)
- Hugging Face — Illustrating Reinforcement Learning from Human Feedback (RLHF)
- Stanford CS224N — NLP with Deep Learning (Post-training: RLHF, SFT, DPO)
Alignment ist das Nachtraining, das aus einem Rohmodell einen brauchbaren Assistenten macht. Pretraining macht ein Modell fähig — es kann jeden Text fortsetzen — aber nicht hilfreich oder harmlos. Alignment lenkt sein Verhalten zu dem, was Menschen tatsächlich bevorzugen.
Wo es vorkommt
- Jeder Chat-Assistent, mit dem du sprichst — die Schicht "sei hilfreich, lehne Schädliches ab".
- Der Unterschied zwischen einem Basismodell auf Hugging Face und seiner
-instruct- oder-chat-Variante. - RLHF, DPO, RLAIF, Constitutional AI — alles Namen für Wege, es zu tun.
Was es tut
Es optimiert das Modell gegen menschliche Präferenzen statt gegen reine Text-Likelihood. Man sammelt Beispiele "Antwort A ist besser als Antwort B" und schiebt das Modell dazu, mehr A-artige Ausgaben zu erzeugen — ohne es von Grund auf neu zu trainieren.
„Aligned" heißt nie wahr oder sicher — nur „passt zu den Präferenzen, auf denen es trainiert wurde", und die hat jemand gewählt.
Wie es funktioniert
Ein vortrainiertes Modell sagt nur das nächste Token voraus; es hat keinen Begriff von gut oder sicher. Alignment setzt zwei Stufen obendrauf:
- SFT (Supervised Fine-Tuning). Feintuning auf kuratierten Demonstrationen — hochwertige Prompt-→-Antwort-Paare — damit das Modell Format und Ton einer hilfreichen Antwort lernt.
- Preference-Tuning. SFT allein kann nicht erfassen, "welche von zwei ordentlichen Antworten besser ist". Zwei Wege:
RLHF macht es in zwei Schritten. Zuerst vergleichen Menschen Antwort-Paare, und ein Reward-Modell r(x, y) lernt, ihre Wahl vorherzusagen — ein berechenbarer skalarer Ersatz für menschliches Urteil. Dann wird das LLM (die Policy) per RL, meist PPO, optimiert, um diese Belohnung zu maximieren — mit einer KL-Strafe, die es nah am SFT-Modell hält, damit es besser wird, ohne abzudriften:
maximiere E[ r(x, y) ] − β · KL( Policy ‖ Referenz )
\____ Belohnung ____/ \___ nah bleiben ___/
DPO (Direct Preference Optimization) überspringt das separate Reward-Modell und die RL-Schleife. Es schreibt dasselbe Ziel als einen einzigen klassifikationsartigen Loss direkt auf den Präferenzpaaren um — es hebt die Wahrscheinlichkeit der gewählten Antwort und senkt die der abgelehnten, während das Referenzmodell die Rolle der KL-Leine spielt:
L = −log σ( β·[ log π(y_win|x)/π_ref(y_win|x)
− log π(y_lose|x)/π_ref(y_lose|x) ] )
Worauf achten
- Reward Hacking & Sycophancy. Optimiert man einen Proxy hart genug, trickst das Modell ihn aus — Geschwafel, Absicherungen, oder es sagt dir, was du hören willst, statt was stimmt.
- Wessen Präferenzen? Die Präferenzdaten und die Annotatoren, die sie erzeugt haben, kodieren bestimmte Werte und Bias. "Aligned" heißt immer aligned an jemanden.
- Alignment-Tax. Alignment kann die rohen Fähigkeiten leicht senken; die KL-Strafe existiert auch, um das zu begrenzen.
- DPO ist einfacher und stabiler (kein Reward-Modell, kein RL), aber nicht umsonst — es hat eigene Trade-offs und reagiert empfindlicher auf die genauen Präferenzdaten.
- "Aligned" ≠ sicher oder wahr. Es heißt "passt zu den Präferenzen, auf denen es trainiert wurde" — und die können falsch, verzerrt oder selbstbewusst unwahr sein.
Mehr dazu
- Ouyang et al. — InstructGPT: Training language models to follow instructions with human feedback
- Rafailov et al. — Direct Preference Optimization (DPO)
- Hugging Face — Illustrating Reinforcement Learning from Human Feedback (RLHF)
- Stanford CS224N — NLP with Deep Learning (Post-training: RLHF, SFT, DPO)



