Mistral Architecture › Grouped Query Attention
Language AI HandbookAll chapters Mistral Architecture › Grouped Query AttentionOne section · Sections in this chapter5 / 14 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Mistral employs grouped query attention (GQA), which reduces the number of key-value heads relative to query heads. Instead of the standard multi-head attention where each query head has its own key-value pair, GQA groups multiple query heads to share the same key-value heads.
GQA is a memory-bandwidth optimization where query heads share key-value heads, with being a multiple of . In this notation:
- : number of query heads (32 for Mistral)
- : number of key-value heads (8 for Mistral)
- : the grouping ratio (4 for Mistral, meaning 4 query heads share each KV head)
This reduces KV cache size by a factor of while maintaining most of the representational capacity of full multi-head attention.
For Mistral 7B:
- Query heads: 32
- KV heads: 8
- Ratio: 4 query heads share each KV head
This means the KV cache is 4x smaller than it would be with standard multi-head attention, directly improving inference throughput by reducing memory bandwidth requirements.

The combination of GQA and the rolling buffer creates substantial memory savings. With 8 KV heads instead of 32, and a fixed window size instead of growing with sequence length, Mistral's inference memory footprint remains manageable even for long-context applications.