Log inStart free
LESSON 11.08 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Activation checkpointing

Watch a 16-layer network drop most activations and recompute them for the backward pass.


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

Go Pro · $8.25/mo
EXPLAINER · 11.08 · CHECKPOINT BAYSTORE ALL · PEAK 17 · TIME 48
01
Stage 1 of 6 · Store everything
Without checkpointing, the forward pass keeps all 17 activations. The backward pass frees each one after use.
Explain it simply

Each small column between the layers is one activation, the output of a layer. The backward pass needs every one of them to find the gradients. So a plain forward pass keeps all 17. The memory curve climbs to 17 and falls back to 1 in the backward pass. The first column, the input batch, stays until the step ends.

16 layer boxes with 17 solid activation columns. On the time axis, 16 forward blocks, then 16 backward blocks twice as wide. The dashed memory curve rises to 17 and falls back to 1.

Weights are random, not trained.
activations heldnot heldlayers, checkpointsbackward, gradientspeak
12345678910111213141516forwardrecomputebackward01648time in layer passes (backward = 2)activationsheld0store all: peak 1716 layers, store everythingh₀h₁₆store all: M = n + 1 = 16 + 1 = 17 activations12345678910111213141516forwardrecomputebackward01648time in layer passes (backward = 2)activationsheld0store all: peak 1716 layers, store everythingh₀h₁₆store all: M = n + 1 = 16 + 1 = 17 activations
Toy: 16 tanh layers, width 4, dropout 0.25
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Mall=n+1\sy{M}{out}{M_{\text{all}}} = \sy{n}{param}{n} + 1
Mall=16+1=17M_{\text{all}} = 16 + 1 = 17

Store-all memory is one activation per layer, plus the input.

Common mix-ups

MYTHMore checkpoints always save more memory.

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

Predict, then reveal
3 CHECKS · PRO
Q01With 2 segments instead of 4, does the peak go up or down?

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

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 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.