WHAT is multiplied? In a plain feed-forward net, each layer computes
a(l)=σ(z(l)),z(l)=W(l)a(l−1)+b(l).
Backprop pushes the error δ(l)=∂L/∂z(l) backward using the chain rule.
Step 1 — link consecutive layers.
Since z(l+1)=W(l+1)σ(z(l))+b(l+1), the chain rule gives
δ(l)=(W(l+1))⊤δ(l+1)⊙σ′(z(l)).Why this step? Error at layer l only reaches the loss through layer l+1, so we take l+1's error, pull it back through the weights (W(l+1))⊤, and scale by how much this neuron's output changes with its input, σ′(z(l)).
Step 2 — unroll across L layers.
Applying Step 1 repeatedly from the last layer down to layer 1:
δ(1)=(∏l=2L(W(l))⊤diag(σ′(z(l−1))))δ(L).Why this step? Every layer inserts one more multiplicative factor. Going from layer L down to layer 1 crosses L−1 links, so there are L−1 factors in the product.
Step 3 — bound the magnitude (the key insight).
Take norms. If every factor satisfies (W(l))⊤diag(σ′)≤γ, then
δ(1)≤γL−1δ(L).Why this step? Norm of a product ≤ product of norms, and there are L−1 factors. Now the behaviour is obvious:
γ<1⇒γL−1→0 → vanish.
γ>1⇒γL−1→∞ → explode.
γ≈1⇒ signal preserved. This is the whole design goal.
Why sigmoid vanishes: its derivative never exceeds 0.25. So even with perfectly scaled weights, γ≤0.25⋅∥W∥; through many layers the 0.25 factors compound to near zero. ReLU has derivative 1 for positive inputs, so it does not shrink the signal (its factor is exactly 1), which is why it dominates deep nets.
What operation in backprop causes gradients to vanish or explode?
Repeated multiplication of Jacobians (weights × activation derivatives) across layers — a product of many factors.
How many multiplicative factors are in the gradient for an L-layer net?
L−1, one per layer-to-layer link, so the bound scales like γL−1.
What single quantity determines stability?
The per-layer gain γ≈∥W∥⋅maxσ′; need γ≈1.
Why does sigmoid promote vanishing gradients?
Its derivative σ(1−σ)≤0.25, so factors always shrink the signal.
What is the max value of the sigmoid derivative and where?
0.25, at z=0 (where σ=0.5).
He vs Xavier init — when and why the factor of 2?
He for ReLU (Var=2/nin); the ×2 compensates for ReLU zeroing ~half the activations. Xavier for tanh/sigmoid (2/(nin+nout)).
Which fix targets exploding gradients specifically?
Gradient clipping (rescale gradient if its norm exceeds a threshold).
Why do residual connections help?
The layer Jacobian becomes I+(…), giving a guaranteed gain-≈1 identity path for the gradient.
For γ=0.25, L=10, estimate the shrink factor.
0.259≈3.8×10−6 (using L−1=9 factors); order 10−6 either way.
Can loss be high while gradients vanish?
Yes — early layers frozen while later layers still learn.
Recall Feynman: explain to a 12-year-old
Imagine whispering a message down a line of 20 friends. If each friend whispers a bit softer, by the end there's no sound — that's a vanishing gradient (the first friends never hear the correction). If each whispers a bit louder, by the end everyone is screaming — that's exploding. We fix it by teaching everyone to repeat the message at the same volume (gain ≈1) using good starting rules (He/Xavier) and shortcuts (skip connections) so the message survives the whole line.
Dekho, deep network ko train karna matlab error signal ko peeche ki taraf (backpropagation) har layer se guzarna. Har layer par yeh signal ek weight aur activation ke derivative se multiply hota hai. Ab agar aap bahut saare numbers ko baar-baar multiply karo — aur woh saare 1 se chhote hain — toh answer 0 ki taraf gir jaata hai. Yeh hi vanishing gradient hai: shuruaat wali layers ko koi correction milta hi nahi, woh seekhna band kar deti hain. Agar numbers 1 se bade hain, toh product phat jaata hai (infinity), isko exploding gradient bolte hain — loss NaN ho jaata hai.
Poori kahani ek number par tiki hai: per-layer gainγ≈∥W∥×maxσ′. Layer L se layer 1 tak jaate hue L−1 links cross hote hain, toh bound γL−1 ki tarah scale karta hai. Agar γ≈1 ho toh signal preserve rehta hai; agar <1 toh vanish, >1 toh explode. Isiliye sigmoid kharab hai — uska derivative maximum sirf 0.25 hota hai, toh gain hamesha girta rehta hai. ReLU ka slope 1 hota hai, isliye woh signal ko shrink nahi karta — yahi reason hai ki modern deep nets ReLU use karte hain.
Fixes bhi sab ek hi cheez karte hain: γ ko 1 ke paas laana. He/Xavier initialization weights ko sahi scale par set karta hai. Batch Normalization pre-activations ko healthy range mein rakhta hai. Residual (skip) connections gradient ko ek identity path deti hain (Jacobian =I+…), jisse gain hamesha ≈1. Aur exploding ke liye gradient clipping — agar gradient bada ho jaaye toh usko cut kar do. Yeh 80/20 concept hai: yeh samajh lo, toh deep learning training ka aadha struggle solve ho jaata hai.