Foundation Lab

Residual Connections & Skip Connections

Residuals enable training 100+ layer networks by preventing vanishing gradients

Concept 41 of 100Core TrainingPhase 2
#41ResidualsCore Training
key equation
y=x+F(x)y = x + F(x)
Reading map and next steps

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 41 of 100ResidualsCore Training / Phase 2: Architecture fundamentals
Current question

Residual networks are "perturbations of identity"—each layer learns to make small corrections rather than full transforms

y=x+F(x)y = x + F(x)
PredictionCommit before tracing the equation.

Ask what should change under a concrete input, then trace that expectation through the equation.

EvidenceCompare the equation and source.

Use the key equation and canonical papers as the available witnesses, without implying that a runnable panel exists.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue through the atlas.

Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.

Why It Matters for Modern Models

  • Residuals enable training 100+ layer networks by preventing vanishing gradients
  • The "residual stream" view is foundational to mechanistic interpretability—each component writes to a shared memory
  • Without residuals, logit lens and activation patching would not work: there is no stable representation to probe

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Residual networks are "perturbations of identity"—each layer learns to make small corrections rather than full transforms
  • Deep networks with residuals behave like ensembles of shallower networks (unraveled view)
  • Pre-norm vs post-norm changes where gradients flow—modern transformers use pre-norm for stability

Visualization Status

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and cited sources. Come back here for the full walkthrough.

Key Equation
y=x+F(x)y = x + F(x)

Residual block transforms input xx by learning a perturbation:

y=x+F(x,{Wi})y = x + F(x, \{W_i\})

In transformers, this creates the residual stream:

h(l+1)=h(l)+Attn(h(l))+MLP(h(l)+Attn(h(l)))h^{(l+1)} = h^{(l)} + \text{Attn}(h^{(l)}) + \text{MLP}(h^{(l)} + \text{Attn}(h^{(l)}))

Gradient flow through L layers:

∂L∂h(0)=∂L∂h(L)⋅(I+∑l=1L∂F(l)∂h(l−1))\frac{\partial L}{\partial h^{(0)}} = \frac{\partial L}{\partial h^{(L)}} \cdot \left( I + \sum_{l=1}^{L} \frac{\partial F^{(l)}}{\partial h^{(l-1)}} \right)

The identity term II ensures gradients always have a direct path backward.

Canonical Papers

Deep Residual Learning for Image Recognition

He et al.2016CVPR
Read paper →

Connections

Prerequisites

Next Moves

Choose the next question to carry this object forward.