Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

JetBrains · Architecture map

Mellum2.1

A compact coding MoE alternates three local-attention layers with one global layer, selecting eight of 64 experts for every token.

Mellum2.1 Thinking, October 2026 · Mellum release timeline

Inside Mellum2.1

Parameters
12B · 2.5B active
Layers
28
Width
2,304
Mixer
Grouped-query
Select a component to explore it. Layer colours match the execution-order strip.
The complete Mellum2.1 architectureInput IDs select embeddings. Layer types execute in the order strip; dotted lines connect the type examples below. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192). Four key/value heads of width 128 per token. Local layers keep a 1024-token window; seven global layers retain the full prefix. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup98,3042,304Input token vectorsCL2,304Execution order · 28 layersLayer 1: Local-attention expert layersLayer 2: Local-attention expert layersLayer 3: Local-attention expert layersLayer 4: Global-attention expert layersLayer 5: Local-attention expert layersLayer 6: Local-attention expert layersLayer 7: Local-attention expert layersLayer 8: Global-attention expert layersLayer 9: Local-attention expert layersLayer 10: Local-attention expert layersLayer 11: Local-attention expert layersLayer 12: Global-attention expert layersLayer 13: Local-attention expert layersLayer 14: Local-attention expert layersLayer 15: Local-attention expert layersLayer 16: Global-attention expert layersLayer 17: Local-attention expert layersLayer 18: Local-attention expert layersLayer 19: Local-attention expert layersLayer 20: Global-attention expert layersLayer 21: Local-attention expert layersLayer 22: Local-attention expert layersLayer 23: Local-attention expert layersLayer 24: Global-attention expert layersLayer 25: Local-attention expert layersLayer 26: Local-attention expert layersLayer 27: Local-attention expert layersLayer 28: Global-attention expert layersLocal-attention expert layers · matches this colour in the execution-order barLocal-attention expert layersLocal-attention expert layers · 21 repetitions21 layers · one layer shown21RMSNorm before this operation.RMSNormGrouped-query attention: Three of every four layers use a 1024-token window, followed by eight selected experts of width 896.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. Three of every four layers use a 1024-token window, followed by eight selected experts of width 896.RoPENormalise queries and keys before attention scores. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).QK-normSliding-window attention over 1,024 tokens.1,024Add the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: Three of every four layers use a 1024-token window, followed by eight selected experts of width 896.MoE8 of 64 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts.Add the branch output to the original stream. +8 of 64 expertsLayer type · execution order aboveGlobal-attention expert layers · matches this colour in the execution-order barGlobal-attention expert layersGlobal-attention expert layers · 7 repetitions7 layers · one layer shown7RMSNorm before this operation.RMSNormGrouped-query attention: Every fourth layer uses full-prefix attention and the same sparse feed-forward block. Full-attention RoPE uses YaRN; local RoPE is unscaled.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. Every fourth layer uses full-prefix attention and the same sparse feed-forward block. Full-attention RoPE uses YaRN; local RoPE is unscaled.RoPENormalise queries and keys before attention scores. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).QK-normAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: Every fourth layer uses full-prefix attention and the same sparse feed-forward block. Full-attention RoPE uses YaRN; local RoPE is unscaled.MoE8 of 64 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts.Add the branch output to the original stream. +8 of 64 expertsLayer type · execution order aboveAfter all 28 layer executionsResidual streamLast columnCL2,304Final RMSNormA separate learned vocabulary projection.Output weights2,30498,304Vocabulary scoresSoftmax98,304Next-token probabilities
Inside attention · Local-attention expert layers
4 K/V groups × 8 query heads per group = 32 query heads. Each query reads up to 1,024 positions in its causal window. Select a component to review it.

Earlier context dimmed · current token bright · dashed K/V region cached.

