Describe the W_O projection in multi-head attention, its shape and what it mixes.
W_O is the (d_model, d_model) output projection after head concat. Its job is to mix signals across heads before the residual add.
Picture eight reporters who each cover a different beat at a city paper, sports, weather, politics, food. Each writes one column independently. Without an editor, the front page would just be eight separate columns sitting side by side, with no story that crosses beats. W_O is the editor who reads all eight columns and weaves them into one front page, where the sports story can pull in a quote from the politics column and the food story can reference the weather. The shape of the front page is the same with or without the editor, but the story is much richer when the editor gets to mix the contributions.
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.
Walk the head-output concat, explain the slice structure, motivate why a dense d_model x d_model matrix is needed to mix across slices, decompose W_O into per-head write blocks, and close with the head-importance reading.
Real products, models, and research that use this idea.
- Every production decoder-only transformer (Llama 4 Maverick, GPT-5.5, Claude Opus 4.7, Gemini 3.1 Pro, Qwen 3.5) keeps W_O at full d_model x d_model rank.
- Anthropic's transformer-circuits framework decomposes W_O into per-head write matrices for mechanistic-interpretability analysis.
- Voita et al. 2019 used W_O column norms as the head-importance signal for head pruning.
- TransformerLens and similar tools expose the per-head W_O decomposition as a first-class object.
What an interviewer would ask next. Try answering before peeking at the approach.
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.
Calling W_O a 'shape-preservation' bookkeeping step and missing that it is the only place where heads can mix with each other before the residual add.
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.