The same hover terms used in the chapters, listed.
- GPT-2 124M
- Smallest GPT-2. 12 layers, 12 heads, 768 dim, context 1024. Paper table of counts is wrong; 124M is the corrected number.
- wte
- Token embedding table, vocab×768. Also reused as the softmax classifier (weight tying).
- wpe
- Learned absolute position embeddings, 1024×768. GPT-2 trains these; the original Transformer used fixed sinusoids.
- pre-norm
- LayerNorm before attention and before MLP, plus a final ln_f. GPT-2's main diagram change vs Attention Is All You Need.
- residual stream
- The x = x + f(x) highway. Clean (no norms on the highway) so gradients travel to the tokens unchanged.
- GELU (tanh)
- Smooth ReLU. GPT-2 used the tanh approximation because TensorFlow's erf was slow in 2018.
- top-k 50
- At sample time, keep only the 50 most likely tokens, zero the rest, renormalize. HF pipeline default; keeps text on the rails.
- Tiny Shakespeare
- ~1M-character debug corpus. Not the real pretraining set.
- weight tying
- Share wte and lm_head.weight. From AIAYN / Press & Wolf. Saves ~40M params.
- residual init
- Scale c_proj weights by 1/sqrt(2·n_layer) so residual-stream variance stays ~1.
- TF32
- Ampere tensor-core mode that crops FP32 mantissa inside matmuls. One line of PyTorch; tensors still look like FP32.
- bfloat16
- 16-bit float with FP32's exponent. Mixed precision without gradient scaling.
- torch.compile
- PyTorch graph compiler. Fuses kernels, kills Python overhead.
- Flash Attention
- IO-aware attention that never writes the full T×T matrix to HBM.
- nice numbers
- Pad ugly dims (50257) to GPU-friendly ones (50304).
- AdamW
- Adam with decoupled weight decay. Default LLM optimizer.
- cosine + warmup
- LR rises linearly, then cosine-decays. GPT-3 schedule.
- gradient accumulation
- Several micro-batches, one optimizer step. Fakes a larger batch.
- DDP
- One process per GPU; all-reduce grads. torchrun + rank + world_size.
- FineWeb-EDU
- Modern educational web crawl used here instead of unavailable WebText.
- HellaSwag
- Commonsense 4-way ending pick. Scored by completion log-prob, not generation.
- llm.c
- Karpathy's C/CUDA rewrite of this stack, faster than the teaching PyTorch.