What are skip connections (residual connections)?
A skip connection is a shortcut that adds a layer block's input directly to its output, so the block computes F(x) + x instead of F(x). The layers then only have to learn the residual F(x), the difference between the desired output and the input. This simple addition is the core of residual networks (ResNets), introduced by He et al. in 2015.
Skip connections are what make very deep networks trainable. They let ResNets go past 100 layers in image classification, and they appear in U-Net for segmentation, in detection backbones, and in every Transformer block, where attention and the feed-forward layer each sit inside a residual connection. Without them, stacking more layers often makes training error worse instead of better.
Key ideas
- A skip connection computes F(x) + x, so the layers learn only the residual F(x).
- Plain networks get worse training error as they grow deeper, even with batch normalization.
- Because ∂(x + F(x))/∂x = 1 + ∂F/∂x, gradients always have a direct path back.
- A block whose F(x) is near zero acts as the identity, so extra blocks are cheap to add.
- Bottleneck blocks use 1x1 convolutions to cut parameters in deep ResNets.
- Residual connections are used in ResNets, U-Nets, and every Transformer block.
Common questions
What is the difference between a skip connection and a residual connection?
A skip connection is any path that carries a layer's input past one or more layers. A residual connection is the specific kind that adds the input to the output, as in ResNet. Skip connections can also concatenate, as in DenseNet and U-Net, or pass through a learned gate, as in highway networks.
Do skip connections reduce overfitting?
Not directly. They mainly fix an optimization problem: deeper plain networks fail to fit even the training data. Overfitting is still handled by data augmentation, weight decay, and other regularization. Deeper ResNets do generalize well in practice, but that comes from being trainable at all.
What is a highway network?
A highway network (Srivastava et al., 2015) is an earlier design where a learned gate T(x) mixes the layer output and the input: y = T(x) · H(x) + (1 − T(x)) · x. It made networks with about 100 layers trainable. ResNet removed the gate and always adds the input, which is simpler and worked better at large scale.
What does the number in ResNet-50 mean?
It counts the layers with learned weights along the main path: the first 7x7 convolution, the convolutions in all residual blocks, and the final fully connected layer. ResNet-50 has 16 bottleneck blocks of 3 convolutions each, so 1 + 48 + 1 = 50. Shortcuts, pooling, and batch normalization are not counted.
Related explainers
- Convolutional Neural Networks — How CNNs see and understand images
- Vanishing & Exploding Gradients — Why deep networks struggle and how to fix it
- Batch Normalization — Why normalizing activations speeds up deep network training
- Backpropagation — How networks learn from their mistakes
- The Transformer Architecture — A visual guide to 'Attention Is All You Need'
- Image Segmentation — Classify every pixel in an image — from semantic regions to individual object instances
References
- He, Zhang, Ren & Sun (2015), "Deep Residual Learning for Image Recognition", CVPR 2016
- He, Zhang, Ren & Sun (2016), "Identity Mappings in Deep Residual Networks", ECCV
- Veit, Wilber & Belongie (2016), "Residual Networks Behave Like Ensembles of Relatively Shallow Networks", NeurIPS
- Srivastava, Greff & Schmidhuber (2015), "Highway Networks"
Last updated