Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

AI21 Labs · Architecture map

Jamba v0.1

One attention layer for every eight, the rest Mamba, with a mixture-of-experts feed-forward in every other layer.

Jamba v0.1, March 2024 · Jamba release timeline

Inside Jamba v0.1

Parameters
52B · 12B active
Layers
32
Width
4,096
Mixer
Hybrid
Select a component to explore it. Layer colours match the execution-order strip.
The complete Jamba v0.1 architectureInput IDs select embeddings. Layer types execute in the order strip; dotted lines connect the type examples below. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings. Keys and values for 8 heads of size 128 in the 4 attention layers only. The 28 Mamba layers keep a fixed-size state (state size 16). Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup65,5364,096Input token vectorsCL4,096Execution order · 32 layersLayer 1: Mamba layers with a dense feed-forwardLayer 2: Mamba layers with expertsLayer 3: Mamba layers with a dense feed-forwardLayer 4: Mamba layers with expertsLayer 5: Attention layers with a dense feed-forwardLayer 6: Mamba layers with expertsLayer 7: Mamba layers with a dense feed-forwardLayer 8: Mamba layers with expertsLayer 9: Mamba layers with a dense feed-forwardLayer 10: Mamba layers with expertsLayer 11: Mamba layers with a dense feed-forwardLayer 12: Mamba layers with expertsLayer 13: Attention layers with a dense feed-forwardLayer 14: Mamba layers with expertsLayer 15: Mamba layers with a dense feed-forwardLayer 16: Mamba layers with expertsLayer 17: Mamba layers with a dense feed-forwardLayer 18: Mamba layers with expertsLayer 19: Mamba layers with a dense feed-forwardLayer 20: Mamba layers with expertsLayer 21: Attention layers with a dense feed-forwardLayer 22: Mamba layers with expertsLayer 23: Mamba layers with a dense feed-forwardLayer 24: Mamba layers with expertsLayer 25: Mamba layers with a dense feed-forwardLayer 26: Mamba layers with expertsLayer 27: Mamba layers with a dense feed-forwardLayer 28: Mamba layers with expertsLayer 29: Attention layers with a dense feed-forwardLayer 30: Mamba layers with expertsLayer 31: Mamba layers with a dense feed-forwardLayer 32: Mamba layers with expertsMamba layers with a dense feed-forward · matches this colour in the execution-order barMamba layers with a dense feed-forw…Mamba layers with a dense feed-forward · 12 repetitions12 layers · one layer shown12RMSNorm before this operation.RMSNormMamba state-space: Even-numbered layers (counting from 0) that are not attention. Mamba mixer, then a dense network (hidden size 14336).Mamba state-spaceAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormDense feed-forward: Even-numbered layers (counting from 0) that are not attention. Mamba mixer, then a dense network (hidden size 14336).Densefeed-forwardAdd the branch output to the original stream. +Layer type · execution order aboveMamba layers with experts · matches this colour in the execution-order barMamba layers with expertsMamba layers with experts · 16 repetitions16 layers · one layer shown16RMSNorm before this operation.RMSNormMamba state-space: Odd-numbered layers (counting from 0). Mamba mixer, then 16 experts with 2 chosen per token (hidden size 14336).Mamba state-spaceAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: Odd-numbered layers (counting from 0). Mamba mixer, then 16 experts with 2 chosen per token (hidden size 14336).MoE2 of 16 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. +2 of 16 expertsLayer type · execution order aboveAttention layers with a dense feed-forward · matches this colour in the execution-order barAttention layers with a dense feed-…Attention layers with a dense feed-forward · 4 repetitions4 layers · one layer shown4RMSNorm before this operation.RMSNormSoftmax attention: Layers 4, 12, 20 and 28 (counting from 0), one in every 8. Attention, then a dense network.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.RMSNormDense feed-forward: Layers 4, 12, 20 and 28 (counting from 0), one in every 8. Attention, then a dense network.Densefeed-forwardAdd the branch output to the original stream. +Layer type · execution order aboveAfter all 32 layer executionsResidual streamLast columnCL4,096Final RMSNormA separate learned vocabulary projection.Output weights4,09665,536Vocabulary scoresSoftmax65,536Next-token probabilities
Inside grouped-query attention · Attention layers with a dense feed-forward
4 query heads per group × 8 K/V groups.

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

Jamba v0.1: Attention layers with a dense feed-forward · grouped-query attentionAttention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings. Keys and values for 8 heads of size 128 in the 4 attention layers only. The 28 Mamba layers keep a fixed-size state (state size 16).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 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input4,096CLWq. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Wq4,096128Wk. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Wk4,096128Wv. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Wv4,096128K cache. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.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 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.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 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Earlier context is dimmed; outlined columns are current.Current token computation.Q context128CLScaled query–key scores, masking and softmax. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.NoPECLCL×. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.×Joined heads. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.32Wo. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Wo4,0964,096Attention output. Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output4,096CL
Model-specific details
Mamba layers with a dense feed-forward · 12 repetitions
Even-numbered layers (counting from 0) that are not attention. Mamba mixer, then a dense network (hidden size 14336).
Mamba layers with experts · 16 repetitions
Odd-numbered layers (counting from 0). Mamba mixer, then 16 experts with 2 chosen per token (hidden size 14336).
Attention layers with a dense feed-forward · 4 repetitions
Layers 4, 12, 20 and 28 (counting from 0), one in every 8. Attention, then a dense network.
Attention and positions
Attention in 4 of 32 layers (32 query heads, 8 key/value heads). The other 28 layers are Mamba state-space layers. The config has no rotary or position settings.
Memory
Keys and values for 8 heads of size 128 in the 4 attention layers only. The 28 Mamba layers keep a fixed-size state (state size 16).

Two overlapping layer patterns

Attention appears at layers 5, 13, 21 and 29; the other 28 layers use Mamba. Expert networks occupy every second layer, selecting two of 16 experts, while the remaining layers use dense networks.

The Mamba blocks use state size 16, expansion factor two and convolution width four. No explicit positional embeddings are applied.

This is the March 2024 v0.1 base checkpoint, with a supported context of 262,144 tokens.

Explore the components

Sources for this map