Visual explainer
Residual Connections
Follow an input through identity and residual routes, add their gradients, match tensor shapes and see why shortcuts do not guarantee stable signals.
Residual connections add a learned correction to an unchanged input: . This makes identity available by setting the residual function to zero. It can ease optimization, while still leaving the network's total behavior dependent on the branch.
The picture is a synthetic starting problem, not a training benchmark: an existing prediction 2 matches target 2, but appending a plain layer that multiplies by .5 changes it to 1. Extra capacity alone does not preserve an already useful mapping. The original Deep Residual Learning paper reports degradation in deeper plain networks' training error and motivates learning residual mappings. This toy arithmetic illustrates the identity-preservation issue without claiming those scalar values reproduce the experiments.
Add A Correction
Follow input along both routes. The identity route carries 2 unchanged; the illustrative branch computes .5. Addition produces . The dot marks a real fork, and the upper route visibly bypasses the branch. In a tensor block, addition happens element by element at matching spatial positions and channels. These scalar values teach the mechanism rather than a trained model's performance.
Add Gradient Contributions
With incoming loss sensitivity 1, the identity derivative contributes 1 and this branch contributes .25. The arrows use one signed-sensitivity scale: the .25 segment is one quarter of the unit segment, and the combined displacement is 1.25. Vertical offsets separate the head-to-tail pieces without changing their lengths.
For this scalar block, . For vectors, the corresponding Jacobian is , and backward propagation applies its transpose. The identity term provides a direct contribution; it does not set the total gradient to one.
Match The Shapes
Change from scalar values to a small shape example. The input has height 4, width 4 and one channel. A projection convolution with stride 2, no padding and two output channels produces . Each plane's grid shows spatial cells; the two offset planes represent channels, not measured activation values. The residual branch supplies the same output shape before element-wise addition.
The spatial size is . The two output channels are learned linear combinations of the input channels at sampled positions. A projection adds parameters and computation and changes the shortcut derivative from identity to the projection operator. Equal shapes make addition possible; they do not make the shortcut an identity mapping.
Compare Derivative Products
Compare ten plain maps with ten residual blocks . Starting from unit terminal sensitivity, the plain product is , while the residual product is . The plot shares a logarithmic vertical scale; horizontal ticks count backward blocks. The dashed plain route shrinks, while the solid residual route grows.
This is a controlled scalar construction. It shows a direct term can change the product substantially, and also disproves the claim that a residual network's total gradient must remain near one. Real branch Jacobians vary with parameters and inputs; skip connections provide a structural advantage without a universal gradient ratio.
Move Activation Inside The Branch
Set to isolate activation placement. A clean addition output gives , shown by the solid line. Putting ReLU after addition instead gives , shown dashed. At input −2, the clean output is −2 (circle), whereas the post-ReLU output is zero (square). The positive branches coincide intentionally. Both curves share input and output scales.
Identity Mappings in Deep Residual Networks moves normalization and activation into the residual branch to preserve a direct identity route across additions. Removing a post-addition gate preserves that route; the branch can still amplify or cancel the total signal. A clean route is not a guarantee about the complete function.
Addition Can Amplify Signals
For a different branch, , each block computes . Starting at 1, three blocks yield 2, 4 and 8. The bars use one linear scale, with the final cross marking unchecked amplification. The value 8 is finite; the picture is a counterexample to automatic stability, not a numerical-overflow threshold. Activation variance depends on branch statistics and covariances, so this deterministic example makes no universal variance-growth claim.
Represent Identity With Zero
Return to over the plotted domain. The dashed branch remains zero; the solid block output is . At input 2, branch output is zero while block output is 2. This is the representational convenience of the residual formulation: the branch can represent no correction rather than synthesizing the full identity transformation internally.
That statement is conditional on a zero residual function and no post-addition operation that alters it. Weight decay does not guarantee that a trained branch becomes exactly zero: biases, normalization parameters, architecture and optimization all matter. An input-dependent zero at one point also does not imply a zero derivative there.
Scale The Correction
With and input 2, use . At , the correction is 2 and output is 4. At the illustrative , the correction is .2 and output is 2.2. The arrows share one value scale, making the tenfold difference in correction length literal. Closely spaced endpoint labels are displaced slightly for legibility; dashed guides identify their exact positions.
The derivative becomes . Scaling can moderate each branch's contribution, but .1 is not a universal prescription. Even repeated factors of 1.1 can grow: three such scalar blocks amplify by . Choose architecture and initialization for the actual network rather than assuming a fixed scale guarantees stability.
Where It Breaks
Finally choose . Inputs −2, 0 and 2 all map to zero under ; the amber horizontal line has slope zero. The dashed diagonal is the identity reference that the branch cancels. Here the derivative is , so this block passes no input sensitivity backward despite its identity wire. This local mechanism is an explicit limit, not a claim that residual networks usually learn cancellation. Skips help make deep optimization practical; they cannot guarantee useful representations, stable magnitudes or generalization.
The Quick Version
- Residual blocks add a correction to a shortcut input.
- Identity and branch derivatives both contribute to the total.
- Projection shortcuts match shapes at an additional computational cost.
- Post-addition activations can alter the identity route.
- Zero residual functions can represent identity blocks.
- Residual additions can amplify signals or cancel gradients.