Concatenate Heads and Project Once
After attention, head results are returned to position-major order, concatenated along the feature axis, and mixed by one output projection. Calculate this reconstruction and show why head order and W_O row-block order must agree.
After each head has produced
the results are concatenated along their feature axes:
The output projection then returns to model width:
Concatenation preserves each head result as a separate block of features. It is not an average over heads. decides how those blocks are mixed into the model-width output.
Continue the Two-Head Trace
The final query produced
Head-order concatenation gives
With identity , the layer returns that vector unchanged. To make the mixing visible, use
Then
The first output coordinate combines head 1's first feature with half of head 2's first feature. The fourth combines half of head 1's second feature with head 2's second feature. Attention weights remain head-specific, while the output projection can mix the features they produced.
Head Order Is a Coordinate Convention
Suppose we swap the order of head blocks in . If we also swap the matching row blocks of , remains unchanged. In matrix form, if permutes the concatenated head features,
then
This symmetry means that “head 1” and “head 2” have no fixed meaning across independently trained models. A head index becomes meaningful only inside a specific parameterization and checkpoint.
Zeroing a Head Occurs Before the Projection
To ablate head 2, replace its result with zero before concatenation:
The same then produces a different . The difference measures the direct effect of removing that head's current contribution through the fixed output projection. In a complete network, later layers and residual paths may change the final effect, and retraining may let other components compensate.
Q1. Join two head readings
Two width-2 heads return and . They are concatenated in that order, and . What is the third coordinate of the layer output?
Compute it first, then check your number.
Hint
Solution
Treat Concatenation Order and Projection Rows as One Contract
An implementation can produce correct head outputs and still fail by joining them in one order while using trained for another. Audit the ordered head blocks immediately before the output projection, not only the final width.