The Rabbit Hole / AI / Model architectures
Mistral AI · Architecture mapMinistral 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
Inside grouped-query attention · Full-attention layers (every fourth, starting at layer 1)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
Inside grouped-query attention · Sliding-window layers (the three after each full layer)
Earlier context dimmed · current token bright · dashed regions contain cached entries.
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
- Embeddings: giving every token a meaning
- Residual connections: when more layers made things worse
- A whole LLM, layer by layer
- RMSNorm: keeping a token's scale under control
- Grouped-query attention (GQA): sharing keys and values in groups
- Sliding-window attention (SWA): a cache that stops growing
- Transformer layers: attention is only half of what you need
- RoPE: position as a rotation
- Attention, from scratch
- The KV cache: why LLMs remember every key and value