3.1.12 · D5Neural Network Fundamentals

Question bank — Weight initialization (Xavier, He)

2,115 words10 min readBack to topic

This page assumes you already met the two rules:

  • Xavier / Glorot (for tanh, sigmoid, linear):
  • He / Kaiming (for ReLU and its variants):

where = fan-in (number of inputs feeding one neuron) and = fan-out (number of neurons the signal feeds forward into next). If either term is fuzzy, revisit Variance and Expectation and 3.1.12 Weight initialization (Xavier, He) (Hinglish) first.


True or false — justify

Good init guarantees the network will train successfully.
False. It only keeps the starting variance sane so gradients are usable at step 0; a bad learning rate, bad architecture, or bad data can still stall training. Init removes one failure mode, not all of them.
He initialization gives a larger weight variance than Xavier for the same layer.
Generally true. He uses while Xavier uses ; since , He's denominator is smaller, so its variance is larger — the extra size compensates for ReLU discarding half the signal.
Setting all weights to the same nonzero constant (say ) is fine because it's not zero.
False. The problem was never the value zero specifically — it is that identical weights make every neuron in a layer compute the same output and receive the same gradient. Any constant fails symmetry breaking; only randomness breaks it.
Biases must also be randomized to break symmetry.
False. Randomizing the weights already gives each neuron a different function, so biases can safely start at . Symmetry breaking is a property of the weight matrix rows being different, not the biases.
If we use Batch Normalization, weight initialization no longer matters at all.
Mostly false. Batch Normalization re-centers and re-scales activations each step, so it makes the network far more forgiving of init — but a wildly scaled init can still hurt the very first forward/backward passes before BN's statistics settle. Good init and BN are complements, not substitutes.
Multiplying every weight by after He init is harmless since it's "still random."
False. Scaling weights by multiplies the variance by , so each layer's gain becomes instead of ; over layers that is — an exponential explosion. The scale is the whole point, not just the randomness.
Xavier init works fine for a deep ReLU network, just slightly less optimal.
False in a dangerous way. Xavier assumes the activation passes ~all the variance; ReLU passes only half, so each layer loses a factor of in variance, giving gain per layer and vanishing across depth. The mismatch compounds exponentially — it is not a mild inefficiency.
The variance-preserving derivation needs weights and inputs to be independent and zero-mean.
True. The clean rule and "variance of a sum adds" both rely on independence and zero mean; without them cross terms and covariances appear and the tidy result breaks.
Glorot-normal and Glorot-uniform give different variances, so they train differently.
False. Both are tuned to the same target variance — the normal form sets that as directly, the uniform form picks its bound so that equals it. They differ only in the shape of the random draws, not the variance the theory cares about.

Spot the error

