protologue

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 AttentionGrouped-Query Attention
How the cache is reducedKeys and values are compressed into a shared latent vector per tokenGroups of query heads share one key head and one value head
Position informationA separate, decoupled rotary position embeddingStandard positional encoding, unchanged
Reported resultBetter performance than multi-head attention, and a 93.3% smaller KV cache for DeepSeek-V2 than DeepSeek 67BClose to multi-head quality at a speed comparable to multi-query attention
IntroducedDeepSeek-AI (2024), DeepSeek-V2Ainslie 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

  1. DeepSeek-AI (2024). DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model.
  2. 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/

Markdown