Skip to content
AI.info

Neural networks

Residual Connections and Stable Depth

Understand residual blocks, shape alignment, gradient pathways, pre-activation variants, and why shortcuts ease optimization without guaranteeing better models.

By the end you can

Learn the change, preserve the reference

A basic residual block computes y=x+F(x). The branch F learns an update, while the shortcut carries the reference representation forward.

If the best local transformation is close to identity, the block can keep F small instead of reconstructing x through several nonlinear layers.

The problem this solves was measured before it was solved. A plain 56-layer network on CIFAR-10 reaches a higher training error than a plain 20-layer one: “the deeper network has higher training error, and thus test error”. That is degradation, not overfitting. The quantity that rises is the training error, and no amount of extra fitting capacity explains a worse fit. Kaiming He and three colleagues reported that in 2016, then rewrote the same stacks with shortcuts, at “exactly the same depth, width, and number of parameters as the plain counterparts”. The ordering reversed. Their 110-layer residual network reaches 6.43% test error on CIFAR-10. Their single 152-layer model reaches 4.49% top-5 validation error on ImageNet.

The headline result does not have to be taken from the paper that claims it. The challenge organisers kept their own scoreboard. On the official ILSVRC2015 results page, MSRA's “Ensemble A for classification and localization” sits first among entries using provided training data, with a classification error of 0.03567 and a localization error of 0.090178. MSRA's Ensemble B (0.03567/0.090801) and Ensemble C (0.0369/0.092108) follow. The best non-MSRA entry listed, Trimps-Soushen, records 0.04649. Results were released on 10 December 2015. So when the paper says “This entry won the 1st place in ILSVRC 2015.”, the 3.57% top-5 figure it reports is the 0.03567 sitting on the scoreboard beside it. The claim and the check are two different documents.

Residual learning makes “do little” an accessible option for each block.

Visual

Two routes through one block

The merge requires compatible shapes and clear semantics.

Only one of the two routes is free. The branch can be given whatever internal structure the designer wants, because whatever it computes is called an update. The shortcut cannot: it either delivers the input unchanged, or it has stopped being an identity and the block should say so.

FigureProcess · 5 steps
  1. 1

    Input x

    A representation enters both the shortcut and residual branch.

  2. 2

    Residual branch F(x)

    Several transformations compute a learned update.

  3. 3

    Shortcut path

    Identity or projection carries a reference signal.

  4. 4

    Addition

    Elementwise merge requires matching shape.

  5. 5

    Block output

    The next stage receives x+F(x), possibly followed by activation.

Comparison

Why shortcuts change optimization

Residual connections do more than add another feature tensor.

Shortcuts change the shape of the loss surface, and the change can be drawn. Hao Li and four colleagues plotted the surface around a trained minimum in 2018. Their filter-normalization scheme is what makes two networks comparable. In those plots, “as network depth increases, the loss surface of the VGG-like nets spontaneously transitions from (nearly) convex to chaotic”. The same architectures with shortcuts kept a smooth surface, at the same depth. Their stated observation: “skip connections promote flat minimizers and prevent the transition to chaotic behavior, which helps explain why skip connections are necessary for training extremely deep networks.” Depth alone made the landscape unusable. The shortcut kept it flat.

The same difference has been measured outside vision, and there it turns on where the normalization sits relative to the merge. Wang and colleagues reported in 2019 that “we successfully trained a pre-norm Transformer system with a 20-layer encoder on the WMT English-German task, whereas the post-norm Transformer system failed to train for a deeper encoder”. The 20-layer pre-norm encoder came in 1.8 BLEU above the 6-layer baseline. Their table records the 16-layer post-norm Transformer simply as “failed”. Xiong and colleagues supplied the mechanism in 2020. Their mean-field analysis shows that at initialization Post-LN has large expected gradients near the output layer, which is why the learning-rate warm-up stage is needed; Pre-LN gradients are well-behaved and warm-up can be dropped. The shortcut is not what changed between those two systems. Only what sits inside the branch did.

FigureComparison · 2 columns

Plain deep stack

