4 · Transformers & LLMs

12. How Large Language Models Are Built

Pretraining, scaling laws, instruction tuning, RLHF/DPO and the resulting behaviour.

11 min read · 3 MCQs

Pretraining

A base model is trained on trillions of tokens with one objective: predict the next token. Everything else — grammar, facts, translation, some reasoning — is an emergent side effect of compressing that corpus.

Scaling laws and compute

Loss falls predictably with model size, data size and compute. The Chinchilla result showed most early models were undertrained: for a fixed budget, more tokens with a smaller model beats a giant model on few tokens.

Alignment

A base model completes text; it does not follow instructions. Supervised fine-tuning on instruction/response pairs adds that, then preference optimisation — RLHF with a reward model, or the simpler DPO — steers towards helpful, harmless answers. Alignment shapes style and refusals, it does not add knowledge.

Chapter quiz

3 questions · pass mark 75%
  1. 1. The pretraining objective of a typical LLM is…

  2. 2. The Chinchilla finding was that models were…

  3. 3. RLHF and DPO primarily change…

Answer every question to submit. Progress for ai-12 is saved in this browser.