The Residual Stream Receives Two Updates
A Transformer block preserves a model-width residual stream while attention and the position-wise MLP add separate updates. Trace both additions numerically and use branch ablations without confusing them with retraining.
The residual stream is the model-width representation passed from one block to the next. Attention and the MLP do not replace it. Each branch calculates an update with the same outer shape and adds that update to the stream.
For the pre-norm convention,
The stream follows . The branch values and are temporary updates, not three interchangeable names for the same representation.
Trace Two Positions
Let , , and . Suppose verified branches return
The first residual update is
If the MLP update is
then
Identity Path and Learned Update
The addition gives each stage a direct identity contribution. If one branch returns zero, that stage passes its input unchanged. This offers an easier function for a branch to approximate than rebuilding the entire representation from scratch.
Residual connections were developed and tested before Transformers. Their successful use in deep residual networks is relevant history and optimization evidence, not a proof that every residual architecture trains reliably under every initialization and optimizer.
Ablate One Branch at a Time
- Set to remove the current attention update while keeping the MLP input consistent with the changed .
- Set to remove the current MLP update while retaining attention.
- Multiply one branch by a scalar to inspect sensitivity.
- Do not compare a removed branch with a separately retrained model as if they were the same intervention.
Changing attention also changes the input later normalized for the MLP. The effect of the attention branch is therefore not limited to adding once.
Q1. Complete two residual updates
For one token record, , attention returns , and the MLP later returns . What is the second coordinate of ?
Compute it first, then check your number.
Hint
Solution
Reference
- Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun, Deep Residual Learning for Image Recognition, 2015.