Phase 7 · Transformers/
Lesson 7.1core2 h 30 min

Attention Is All You Need: the big picture

Why a 2017 translation paper became the blueprint for every frontier model

Everything after this lesson — GPT, BERT, Whisper, ViT, Claude — is a variation on the architecture in one 2017 paper. Understanding why attention replaced recurrence (parallelism and short paths), how the encoder and decoder stacks fit together, and how the model is trained and run gives you the map you need for the detailed derivations in 7.2 Scaled dot-product and multi-head attention, fully derived–7.4 Inside the block: residuals, LayerNorm, FFN and embeddings, the architecture families in 7.5 Encoder-only: BERT and friends (and sentence embeddings)–7.7 Encoder–decoder: T5, BART and choosing an architecture, and the inference engineering in 7.10 Efficient inference: KV cache, GQA, FlashAttention, speculative decoding, quantization.

You'll be able to

  • Explain the two costs of recurrence that self-attention removes and quantify them with the per-layer complexity table
  • Trace a token through the original encoder–decoder: embeddings, positional encodings, self-attention, cross-attention, feed-forward, output softmax
  • Describe how the transformer is trained with teacher forcing and run autoregressively at inference
  • List what the 2017 design got right and which components were later replaced

Key ideas

  1. Recurrence costs O(n) sequential steps and O(n) path length; self-attention costs O(1) of both at the price of O(n²d) compute per layer.
  2. The original transformer is an encoder–decoder: 6 encoder blocks (self-attention + FFN) and 6 decoder blocks (masked self-attention + cross-attention + FFN), d_model = 512, 8 heads.
  3. Cross-attention takes queries from the decoder and keys/values from the encoder; masked self-attention keeps the decoder autoregressive.
Show 3 more key ideas
  1. Training uses teacher forcing with a causal mask, so all next-token predictions are computed in one parallel forward pass; inference generates one token at a time.
  2. Warmup-then-decay learning rates, label smoothing, dropout 0.1 and BPE vocabularies were set here and became defaults.
  3. What survived: self-attention, multi-head attention, explicit positions. What changed: pre-norm, RoPE, SwiGLU, RMSNorm, decoder-only dominance, MoE, scale.

Suggested path through this lesson