LLM Architecture Gallery (rasbt) and the architectural deltas that matter

Which released open models made which architectural choices, for every model of Sebastian Raschka's LLM Architecture Gallery with a readable config, rebuilt layer by layer from its own config.json and checked against the gallery, transformers 5.20.1 and the root Config calculator. Configs parsed on an Apple M1 Pro (CPU); no model was run. Data as of October 2026. Reading: 28 min, plus 9 in closed details.

The idea in one screen

An open model of 2026 is still the decoder block of Topic: llm-architecture with a handful of choices changed, and two of them decide what it costs to serve: how many weights run per token (experts) and what each token leaves behind in each layer (shared heads, latents, windows, linear layers). Both can be read off a config.json in thirty seconds; in 2026 almost every model is sparse on both, in different proportions.

Fig. 1, step by step

  1. Llama 3.1 8B: the plain stack. 32 full-attention layers, each keeping 4 KiB per token (8 KV heads of 128 numbers, keys and values, 2 bytes each): 128 KiB per token. One slab per layer, its footprint the bytes that layer keeps, so a tower's volume is its cache per token, written under it; the dots are one new token's entries going up the stack.
  2. DeepSeek V3: a smaller entry in every layer. 61 MLA layers each keep one latent of 512 numbers plus a 64-number positional key, 1,152 bytes: 68.6 KiB per token, about half of Llama 3.1 8B's from a model with 671B parameters.
  3. Gemma 3 27B: most layers forget. 52 of its 62 layers (teal) attend within a 1,024-token window, so at 131,072 tokens each holds only its last 1,024 entries and shrinks to its share: the card's 496 KiB per token becomes 83.3 KiB.
  4. Qwen3-Next 80B: most layers keep nothing per token. 36 of its 48 layers are Gated DeltaNet (hollow, yellow): each folds the token into a fixed-size state. Only the 12 attention layers grow, 2 KiB each: 24 KiB per token.
  5. Kimi K3, and all five on one scale. 69 Kimi Delta Attention layers and 24 MLA layers: 27 KiB per token from a 2.8T-parameter model. The same block with three levers pulled (the entry, the window, the linear layer); sections 5 to 7 take them one at a time.

You need: the decoder block and what a KV cache is (The transformer from zero). This page does not teach the mechanisms; it counts who uses them and links each to its owner: Attention variants (MHA, GQA, MQA, MLA, windows, sparse attention), Long context (sizing a whole cache at a context length), Beyond attention (linear and state-space layers), Mixture of experts, Positional Encodings and Normalisation, residuals and stability.

Fourteen models, one row each

Fig. 2 reads fourteen models from Llama 3.1 8B to Kimi K3 off their own configs (src/gen_data.py): tinted cells are choices, layer counts are out of the model's layers (W the window, 1K = 1,024 tokens). Click a row to open it in Decode a config.

Bottom row, the gallery's 66 models of 2026: MLA in 16; no plain MHA at all; windows in 25; linear or SSM hybrids in 20; trained sparse attention in 11; MoE in 52 (39 add a shared expert and 31 keep their first layers dense); partial RoPE in 25; layers with no position in 5; median cache 68.6 KiB per token against 144 KiB for the 2025 models. Fig. 3 puts the same counts against 2025 and earlier.

KV per token (card)
the gallery's headline: bytes one token adds to the cache across all layers, bf16, every layer at full cost.
Held at 131K
the average bytes per token one 131,072-token request actually holds once windowed layers stop growing.
Per-layer strip
this page's picture of a model: one cell per layer, coloured by what the layer does; three bars for mixer, FFN and position.
Local : global
windowed layers per full-attention layer (Gemma 3: 5 : 1).
Linear : attention
linear or state-space layers per attention layer in a hybrid (Qwen3.5: 3 : 1).
Dense prefix
the first layers of an MoE model kept as ordinary FFNs.
The deltas, the config fields that say them, and who owns the mechanism (reference)
DeltaWhat it changesWhere to read itOwned in depth by
What each token storesKV cache per token per layer: all heads (MHA), shared heads (GQA, MQA), a compressed latent (MLA)num_key_value_heads, head_dim, kv_lora_rankAttention variants
How long it is keptSliding-window layers keep only the last W tokens; a few global layers keep everythinglayer_types, sliding_windowLong context
Whether it is stored at allLinear-attention or state-space layers keep a fixed-size state instead of a growing cachelayer_types, hybrid_override_pattern, linear_attn_configBeyond attention
Which attention is computedA trained indexer picks the top k earlier tokens per query; full attention only over thoseindex_topk, index_head_dimAttention variants
How many FFN weights runMixture of experts: many expert FFNs, a router picks k per tokenn_routed_experts, num_experts_per_tok, n_shared_expertsMixture of experts
How position entersRoPE on all dimensions, on part of them, or on none in some layersrope_parameters, partial_rotary_factor, no_rope_layersPositional Encodings
Stack shapeLooped layers, layers that share another layer's cache, two sublayers per layer, encoder-decodernum_loops, num_kv_shared_layersthis page, section 10 (looped in 1, cross-layer KV sharing in 2 of the 2026 models)

