Residual connection
A residual connection, a kind of skip connection, adds a block's input directly to its output, so each block only has to learn a correction; it is what lets very deep networks, including every transformer, train reliably.
A residual connection is a shortcut. Instead of a block of layers turning its input x into an entirely new output, the block computes some change F(x) and the network adds it back to the original: the output is x plus F(x). If the block has nothing useful to contribute, it can learn to output close to zero and the input passes through unchanged.
The idea was made famous by Kaiming He, Xiangyu Zhang, Shaoqing Ren and Jian Sun in December 2015, in Deep Residual Learning for Image Recognition. Very deep networks had proved hard to train, so they reformulated layers to learn residual functions relative to their inputs. Their ResNets reached 152 layers, about eight times deeper than the VGG networks of the time, yet were less complex. An ensemble of them achieved 3.57% error on the ImageNet test set and won the ILSVRC 2015 image classification contest.
The 2017 transformer put a residual connection around every sub-layer, both attention and the feed-forward network, followed by layer normalization. To make the addition possible, every sub-layer and the embeddings produce outputs of the same width, 512 numbers per token in the original model. Large language models since have kept this pattern: each block reads from a running total and adds its contribution back to it.
The shortcut matters most during training. When the network learns by backpropagation, the error signal can travel straight back through the additions instead of being repeatedly shrunk or distorted by each layer, which eases the long-standing difficulty of training very deep stacks. Where normalization sits relative to the shortcut also matters: a 2020 study found that normalising inside the residual branch, rather than after the addition, gave better-behaved gradients at the start of training.
Residual connections rarely feature in news on their own, but they are one of the reasons models could grow from a handful of layers to many dozens.
It is a shortcut that adds a block's input to its output, so the block only has to learn the difference it wants to make. If the block is not useful, the input simply passes through. Residual connections are used throughout modern image networks and every transformer. During training, the error signal has to travel back through every layer. The additions in residual connections give it a direct path, so it does not fade or distort as it passes through many layers. That made networks with over a hundred layers practical, as ResNet showed in 2015. Not exactly. Skip connection is the broader term for any path that lets a signal bypass layers, including the U-Net's, which joins features side by side rather than adding them. A residual connection is the kind that adds the input to the output, as in ResNets and transformers.Common questions
What is a residual connection in a neural network?
Why do residual connections help train deep networks?
Is a skip connection the same as a residual connection?
Search for "residual connection explained", "ResNet deep residual learning" or "transformer residual stream" for explanations at different levels. The ResNet and transformer papers on arXiv are the primary sources, and deep learning textbooks and university course notes cover why the shortcut helps training. Interpretability research uses residual-stream ideas heavily, so its explainers are useful for seeing how information flows through a model.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.