Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

IBM · Architecture map

Granite 4.0 H Small

Only 4 of 40 layers use attention. The rest are Mamba-2 layers, and every layer routes through experts.

Granite 4.0 H Small, October 2025 · Granite release timeline

Inside Granite 4.0 H Small

Parameters
32B · 9B active
Layers
40
Width
4,096
Mixer
Hybrid
Select a component to explore it. Layer colours match the execution-order strip.
The complete Granite 4.0 H Small architectureInput IDs select embeddings. Layer types execute in the order strip; dotted lines connect the type examples below. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings. Keys and values for 8 heads of size 128 in the 4 attention layers only. The 36 Mamba-2 layers keep a fixed-size state (128 state values per channel), which does not grow with context length. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup100,3524,096Input token vectorsCL4,096Execution order · 40 layersLayer 1: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 2: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 3: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 4: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 5: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 6: Attention layers 6, 16, 26 and 36Layer 7: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 8: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 9: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 10: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 11: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 12: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 13: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 14: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 15: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 16: Attention layers 6, 16, 26 and 36Layer 17: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 18: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 19: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 20: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 21: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 22: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 23: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 24: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 25: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 26: Attention layers 6, 16, 26 and 36Layer 27: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 28: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 29: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 30: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 31: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 32: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 33: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 34: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 35: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 36: Attention layers 6, 16, 26 and 36Layer 37: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 38: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 39: Mamba-2 layers (all except 6, 16, 26 and 36)Layer 40: Mamba-2 layers (all except 6, 16, 26 and 36)Mamba-2 layers (all except 6, 16, 26 and 36) · matches this colour in the execution-order barMamba-2 layers (all except 6, 16, 2…Mamba-2 layers (all except 6, 16, 26 and 36) · 36 repetitions36 layers · one layer shown36RMSNorm before this operation.RMSNormMamba-2: Mamba-2 mixer, then the expert block.Mamba-2Add the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: Mamba-2 mixer, then the expert block.MoE10 of 72 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts. 1 shared experts run for every token.Add the branch output to the original stream. +10 of 72 experts + 1sharedLayer type · execution order aboveAttention layers 6, 16, 26 and 36 · matches this colour in the execution-order barAttention layers 6, 16, 26 and 36Attention layers 6, 16, 26 and 36 · 4 repetitions4 layers · one layer shown4RMSNorm before this operation.RMSNormSoftmax attention: Attention layer, then the expert block.Softmax attentionNo explicit positional embedding in this attention layer. Causal masking still restricts which tokens it can read.NoPEAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: Attention layer, then the expert block.MoE10 of 72 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts. 1 shared experts run for every token.Add the branch output to the original stream. +10 of 72 experts + 1sharedLayer type · execution order aboveAfter all 40 layer executionsResidual streamLast columnCL4,096Final RMSNormReuses the embedding table, transposed.Tied output weights4,096100,352Vocabulary scoresSoftmax100,352Next-token probabilities
Inside grouped-query attention · Attention layers 6, 16, 26 and 36
4 query heads per group × 8 K/V groups.

Earlier context dimmed · current token bright · dashed regions contain cached entries.

Granite 4.0 H Small: Attention layers 6, 16, 26 and 36 · grouped-query attentionAttention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings. Keys and values for 8 heads of size 128 in the 4 attention layers only. The 36 Mamba-2 layers keep a fixed-size state (128 state values per channel), which does not grow with context length.8 KV groups; the front face shows one representative.8 KV groups4 heads / group; the front face shows one representative.4 heads / groupAttention input. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input4,096CLWq. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Wq4,096128Wk. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Wk4,096128Wv. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Wv4,096128K cache. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.K cache128CLV cache. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.V cache128CLQ context. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Earlier context is dimmed; outlined columns are current.Current token computation.Q context128CLScaled query–key scores, masking and softmax. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.NoPECLCL×. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.×Joined heads. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.32Wo. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Wo4,0964,096Attention output. Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output4,096CL
Model-specific details
Mamba-2 layers (all except 6, 16, 26 and 36) · 36 repetitions
Mamba-2 mixer, then the expert block.
Attention layers 6, 16, 26 and 36 · 4 repetitions
Attention layer, then the expert block.
Attention and positions
Attention in 4 of 40 layers (32 query heads, 8 key/value heads). The other 36 layers are Mamba-2 state-space layers, not softmax attention. No positional embeddings.
Memory
Keys and values for 8 heads of size 128 in the 4 attention layers only. The 36 Mamba-2 layers keep a fixed-size state (128 state values per channel), which does not grow with context length.

A mostly Mamba stack

Thirty-six Mamba-2 layers share the stack with attention at layers 6, 16, 26 and 36. No positional embeddings are applied.

Every layer selects ten of 72 experts of width 768, alongside a shared expert of width 1,536. There are no dense feed-forward layers. Embedding, residual, attention and logits multipliers remain explicit model constants.

IBM validates a 131,072-token context; training included samples up to 512K tokens.

How it scores

AA Intelligence Index

Version 4.3.2 · higher is better · checked 2026-11-01. Separate from Epoch ECI.

Checkpoint / sizeResultEvaluation
Granite 4.0 H Small6Estimated by AAAA Index 4.3.2Published checkpoint

Explore the components

Sources for this map