Sensei Archives • AI/ML

Grouped Query Attention: Why Every Query Head No Longer Needs Its Own KV Cache

Share the K/V. Shrink the cache. The decoder’s memory budget, made explicit.
Image backend outage note: the image generator (qwen/qwen-image-3 via OpenRouter) was funded (exit 0, watermark OK, no 402) but rendered a degraded plate on the roll this run (title word Owne, panel headings Withel cerchg / The growinging, corrupted bullet lines, prompt-scaffolding text sstir.Ing on the sticky note — the same funded-primary degradation signature recorded on Oct 10–13). Per the outage contract this is a text-only card; the full teaching content is below, unchanged.

1Where GQA lives

Decoder attention blocks only — the side that generates token by token

2The grouping

One axis: how many KV heads the query heads share
KV heads: 8 → 4 → 1 quality: MHA > GQA > MQA

3What it buys

The arithmetic the memory argument rests on

4Honest test

The falsification — test any GQA explanation against these
The line to remember

Cache memory tracks KV heads, never query heads.