Fig. 2 · Fourteen models, one row each: which choices they made

Read from each model's config by src/gen_data.py. Where the column is narrow the dense-first and held-at-131K columns are left out; Compare architectures has every field for every model.

Fig. 3 · MoE and windows were common by 2025; linear hybrids, MLA and trained sparse attention are what 2026 added

Derived from configs; 2026 counts in brackets. The gallery is curated, not a census: read the shares as "among the models a careful observer found worth drawing".

1. The gallery, and the six figures the configs do not reproduce

The LLM Architecture Gallery is Sebastian Raschka's side-by-side reference of open-weight architectures: a diagram and a fact sheet per model (total and active parameters, attention and layer mix, context, licence, links to config and report) and one headline number, the KV cache per token in bf16. Its metadata is one models.yml (Apache 2.0), used here at commit 589d213 (4 October 2026, read 18 October 2026): 109 entries from GPT-2 XL to October 2026. It is a third-party summary, useful because it is consistent, not because it is primary.

Its convention (KV-cache notes): "the logical cache added by one token for one sequence", batch 1, 2 bytes per element, summed over every layer that appends to a growing cache. A sliding-window layer counts at full cost ("It changes how long a token remains in the cache"), linear and state-space layers count 0 B with their fixed state kept outside the number, and MLA counts its latent, not expanded keys and values. The root's Architecture map (on Topic: llm-architecture) and this page use the same convention and add a second number with the windows credited.

How this page rebuilt it. For the 105 of the 109 models whose config this page could read, the script reads the saved config.json (public mirrors for gated Meta and Google repos; nothing is downloaded at build time), decodes one code per layer for mixer, FFN and position, sums the cache layer by layer and compares with the gallery.

Defaults reproduce the gallery, independently
Recomputed from each model's own config with the gallery's convention, the KV cache per token matches the gallery's figure for 95 of the 101 figures both sides compute, within rounding (two only once the trained-sparse indexer keys are added, as the gallery does). Not rebuilt: four entries whose config is not public (three gated repos, one LoRA adapter with no config of its own), and the three DeepSeek V4 entries, whose compressed caches the per-layer formula does not express (their reconstruction is in section 10). Rows this page adds: Llama 3.1 8B and 70B, Granite 4.0-H Small, Step-5 Preview (gallery figure "N/A") and the tiny GPT.
Correction
Gemma 4 E2B and E4B: 18 KiB and 56 KiB per token, not the gallery's 35 and 84: the last 20 and 18 layers reuse an earlier layer's cache and the global layers use global_head_dim 512 (transformers 5.20.1). MiMo-V2-Flash and MiMo-V2.5: 217.5 KiB, not 144: the config gives sliding layers their own 8 KV heads and 128-dimension values. LongCat-Flash-Lite: 31.5 KiB, not 63: 14 config layers of two MLA sublayers are 28 caches, not 56. Step 3.5 Flash: 180 KiB against 192 is a convention, not an error (the gallery adds the 3 multi-token-prediction layers). Orange: correction; teal: convention. The full arithmetic of each side is below.

Fig. 4 · Six gallery figures the configs do not reproduce: gallery (hollow) against the config (filled)

Orange: correction; teal: convention. Change against the gallery on the right.

Each mismatch with both arithmetics (provenance)

The lesson of this page's first build: a curated table is only as good as its recomputation. Two of the six overstate the cache by about 1.5 to 2 times because they ignore cross-layer sharing. Recompute every row you rely on and publish the match count.

2. Reading a model card in thirty seconds

Five questions, in this order; each answer predicts something different.

  1. Total and active parameters. Total is the weight memory; active is what runs per token, so latency and price. Their ratio is the MoE sparsity. They are routinely conflated, and an encoder-decoder can have two active counts (DeepSeek V4.1-Flash: 8B during prefill, 16B during decode, gallery).
  2. Attention type and layer mix. Full attention, windows, linear layers or trained sparse attention, and in what proportion: how cost grows with context, which matters more than the advertised context length.
  3. KV cache per token, times context, times concurrent requests, with the windows credited: whether long context fits, in GiB.
  4. Experts: routed, active, shared. How much expert parallelism serving needs, and how much skewed traffic will hurt.
  5. Licence, and whether base weights shipped. Base weights decide whether you can post-train at all.