Mellum2.1: Local-attention expert layers attentionThe main stacked enclosure contains 8 query heads per group. The side enclosure contains 4 shared key/value groups. Each head is 128 wide. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).Query heads within each group: 8. The front face shows one representative query head.8 heads / groupShared key/value groups: 4. The front face shows one representative K/V pair.4 KV groupsAttention inputEarlier context is dimmed; outlined columns are current.Current token computation.2,304CLEach query head has its own projection from width 2304 to 128 query coordinates.WqEarlier context is dimmed; outlined columns are current.Current token computation.128QCLOne K projection per KV group, shared by its 8 query heads.WkEarlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.≤1,024128One V projection per KV group, shared by its 8 query heads.WvEarlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.≤1,024128Normalise the key head. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).RMSNormRotate queries after normalisation. Values are unchanged.RoPENormalise the key head. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).RMSNormRotate keys after normalisation. Values are unchanged.RoPECached keys have already been normalised and rotated at their original positions. Reuse them directly; only the new key passes through the operations above.Q · Kᵀ / √128, causal masking with a 1,024-token window, then softmax. Filled cells show the causal attention pattern; the diagonal is strongest in this illustrative map. The number of drawn cells is schematic.AttentionmapCLCLShared VThe attention map weights V; each query head forms its own weighted sum from its shared KV group.×Concatenate all 4 × 8 = 32 query-head outputs, then project 4096 coordinates to width 2304.Wo32Earlier context is dimmed; outlined columns are current.Current token computation.2,304CLAttention branch output
Inside attention · Global-attention expert layers
4 K/V groups × 8 query heads per group = 32 query heads. Each query reads the available causal prefix. Select a component to review it.

Earlier context dimmed · current token bright · dashed K/V region cached.

Mellum2.1: Global-attention expert layers attentionThe main stacked enclosure contains 8 query heads per group. The side enclosure contains 4 shared key/value groups. Each head is 128 wide. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).Query heads within each group: 8. The front face shows one representative query head.8 heads / groupShared key/value groups: 4. The front face shows one representative K/V pair.4 KV groupsAttention inputEarlier context is dimmed; outlined columns are current.Current token computation.2,304CLEach query head has its own projection from width 2304 to 128 query coordinates.WqEarlier context is dimmed; outlined columns are current.Current token computation.128QCLOne K projection per KV group, shared by its 8 query heads.WkEarlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.CL128One V projection per KV group, shared by its 8 query heads.WvEarlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.CL128Normalise the key head. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).RMSNormRotate queries after normalisation. Values are unchanged.RoPENormalise the key head. 32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).RMSNormRotate keys after normalisation. Values are unchanged.RoPECached keys have already been normalised and rotated at their original positions. Reuse them directly; only the new key passes through the operations above.Q · Kᵀ / √128, causal masking, then softmax. Filled cells show the causal attention pattern; the diagonal is strongest in this illustrative map. The number of drawn cells is schematic.AttentionmapCLCLShared VThe attention map weights V; each query head forms its own weighted sum from its shared KV group.×Concatenate all 4 × 8 = 32 query-head outputs, then project 4096 coordinates to width 2304.Wo32Earlier context is dimmed; outlined columns are current.Current token computation.2,304CLAttention branch output
Model-specific details
Local-attention expert layers · 21 repetitions
Three of every four layers use a 1024-token window, followed by eight selected experts of width 896.
Global-attention expert layers · 7 repetitions
Every fourth layer uses full-prefix attention and the same sparse feed-forward block. Full-attention RoPE uses YaRN; local RoPE is unscaled.
Attention and positions
32 query heads and four KV heads, each 128 coordinates wide. Query and key RMSNorm precede RoPE. Local attention reads a 1024-token window; every fourth layer reads the full prefix with YaRN scaling (factor 16 over 8192).
Memory
Four key/value heads of width 128 per token. Local layers keep a 1024-token window; seven global layers retain the full prefix.

A local window with regular global reads

Twenty-one layers read a 1,024-token window; seven read the full prefix. Each attention block is followed by a mixture of experts that selects eight of 64 SwiGLU experts, each of width 896. Query and key heads are normalised before rotary positions are applied.

JetBrains describes this as the same architecture used by Mellum2. Version 2.1 changes the post-training, especially reinforcement learning for coding agents. The diagram follows the released 2.1 configuration; its separate prediction artifact is outside the backbone.

Explore the components

Sources for this map