Every block must transform and transmit the full representation.

  • Long uninterrupted derivative paths
  • Identity may be hard to learn
  • Degradation can appear with depth
  • No explicit bypass

Residual stack

Shortcut paths preserve reference signals alongside learned changes.

  • Direct additive gradient routes
  • Blocks can start near identity
  • Easier optimization of greater depth
  • Supports modular refinement

Key idea

Identity shortcuts work only when shapes agree

Elementwise addition requires matching batch, spatial, sequence and feature dimensions. When a block changes width or resolution, the shortcut needs a projection or compatible resampling. A projection is itself a learned transformation, and it changes the “identity” interpretation.

That choice has a price, and the ResNet authors measured it. Table 3 of their 2016 paper compares three shortcut policies on ResNet-34 under 10-crop ImageNet testing: (A) zero-padding shortcuts, 25.03% top-1 and 7.76% top-5; (B) projections only where dimensions increase, 24.52% and 7.46%; (C) all shortcuts projections, 24.19% and 7.40%. C is the best of the three. They did not keep it. The rest of the paper uses B, to save memory and parameters. Their own reading of the spread: “But the small differences among A/B/C indicate that projection shortcuts are not essential for addressing the degradation problem.” The projection is a shape fix, not the source of the gain.

The block where the shortcut cannot be an identity is nonetheless where the remaining accuracy sits, and it is still being tuned a decade later. NVIDIA's own ResNet v1.5 model documentation records the change: “In the bottleneck blocks which requires downsampling, v1 has stride = 2 in the first 1x1 convolution, whereas v1.5 has stride = 2 in the 3x3 convolution.” Moving the stride buys about 0.5% top-1 at about 5% fewer images per second. Bag of Tricks for Image Classification measures the same tweak in 2019 as ResNet-B, 76.21% → 76.66% top-1, and its average-pooling shortcut, ResNet-D, reaches 77.16%. Document where and why projections occur — and which variant you actually built.

A shortcut is mathematically simple only when its shape contract is explicit.

Example

Residual design choices that alter behavior

Several details determine whether a residual stack trains cleanly. Each of the five below has a published number attached. The numbers are the reason to care about the detail.

  • Post-activation blocks apply normalization and activation around the branch and merge in one order. It is the order whose deep variant Wang and colleagues recorded as untrainable at a 16-layer encoder.
  • Pre-activation blocks move normalization and activation before the weight layers. The point, as He and three colleagues put it in 2016, is that “the forward and backward signals can be directly propagated from one block to any other block, when using identity mappings as the skip connections and after-addition activation”. Their 1001-layer pre-activation ResNet reaches 4.62% CIFAR-10 error, against 6.43% for the original 110-layer network. A second group checked the figure: the DenseNet comparison table lists the same architecture at 4.62% on C10+ and 22.71% on C100+, with pre-activation ResNet-164 at 5.46%.
  • Residual scaling multiplies F(x) by a small factor when very deep or very wide stacks become unstable. Christian Szegedy and three colleagues hit that wall and wrote it down: “We found that if the number of filters exceeded 1000, the residual variants started to exhibit instabilities and the network just “died” early in the training, meaning that the last layer before the average pooling started to produce only zeros after a few tens of thousands of iterations.” Neither a lower learning rate nor an extra batch-normalisation layer prevented it. Scaling the branch down by a factor between 0.1 and 0.3 before the addition did. Lim and colleagues hit the same instability widening EDSR to 256 feature maps, and reached for the same fix: “We resolve this issue by adopting the residual scaling [24] with factor 0.1.”
  • Zero-initialized final branch scales make a block begin close to identity, and two teams measured the payoff. Goyal and eight colleagues initialised the last batch-norm scale γ of every residual block to 0, taking ResNet-50 top-1 error from 23.84%±0.18 to 23.60%±0.12 at batch 256, and from 24.11%±0.07 to 23.74%±0.09 at batch 8k. Tong He and colleagues at Amazon list the same heuristic in their 2019 ablation at 76.03% → 76.19% top-1 accuracy for batch 256, and 75.93% → 76.37% for batch 1024.
  • Stochastic depth randomly drops residual branches during training and bypasses them with the identity. Gao Huang and four colleagues state the result in their abstract: “With stochastic depth we can increase the depth of residual networks even beyond 1200 layers and still yield meaningful improvements in test error (4.91% on CIFAR-10).” Zagoruyko and Komodakis, working independently in 2016, list the method in their own Table 5 at 5.23% for 110 layers and 4.91% for 1202 layers, against 6.43% and 7.93% for the same-depth original ResNets.

