First time here? Start with tokenization: how many positions does a sentence take up? Follow those positions through multi-head attention to see how they exchange information. Then put attention, residuals and the FFN together in the original Transformer.

From there, pick a question. Why can BERT read the words on the right when GPT can't? Compare their inputs. How much cache does sharing K/V actually save? Change the head layout in the Transformer Lab. The full directory follows if you want to explore further.

22 core notes, about 4 h. 20 deep dives fold under the notes they extend.

Sequences & tokens1 core · 1 deep

How text becomes token IDs and vectors, and what BPE-style tokenizers learn

  1. Tokenization: text to IDsHow text becomes token IDs and vectors, and why the split changes length and cost7 min
  2. Tokenizer algorithms: what does BPE actually learn?BPE by hand, WordPiece and Unigram compared, and why tokenizer changes break models6 min

The whole Transformer1 core · 2 deep

The whole model first: the core path, the diagram as matrix maths, six optimizations

  1. The Transformer architectureThe diagram as matrix maths, checking causality, position and cache equivalence15 min
  2. Core knowledge: from tokens to generationThe core path from tokens to generation: what each part computes, and why2 min
  3. The Transformer, interactively: structure, optimizations, and model familiesOne morphing diagram: what six optimizations save in memory, traffic or compute10 min

The parts of a layer4

What attention, residuals, normalization and the FFN each compute

  1. Multi-head attention: from equations to implementationFrom a weighted sum: how Q and K set weights, what masks hide, how heads combine23 min
  2. Residual connectionsEach layer learns an edit: the residual keeps the input and gives gradients a path9 min
  3. Normalization: BatchNorm, LayerNorm, and RMSNormWhich axis each norm averages over, and why train and eval modes behave differently18 min
  4. FFNs and SwiGLU: what happens after attention?What each position computes after attention: widen, narrow, and SwiGLU's gated path4 min

Three architectures3

Encoder-decoder, encoder-only and decoder-only: three ways to wire the same parts

  1. Vanilla TransformerOne translation through encoder and decoder, and the question each attention asks13 min
  2. BERT: how an encoder learns to readSame word, different vectors: how BERT is pretrained and then given a task27 min
  3. Decoder-only: autoregressive generationParallel in training, token by token in generation: causal masks, prefill and decode17 min

Position and long context1 core · 2 deep

Where order comes from, and how long contexts store less and read less

  1. RoPE and long context: fitting the input is not understanding itFitting 128K is not reading it: what RoPE and YaRN change, and how to test10 min
  2. Can a model track order without positional encoding?“Pay, then ship” or the reverse: where order comes from with no positional encoding10 min
  3. MLA and sparse attention: storing less or reading less?MLA stores less, sparse attention reads less: two separate costs of a long history12 min

New parts: gates and memory1 core · 4 deep

What recent parts change in the computation: gates, linear memory, lookups, links across depth

  1. Advanced reading: what does each component change?Put FlashAttention, MLA, MoE and gates back in the computation: what each changes4 min
  2. Gated Attention: deciding how much of an attention output to useA learned gate on attention output, worked through two heads by hand5 min
  3. Gated DeltaNet: decay the state, then correct its predictionHow a fixed-size memory forgets a little, then updates on its prediction error4 min
  4. Engram: looking up recurring local patternsA learned lookup for recurring phrases, with context deciding how much of it to use4 min
  5. Attention Residuals: choosing information across depthAttention across depth: how a token at one layer combines what earlier layers left4 min

MoE: experts and routing4 core · 3 deep

Many parameters, few used per token: routing, balance, expert shapes and serving costs

  1. MoE: why make a model sparseEight FFNs, two used per token: count what MoE stores apart from what it uses4 min
  2. MoE: fine-grained and shared expertsFiner experts, far more combinations: 2 of 16 gives 120, 8 of 64 about 4.4 billion4 min
  3. LatentMoE: must experts be as wide as the backbone?Narrow the representation before the experts: do the savings buy more experts?8 min
  4. MoE: what it costs to train and serveMoE's serving bill at DeepSeek-V3 size: all-to-all traffic and GPU memory6 min
  5. MoE: how the router picks expertsHow the router learns despite top-k, and how tokens are dispatched and combined back9 min
  6. MoE: load balancingHow many tokens each expert gets: capacity limits, auxiliary loss, or just a bias10 min
  7. MoE: review questionsReview: total versus active parameters, and why Mixtral 8x7B has 46.7B, not 56B4 min

Looped: depth and shared weights2 core · 4 deep

Reuse one block: what extra loops buy, and what they cost in latency, cache and training

  1. Looped Transformers: reusing one blockRun a four-layer block three times: twelve layer passes from four layers of weights3 min
  2. Looped Transformers: why loops help reasoningLoops add serial depth, which is not the same as an extra reasoning step3 min
  3. Looped Transformers: how many loops per tokenWhich positions deserve more loops: from ACT and PonderNet to Mixture-of-Recursions4 min
  4. Looped Transformers: what today's looped LMs look likeHuginn, Ouro and retrofitted loops: their structure, and how to read their numbers3 min
  5. Looped Transformers: costs and limitsLoops run in series: latency, per-loop KV cache, harder training, and when it pays4 min
  6. Looped Transformers: review questionsReview: loops versus ALBERT's sharing, and why fixed weights still cost more compute3 min

Reading model reports5 core · 4 deep

With the parts in hand, read GPT, Llama, Qwen, DeepSeek and Gemma with the same questions

  1. Model family deep dives: beyond the parameter tableRead every model report with the same questions: problem, design, training4 min
  2. How to read a model reportPractice: trace a token, cost out GQA, and sort the claims into three columns4 min
  3. Gemma deep dive: model design from deployment constraintsHow much cache Gemma 3's local/global attention saves, and what 3n and 4 change8 min
  4. Reading GPT: how does a model learn a new task?GPT-1 to InstructGPT: skills learned into the weights versus supplied in the context10 min
  5. Reading Llama: from one block to training and inference trade-offsLlama as a baseline: where a token goes, and how much cache GQA saves9 min
  6. Qwen deep dive: one family across scales and reasoning modesOne family across budgets: dense and MoE, many sizes, thinking and non-thinking modes12 min
  7. Qwen 1–2.5: separating architecture changes from training changesQwen 1–2.5 gains, separated into tokenizer, architecture, data and post-training7 min
  8. DeepSeek deep dive: architecture, systems, and reasoning training togetherV3's architecture and R1's post-training, read separately: MLA, fine-grained MoE, MTP11 min
  9. DeepSeek-V4: What Remains After Compressing History?What V4's two attention types save, counting storage and reads separately9 min