179 questions
No questions match those filters.
What is grouped-query attention (GQA) and why do most p...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansIn standard multi-head attention, every query head has its own dedicated key and value heads. At inference time you cache the keys and values for every token generated so far so you don’t recompute them — and with a KV pair per head, that cache grows linearly with the number of heads, which becomes the dominant memory cost at long context lengths and large batch sizes, often before compute becomes the bottleneck.
Grouped-query attention shares one set of key/value heads across a group of several query heads, instead of giving every query head its own. That shrinks the KV cache by roughly the group size, with only a small quality cost compared to full multi-head attention — which is why it’s become close to the default choice for production-scale models, where serving cost and context length matter as much as raw quality.
Multi-query attention (a single shared KV head for all query heads) is the extreme version of the same idea — maximal cache savings, but a larger quality hit; GQA is the practical middle ground most teams land on.