LLM & Transformer Fundamentals·Question 37 of 109Intermediate

What is Multi-head Latent Attention, and how is it actually different from GQA?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

GQA shrinks the KV cache structurally: fewer KV heads, shared across groups of query heads. You are throwing away head diversity in K and V and hoping it does not matter much.

Full worked answer with diagram

GQA shrinks the KV cache structurally: fewer KV heads, shared across groups of query heads. You are throwing away head diversity in K and V and hoping it does not matter much.

MLA takes a different cut. Project the hidden state down to a small latent vector, cache only that latent, and reconstruct per-head K and V with learned up-projections at attention time. Conceptually every head keeps its own K and V; you just store a compressed representation. It came from DeepSeek-V2 and carried into V3.

Why it is not just "GQA with extra steps": the up-projection matrices are static, so they can be algebraically absorbed into the query and output projections. At inference you never materialise full per-head K, you compute scores against the latent directly. That makes it a genuine memory win rather than trading memory for recompute. DeepSeek reported roughly a 93% KV cache reduction versus their MHA model at V2, with quality matching or beating GQA in their ablations, which is the unusual part: normally cache compression costs you something.

The complication is RoPE, and this is the detail that separates people who have read the paper from people who have read a summary. RoPE applies a position-dependent rotation, and you cannot absorb a position-dependent rotation into a static up-projection, so the absorption trick breaks. DeepSeek's answer is decoupled RoPE: split the head dimension into a compressed no-RoPE part and a small separate RoPE-carrying part that is cached uncompressed and shared across heads.

When would I pick it? Only when KV memory at long context is genuinely my binding constraint and I control the serving stack. MLA is materially harder to implement and to shard under tensor parallelism, kernel support (improved since dedicated MLA kernels and mainstream serving engines added it) is still narrower than for GQA, and the reported quality advantage shows up mainly at large scale. Below roughly 100B most teams still choose GQA, and that is a defensible engineering call: GQA is simple, supported everywhere, and good enough. Complexity you cannot serve is negative value.

Worth sketching. The separate RoPE-carrying path is the detail that shows you read the paper rather than a summary of it.

flowchart LR
    H["hidden state"] --> C["down-project to a small latent"]
    C --> CACHE["cache the latent only"]
    CACHE --> UP["up-projections rebuild per-head K and V"]
    UP --> ABS["static, so absorb them into W_q and W_o:<br/>score against the latent directly"]
    H --> RP["small RoPE-carrying slice, cached<br/>uncompressed and shared across heads"]
    ABS --> SC["attention scores"]
    RP --> SC

What a good answer covers

  • GQA shrinks the KV cache structurally: fewer KV heads, shared across groups of query heads
  • You are throwing away head diversity in K and V and hoping it does not matter much
  • Project the hidden state down to a small latent vector, cache only that latent, and reconstruct per-head…
  • Conceptually every head keeps its own K and V; you just store a compressed representation
  • It came from DeepSeek-V2 and carried into V3

Interviewer follow-ups to expect

  1. How does MLA interact with tensor parallelism compared to GQA?

  2. Would you expect MLA or KV cache quantization to be the better first move on an existing GQA model?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep