00Concept constellation
Every idea in this lesson, drawn as a map. Amber is the memory frame, terracotta is update rules, blueprint is hardware & parallelism, moss is the full system. Hover to preview; click to jump to its chapter. Nodes with a blue ring have their own dedicated lesson on this site — shift-click (or ⌘-click) to open it.
The timeline reads like a parade of paper titles: linear attention, fast weight programmers, DeltaNet, Gated DeltaNet, Kimi Delta Attention, Kimi K3. A parade tells you what happened. It never tells you why each thing had to happen — what specific failure of the previous idea forced the next one. That is what this map is for. Every arrow means "this problem created that solution."
00bThe four questions
Every architecture in this lesson will be forced to answer the same four questions. The answers are the whole story.
What does it store?
A growing list of every key and value it has ever seen? Or a fixed-size matrix that must summarize?
How does it write?
Append a new slot? Add an outer product on top of everything? Erase first, then write?
How does it read?
Softmax over every stored key — sharp, expensive? Or one matrix multiply against the summary — cheap, blurry?
What gets evicted?
Nothing? Everything, slowly? One fact, precisely? Each channel at its own speed? This question is the plot.
As each chapter answers them, a running scorecard accumulates one row per architecture. By the coda you will read the completed table and see the entire seven-year arc in eight rows. Here is the row every other row is measured against:
| Architecture | Stores | Write | Read | Eviction |
|---|---|---|---|---|
| GPT-2 (softmax + KV cache) | every K,V ever seen — grows O(N) | append a slot | softmax over all N keys | none. Perfect memory, unbounded rent. |
00c22,580 — held honestly
The number is real. It is also three different comparisons wearing one trenchcoat. Let's take the coat off before we start.
Kimi K3 reports 2.8 trillion total parameters. The GPT-2 that ships in nanoGPT — the one whose code opens Chapter 1 — is 124 million. Divide and you get 22,580. True, and worth holding. But hold the asterisks with it:
- 124M is GPT-2 small. The model the 2019 paper actually headlines is the 1.5B-parameter XL. Against that, the ratio is about 1,867×.
- 2.8T is a sparse total. K3 is a mixture-of-experts that activates roughly 16 of 896 routed experts per token (plus shared ones). Per-token active parameters are on the order of tens of billions — so the compute ratio against GPT-2 small is on the order of hundreds, not tens of thousands. Chapter 7 has a live calculator where you can do this arithmetic yourself.
- Neither number is the interesting one. The interesting number is how much of the gap is new ideas versus more of the same. By raw parameter count, K3 is ~95%+ expert FFNs — an idea whose structure dates to 2017. The sub-1% — the eviction policy, the hybrid read path, the depth-wise attention — is what decides whether the other 95% is even reachable at million-token contexts. Scale bought the library. The new ideas bought the librarian.
00dHow to read this lesson
Nine chapters, ten widgets, one running example that never changes.
Chapters 1–3 are the memory story: what attention actually stores (Ch 1), what happens when you compress the store into a fixed square (Ch 2), and how to erase from that square with linear algebra (Ch 3). Chapter 4 is the hardware interlude — how the eraser was made trainable at scale; if you only care about the memory story you can skim it and keep its one-line conclusion. Chapters 5–6 give the memory knobs for forgetting — one knob, then one per channel. Chapters 7–8 assemble the full system: Kimi K3's stack, and the beautiful final twist — the residual stream itself has the same disease, and gets the same cure.
The running example: Ada and Mochi
One tiny story is re-processed by every architecture in this lesson:
A fact is written early and queried late. Whether the answer survives — and what it costs to keep it alive — is exactly what distinguishes these architectures. We run it in a toy dimension of $d=4$ so every matrix fits on your screen and every multiplication can be checked by hand. Real models use $d_{\text{head}} = 64$–$128$; nothing about the story changes, only the size of the square.
Prerequisites, honestly stated. You should know what a transformer is at the level of "attention mixes information across positions, MLPs transform it, gradient descent trains it." If that sentence is shaky, read the attention & transformers lesson first. Everything else — linear attention, delta rules, gating, MoE, MLA — is built from zero right here.
Notation, fixed once. Batch and head dimensions are dropped everywhere (they just come along for the ride). A key $k$, query $q$, value $v$ are row vectors of size $1 \times d$. The state $S$ is a $d \times d$ matrix. Writing is $S \mathrel{+}= k^{\top} v$ (an outer product), reading is $o = qS$. Sequence length is $T$, chunk size is $C$. Some papers write everything transposed ($S$ as $d_v \times d_k$, read as $Sq^{\top}$) — same math, flipped convention; we flag it once in Chapter 3 and then never mix them.
00eConcept index
The eighteen ideas on the map, one line each.
Attention is a memory
K rows are labels, V rows are contents, softmax is the read. The reframe everything else stands on.
The KV cache
Past keys and values never change, so store them. Decode goes quadratic→linear per step.
The memory wall
37 MB at 1K tokens is cute. At 1M tokens the cache outweighs the model — and you re-read it every step.
Re-association
Remove the softmax and the parentheses move: $(qK^{\top})V$ becomes $q(K^{\top}V)$. History folds into a $d{\times}d$ square.
Interference
A $d{\times}d$ matrix holds at most $d$ clean facts. Fact number $d{+}1$ lands on top of the others.
FlashAttention, correctly
An IO-aware exact kernel — it changes memory traffic, not asymptotics. The KV cache is what kills per-step quadratic cost.
The delta rule
Read what the key currently retrieves, subtract it, write the difference. An eraser made of algebra.
Fast weight programmers
Schlag's 2021 name for the same idea: the state is a weight matrix that inference itself trains.
Chunked training
Exact attention inside C-token tiles, one folded state across tiles. C is a dial between recurrence and attention.
The T-matrix trick
The delta rule's within-chunk dependency chain is a small triangular solve. That one observation buys parallel training.
Decay gating
One scalar $\alpha_t$ multiplies the whole state each step. Forget-everything-a-little, on demand.
Gated delta rule
Gate for bulk forgetting, delta for precise replacement. Each fixes exactly what the other cannot.
KDA: a knob per channel
$\alpha_t$ becomes a $d$-vector. Fast facts and slow facts share one matrix at different half-lives.
MLA
Full attention with a compressed cache: store one small latent per token, expand K and V on demand.
The 3:1 hybrid
Three KDA layers per MLA layer. Constant-state memory plus periodic photographic recall.
Latent MoE
898 experts, ~18 awake per token, running in a compressed space. Capacity where compute isn't.
Kimi K3
23 macrocycles of KDA·KDA·KDA·MLA with latent MoE everywhere and AttnRes taps up the spine.
AttnRes
The residual stream is an additive memory over depth — same disease as Chapter 2, same cure: attention.