The journey from Attention Is All You Need to DeepSeek V4.
Only the models that actually changed something are in the timeline.
One question per stop: what new component did this model introduce?
21 architectures16 fundamental shifts6 deep-dive panelsfamily-tree mapsingle-page
9 yrscovered
16 Ffundamental jumps
11honourable mentions
~1.6 Tlargest model
§ map
The family tree
Every node is a model, every line is "this descends from that". Color = family. Size = parameters (log-scaled).
Click any node to jump to its full timeline entry below.
drag horizontally · click a node to jump
Chronological scrubber
§ baseline
The baseline recipe
Before we begin, the reference frame. Most "new" architectures from 2023 onward are this recipe ± one or two small twists. Tattoo it on the inside of your forehead — every "what changed?" question below is a delta against this.
§ timeline
The timeline — 2017 to 2026
Every entry below introduced something the field hadn't seen before.
Each is shown only as a delta against its closest ancestor: what was already there, what got swapped, and why it mattered. Models that
only scaled or adopted other people's ideas live in the
honourable mentions section further down.
§ honourable mentions
Real ships that didn't change the recipe
These models are real, important, and widely deployed — but every one
of them adopted, scaled, or refined an idea covered above rather than
introducing a new architectural component. Listed here for completeness;
each name links to its full diagram in the architecture atlas.
§ deep dives
The six big stories
Six anchored panels you can read in any order. Each one picks one design dimension and traces it across the whole timeline — so you see, in one place, every time someone touched attention, or normalisation, or the FFN.
§ deep dive 1 of 6
The attention family tree
From MHA to KDA — every shortcut someone took to dodge the O(N²) bill.
Vanilla self-attention has two cost problems. The compute is
O(N²·d) per layer, which already hurts at training. But
the killer at inference is the KV cache: for
a model with L layers and H heads of
dimension d, generating one token at context length
N requires reading
2 · L · H · N · d floats every single step. A 70B model
at 32k context with H=64, d=128 needs ~32 GB of cache per user.
Every variant below is, fundamentally, a different way to compress that
cache.
Eight attention variants, ordered by how aggressively they compress the KV cache. Q is always per-head; K/V is what every variant attacks differently.
Reading the family tree
The first three variants — MHA, MQA, GQA — are the same algorithm with
progressively fewer K/V heads. MHA gives every Q-head its own K/V (full
expressivity, full cost). MQA goes to the extreme: one shared
K/V across all H heads, ~H× smaller cache, but the model loses ~1% on
most evals. GQA found the sweet spot: groups of (typically) 8 Q-heads
share one K/V each, so cache shrinks ~8× but quality holds. Llama 2 70B
shipped GQA at production scale; by 2024 it was the default for any
dense LLM above ~30B.
MLA (DeepSeek V2/V3) is a different idea. Instead of
cutting the number of K/V heads, it caches a low-rank latent
(≈64 dims) and reconstructs full K/V on demand inside the attention
op. The cache shrinks to a fraction of even GQA, with no quality
drop. The trade-off: a small recompute cost per attention call. For
long-context inference this is overwhelmingly worth it.
Sliding window attacks the problem from a different
axis: don't cache fewer dimensions per token, just cache fewer
tokens. Each query attends only to its last W positions (typically
128–4096), so the cache cost is bounded regardless of how long the
context grows. Mistral 7B popularised W=4096; Gemma 3
and GPT-OSS went further to W=128 mixed with full
attention every few layers (a "sliding hybrid"). The catch: pure
sliding loses information from far away. Attention sinks
(a tiny set of always-attended initial tokens) plug that hole — the
model relies on those sink tokens to carry global state.
DSA (DeepSeek V3.2's "DeepSeek Sparse Attention") is
the first production version of learned sparse attention. A
tiny gating network decides, per query, which K positions are worth
attending to. The cache stays sparse, but which positions are kept
isn't fixed — it's content-dependent.
The most aggressive option is linear attention and its
cousins (Gated DeltaNet, KDA). They rewrite softmax(QKᵀ)V
using a kernel trick that turns attention into a recurrent update on
a fixed-size state — so you cache nothing per token, just d²
floats total. The cost: a measurable quality dip when used alone.
The fix: hybrids. Qwen3-Next uses 3 linear
layers per 1 full-attention layer; Kimi Linear mixes
KDA with MLA; Nemotron 3 Nano mixes Mamba (a related
state-space variant) with sparse full attention. Hybrids match or
beat full transformers at 100k+ context.
The pattern: nobody has won. The 2026 frontier ships
five attention variants in different layers of the same
model. Long-context inference is now a stack of complementary cache-
compression tricks, not one canonical "best attention".
§ deep dive 2 of 6
The MoE design space
Few-large vs many-small. Shared expert vs no shared expert. Three open arguments, settled in production every six months.
A Mixture-of-Experts replaces one big FFN with N smaller FFNs and a
router that selects K of them per token. The win is params
≠ compute: a 671B-parameter model can run at the speed of a
37B-parameter dense model, because only 37B params are actually
touched per forward pass. The catch is that you pay training
cost for the full 671B, and you have to keep all 671B in HBM at
inference. The design space below is what teams actually argue about.
Each model picks a corner of "how many experts × how big each one is". The top-left and bottom-right are the two stable basins; the upper-right is theoretically possible but nobody ships it.
Three arguments still being settled
Argument 1 — Few large experts vs many small ones?
Mixtral set the precedent in 2023: 8 large experts, top-2 active per
token. The case for few-large is engineering simplicity —
fewer all-to-all communication calls between GPUs, easier load
balancing, fewer routing pathologies. Llama 4,
Grok 2.5, and GPT-OSS all stayed in
this basin. DeepSeek V3 took the opposite bet: 256 small experts,
top-8 active. The case for many-small is that each expert can specialise
in a much narrower input slice, and total parameter count grows much
faster than active compute. DeepSeek V3, Qwen3-MoE,
Kimi K2, and Mistral Large 3 all
ship many-small.
Argument 2 — One shared "always-on" expert, or none?
DeepSeek V3 introduced a shared expert that every token
passes through, in addition to the 8 routed experts. The intuition:
give the model an always-on baseline so the routed experts can each
specialise rather than re-learning the average. Empirically it helps
stability and final quality by ~0.3–0.5%. Then Qwen3-MoE
ran the experiment without one — same parameter count, same active
compute, just no shared expert — and matched DeepSeek V3 on most
evals. The argument is unresolved. As of 2026, DeepSeek-lineage models
(V3, V3.2, Kimi K2, GLM-4.5, Mistral Large 3) keep the shared expert;
Qwen-lineage models (Qwen3, Qwen3-Next) drop it.
Argument 3 — Dense layers first, or all-MoE from layer 1?
DeepSeek V3 keeps the first 3 layers dense (no MoE) before switching
on experts in layers 4 and up. The argument: at the input, the
distribution is uniform — there's nothing to specialise on yet —
so MoE routing is wasted. Kimi K2 keeps 1 dense layer; most others
go all-MoE from layer 0. The cost of the dense layer is small (one
extra ~5B param layer for a 671B model is rounding error) but the
stability benefit is real.
Model
# experts
top-K active
shared expert
dense layers
granularity
Mixtral 8×7B
8
2
—
0
few-large
DeepSeek V3
256
8 + 1 shared
1 always-on
3
many-small
Llama 4 Maverick
8 (alt layers)
2
—
0
few-large
Qwen3 235B-A22B
128
8
—
0
many-small
GPT-OSS 120B
32
4
—
0
middle
Kimi K2
384 + 1
8 + 1 shared
1 always-on
1
many-small
Grok 2.5
8
2 + 1 always-on
1 always-on (SwiGLU)
0
few-large
Qwen3-Next
10
1
1 always-on
0
middle
The pattern: "few-large" is the easier-to-train
choice; "many-small + shared" is the higher-quality-per-active-param
choice. The split roughly tracks "Western lineage vs Chinese lineage"
in 2026, but that's mostly accidental — the technical case for
many-small keeps winning.
§ deep dive 3 of 6
The normalisation map
Where you put the LN — and which LN — quietly determines whether your loss diverges at layer 32.
Normalisation is the most under-appreciated lever in modern LLMs.
It doesn't add expressive power; it doesn't reduce parameter count;
it doesn't help inference. It only does one thing: it keeps training
numerically stable as you stack layers. But that one thing is the
difference between a 7B model that converges at 70 layers and a 7B
model whose loss spikes to NaN halfway through the run.
Same residual block, four placements of normalisation. The blue box is the actual sub-layer (attention or FFN); the yellow boxes are normalisation; the dotted line is the residual stream.
The historical arc
The original transformer was post-norm: LayerNorm
after the residual add. This is mathematically clean — every
block's output is normalised — but it's brittle. Past ~24 layers the
gradients into the bottom of the stack collapse, training stalls,
and you get the famous "loss plateau then NaN" failure mode.
GPT-2 popularised pre-norm: move the LN before
the sub-layer. Now the residual stream is no longer normalised, but
the input to each attention/FFN block always is. Training is stable
to 100+ layers. Every major dense LLM from 2019 to 2024 used this
(with one twist: Llama 1 swapped LayerNorm for RMSNorm — drop the
mean-centering, just scale by RMS — same quality, ~20% faster on GPUs).
Then two refinements showed up. Sandwich norm
(Gemma 3) adds a second RMSNorm after the sub-layer,
before the residual add. The motivation is sliding-window attention:
when the window slides, the attention output's distribution can
shift sharply, and that shift propagates into the residual stream.
Normalising on both sides absorbs it. By 2025 sandwich norm is the
"safer at scale" default.
OLMo 2 made the most controversial move: revive
post-norm, but pair it with QK-Norm — a
tiny LN applied separately to Q and K just before the dot product.
The original "post-norm is unstable" failure was driven by attention
logits exploding to ±∞; QK-Norm caps that explicitly. With QK-Norm
in place, post-norm trains as stably as pre-norm and the residual
stream stays cleaner.
The current consensus: pre-norm RMSNorm is the
default; add sandwich at scale (esp. with sliding-window); add
QK-Norm if you're seeing attention-logit blow-up. The post-norm
revival is real but still niche.
§ deep dive 4 of 6
The position-encoding map
Where (and whether) the model learns "this token is in slot 47".
Attention is permutation-invariant: shuffle the input
tokens and the attention matrix is just shuffled the same way.
Without a positional signal, the model sees a bag of words. Every
variant below is a different answer to "where do you inject position?"
Six positional schemes in chronological order. Above the line = injected at embeddings or in attention; below the line = retrofitting moves (extending RoPE) or partial application.
From "added to embeddings" to "implicit in the mask"
The original transformer used sinusoidal PE:
hand-crafted sinusoids of varying frequencies, added to the input
embeddings. The clever idea was that any position offset could be
expressed as a linear function of the encoding, so the model could
in principle generalise to longer sequences. In practice it
didn't — quality dropped sharply past the training length.
GPT-2 swapped to learned absolute PE: N trainable
position vectors added to embeddings. Simpler, slightly better at
training length, completely incapable of extrapolating beyond N.
RoPE (LLaMA 1, originally RoFormer) is the
breakthrough. Instead of adding position to the embedding,
it rotates Q and K by a position-dependent angle inside the
attention op. The dot product Q·K then naturally encodes
relative position — the answer "how far apart are these two
tokens?" emerges from the rotation difference. RoPE extrapolates
much better than absolute PE and became universal by 2024.
Then the long-context arms race demanded longer windows than RoPE
was trained for. YaRN (DeepSeek and others) is a
smart re-scaling of RoPE's per-dimension frequencies: low-frequency
dims (the ones encoding "near vs far") get squeezed, high-frequency
dims (the ones encoding fine ordering) are preserved. A 4k-trained
model can be retrofitted to 128k context with a few hundred
fine-tuning steps.
NoPE (SmolLM3 in production, Stella-style) is the
most surprising move: drop positional encoding entirely on some
layers. The causal attention mask itself contains positional
information ("this token can only see the ones before it"), and a
deep model can reconstruct ordinal position from that signal alone.
Empirically, mixing NoPE layers with RoPE layers gives slightly
better long-context generalisation than RoPE-everywhere.
Partial RoPE (Gemma 4) is the latest twist: apply
RoPE only to half the head dimensions; leave the other half
un-rotated. The model now has both position-aware and position-
agnostic features in parallel — useful for tasks where the answer
should be invariant to position (factual recall) and tasks where it
shouldn't (code, math).
The pattern: position info has migrated from
embeddings (2017) → into attention (2023) → out of the model
entirely on selected layers (2025). The trend is to inject less,
not more.
§ deep dive 5 of 6
The FFN, layer by layer
Three multiplications, one activation. Five iterations of refinement; only one of them is purely additive.
The FFN is where most of a transformer's parameters live (~⅔ in a
dense Llama-style block). It's also the part that has changed the
least in spirit: every variant below is still "project up, do
something nonlinear, project down". What changed is the activation
function and, eventually, the identity of the FFN itself —
MoE turns "one big FFN" into "N small ones plus a router".
Five FFN block variants. Blue = linear projections. Yellow = activation. Purple = expert/latent specialisation. Pink × = element-wise multiplication (the SwiGLU gate).
Why each step happened
ReLU → GELU. ReLU's hard zero discards every negative
input; GELU smooths the transition (it's roughly a Gaussian-weighted
ReLU). The smoother gradient improves convergence by ~0.3%.
GPT-2 shipped GELU; everyone followed.
GELU → SwiGLU. GLU (gated linear units) split the
FFN's first projection into two parallel projections — a "gate" and
an "up" — then element-wise multiply them after passing the gate
through a sigmoid-like non-linearity. SwiGLU uses SiLU (= Swish) as
the gate non-linearity. The cost is one extra weight matrix (3
instead of 2). The benefit is reliably ~1.5% better quality at the
same parameter budget. LLaMA 1 made it the dense default; nobody at
frontier scale uses anything else.
Dense FFN → MoE FFN. Replace one big SwiGLU with N
smaller ones plus a router that picks K. You spend total parameters,
but only K are active per token. The first big one was Mixtral
8×7B (8 experts, top-2). DeepSeek V3 went to 256+1 (top-8 + 1
shared). Now MoE is the default for any model above ~50B active.
(See the MoE design space
for the inside of the router.)
MoE → latent MoE. DeepSeek V3 (in some variants)
and Qwen3-Next ship experts that work in a compressed latent
space rather than full hidden dim. Each expert is smaller in
parameter count but more numerous; total expressivity per active
param is higher.
The pattern: activation choice has been settled
(SwiGLU). Identity of the FFN is being unsettled — there's no longer
one "FFN block" per layer; there's a router and a population.
§ deep dive 6 of 6
Beyond the Transformer
Three different ways to escape O(N²) attention. None of them won. All three are now in production hybrids.
For nine years, the transformer's quadratic attention cost was the
field's main constraint at long context. In 2024–25, three
alternatives reached production. None of them dethroned attention
on its own — but all three earned a permanent slot inside hybrids.
The baseline (full attention) and the three sub-quadratic alternatives. Orange = quadratic cost. Green = sub-quadratic. The headline: all three alternatives shrink memory to constant in N; their differences are in what their fixed-size state remembers.
Three escape routes
xLSTM is the most radical: drop attention entirely.
The mLSTM (matrix LSTM) cell maintains a matrix-valued hidden state
that is updated left-to-right per token. There's no attention
matrix, no Q/K/V, no KV cache. Memory is genuinely constant in
context length. xLSTM 7B (2025) was the first scaled model with
zero attention layers. The catch: pure recurrent models
underperform transformers by 1–3 quality points at the same
parameter count.
Mamba and other state-space models (SSMs) are also
recurrent, but they keep a structured hidden state and use a
"selective scan" — the state-update parameters depend on the input,
which lets the model decide what to remember and what to discard.
Mamba alone underperforms transformers, but Mamba hybrids
— a few attention layers sprinkled into a stack of Mamba layers —
match transformer quality at much lower long-context cost.
Nemotron 3 Nano (NVIDIA, 2025) was the first major
production Mamba hybrid.
Linear attention and its modern descendants
(Gated DeltaNet, Kimi's KDA) are the closest to "regular" attention.
They keep the Q/K/V projection structure but replace
softmax(QKᵀ)V with a kernel approximation
φ(Q)(φ(K)ᵀV). The kernel form has an associative
property that lets you compute attention recurrently with a
fixed-size hidden state of d². Add gating (KDA's
per-channel gates, Gated DeltaNet's per-head gates) and the model
gets selective forgetting, which matters at long context.
The verdict the field reached in late 2025: hybrids dominate.
A single attention type — full or sub-quadratic — alone leaves
quality on the table. The frontier 2026 recipe puts 3–12 sub-
quadratic layers (linear or SSM) per 1 full attention layer,
and pays the quadratic cost only on the layers that need it. This
gives you O(N) inference at long context with no quality loss.
The pattern: pure transformer is no longer the
terminal architecture. The frontier is "transformer + selective
recurrence". Whether you call that a transformer is a vocabulary
question.
§ patterns
Ten patterns that emerge end-to-end
If you only remember ten things about the last nine years of LLM architecture, make it these.
PATTERN 01
Pre-norm became universal — and post-norm is sneaking back
From 2019 to 2024, every frontier LLM was pre-norm RMSNorm.
OLMo 2 broke the streak in 2024 by reviving post-norm + QK-Norm.
Gemma 3 added sandwich (both). The single-norm era is over;
modern blocks routinely have 2 or even 3 norms per residual.
PATTERN 02
Attention is being replaced one layer at a time
Pure attention is now rare in fresh designs. The 2026 stack mixes
full attention, sliding attention, MLA, sparse attention, and
linear/SSM/recurrent layers — often four variants in one model.
"Attention" is a layer type, not the layer type.
PATTERN 03
MoE became the default above ~50B
Every frontier model in 2025–26 is MoE except deliberately-dense
ones (Llama 3 8B, Qwen3 32B). Active-vs-total parameter counts
are now standard reporting; "200B-A37B" is more meaningful than
either number alone.
PATTERN 04
The KV cache became the inference bottleneck
Every attention variant after 2023 — GQA, MLA, Sliding, DSA —
exists to shrink the KV cache. The KV cache, not parameter count,
now sets how many users a frontier model can serve per GPU.
PATTERN 05
Long context came from tricks, not more compute
128k → 1M → 10M context windows ship every quarter. Almost none
of this is "we trained on longer sequences" — it's RoPE scaling
(YaRN), sliding windows, NoPE, latent caches, and selective
sparsity. The expensive thing is still inference, not pre-training.
PATTERN 06
SwiGLU is uncontested
Every frontier LLM since LLaMA 1 (2023) uses SwiGLU as its
FFN activation. Three years on, no published model has displaced
it. The "activation function debates" of the 2010s are over.
PATTERN 07
Tokenisers got 4× bigger
From 32k vocab (Llama 1) to 128k tiktoken (Llama 3) to 256k+
(DeepSeek, Gemma 3). Bigger vocab = fewer tokens per request =
cheaper inference and more "useful work" per attention op.
The cost is a bigger embedding matrix; it's worth it.
PATTERN 08
Latent everything
DeepSeek V2 showed it for K/V (MLA). Some models now ship latent
FFN (experts work in compressed dim). The next likely candidate:
latent embeddings — the model lives in a low-rank space and
unfolds to full dim only at the head. Compression is the trend.
PATTERN 09
Training-time tricks now matter as much as architecture
The most consequential recent ships aren't block-level changes:
Muon optimizer (Kimi K2), MXFP4 native training (GPT-OSS), MTP
multi-token prediction (Qwen3-Next), GRPO/DAPO/Dr.GRPO for RLHF.
Architecture is converging; training recipes are diverging.
PATTERN 10
The "best Western recipe" exists
For a dense LLM under 70B in 2026: RMSNorm pre-norm + RoPE +
SwiGLU + GQA + AdamW + tiktoken-class vocab. Nine years of
research collapsed into seven defaults. Disagreement now lives
in the MoE layer, the attention variant, and the training recipe
— not in the basic block.
§ closing
Where the next delta is forming
Nine years after Attention Is All You Need, attention is no
longer all you need. The 2026 frontier model is a hybrid of
five different attention variants, an MoE FFN, sandwich norm with
QK-Norm, and a partial-RoPE positional scheme — a stack
that would be unrecognisable to the original 2017 paper, even though
its bones (residual blocks, multi-head projection, FFN-after-attention)
are still there.
Three deltas are forming right now and will probably show up in the
next round of releases:
1. Latent everywhere
MLA proved that K/V doesn't need full hidden dim. Latent FFN proved
the same for the expert. The next obvious target is latent
embeddings — train the model in a low-rank space and unfold
to full dim only at the unembedding head. Expect the first production
run sometime in 2026.
2. Sub-quadratic attention as the default
Full attention is expensive enough that, on the next generation, it
will probably be the minority layer type rather than the
majority. The 3:1 hybrid Qwen3-Next shipped is likely to invert to
12:1 or higher — most layers do linear/SSM, with a few "global view"
attention layers sprinkled at strategic depths.
3. Training-recipe innovation will dominate architecture innovation
The block-level tweaks left to make are diminishing-returns. The big
wins of 2026–27 will come from training side: MXFP4 native
from token zero (GPT-OSS started this), Muon-class
optimisers (Kimi K2), multi-token prediction
(DeepSeek/Qwen3-Next), verifier-augmented RL (RLVR /
GRPO). These don't show up in family-tree diagrams but they're where
the next 1–2 quality points will come from.
The thing to remember: the field hasn't been doing
random walks. Every delta in this timeline answers a specific
engineering pain — the KV cache that's too big, the residual stream
that's too unstable, the expert layer that's too dense, the context
window that's too short. Read the timeline forward and it looks
like one model copying the previous; read it as a series of
constraints being relaxed and you can see the whole nine-year
argument the field has been having with itself.