Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

Mistral AI · Architecture map

Ministral 8B

Every fourth layer attends to the full context; the three between them use a sliding window.

Ministral 8B Instruct 2410, October 2024 · Mistral release timeline

Inside Ministral 8B

Parameters
8B
Layers
36
Width
4,096
Mixer
Grouped-query
Select a component to explore it. Layer colours match the execution-order strip.
The complete Ministral 8B architectureInput IDs select embeddings. Layer types execute in the order strip; dotted lines connect the type examples below. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention. Keys and values for 8 key/value heads of size 128 per token per layer. Sliding layers only need the most recent window. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup131,0724,096Input token vectorsCL4,096Execution order · 36 layersLayer 1: Full-attention layers (every fourth, starting at layer 1)Layer 2: Sliding-window layers (the three after each full layer)Layer 3: Sliding-window layers (the three after each full layer)Layer 4: Sliding-window layers (the three after each full layer)Layer 5: Full-attention layers (every fourth, starting at layer 1)Layer 6: Sliding-window layers (the three after each full layer)Layer 7: Sliding-window layers (the three after each full layer)Layer 8: Sliding-window layers (the three after each full layer)Layer 9: Full-attention layers (every fourth, starting at layer 1)Layer 10: Sliding-window layers (the three after each full layer)Layer 11: Sliding-window layers (the three after each full layer)Layer 12: Sliding-window layers (the three after each full layer)Layer 13: Full-attention layers (every fourth, starting at layer 1)Layer 14: Sliding-window layers (the three after each full layer)Layer 15: Sliding-window layers (the three after each full layer)Layer 16: Sliding-window layers (the three after each full layer)Layer 17: Full-attention layers (every fourth, starting at layer 1)Layer 18: Sliding-window layers (the three after each full layer)Layer 19: Sliding-window layers (the three after each full layer)Layer 20: Sliding-window layers (the three after each full layer)Layer 21: Full-attention layers (every fourth, starting at layer 1)Layer 22: Sliding-window layers (the three after each full layer)Layer 23: Sliding-window layers (the three after each full layer)Layer 24: Sliding-window layers (the three after each full layer)Layer 25: Full-attention layers (every fourth, starting at layer 1)Layer 26: Sliding-window layers (the three after each full layer)Layer 27: Sliding-window layers (the three after each full layer)Layer 28: Sliding-window layers (the three after each full layer)Layer 29: Full-attention layers (every fourth, starting at layer 1)Layer 30: Sliding-window layers (the three after each full layer)Layer 31: Sliding-window layers (the three after each full layer)Layer 32: Sliding-window layers (the three after each full layer)Layer 33: Full-attention layers (every fourth, starting at layer 1)Layer 34: Sliding-window layers (the three after each full layer)Layer 35: Sliding-window layers (the three after each full layer)Layer 36: Sliding-window layers (the three after each full layer)Full-attention layers (every fourth, starting at layer 1) · matches this colour in the execution-order barFull-attention layers (every fourth…Full-attention layers (every fourth, starting at layer 1) · 9 repetitions9 layers · one layer shown9RMSNorm before this operation.RMSNormGrouped-query attention: Dense SwiGLU network with intermediate size 12288. Attends to the whole prefix.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. Dense SwiGLU network with intermediate size 12288. Attends to the whole prefix.RoPEAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormSwiGLU: Dense SwiGLU network with intermediate size 12288. Attends to the whole prefix.SwiGLUAdd the branch output to the original stream. +Layer type · execution order aboveSliding-window layers (the three after each full layer) · matches this colour in the execution-order barSliding-window layers (the three af…Sliding-window layers (the three after each full layer) · 27 repetitions27 layers · one layer shown27RMSNorm before this operation.RMSNormSliding-window attention: Same dense network. Attends to the last 32,768 positions, per the config.Sliding-windowattentionRotate query and key position components before attention scores; values are unchanged. Same dense network. Attends to the last 32,768 positions, per the config.RoPESliding-window attention over 32,768 tokens.32,768Add the branch output to the original stream. +RMSNorm before this operation.RMSNormSwiGLU: Same dense network. Attends to the last 32,768 positions, per the config.SwiGLUAdd the branch output to the original stream. +Layer type · execution order aboveAfter all 36 layer executionsResidual streamLast columnCL4,096Final RMSNormA separate learned vocabulary projection.Output weights4,096131,072Vocabulary scoresSoftmax131,072Next-token probabilities
Inside grouped-query attention · Full-attention layers (every fourth, starting at layer 1)
4 query heads per group × 8 K/V groups.

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

Ministral 8B: Full-attention layers (every fourth, starting at layer 1) · grouped-query attention32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention. Keys and values for 8 key/value heads of size 128 per token per layer. Sliding layers only need the most recent window.8 KV groups; the front face shows one representative.8 KV groups4 heads / group; the front face shows one representative.4 heads / groupAttention input. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input4,096CLWq. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wq4,096128Wk. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wk4,096128Wv. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wv4,096128RoPE. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.RoPERoPE. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.RoPEK cache. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.K cache128CLV cache. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.V cache128CLQ context. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Q context128CLScaled query–key scores, masking and softmax. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.CLCL×. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.×Joined heads. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.32Wo. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wo4,0964,096Attention output. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output4,096CL
Inside grouped-query attention · Sliding-window layers (the three after each full layer)
4 query heads per group × 8 K/V groups.

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

Ministral 8B: Sliding-window layers (the three after each full layer) · grouped-query attention32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention. Keys and values for 8 key/value heads of size 128 per token per layer. Sliding layers only need the most recent window.8 KV groups; the front face shows one representative.8 KV groups4 heads / group; the front face shows one representative.4 heads / groupAttention input. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input4,096CLWq. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wq4,096128Wk. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wk4,096128Wv. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wv4,096128RoPE. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.RoPERoPE. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.RoPEK cache. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.K cache128≤ 32768V cache. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.V cache128≤ 32768Q context. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Q context128CLScaled query–key scores, masking and softmax. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Window 32,768CLCL×. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.×Joined heads. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.32Wo. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Wo4,0964,096Attention output. 32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output4,096CL
Model-specific details
Full-attention layers (every fourth, starting at layer 1) · 9 repetitions
Dense SwiGLU network with intermediate size 12288. Attends to the whole prefix.
Sliding-window layers (the three after each full layer) · 27 repetitions
Same dense network. Attends to the last 32,768 positions, per the config.
Attention and positions
32 query heads share 8 key/value heads, head size 128. The config marks layers 1, 5, 9 and so on as full attention and the rest as sliding window attention.
Memory
Keys and values for 8 key/value heads of size 128 per token per layer. Sliding layers only need the most recent window.

A ragged attention pattern

Thirty-six layers repeat one full-attention layer followed by three 32,768-token sliding-window layers. There are nine global and 27 local layers.

Mistral advertises a 131,072-token window for the 2410 Instruct checkpoint. Its released config and the cited vLLM setup use 32,768 positions; the local window stays at 32,768 in either case.

Explore the components

Sources for this map