Part III showed a plain deep network's gradient shrinking toward zero, one sigmoid layer at a time. Adding more layers should make a network more powerful — instead, past a certain depth, it makes it untrainable. What if each layer didn't have to replace its input, only adjust it?
Same depth, same per-layer weight, same nonlinearity — the only difference is whether each layer computes a brand new value or adds a small adjustment on top of the one it received. Step through the depths and watch one gradient collapse while the other holds steady.
A plain layer replaces its input entirely: . A residual (skip) connection instead adds the layer's output back onto its input:
- — the representation produced at layer , after the residual connection is applied.
- — the representation entering layer , produced by the previous layer.
- — the layer's own transformation (e.g., a weight multiply and nonlinearity) — the same function a plain layer would apply on its own.
- A plain layer's gradient compounds toward zero
Backpropagating through a plain layer multiplies the gradient by — a term that's often well below 1, so a long chain of layers shrinks it toward zero.
- A residual layer keeps a direct path open
Backpropagating through a residual layer multiplies by instead. That leading is a direct, unobstructed path for the gradient — an "identity shortcut" that depth alone can't erode.
The plain network's gradient shrinks so fast with depth that its bars are barely visible next to the residual network's. By depth 20, the plain network's gradient has vanished to the order of ; the residual network's has stayed above .
Same weight and sigmoid in both networks — the plain network's per-layer function is , and the residual network's added term is — starting from , at depths 5, 10, and 20:
- The plain network vanishes on schedule
Once the forward pass saturates (by around depth 2, same as Part III's chapter), each additional layer's backward factor settles near a steady . Compounding that factor 5 more times multiplies the gradient by roughly — about 4 orders of magnitude — exactly the pattern in the numbers:
- Depth 5:
- Depth 10 ():
- Depth 20 (two more such 5-layer jumps):
- The residual network doesn't just survive — it stabilizes
Because each layer adds instead of replacing , and saturates to almost immediately here, grows by very close to every layer past the first couple:
- Depth 5:
- Depth 10:
- Depth 20:
So the raw gradient at the output, , grows roughly linearly with depth too. Meanwhile every backward factor is essentially once is deep in saturation (true from the second layer on) — only the first layer's factor, , differs meaningfully from . So the accumulated gradient is essentially just :
- Depth 5:
- Depth 10:
- Depth 20:
- One structural change fixes it, not a different F
The two networks share the same weight and nonlinearity — no new gate, no new parameter. What changes is purely structural: whether replaces or adds to it. That single addition, , is the entire fix — not some special property of the per-layer function itself.
Find the depth, among the three candidates, where the plain network's gradient has shrunk below 1e-10.
This is the same fix the GRU (short for Gated Recurrent Unit) and LSTM (short for Long Short-Term Memory) chapters made across time — a term guaranteeing the gradient has an unobstructed path — now applied across depth instead. Wherever a network needs to stack many transformations without each one eroding what came before, the same identity-shortcut idea reappears. The next chapter turns from stacking more layers to a completely different way of representing data: compressing it down to a small latent space and learning to generate new examples from it.