AI Research Scientist · Deep Network Training Basics
Vanishing and exploding gradients
Vanishing and exploding gradients
Vanishing and exploding gradients
During backprop, the gradient reaching an early layer is the product of many per-layer (or per-timestep) local gradient factors. If those factors are consistently below 1, the product shrinks exponentially toward zero — vanishing. If consistently above 1, it grows exponentially — exploding.- 1Multiply the four 0.5 factors: .WhyLocal gradients multiply across layers, so shrinking factors compound geometrically with depth.
- 2Multiply the four 2.0 factors: .WhyGrowing factors compound the same way, but toward large magnitudes instead of small ones.
- 3Compare the resulting layer-1 updates: near-zero vs. huge.WhyNear-zero gradients stall learning (vanishing); huge gradients cause erratic, diverging updates (exploding).
Normalization layers (BatchNorm, LayerNorm) rescale each layer's activations — and therefore the gradients flowing through them — to a controlled range at every layer. This resets the multiplicative product's scale before it can compound toward zero or infinity across depth. That's distinct from rerouting gradient flow around layers: normalization keeps the same backward path but keeps its scale stable at each step.
Recall check from the same lesson
In a very long recurrent sequence model, adding LayerNorm at each timestep is enough to fully prevent gradient decay across all time steps, without needing a gating mechanism.
Review the explanation
Answer: False. LayerNorm rescales the activations and gradients at each individual step, but it doesn't control how much gradient signal is allowed to persist backward across many steps of the same reused weight matrix. Gating mechanisms address exactly that long-range decay by learning, per step, how much gradient to let flow backward — a job normalization alone doesn't do.
Sources
One sitting · 20–30 minutes
A focused session on your AI Research Scientist interview
LearnBench starts from what you already know — skip what you have, master what you’re missing.
Start now