A residual connection is a shortcut that carries an earlier representation past some processing and combines it with the later result. Think of keeping the original sketch while adding a new layer of detail: the later layer need not recreate everything from memory. section 11.26
In a Transformer feed-forward block, the shortcut carries the block’s input directly to its output. The processed result is added to that input, so both must have the same size. A project-down layer turns an 8D intermediate vector back into a 4D vector before the addition. This helps stabilize training and lets the model bypass feed-forward calculations that are not useful for a particular token. section 11.26
Following the Transformer shortcut
After projection, one 4D result is [1.6265, -1.3635, -0.2657, 1.9661]. Adding the bias [0.05, -0.1, 0.15, -0.02] gives [1.6765, -1.4635, -0.1157, 1.9461]. The residual step then adds the feed-forward block’s original 4D input to this 4D result, position by position. section 11.26
A U-Net uses a related shortcut for a different job. Downsampling captures what an image contains but loses precise information about where details belong. A skip connection carries an early, high-resolution feature map directly to the corresponding decoder layer. Here the maps are concatenated, not added: an 8×8×8 early tensor joined with a 16×8×8 upsampled tensor becomes a 24×8×8 tensor. The decoder can then use both spatial detail and deeper, abstract information when reconstructing an image. section 12.15 section 12.19
12.42 How skip-connection feature maps are combined with the upsampled feature maps
Follow the early feature maps across to the decoder and see where they join the upsampled maps. section 12.19











