Lesson 314

Transformers & LLMs

Self-Attention at Scale

1:00

How the transformer architecture works — self-attention, Q/K/V projections, multi-head attention, the transformer block — and how pretraining, instruction fine-tuning, and RLHF turn it into a large language model.

By the end, you can

  • Explain why transformers replaced RNNs, specifically the parallelism and long-range memory arguments.
  • Describe the role of Query, Key, and Value vectors in one self-attention step.
  • Trace the computation: Q · K scores → divide by sqrt(d_k) → softmax → weighted blend of V.
  • Explain why positional encodings are necessary and what they add to the embeddings.
  • Describe what multi-head attention does that a single attention head cannot.
  • Identify the components of a transformer block (attention sub-layer, FFN sub-layer, residual connections, LayerNorm) and explain why residuals matter in deep models.
  • Distinguish pretraining, instruction fine-tuning, and RLHF by their objectives and data sources.
  • Apply the Chinchilla rule to estimate compute-optimal token counts for a given model size.
  • State the three hard limits of LLMs: hallucination, finite context window, and pattern-shaped reasoning.
Up next in AI, Machine Learning & Course Review
Questions or feedback?