Chapter 11. Alignment
A pretrained language model knows a great deal about language but has no particular incentive to be helpful, truthful, or safe. It will happily complete any text pattern, including toxic, misleading, or dangerous ones. The reason for this is that its training objective, next-token prediction, is agnostic to these concerns. Alignment is the process of shaping a model’s behavior so that its outputs reflect human values and intentions, not just statistical patterns in the training data.
The dominant framework for thinking about alignment comes from Anthropic’s HHH criteria: a well-aligned model should be Helpful (understands user intent and provides useful responses), Honest (avoids fabrication, expresses uncertainty when appropriate), and Harmless (refuses dangerous requests and avoids toxic content). These objectives can conflict, and much of the challenge of alignment is in balancing them.
In the standard training pipeline, alignment is the final stage, shown in Figure 11-1. After pretraining on large text corpora (Chapter 2) and supervised fine-tuning on instruction-response pairs (Chapter 10), the model undergoes alignment training to learn which behaviors are preferred.
Figure 11-1. LLM post-training pipeline highlighting preference fine-tuning (alignment), where preference data is used to shape a supervised fine-tuned model into an aligned, production-ready ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access