Weight initialization chooses a distribution for the weights before training, aiming to keep the variance of forward activations and backward gradients preserved across layers (neither shrinking nor exploding), avoiding vanishing/exploding gradients. Zero or identical initialization is the anti-pattern: all neurons in a layer share the same weights → identical outputs and gradients → symmetry never breaks and every neuron learns the same function (equivalent to one neuron). Xavier/Glorot (2010, for the near-linear regime of tanh/sigmoid): forward variance preservation requires Var(w)=1/din, backward Var(w)=1/dout; the compromise is Var(w)=din+dout2; uniform form w∼U[−din+dout6,din+dout6] (since U[−a,a] has variance a2/3, setting a2/3=2/(din+dout) gives a=6/(din+dout)), or normal N(0,2/(din+dout)). Kaiming/He (2015, for ReLU): Var(w)=din2, uniform U[−din6,din6] or normal N(0,2/din); PReLU generalizes to Var(w)=(1+a2)din2 (a = negative-slope coefficient). Core derivation (assuming E[w]=0 and x independent of w): for one output y=∑iwixi, Var(y)=dinVar(w)Var(x); setting output variance equal to input variance gives Var(w)=1/din, and ReLU halves the activation energy (zeroing the negative half), hence the factor 2.
💡Use Cases
the first line of defense in training any deep network (CNN/Transformer), complementary to BatchNorm (BN mitigates but does not fully fix a bad initialization); interview favorites: why zero-init fails, Xavier vs Kaiming selection, and how initialization relates to vanishing/exploding gradients.
⚡Key Problems Solved
weights too large → activation saturation (tanh derivative → 0 at the tails) or forward explosion; weights too small → exponential decay of signals (on the order of 0.950≈0.005 after 50 layers). Variance-preserving initialization keeps signal magnitudes at O(1) throughout, making dozens-to-hundreds-of-layer networks trainable. Note initialization only sets the starting point: long-term control of vanishing/exploding gradients also needs skip connections, BN/LN and gating — initialization complements, not replaces, them.
🎯5 High-Frequency Exam Points
1
Why can't all weights be initialized to 0 (or the same value)? Explain the symmetry problem: identical initialization → identical gradients → symmetry never breaks → equivalent to a single neuron.
2
Derive Xavier's forward condition: from Var(y)=dVar(w)Var(x) and variance preservation get Var(w)=1/din; why does the final formula average as 2/(din+dout) (compromise between 1/din forward and 1/dout backward)?
3
Write Xavier and Kaiming formulas and their activation targets: tanh/sigmoid → Xavier (2/(din+dout)), ReLU → Kaiming (2/din); why (ReLU zeroes half → factor 2)?
4
Where does the uniform bound 6/(din+dout) come from? Solve a2/3=2/(din+dout) for U[−a,a].
5
Initialization vs vanishing/exploding gradients: how does the initial variance determine signal propagation (magnitudes of forward activations and backward gradients); why are initialization and BN complementary?