protologue

Grouped-Query Attention

Also called GQA, multi-query attention, MQA.

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.

Description

Multi-query attention, which uses one key-value head for all query heads, decodes much faster than multi-head attention but can lose quality. Ainslie et al. proposed GQA in 2023 as an intermediate setting and showed how to convert ("uptrain") an existing multi-head checkpoint to it using about 5% of the original pre-training compute. They reported that uptrained GQA came close to multi-head quality at a speed comparable to multi-query attention. Because the KV cache grows with the number of key-value heads, the savings matter most for long contexts and large batches.

Sources

  1. Ainslie et al. (2023). GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints.

Cite this entry

Protologue. (2026). Grouped-Query Attention. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.9.1, PTL-0255). https://protologue.com/t/grouped-query-attention/

BibTeX
@misc{protologue_grouped_query_attention,
  title = {Grouped-Query Attention},
  author = {{Protologue}},
  year = {2026},
  howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.9.1},
  note = {Entry PTL-0255},
  url = {https://protologue.com/t/grouped-query-attention/}
}

Markdown JSON