Visual explainer
Residual Connections
Let each neural block learn an additive residual correction F(x) added to identity skip x, preserving gradient flow across extreme depths without optimization degradation.
In traditional feedforward architectures, stacking additional layers causes the degradation problem: beyond a certain depth, training error actually increases rather than plateauing. For example, a 56-layer plain convolutional network plateaus at training error on CIFAR-10, whereas a shallower 20-layer network converges to . This is fundamentally an optimization failure rather than overfitting: theoretically, the deeper network could match the shallower model simply by learning identity mappings () across its extra 36 layers, yet unconstrained nonlinear transformations fail to discover identity functions.
Learn the Nudge
To bypass the identity paradox, He et al. reformulate the objective. Instead of requiring stacked layers to approximate the underlying mapping , the network explicitly learns a residual function:
The input travels unaltered across an identity shortcut wire, while the residual branch computes only the additive correction. If the identity mapping is optimal, standard weight decay naturally drives the parameter weights toward zero (), ensuring the block defaults safely to rather than degrading performance.
Numbers That Add
In the forward pass, scalar input combines with residual branch output at the summation node to produce . In the backward pass, applying the chain rule to the additive node yields the gradient highway:
With an incoming gradient and residual derivative , the downstream gradient splits into a direct through the skip highway and through the residual branch, totaling . Even if the residual Jacobian completely vanishes to zero, the additive identity term ensures an unobstructed gradient flows back to earlier layers.
Reshape the Skip
When convolutional stages downsample spatial dimensions (e.g., stride 2 reducing to ) while doubling feature channels (), raw identity addition fails due to dimensional incompatibility. To reconcile shapes, a projection shortcut introduces a linear convolution with stride 2 along the skip path:
The projection matrix matches spatial grid dimensions and channel depth without adding non-linearities, allowing seamless element-wise summation across hierarchical scale boundaries.
Signal Survives Depth
Over a sequence of 10 plain layers, backpropagation multiplies successive weight Jacobians (). If average layer amplification is , gradient magnitude attenuates exponentially (), completely freezing early layer learning. In a ResNet, the gradient across layers decomposes additively:
The direct highway term provides a 1,000,000x gradient survival advantage, allowing networks with 100 to 1,000+ layers to train reliably from random initialization.
Keep Skips Bare
In original ResNet-v1 (post-activation), the non-linear activation followed addition (). Because ReLU zeroes out negative activations, it truncates signals travelling along the identity highway. ResNet-v2 (pre-activation) fixes this by moving Batch Normalization and ReLU entirely inside the residual branch . Keeping the skip path a completely clean, bare identity wire guarantees unrestricted, bidirectional forward signal and backward gradient flow.
Where It Breaks
While residual shortcuts resolve optimization degradation, they introduce specific failure boundaries:
- Noise and Corruption Conduction: Because identity shortcuts are transparent conduits, mislabeled training inputs or adversarial perturbations travel directly to output layers without filtration. Skips facilitate information flow, but they cannot clean corrupted data.
- Variance Accumulation: Unbounded additive accumulation () causes feature variance to grow linearly with depth . Without normalization layers (BatchNorm or LayerNorm) or residual scaling factors (), activation magnitudes explode (), destabilizing deep architectures.
The Quick Version
- Degradation paradox: Deeper plain networks suffer worse training error because optimization fails to learn identity mappings.
- Residual mapping: Shifting the target to allows layers to default to identity via zero weights.
- Additive gradient highway: Addition distributes upstream gradients directly: , guaranteeing that survives.
- 1x1 projection shortcuts: Stride-2 convolutions match spatial resolutions and channel counts across downsampling stages.
- Signal preservation: Multiplicative plain layers decay to over 10 layers, while the residual highway preserves gradient magnitude.
- Clean skip design: Pre-activation (moving BN and ReLU inside ) ensures the skip wire remains an unobstructed identity channel.
- Failure boundaries: Skips pass corrupted labels straight to the output and require normalization to prevent cumulative activation variance explosion.