Log inStart free
LESSON 5.18 · 5 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Residual connections

Watch a skip around each layer carry the gradient back through 20 layers.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 5.18 · DEEP STACK BAYPLAIN · 20 LAYERS · ŷ = 0.02
01
Stage 1 of 5 · Plain stack
A plain stack sends x through 20 layers. Each layer feeds only the next layer.
Explain it simply

You see one input, x equals 0.6, pass through 20 layers of 4 units each. Each column of cells is the output of one layer. A stronger shade means a value farther from zero, and a dashed cell is negative. The ochre bands between columns are the weights. In a plain stack, every value goes through every layer.

The plain stack: the input x on the left, then 21 columns of 4 cells. The output ŷ 0.02 is on the right. Ochre bands join the columns.

x, layer outputs hweightsskipgradient size (log)fit ŷnegative value
x = 0.6ŷ = 0.02plain stackthe task: y = x³hₖ = tanh(Wₖ hₖ₋₁ + bₖ) · 20 layers · ŷ = 0.02 for x = 0.6x = 0.6ŷ = 0.02plain stackthe task: y = x³hₖ = tanh(Wₖ hₖ₋₁ + bₖ) · 20 layers · ŷ = 0.02 for x = 0.6
Toy: 1 input, 3–20 layers of 4 tanh units, 16 points of y = x³
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
hk=tanh⁡(Wk hk−1+bk)\sy{h}{data}{h_k} = \tanh(\sy{W}{param}{W_k}\,\sy{h}{data}{h_{k-1}} + \sy{W}{param}{b_k})
y^=0.02 for x=0.60\hat y = 0.02 \text{ for } x = 0.60

Each layer applies tanh to its weights times the layer before.

Common mix-ups

MYTHA skip connection adds new weights to learn.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01At weight size 1 and 3 layers, does the plain gradient still fade before layer 1?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.