Zenaique

MQA, spell out the acronym and name exactly what gets shared across heads

Flashcard·Easy·4.0 · 0·~30s·Asked atArize AiCursorWorkday·Relevant atMicrosoft
Attempt it
TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Multi-Query Attention (MQA) is one of the original answers to the KV cache problem in autoregressive transformer inference. Knowing what the acronym means, exactly what stays per-head and what is shared, and why the field has largely moved past it to GQA and MLA, is the difference between a surface-level vocabulary recall and a working mental model of cache-aware attention design.

MQA expands to Multi-Query Attention. The naming convention is consistent across the family: M-H-A is Multi-Head Attention, M-Q-A is Multi-Query Attention, G-Q-A is Grouped-Query Attention. In each case, the letter modified by 'Multi' tells you what stays plural, and the rest is shared or grouped.

Under MQA, queries stay multi-headed (one Q per head, h heads per layer) but keys and values collapse to a single shared slice per layer. The KV cache shrinks by a factor of h, but at a measurable quality cost. This deep dive walks the projection shapes, the cache math, the quality tradeoff, and the GQA generalization that has replaced MQA in most 2026 production decoders.

The naming convention, decoded

The MHA, MQA, GQA family of acronyms follows one consistent rule: the letter after 'Multi' or 'Grouped' tells you what stays multi-headed or grouped, and the rest is shared.

MHA: Multi-Head Attention

Everything is multi-headed: h queries, h keys, h values per layer. The original Vaswani 2017 design.

MQA: Multi-Query Attention

Only queries stay multi-headed. K and V collapse to a single shared head per layer. Cache shrinks by a factor of h.

GQA: Grouped-Query Attention

Queries are still multi-headed, but they are split into G groups, each group sharing one K and one V. G=1 recovers MQA; G=h recovers MHA.

MLA: Multi-head Latent Attention

A different family. K and V are compressed into a shared low rank latent that is decompressed per attention step. Conceptually 'multi-head' but with a different K, V representation entirely.

Knowing the convention lets you parse the acronym in one pass: 'Q' in MQA tells you queries are what stays plural; K and V are the things shared.

Projection shapes and the cache math
The quality cost
From MQA to GQA: why the field moved on
Where MQA still appears
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Google's PaLM used MQA throughout, exploiting TPU memory bandwidth to make the cache shrink the dominant inference win.
  • Falcon-40B and Falcon-180B used MQA in their initial release, before the field largely moved to GQA.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QWhy does Ainslie et al.'s GQA paper describe MQA as too aggressive?
A

Their empirical result is that group-size-1 (MQA) shows a consistent perplexity hit, while small group counts (G=8) recover most of the quality at almost the same cache size. MQA over-collapses the K, V diversity.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • What MQA stands for

  • What stays per-head (queries) and what is shared (K and V)

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Explain scaled dot product attention.
Short answer·Medium