Multi-Head Latent Attention vs Grouped-Query Attention
Multi-head latent attention (MLA) and grouped-query attention (GQA) both shrink the key-value cache that a transformer keeps during generation, but in different ways. GQA lets groups of query heads share a single key head and value head, so fewer keys and values are stored, while MLA compresses each token's keys and values jointly into one low-dimensional latent vector and caches only that vector.
Definitions
- Multi-Head Latent Attention PTL-0271
- Multi-head latent attention (MLA) is an attention mechanism that compresses each token's keys and values into a low-dimensional latent vector and caches only that vector, greatly shrinking the key-value cache needed during generation.
- Grouped-Query Attention PTL-0255
- Grouped-query attention (GQA) is a transformer attention variant in which groups of query heads share a single key head and value head, using more key-value heads than multi-query attention but fewer than standard multi-head attention, to shrink the key-value cache and speed up decoding.
Differences
| Multi-Head Latent Attention | Grouped-Query Attention | |
|---|---|---|
| How the cache is reduced | Keys and values are compressed into a shared latent vector per token | Groups of query heads share one key head and one value head |
| Position information | A separate, decoupled rotary position embedding | Standard positional encoding, unchanged |
| Reported result | Better performance than multi-head attention, and a 93.3% smaller KV cache for DeepSeek-V2 than DeepSeek 67B | Close to multi-head quality at a speed comparable to multi-query attention |
| Introduced | DeepSeek-AI (2024), DeepSeek-V2 | Ainslie et al. (2023) |
Which to use
- MLA suits models designed from the start for a very small KV cache, at the cost of extra projections and a more complex position-encoding scheme.
- GQA is simpler, and an existing multi-head checkpoint can be converted to it with about 5% of the original pre-training compute.
Sources
- DeepSeek-AI (2024). DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model.
- Ainslie et al. (2023). GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints.
Cite this page
Protologue. (2026). Multi-Head Latent Attention vs Grouped-Query Attention. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.9.1). https://protologue.com/compare/multi-head-latent-attention-vs-grouped-query-attention/