"Fan-in for a layer mapping is , because that's the layer's output size."
Error. Fan-in is the input dimension, so , not . The is fan-out. He init would use , not .
"He variance is , so the standard deviation to sample from is also ."
Error. Standard deviation is the square root of variance: . Sampling with std would give the wrong (much smaller) spread for large .
"Xavier uniform samples from to match the variance."
Error. A uniform has variance , not ; setting equal to the target variance ignores that factor. The correct bound is .
"ReLU halves the variance, so He fixes it by halving the weight variance."
Error. ReLU halving the activation variance means we must double the weight variance to compensate (), not halve it. The factor pushes the signal back up to full strength.
"Since forward wants and backward wants , Xavier just picks whichever is smaller to be safe."
Error. Xavier takes the harmonic-style average by using , a compromise that lands between the two targets. Picking the smaller would over-shrink and risk vanishing in one direction.
"With He init the per-layer variance gain is , which is why it prevents explosion."
Error. He is designed so the gain equals : . The three factors (fan-in, weight variance, ReLU's ) multiply to exactly — that unit gain is what keeps variance stable across depth.
"For a conv layer with input channels and kernels mapping to output channels, fan-in is just ."
Error. For convolutions, fan-in counts every weight feeding one output pixel: . Fan-out is . Ignoring the kernel area badly under-scales the variance.

Why questions

Why does the per-layer variance factor get raised to the depth rather than added?
Each layer multiplies the running variance by its gain , and repeated multiplication is exponentiation: layers of gain give . That is why even a mild gain like or becomes catastrophic in a deep net.
Why do we track the variance of the pre-activation specifically, and not its mean?
With zero-mean weights and inputs the mean of stays automatically, so the mean carries no information about signal size; variance is what measures how big is, so keeping it constant is the real goal.
Why does the same weight-variance argument apply to gradients flowing backward?
Backpropagation multiplies gradients by (transposed) weight matrices layer by layer, so gradients obey the same "sum of products of independents" structure as the forward pass — just with replacing , giving the backward target .
Why can't a single choice of satisfy both the forward and backward goals exactly?
Forward preservation needs and backward needs ; unless these demand two different variances, so we compromise (Xavier's average) instead of picking one.
Why is symmetry breaking a permanent failure and not something training fixes later?
If two neurons start identical, they get identical gradients, so they update identically and stay identical forever — gradient descent can never separate points it moves in lockstep. Only different starting weights can break the tie.
Why does sigmoid combined with a variance-preserving init still risk vanishing gradients?
Even if activation variance is preserved, sigmoid's derivative is tiny (near ) whenever inputs drift into its saturated flat regions, so gradients shrink through the derivative term regardless of init — see Vanishing and Exploding Gradients.
Why does Xavier suit tanh but He suit ReLU, given both are "activations"?
tanh is symmetric and nearly linear near , so it passes almost all the variance — Xavier's variance-preserving assumption holds. ReLU discards the negative half, breaking that assumption, which is exactly what He's factor repairs.
Why do frameworks offer truncated normal init instead of plain normal?
A plain normal occasionally draws extreme weights far out in the tails, which can seed a few outsized activations; truncated normal re-samples anything beyond about , keeping the same target variance while removing rare huge values that could destabilize the first steps.

Edge cases

For a layer where , Xavier reduces to which simple rule?
It becomes , i.e. exactly the plain forward variance-preserving rule — because the forward and backward targets coincide when the fans are equal.
What happens to He variance as a layer gets extremely wide ()?
The variance , so individual weights become tiny; this is correct, because summing many terms of small variance still yields a with the intended finite variance — the shrink exactly offsets the growing number of inputs.
The very first layer's inputs are raw data (not zero-mean, not unit-variance). Does the derivation still apply?
Not cleanly — the zero-mean/i.i.d. assumptions can fail on raw features, which is why we usually standardize inputs first so the first layer sees roughly zero-mean, unit-variance data and the init math holds.
A layer with fan-in (a single input) — is init even meaningful?
Yes, but degenerate: with , He gives and Xavier depends on ; there's no averaging over many inputs, so the variance-of-a-sum argument is trivial and the practical benefit of careful scaling is minimal.
For the output layer feeding a loss (no further layer), what should mean?
Conceptually the backward target loses its usual meaning since nothing follows, so people often fall back to the forward-only rule or use the number of output units as ; either way the exact choice matters least here because it's the last layer.
Leaky ReLU passes a small slope for negatives instead of zeroing them. Should we still use plain He?
Not exactly — since leaky ReLU keeps some negative-side variance, less than half is discarded, so the ideal constant is slightly less than ; the corrected He formula uses .
If a network is shallow (2–3 layers), does init choice still matter much?
Much less — the exponential term barely moves for tiny , so a gain of over layers is only , easily recoverable by training. Init matters most precisely when depth is large.
For a convolutional layer, which distribution do frameworks default to — uniform or normal?
It varies: PyTorch's default kaiming_uniform_ uses the uniform form, while many He-init recipes in papers use the normal form; both target the same variance (with ), so results are equivalent up to draw shape.

Recall One-line self-test before you leave

Can you, from memory, state (1) why the gain is exponentiated by depth, (2) why He doubles Xavier for ReLU, and (3) why zero init fails even though it can't explode? Answers ::: (1) Layers multiply variance, and repeated multiplication is a power, so layers give ; (2) ReLU kills half the variance so we double the weight variance to restore gain ; (3) zero (or any constant) makes neurons identical, so symmetry never breaks.


Connections