Past the visuals — into the real mechanics
Backpropagation, attention as code, KV-cache, MoE routing, RLHF, quantization, and interpretability — with interactive diagrams at simple, technical, and research depth.
Chain rule on a tiny graph
Training adjusts weights by flowing loss gradients backward through every multiply and activation — exactly what autograd records during the forward pass.
loss.backward() # ∂L/∂W accumulates via chain rule
Self-attention, line by line
Step through the same operations PyTorch-style frameworks implement inside each transformer block.
Scaled dot-product scores
Each row is a token asking how much it should read from every position — softmax turns scores into weights.
Why caching keys & values matters
During generation, past tokens' K and V don't change — recomputing them every step would waste compute. KV-cache stores them so each new token only runs one layer pass.
FlashAttention intuition
Attention is memory-bound on long sequences. Tiled kernels fuse softmax with matmul so SRAM holds working blocks instead of materializing the full N×N matrix.
Mixture-of-Experts routing
Only a few expert FFNs fire per token. A router softmax picks top-k experts — huge parameter count, moderate compute.
Low-bit weights
INT8/INT4 shrinks memory and bandwidth; the curve gets stair-steps as precision drops.
From base model to helpful assistant
Training often stacks: pretrain on text → fine-tune on instructions → reward model scores answers → RLHF nudges the policy toward human-preferred responses.
LoRA: low-rank adapters
Freeze W, train small matrices A·B so ΔW ≈ BA — millions of trainable params instead of billions.
h = W @ x + (B @ A) @ x # rank r ≪ d
Circuits & mechanistic hints
Advanced interpretability means causal tests: patch activations, ablate heads, measure logits — not just heatmaps.
The Mech Interp track has the playground — attention map, value mixing, residual stream, and 3D embeddings. Open it after you understand attention math here.
Need the visual lab?
Tokens, embeddings, NN lab, and generation demos live in the intermediate track.
