Tying K and V to one projection, what is gained and what is risked?
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.
Detailed answer & concept explanation~6 min readEverything 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. 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.
- Most production transformers (GPT-style decoders, BERT-style encoders, T5 encoder-decoder) keep K and V as distinct projections; tied K = V is rare in published work.
- Some early on-device transformer designs (MobileBERT variants, some tiny LLMs in 2022-2023) used tied K = V to fit aggressive memory budgets, accepting quality loss.
- Llama 4 Maverick, Claude Opus 4.7, Gemini 3.1 Pro all use GQA, keeping K and V distinct but sharing KV heads across query heads.
- DeepSeek V4 uses Multi-head Latent Attention (MLA), compressing K and V into a low-rank latent space, an alternative to tying them entirely.
- Mistral Large 3 uses sliding-window attention combined with GQA; nowhere in the design is K tied to V.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does GQA work well but tied K = V doesn't, given both are forms of weight sharing in attention?
QCould you partially tie K and V, e.g., share a few dimensions while keeping others separate?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
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.
Same topic, related formats. Practice these next.