Back to Deep Learning Mind Map
中文·English
🧠 Deep LearningID: weight-init

Weight Initialization

权重初始化
🎯Core Definition
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\text{Var}(w) = 1/d_{\text{in}}, backward Var(w)=1/dout\text{Var}(w) = 1/d_{\text{out}}; the compromise is Var(w)=2din+dout\text{Var}(w) = \frac{2}{d_{\text{in}} + d_{\text{out}}}; uniform form wU[6din+dout,6din+dout]w \sim U\left[-\sqrt{\frac{6}{d_{\text{in}}+d_{\text{out}}}}, \sqrt{\frac{6}{d_{\text{in}}+d_{\text{out}}}}\right] (since U[a,a]U[-a,a] has variance a2/3a^2/3, setting a2/3=2/(din+dout)a^2/3 = 2/(d_{\text{in}}+d_{\text{out}}) gives a=6/(din+dout)a = \sqrt{6/(d_{\text{in}}+d_{\text{out}})}), or normal N(0,2/(din+dout))N(0, 2/(d_{\text{in}}+d_{\text{out}})). Kaiming/He (2015, for ReLU): Var(w)=2din\text{Var}(w) = \frac{2}{d_{\text{in}}}, uniform U[6din,6din]U\left[-\sqrt{\frac{6}{d_{\text{in}}}}, \sqrt{\frac{6}{d_{\text{in}}}}\right] or normal N(0,2/din)N(0, 2/d_{\text{in}}); PReLU generalizes to Var(w)=2(1+a2)din\text{Var}(w) = \frac{2}{(1+a^2)d_{\text{in}}} (aa = negative-slope coefficient). Core derivation (assuming E[w]=0E[w]=0 and xx independent of ww): for one output y=iwixiy = \sum_i w_i x_i, Var(y)=dinVar(w)Var(x)\text{Var}(y) = d_{\text{in}}\,\text{Var}(w)\,\text{Var}(x); setting output variance equal to input variance gives Var(w)=1/din\text{Var}(w) = 1/d_{\text{in}}, 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.9500.0050.9^{50} \approx 0.005 after 50 layers). Variance-preserving initialization keeps signal magnitudes at O(1)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)\text{Var}(y) = d\,\text{Var}(w)\,\text{Var}(x) and variance preservation get Var(w)=1/din\text{Var}(w) = 1/d_{\text{in}}; why does the final formula average as 2/(din+dout)2/(d_{\text{in}}+d_{\text{out}}) (compromise between 1/din1/d_{\text{in}} forward and 1/dout1/d_{\text{out}} backward)?
3
Write Xavier and Kaiming formulas and their activation targets: tanh/sigmoid → Xavier (2/(din+dout)2/(d_{\text{in}}+d_{\text{out}})), ReLU → Kaiming (2/din2/d_{\text{in}}); why (ReLU zeroes half → factor 2)?
4
Where does the uniform bound 6/(din+dout)\sqrt{6/(d_{\text{in}}+d_{\text{out}})} come from? Solve a2/3=2/(din+dout)a^2/3 = 2/(d_{\text{in}}+d_{\text{out}}) for U[a,a]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?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Weight Initialization"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardLearning Rate SchedulingNext CardKaiming Init Derivation

🔗 More Deep Learning Knowledge Cards

Activation FunctionsAdam & AdamWAutograd Compute GraphBatch Normalization