Glossary · Attention

Multi-query attention (MQA)

Also: MQAsingle KV head

Read it at the depth you need: one sentence · a paragraph · the math · in the models here

1In one sentence

The extreme of grouped-query attention: every query head shares a single key/value head, for the smallest possible KV cache.

2In a paragraph

Multi-query attention keeps one key and one value head for the whole layer, shared by every query head. It cuts the KV cache by the full head count, which made decoding much faster on memory-bound hardware, but it costs some quality, so most models settled on GQA with 4 to 8 KV heads. It survives in small models, where the cache would otherwise rival the weights.

3The math, shapes and parameters

WK, WV: [h, d]    KV cache per token = 2 × L × h × bytes

It is GQA with K = 1.

4In the 96 models on this site

Models here with a single KV head: Gemma 3 270M (4 query heads, 18.4 KB per token) · Gemma 3 1B (4 query heads, 26.6 KB per token).

Introduced in Shazeer, “Fast Transformer Decoding: One Write-Head is All You Need” (2019).

Related

Grouped-query attention (GQA) · Multi-head attention (MHA) · KV cache · every term