MQA, spell out the acronym and name exactly what gets shared across heads
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
MQA is Multi-Query Attention: queries stay multi-headed, but ALL heads share a single K and single V, shrinking KV cache by a factor of num_heads.
Imagine a panel discussion where each panelist asks their own questions (the queries) but they all share one big shared notebook of source material (the keys and values). Standard multi-head attention gives each panelist their own private notebook, which is great for diversity but expensive to print and carry. MQA keeps the diverse questioners and gives them one shared notebook, much cheaper to manage at the cost of slightly less specialized lookups.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3m: what MQA stands for and what stays multi-headed, projection shapes for W_Q vs W_K, W_V, the KV cache reduction factor, why quality drops, and how GQA recovers most of the quality at slightly more cache.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying MQA collapses queries too. Only K and V are shared; query heads remain independent. The shared-K-V part is what shrinks the cache; the multi-query part is what preserves query-side specialization.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.