Tying K and V to one projection, what is gained and what is risked?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Tying K and V halves attention parameters and KV-cache memory, but forces lookup address and content payload to be the same vector, which measurably hurts quality.
Imagine a library where each book's title doubles as its entire contents. To find any book you search by title, which is fine, but every time you find one, the only thing inside is its own title repeated. The library saves a lot of shelf space, but the books are useless because the lookup label and the actual material people want to read are forced to be identical. Real libraries (and real transformers) keep titles separate from book contents so each can be optimized for its own job, finding things versus delivering useful material.
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.
5m: parameter and memory accounting for tied K = V, why K and V have different gradient signals, structural cost vs head-level sharing, comparison table MHA vs tied vs MQA vs GQA vs MLA, and why no frontier model uses tied K = V.
| Technique | What's shared | KV-cache savings | Quality cost |
|---|---|---|---|
| Standard MHA | Nothing | Baseline | Baseline |
| Tied K = V | K and V are the same tensor per head | 2x | 1 to 3% perplexity loss |
| MQA | One KV head for all query heads | n_heads-x | Measurable but small |
| GQA | KV heads grouped across query heads (typically 8 groups) | 4x to 8x | Negligible at scale |
| MLA | K and V compressed into shared latent space | 10x or more | Negligible after kernel tuning |
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.
Confusing tied K = V with GQA or MQA. MQA and GQA share K and V across heads while keeping K and V as distinct tensors; tying K = V makes them literally the same vector, a much more aggressive cut.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.