gpt-oss-120b (August 2025)

  1. 117B total, 5.1B active (OpenAI's model card, vendor): 4.4% runs per token, so it decodes like a 5B model and needs memory for 117B.
  2. 36 layers alternating a 128-token sliding window and full attention, one to one: cost grows with context through 18 of 36 layers.
  3. 8 KV heads of 64: 72 KiB per token on the card, 36 KiB per token effective at 131,072 tokens; one full-context request holds 4.5 GiB, so 16 such requests need 72 GiB of cache.
  4. 128 routed experts, 4 active, no shared expert in the config.
  5. Apache 2.0; the card does not say whether a base checkpoint shipped.

Kimi K3 (July 2026)

  1. 2.8T total, 104B active (gallery line from Moonshot's card, vendor): 3.7% runs per token.
  2. 93 layers: 69 Kimi Delta Attention layers (linear, fixed state) and 24 MLA layers that carry no positional encoding (mla_use_nope).
  3. Only the 24 MLA layers grow a cache: 24 × (512 + 64) × 2 = 27 KiB per token, 3.4 GiB at 131,072 tokens; the 69 linear layers add a fixed state of 1,572,864 numbers each, 414 MiB per sequence in FP32 (matrix state only).
  4. 896 routed experts, 16 active, 2 shared; the first layer dense.
  5. "Kimi K3 License" (gallery); read it before planning to serve or post-train.
Predict: Gemma 3 27B's card says 496 KiB per token, and its context is 128K. What does one 131,072-token request actually hold in bf16?

3. Reading the config: the fields behind each strip

The card is a summary; config.json is what the loading code reads, so when they disagree the config wins for that checkpoint. Each strip comes from a handful of fields, and every lab spells them differently. Decode a config shows, for any of the 105 models, exactly which fields were read and what each set.

To knowReadWatch for
Layers and widthnum_hidden_layers, hidden_sizen_layer (GPT-2), num_layers (LongCat), n_layers and dim (Mistral's params.json)
Cache per attention layernum_key_value_heads × head_dim, or kv_lora_rank + qk_rope_head_dim for MLAKV heads under another name (num_attention_groups in Step); head_dim that is not hidden_size / num_attention_heads (Gemma, Qwen3)
Which layers do whatlayer_typesEleven other spellings in this set: hybrid_override_pattern (Nemotron), layers_block_type, attn_type_list (MiniMax), linear_attn_config.full_attn_layers (Kimi, counted from 1), hybrid_layer_pattern (MiMo), gqa_layers, local_layer_ids, sliding_window_pattern (an integer, or the string "interleave" in Motif), full_attention_interval, no_rope_layers (Llama 4), compress_ratios (DeepSeek V4)
Windowsliding_windowsliding_window_size, attention_chunk_size (Llama 4 chunks), a window set but switched off by use_sliding_window: false
Expertsn_routed_experts, num_experts_per_tok, n_shared_experts, first_k_dense_replacenum_local_experts, moe_topk, moe_layer_freq (a list), mlp_only_layers, interleave_moe_layer_step
Positionrope_theta, rope_scalingNested per layer type in rope_parameters (Gemma 4); per-layer lists of bases and rotary fractions (Step); partial_rotary_factor
Contextthe model cardmax_position_embeddings is a limit in the code, not the trained context (MiniMax-M1's is 10,240,000; Qwen3's 40,960 against a 32,768 native context, per the root page)

The two classic misreadings, deriving head_dim from hidden_size and reading max_position_embeddings as trained context, are worked on the root page's section 11 (Topic: llm-architecture).

Traps met building this page, each real:

  • The config is not where you think. Multimodal checkpoints nest the language model under text_config (Gemma 4, Qwen3.5, Kimi K3); DeepSeek V4.1-Flash stores its text_config as a Python-repr string, V4-Pro its compress_ratios as a string holding a list; Mistral Large 3 ships params.json with its own key names.
  • A saved file that is not a config. A gated repo answers an anonymous download with an error body, and a script that does not check saves it as config.json. This page's earlier build had nine such files (eight from gated repos, one "Entry not found"), among them unsloth__Meta-Llama-3-8B.json containing only Invalid username or password.; those models were silently skipped. Parse every download and fail loudly; Llama 3 8B now comes from the public mirror unsloth/llama-3-8b.
  • The list includes layers that are not in the stack. Step 3.5 Flash's layer_types has 48 entries for 45 decoder layers: the last three are its multi-token-prediction layers.
  • The config alone is not enough. Gemma 4 E2B's config says head_dim 256, but transformers gives its global layers global_head_dim 512 and lets its last 20 layers reuse earlier caches; Motif 3 has kv_lora_rank like MLA, but its released code caches the expanded keys and values. Both are settled only by the modeling code (section 1).
The decoder's mixer branch, and the report line it wrote for Gemma 3 27B (code)

The start of the mixer branch of src/gen_data.py (the same branches as the root map's build_map.py):

if t.get('hybrid_override_pattern'): p = t['hybrid_override_pattern'] mix = ''.join({'M': 'L', '*': 'G', 'E': 'F', '-': 'F'}[c] for c in p) ... elif lt: m = {'full_attention': 'G', 'attention': 'G', 'sliding_attention': 'S', 'linear_attention': 'L', ...} mix = ''.join(m.get(x, '?') for x in lt[:L]) elif t.get('sliding_window_pattern'): n = t['sliding_window_pattern'] mix = ''.join('G' if (i + 1) % n == 0 else 'S' for i in range(L)) # src/out/report.txt match Gemma 3 27B calc 496.00 KiB idx - gallery 496 KiB kvw 85248.0 mix SSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSSSSSGSS ffn dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd pos RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

4. The per-layer strips

A card's "52 sliding-window + 10 global" hides where those layers sit, and placement matters: Gemma 3 puts a global layer after every five windowed ones, so information never travels more than five layers before it can reach the whole context. The strips draw each layer in order, left (next to the embedding) to right (next to the output head), every model stretched to the same width; Fig. 1 drew five of these stacks as towers, and each strip flattens one to a row.

How to read one. Blue (full attention), green (MLA) and purple (trained sparse) cells grow a cache with every token; teal (windowed) cells stop at W and yellow (linear) cells keep a fixed state. Orange cells in the middle bar are expert layers, so a grey first cell is the dense prefix DeepSeek-style models keep. A black cell (white in dark mode) in the bottom bar is a layer with no positional encoding: Llama 4 Maverick's every fourth layer, SmolLM3's every fourth, Kimi K3's attention layers. Compare architectures has the strips of every model, sortable and filterable.

Seven colours, seven answers to one question: what must this token leave behind in this layer so later tokens can use it? A key and value for every query head (MHA), one per group (GQA) or one for all (MQA), a latent every head rebuilds from (MLA), the same entries for the last W tokens only (window), all entries kept but only the top k read (trained sparse), or a fixed-size state (Gated DeltaNet, KDA, Mamba-2). How each works is on Attention variants and Beyond attention; this page's question is which answer each released model chose, and in what mixture.

Fig. 5 · Twelve stacks side by side: the cache grows only in the blue, green and purple cells

Three bars per model: mixer, FFN, position; on the right the KV cache per token in bf16, card convention. Click a name to open it in Decode a config. The tiny GPT is this topic's running example (6 layers of multi-head attention with learned positions, 6,144 bytes per token).

5. Delta one: what each token stores

Every decoded token reads the keys and values of every earlier token in every attention layer, so the bytes per entry are decode time as well as memory. At Llama 3.1 70B's shape with all 64 heads (MHA) that would be 2,560 KiB per token, 320 GiB for one 128K request; GQA keeps one key and value head per group (Llama 3.1 70B: 64 query heads, 8 KV heads, 320 KiB per token), and MLA a 512-number latent plus a 64-number positional key per layer whatever the head count (DeepSeek-V3: 61 × 576 × 2 = 68.6 KiB per token). Fewer KV heads cost a little quality and MLA costs extra projections and its own kernels; why, and how MLA rebuilds the heads, is on Attention variants. Fig. 6 shows what released models chose.

  1. One layer, one token. Each row is a released model and each box one of its layers; the first box's height is what that layer keeps for one token, read from the config: from 1 KiB (Nemotron 3.5 Lightning, 2 KV heads of 128) and 1,152 bytes (DeepSeek V3's MLA latent and key, (512 + 64) × 2) to 16 KiB (Gemma 4 31B's windowed layers, 16 KV heads of 256). The outlines are the layers still to come; front to back, the rows are Nemotron 3.5 Lightning, DeepSeek V3, gpt-oss-120b, Qwen3 235B, Llama 3.1 70B and Gemma 4 31B.
  2. Times every layer that grows. Llama 3.1 70B 80 × 4 KiB = 320 KiB per token; Qwen3 235B 94 × 2 KiB = 188 KiB; gpt-oss-120b 36 × 2 KiB = 72 KiB; DeepSeek V3 68.6 KiB; Gemma 4 31B 50 × 16 + 10 × 4 = 840 KiB. In Nemotron 3.5 Lightning only 6 of 52 layers grow (the flat hollow tiles are Mamba-2 and FFN-only blocks): 6 KiB per token.
  3. The spread, from above. Each row's boxes add up to its card figure, from 6 KiB to 840 KiB per token: 140 times. It does not follow size: gpt-oss-120b, with 117B parameters, keeps less than a quarter of what Llama 3.1 70B keeps.
  4. Sparse attention adds keys. Selecting the top k keys cuts arithmetic, not storage: every key must stay available to be selected, and the indexer adds keys of its own (purple). DeepSeek V3.2 keeps V3's 68.6 KiB per token plus 15.25 KiB of indexer keys (61 × 128 × 2 bytes); storage falls only when entries are also compressed, as in V4 (section 10).

Across the whole gallery (Fig. 7), the median halved in a year and the spread stayed a hundredfold: in the gallery's 2026 models the median is 68.6 KiB per token against 144 KiB for the 2025 models, and Nemotron 3.5 Lightning keeps 6 KiB per token, Gemma 4 31B 840 KiB.

How to check: num_key_value_heads × head_dim × 4 bytes per attention layer (K and V, 2 bytes each), or (kv_lora_rank + qk_rope_head_dim) × 2 for MLA, then count the layers that grow a cache. The table does that for ten models.

Fig. 7 · The hundredfold spread, and a median that halved in a year

KV cache per token, card convention, bf16, every gallery model with a config (DeepSeek V4's compressed caches and xLSTM's state-only stack left out); dots coloured by attention family, the bar marks the median. Derived from configs.

6. Delta two: how long it is kept (sliding windows)

Most layers attend only to the last W tokens (a sliding window) and every few layers a global layer attends to everything. A windowed layer stores the same entry per token as its base design but drops entries older than W, so one request at context T holds the sum over layers of bytes per token × min(T, W). That is why the card's figure, which counts windowed layers at full cost, overstates a windowed model's long-context cache. The price: information more than W tokens back reaches a token only through the global layers, so exact retrieval far back depends on how many there are. What windows cost in recall is on Attention variants and Long context; this section counts who uses them.

  1. Gemma 3 27B at 1,024 tokens: every layer holds the same. 62 layers of 8 KiB per token (16 KV heads of 128), each a bar as long as the tokens it holds. Below the window the windowed (teal) and global (blue) layers coincide: 496 MiB, card and held alike.
  2. At 8,192 tokens the windows stop. The 52 windowed layers keep their last 1,024 tokens (the band at the front) and drop older entries; the 10 global layers keep all 8,192. Held 1.03 GiB, against 3.88 GiB if every layer were global.
  3. At 131,072 tokens the windows are a sliver. 52 × 8 KiB × 1,024 = 416 MiB for the windowed layers, 10 × 8 KiB × 131,072 = 10 GiB for the global ones: 10.4 GiB held, against the card's 496 KiB × 131,072 = 62 GiB.
  4. gpt-oss-120b: one to one, 128-token windows. 18 windowed and 18 global layers of 2 KiB: the windows save half, 4.5 GiB held against 9 GiB on the card, because half the layers still grow.
  5. Gemma 4 31B: windows on the big layers. Its 50 windowed layers keep 16 KiB per token and its 10 global layers only 4 KiB (4 KV heads of 512, keys and values shared): 800 MiB + 5 GiB = 5.8 GiB held against 105 GiB on the card, 18 times less.

The ratios released. The local-to-global ratio runs from 1:1 (gpt-oss) through 3:1 (11 models, the most common) to 5:1 (Gemma 3 and 4), and windows from 128 tokens (11 models, gpt-oss and MiMo among them) to 8,192 (Llama 4's chunks). How to check: count sliding_attention entries in layer_types, read sliding_window, then credit them; below W the two numbers coincide.

Predict: Llama 4 Maverick has 48 layers; 36 attend within 8,192-token chunks and 12 are global, each layer 4 KiB per token. The card says 192 KiB per token. What does a 131,072-token request hold per token?

Fig. 9 · Crediting the windows: the card (hollow) against the cache held at 131,072 tokens (filled)

Every windowed model in the gallery with a computable cache, sorted by the factor on the right; log scale, bf16, derived from configs. Crediting the windows cuts the long-context cache 2 times for gpt-oss and 18 times for Gemma 4 31B: 840 KiB per token on the card, about 46 KiB per token at 131,072 tokens, 105 GiB against 5.8 GiB for one request. The top of the list is Gemma 4 12B at 31.2 times.

7. Delta three: whether it is stored at all (linear and state-space layers)

A hybrid replaces most attention layers with a recurrence that folds each token into a fixed-size state: Gated DeltaNet in Qwen3-Next and Qwen3.5 to 3.8, Kimi Delta Attention in Kimi Linear and Kimi K3, Mamba-2 in Nemotron 3 and Granite 4.0-H, lightning attention in Ling, short convolutions in LFM2.5. The state is a lossy summary, so every released hybrid keeps some attention layers for exact recall; the question the configs answer is how many. The mechanisms are on Beyond attention.

  1. Kimi K3 at 4,096 tokens: the state outweighs the cache. Three Kimi Delta Attention layers (hollow, yellow) for every MLA layer (green): 69 of its 93 layers each hold a fixed state of 1,572,864 numbers, 6 MiB in FP32, and the 24 MLA layers grow by 1,152 bytes per token each. Each bar's length is the bytes it holds for one request: at 4,096 tokens, 108 MiB of cache against 414 MiB of state.
  2. At about 15,700 tokens they balance. The cache has grown to the size of the state; the state has not moved, because a linear layer folds each new token into the same matrix instead of appending it.
  3. At 131,072 tokens the cache dominates. 24 × 1,152 bytes × 131,072 = 3.4 GiB of cache; the state is still 414 MiB, an eighth of it.
  4. Nemotron 3 Super: fewer attention layers, a later balance. 40 Mamba-2 layers of 4 MiB (160 MiB) against 8 attention layers of 1 KiB per token (the flat tiles are its FFN-only blocks): the cache reaches the state only at 20,480 tokens.

The state is a cost too. Below some context a hybrid holds more state than cache (the closed table gives, per model, the context at which the fixed state equals the growing cache). How to check: count linear_attention, mamba or M entries; the state per layer is heads × key dim × value dim (heads × head dim × state size for Mamba-2), in FP32. Calling a hybrid "cache-free" is wrong on both counts: Kimi K3's attention layers still grow 27 KiB per token, and its 414 MiB of state is larger than the cache up to about 15,700 tokens.

How many attention layers to keep is the design question, and Fig. 11 sets the one published ablation beside what the released hybrids chose: the market settled near 3 : 1, which is also where the ablation's perplexity bottoms out.

Every hybrid: attention layers, cache, state, and where they cross (per-model table)
Predict: Qwen3.5 397B keeps 15 attention layers of 60, 30 KiB per token in all; its 45 Gated DeltaNet layers hold 180 MiB of FP32 state per sequence. Past what context does the growing cache outweigh the fixed state?

Fig. 11 · The ablation picked 3 : 1, and so did most of the market

Top, published (vendor): Moonshot's Kimi Linear ablation (arXiv 2510.26692, Table 1), validation perplexity 5.65 at 3:1 against 5.66 at 1:1, 5.70 at 7:1, 5.82 at 15:1 and 5.77 for the pure full-attention baseline (0:1). Bottom, derived from configs: every gallery hybrid with attention layers at its own linear-to-attention ratio (Nemotron's FFN-only blocks left out); 13 of the 23 sit between 2.9 and 3.1 to 1, the rest from 1.7:1 (LFM2.5) to 7:1 (Ling). Two sources on two panels: one vendor's small-scale ablation is not evidence about the other models.

8. Delta four: how many FFN weights run (experts)

A mixture-of-experts (MoE) layer holds many expert FFNs and a router sends each token to k of them, often plus an always-on shared expert; many models keep their first layers dense. Of the gallery's 2026 models with a config, 52 of 66 are MoE; 39 of those add a shared expert and 31 keep a dense prefix; 8 experts per token is the most common choice (31 models). Routing, balancing and expert parallelism are owned by Mixture of experts.

  1. Llama 3.1 8B: one dense FFN. Every weight runs for every token: 8B parameters in all, 8B active.
  2. gpt-oss-120b: 128 experts, 4 per token. The router sends each token to 4 of 128 expert FFNs, with no shared expert: 5.1B of 117B parameters run per token (the gallery's lines, from OpenAI's card).
  3. DeepSeek V3: 256 experts, 8 per token, plus 1 shared. The shared expert (dark, beside the grid) sees every token; the first 3 of its 61 layers stay dense (the dense prefix, not drawn). 37B of 671B active.
  4. Kimi K3: 896 experts, 16 per token, plus 2 shared. The same layer cut into finer experts, each a smaller block: 104B of 2.8T active, 3.7%.
  5. Six tokens read many experts. Each token picks its own 8 of DeepSeek V3's 256 (illustrative random picks; real routing depends on the token and is skewed), so six tokens already touch dozens of experts, and every expert must sit in memory.

What it means for serving. All experts must be in memory, so the total, not the active count, sets the hardware; at small batch, decode reads every expert some token picks. The MoE choice and the attention choice are independent: Kimi K3 is extreme on both.

Across the gallery (Fig. 13) the active share falls as models grow. How to check: n_routed_experts, num_experts_per_tok, n_shared_experts, and the dense prefix from first_k_dense_replace or a per-layer list.

The fourteen largest MoE models of 2026: experts, shared, dense first layers (per-model table)

Fig. 13 · The bigger the model, the smaller the share that runs

Active parameters as a share of total, every MoE model of 2025 and 2026 in the gallery, against total parameters (both from the gallery's lines, gallery, from vendor cards). From 500B parameters up, 21 of 22 models run 2.9 to 6.4% of their weights per token (DeepSeek V4-Pro 3.1%, Kimi K2.5 to K2.7 3.2%, Kimi K3 3.7%; the exception, Nemotron 3 Ultra, 10%); at 35B and below the share is 8 to 21% (Mellum2 Thinking 20.8%).

9. Position, norms and gates

Position. Almost every model rotates queries and keys by their position (RoPE, 61 of the 66 models of 2026), and the deltas are in the details, each readable from the config and visible in the bottom strip: partial RoPE (rotate only some dimensions: 25 models, the Qwen3.5 to 3.8 line and Gemma 4's global layers among them); no position in some layers (5 models in 2026: Kimi K3 and Ember-1 in all 24 attention layers, Solar Open 2, Muse Glimmer, GLM-5.3-Flash; earlier Llama 4 Maverick in 12 of 48 and SmolLM3 in 9 of 36); different bases per layer type (10,000 on local layers against 500,000 to 10,000,000 on global ones in Gemma 4, MiMo, Laguna and Naive); and scaling past the trained length (YaRN factors in 9 of the 2026 configs). Why each works is on Positional Encodings; read rope_parameters per layer type.

Norms and gates: on the card, rarely in the config. Pre-norm RMSNorm is close to universal; the 2025 to 2026 deltas are QK-norm (an RMSNorm on queries and keys before the dot product, which bounds attention logits), extra norms after each sublayer (OLMo 2, Gemma's sandwich) and output gates on attention (Qwen3-Next, Trinity, Laguna, Kimi K3's "Gated MLA"). The modeling code does these, not config fields, so this page does not decode them; the gallery's attention line names QK-norm for 19 of the 2026 models, an undercount because it is named only when the card mentions it. The root Architecture map (on Topic: llm-architecture) records norm placement and QK-norm, sourced, for its 46 lineage models; Normalisation, residuals and stability owns why they work.

10. Delta six: stack shape

Everything above assumes one causal stack, each layer run once with its own cache. Four 2025 to 2026 designs break that, and each changes the cache arithmetic, which is why the number of layers in a config is not the number of caches.

  1. One stack, each layer once. Five ordinary stacks to scale, height the layer count and width the hidden size, from Llama 3.1 8B (32 × 4,096) to Kimi K3 (93 × 7,168): one layer, one cache, the assumption of every section above.
  2. Looped layers. Ouro-Thinking 2.6B runs its 48 layers 4 times per token (total_ut_steps 4) and each pass keeps its own cache: 384 KiB per pass, 1.5 MiB per token, the largest per-token cache in the gallery, from a 2.6B model. Nanbeige 4.2 runs 22 layers twice (num_loops 2). Whether every pass needs its own cache, and why two loops is the usual stopping point, is research in progress (closed block below).
  3. Cross-layer KV sharing. Gemma 4 E2B's last 20 of 35 layers keep no cache of their own (hollow): each reads the keys and values that the last unshared layer of its type keeps for it (num_kv_shared_layers; transformers, modeling_gemma4.py, is_kv_shared_layer). 15 caches, 18 KiB per token: this page's section 1 correction. Gemma 4 E4B shares its last 18 of 42.
  4. Two attention sublayers per layer. LongCat-Flash layers each hold two MLA sublayers and a shortcut MoE beside two dense MLPs (modeling_longcat_flash.py): 14 layers in the config, 28 caches, 31.5 KiB per token for LongCat-Flash-Lite.
  5. Layers in the config are not caches per token. The five cases side by side: Ouro-Thinking 48 layers and 192 caches, Nanbeige 4.2 22 and 44, LongCat-Flash-Lite 14 and 28, Gemma 4 E4B 42 and 24, Gemma 4 E2B 35 and 15. Count caches, not layers.

Compressed caches are the fourth design. DeepSeek V4 compresses most layers' entries 4 times (CSA) or 128 times (HCA) along the sequence (the mechanism is on Attention variants). From compress_ratios, in the gallery's bf16 convention (512 numbers per entry, indexer keys and the 128-token windows left out): V4-Pro 30 CSA + 31 HCA layers, 7,928 bytes per token, which reproduces the gallery's 7.7 KiB; V4-Flash 21 CSA + 20 HCA layers plus 2 window-only layers, 5,536 bytes, the gallery's 5.4 KiB. DeepSeek V4.1-Flash goes further, an encoder whose final state feeds the decoder's keys and values (gallery; detailed, with its 890 bytes per token at FP4, on DeepSeek). The DeepSeek page's own V4-Pro estimate, 4,939.5 bytes per token, uses FP8 main entries and FP4 indexer keys: a different precision convention, not a contradiction.

Multi-token prediction (MTP) layers, extra heads that predict tokens further ahead and double as a draft model (Families and objectives), are a fifth: used at inference they keep caches too, which is the whole difference between this page's 180 KiB and the gallery's 192 KiB for Step 3.5 Flash.

Looped models: does every pass need its own cache? (research, October 2026)

The cache per pass is a training choice, not a law: as the recurrent states approach fixed points, later passes can share the last pass's keys and values (terminal KV sharing) "with almost no loss in accuracy", and at 1.6B a learned depth prior with a 3x smaller KV cache matched fixed-depth training with the full cache; fixed-depth training is what breaks sharing (Looped Models Done Right, Part II (arXiv 2610.06833)).

Why two loops is the usual stopping point: hidden-state variance grows with each loop, and in a looped MoE the routers pick the same experts every pass, so extra loops add FLOPs without new computation; scaled residuals, input re-injection and per-loop routers kept 100M to 1.7B models stable to 9 to 12 loops, with a near-iso-FLOP 700M model best at 5 (LOOM (arXiv 2610.01153)).

The first scaling law fitted jointly over recurrence, sparsity, size and data puts recurrence at about 2x total-parameter efficiency on reasoning (sparsity about 3x active-parameter efficiency), and at trillion-token scale and matched training compute a looped MoE with law-derived recurrence matched a non-looped MoE about twice its size on reasoning benchmarks (Scaling Laws for Looped MoE (arXiv 2609.40316)).

11. How the numbers were checked

Every cache figure here was checked four ways, configs only, on an Apple M1 Pro (CPU):

  1. Against the gallery: 95 of the 101 figures agree within rounding; the six that do not are in section 1, each with both arithmetics.
  2. Against transformers' own parsing: src/checks/hf_layer_types.py builds each config with its transformers 5.20.1 configuration class (no weights, no network) and compares the per-layer list transformers derives with this page's mixer strip. 59 models agree layer for layer, 0 differ; the other 49 cannot be checked this way.
  3. Against the root's Config calculator: src/checks/cc_agree.mjs runs the root page's Config calculator (on Topic: llm-architecture) code on every gallery config it models and compares the KV cache at 1; 1,000; 4,096; 32,768 and 131,072 tokens with windows credited: all 46 models agree, 230 numbers, all equal (the calculator includes DeepSeek V3.2's indexer keys, as this page's "with indexer" figure does), checked 2026-10-23. The four Nemotron 3 MoE configs agree since the calculator learned their latent MoE layers that day; before, it refused them.
  4. Against the root's Architecture map: the 27 models both pages draw have identical strips, cache, windows and expert counts, field for field.

measured means a script ran over saved configs; nothing depends on the machine. gallery marks fields read from models.yml (third-party summaries of vendor cards: release dates, total and active parameters, licences). derived marks numbers computed from configs.

The transformers check as it ran, and the 49 it cannot check (provenance)

Of the 49: 19 need custom code (no class in transformers), 2 configs are rejected by their class (a non-finite number inside a list, a field type), and 28 classes keep no per-layer list, 26 of them for stacks this page also draws as uniform; the other two are Inkling (windows from local_layer_ids) and MiniMax M3 (three dense layers, from its model card). Excerpt of src/checks/hf_layer_types.py and its last lines of output:

cfg = CONFIG_MAPPING[mt](**{k: v for k, v in t.items() if k not in ('model_type', 'transformers_version')}) lt = getattr(cfg, 'layer_types', None) or getattr(cfg, 'layers_block_type', None) hf = ''.join(CODE.get(x, '?') for x in lt) mine = page_code(r['mix']) hf = hf[:len(mine)] ok = hf == mine # output (src/out/hf_layer_types.txt) agree Kimi K3 kimi_linear agree Nemotron 3.5 Lightning 30B-A3B nemotron_h agree Kolibri-1 78B kolibri1 transformers 5.20.1 agree 59 differ 0 not checkable 49

12. Depth

Rehearse it: four design questions (optional)
A config has 60 layers, 50 of them sliding (window 1,024, 16 KV heads of 256) and 10 global with one shared K = V tensor of 4 heads × 512. KV per token in bf16, and at 131,072 tokens?
Sliding: 2 × 16 × 256 × 2 = 16 KiB per layer; global: 4 × 512 × 2 = 4 KiB. Per token on the card: 50 × 16 + 10 × 4 = 840 KiB. At 131,072 tokens the sliding layers hold 1,024 tokens each (800 MiB) and the global ones all of them (5 GiB): about 5.8 GiB, 46 KiB per token. That is Gemma 4 31B.
"2.8T total, 104B active". What does each number tell you about serving it?
2.8T is the weight memory (5.1 TiB in bf16, so a multi-node deployment or aggressive quantisation); 104B is the compute per token, so latency and price are those of a 100B dense model. Neither says anything about the cache: that is the attention design (27 KiB per token for Kimi K3).
A hybrid keeps 1 attention layer in 4. At what context does its fixed state stop mattering?
Where the state equals the growing cache: state bytes divided by cache bytes per token. Qwen3-Next: 72 MiB of FP32 state against 24 KiB per token, about 3,000 tokens; beyond a few tens of thousands of tokens the state is a rounding error.
Design: serve 16 concurrent 1M-token conversations on one node of 8 × 80 GB GPUs, weights and cache in bf16. Which gallery design would you start from, and why?
First filter on published context: Gemma 4 31B (256K), Qwen3.5 and Qwen3-Next (262K) are out. Then budget: 640 GB is 596 GiB. Nemotron 3 Super 120B-A12B: weights about 224 GiB; its 8 attention layers hold 8 GiB per 1M-token request plus 160 MiB of Mamba-2 state, about 130 GiB for 16 requests: about 355 GiB, it fits with room for activations. Kimi K3 has a small cache (27 GiB per request) but 2.8T of weights (5.1 TiB). A GQA model of the same size would hold hundreds of GiB per request. So: a Mamba-2 or linear-attention hybrid with few attention layers, MoE for quality at 12B active, then FP8 for both weights and cache if headroom is needed. Illustrative arithmetic: activations, framework overheads and expert placement are left out.
Why do so many MoE models keep their first layers dense? (one published reason)

The published reason is DeepSeekMoE's: it kept the first layer of its 16B model dense “since we observe that the load balance status converges especially slower for the first layer” (Dai et al. 2024, DeepSeekMoE, section 5.1.2). The wider argument, that early representations are barely differentiated by token type so routing on them is close to random, is unsourced here. 31 of the 52 MoE models of 2026 in the gallery do it, most with one to three dense layers. The mechanism and its evidence belong on Mixture of experts.

Built 2026-10-18 from Sebastian Raschka's LLM Architecture Gallery (models.yml at commit 589d213, Apache 2.0) and the config.json of each model; how it was built is in this page's src/README.md. Corrections to the gallery are this page's reading of the configs and the modeling code, not the gallery author's.