Residual connections do not make arbitrary depth free

More blocks still increase compute, memory, latency, and opportunities for overfitting, and a residual network can learn redundant or harmful updates.

Depth stops paying, and the authors of ResNet found the point and published it. Their 1202-layer CIFAR-10 network trained without optimization difficulty, down to under 0.1% training error. The shortcuts did exactly what they were built to do. It then scored 7.93% test error against 6.43% for the 110-layer network, on 19.4M parameters against 1.7M. Their verdict names the cause, and it is not optimization: “The testing result of this 1202-layer network is worse than that of our 110-layer network, although both have similar training error. We argue that this is because of overfitting.” Zagoruyko and Komodakis reproduce both rows in their own Table 5 — the original ResNet at 110 layers scoring 6.43 on CIFAR-10 and 25.16 on CIFAR-100, at 1202 layers 7.93 and 27.82. They conclude that very high depth in residual networks shows no regularization effect once parameter count is held fixed against wider networks.

Shortcuts ease optimization under many conditions. They do not prove that the added depth improves the target task. Matched ablations remain necessary. The 1202-layer result is what it looks like when you skip one: a network that trains beautifully and generalizes worse than a much shallower one.

Case

Deleting one layer from a VGG network dropped it to chance

The shortcuts do not simply add depth; they change what depth means.

Delete a single layer from a trained 15-layer VGG network and it falls to chance. Veit and two colleagues reported exactly that in 2016: “deleting any layer in VGG reduces performance to chance levels”. Do the same to a trained 110-layer residual network and almost nothing happens — “removing downsampling blocks does have a modest impact on performance … but no other block removal lead to a noticeable change”. They also traced where the training signal comes from: “most of the gradient in a residual network with 110 layers comes from paths that are only 10-34 layers deep”. A residual stack of n blocks is a collection of paths of many lengths. In the sense that matters for training, it is not n layers deep.

Figure

The number in the architecture’s name is not the depth that trains it — a residual stack is a collection of paths of many lengths. Veit, Wilber and Belongie, NIPS 2016; the shares of nominal depth are derived from the stated path lengths.

Analogy

Editing a document with tracked changes

A document can be revised so that the original text is preserved and only additions or corrections are recorded. A reviewer can see the base plus the proposed change.

Tracked document edits remain human-readable; residual updates usually do not. Later blocks also transform the merged representation rather than preserving an untouched original forever.

Residual blocks refine a representation instead of rebuilding it from scratch.

Steps

Residual block checks

Test a block independently before stacking dozens of copies.

The near-identity check in step 2 is not a thought experiment. It is a documented initialization. Goyal and eight colleagues describe it plainly: “Setting γ = 0 in the last BN of each residual block causes the forward/backward signal initially to propagate through the identity shortcut of ResNets, which we found to ease optimization at the start of training.” Tong He and colleagues at Amazon describe the same effect as making all residual blocks just return their inputs at the start of training. So drive your block into that state on demand and watch the shortcut alone come out the other side. If you cannot, step 2 has just told you the identity route is not clean.

FigureProcess · 5 steps
  1. 1. Verify shapes

    Confirm branch and shortcut match at the merge.

  2. 2. Test near-identity behavior

    Set branch output near zero and compare output with the shortcut.

  3. 3. Inspect branch scale

    Measure norms of x, F(x), and x+F(x).

  4. 4. Check gradients

    Compare sensitivity through shortcut and residual paths.

  5. 5. Run depth ablations

    Confirm additional blocks improve held-out results enough to justify cost.

Key takeaways