TensorTau PathToAGI Training Deep Networks Level 07

Level 07 · Training Deep Networks · Chapter 102

Residual Connections

Why can adding a shortcut around a complicated transformation make a much deeper network easier to train?

A residual block computes

y=x+F(x).y=x+F(x).

Instead of forcing a stack to learn the entire desired mapping H(x)H(x), it can learn a residual

F(x)=H(x)−x.F(x)=H(x)-x.

1. Identity becomes easy

If the best transformation is “do almost nothing,” the block can set F(x)≈0F(x)\approx0, leaving y≈xy\approx x.

Without a shortcut, many nonlinear layers would have to learn identity themselves.

2. Gradient has a direct path

Differentiate:

∂y∂x=I+∂F∂x.\frac{\partial y}{\partial x}=I+\frac{\partial F}{\partial x}.

The identity term creates a path for signal and gradient that does not depend entirely on the product of many learned Jacobians.

x ───────────────┐
│                + → y
└→ F(x) ─────────┘

3. Shapes must match

Addition requires compatible shapes. If channel/feature dimensions change, a projection such as a linear or 1×1 convolution can transform the shortcut.

4. Beyond ResNet

Residual connections became foundational not only in vision but in Transformers, where attention and MLP sublayers sit inside residual streams.

What to Remember

Residual connections create easy identity paths and let layers focus on learning corrections.

Next → Gradient Clipping: residual paths help gradients travel, but what if a particular update still becomes dangerously huge?

Six ways to work the chapter, climbing from explaining it in your own words to investigating it like a researcher. Reading is not enough — this is where the chapter lands.

  1. Explain: Why is learning a residual often easier than relearning identity?
  2. Calculate: Differentiate y=x+F(x).
  3. Predict: What shape requirement does residual addition impose?
  4. Break: Remove residual paths from a deep network and compare gradient flow.
  5. Build: Implement a small residual MLP block.
  6. Investigate: Compare deep plain and residual networks under matched width/depth.