Weight Initialization

August 2026Vladislav Kruglikov

Weight initialization sets the starting values of the trainable parameters. Those values affect activation scale, gradient scale, and whether different neurons learn different features.

Why initialization matters

Initialization decides the model's starting signal scale. If weights are too small, activations and gradients shrink as they move through layers. If weights are too large, they can grow, destabilize updates, or push activations into saturated regions.

Zero initialization

For a linear layer Y=XWY = XW, the backpropagation formulas are LX=GWT\frac{\partial L}{\partial X}=GW^\mathsf{T} and LW=XTG\frac{\partial L}{\partial W}=X^\mathsf{T}G, where G=LYG=\frac{\partial L}{\partial Y}.

In a stack of linear layers without bias, if every WW is initialized to zero, every hidden activation XX becomes zero. The output gradient GG can be nonzero, but XTGX^\mathsf{T}G is still zero, so all weight matrices receive zero gradient.

If biases exist, only the last bias can receive a nonzero gradient at first. Its gradient comes directly from the output gradient GG. But after backpropagation multiplies by a zero weight matrix, LX\frac{\partial L}{\partial X} becomes zero, so biases in earlier layers also receive zero gradient. The activation between two linear layers does not change this. Once its upstream gradient is zero, multiplying by the activation derivative still gives zero, so the layers before it remain blocked.

If only the last layer has zero weights while earlier layers are nonzero, the last layer can still learn. Its input XX can be nonzero, so XTGX^\mathsf{T}G can update its weights, and GG can update its bias. But the gradient sent to earlier layers is GWT=0GW^\mathsf{T}=0, so all layers before it receive zero gradient for both weights and biases.

Constant nonzero initialization

Creates a symmetry problem. Every neuron in a layer receives identical inputs and computes the exact same output, causing all neurons to update identically during backpropagation and rendering multiple neurons redundant.

Uniform random initialization

Uniform random initialization samples each weight independently from some interval [l,r][l,r]. This breaks symmetry, so neurons in the same layer no longer receive identical updates.

A general interval can have nonzero mean, which shifts activations in one direction before training starts. For initialization, it is usually cleaner to use a symmetric interval [a,a][-a,a], whose mean is zero.

Randomness alone is not enough. If aa is too small, activations and gradients can shrink across layers. If aa is too large, they can grow or push nonlinearities into saturated regions. The useful question is therefore not only whether weights are random, but what scale the random distribution should have.

For a non-symmetric uniform distribution WU(l,r)W\sim U(l,r), the variance is

Var(W)=112(rl)2\operatorname{Var}(W) = \frac{1}{12}(r-l)^2

For the symmetric case WU(a,a)W\sim U(-a,a), we substitute l=al=-a and r=ar=a

Var(W)=112(a(a))2=112(2a)2=13a2\operatorname{Var}(W) = \frac{1}{12}(a - (-a))^2 = \frac{1}{12}(2a)^2 = \frac{1}{3}a^2

So for a symmetric uniform initialization, choose the variance vv first, then convert it into the bound a=3va=\sqrt{3v}.

The usual formulas come from trying to keep variance stable across layers. Let faninfan_{in} be the number of inputs to one neuron. For that neuron, xix_i is one input value, wiw_i is the weight attached to that input, and yy is the value before the activation function:

y=x1w1+x2w2++xfaninwfaniny = x_1w_1 + x_2w_2 + \cdots + x_{fan_{in}}w_{fan_{in}}

So the neuron adds faninfan_{in} terms. The first term is x1w1x_1w_1, the second is x2w2x_2w_2, and so on. If these terms are not strongly correlated, the variance of the sum is roughly the sum of their variances:

Var(y)Var(x1w1)++Var(xfaninwfanin)\operatorname{Var}(y) \approx \operatorname{Var}(x_1w_1) + \cdots + \operatorname{Var}(x_{fan_{in}}w_{fan_{in}})

For centered inputs and weights, each term xiwix_iw_i has variance Var(X)Var(W)\operatorname{Var}(X)\operatorname{Var}(W). Since there are faninfan_{in} such terms,

Var(y)faninVar(X)Var(W)\operatorname{Var}(y)\approx fan_{in}\operatorname{Var}(X)\operatorname{Var}(W)

To keep the activation scale from growing or shrinking, we want Var(y)Var(X)\operatorname{Var}(y)\approx\operatorname{Var}(X). That gives Var(W)1/fanin\operatorname{Var}(W)\approx 1/fan_{in}.

The backward pass gives a similar constraint in the other direction. Let fanoutfan_{out} be the number of outputs from the layer. From LX=GWT\frac{\partial L}{\partial X}=GW^\mathsf{T}, the gradient for one input is also a sum:

Lxi=G1wi1+G2wi2++Gfanoutwi,fanout\frac{\partial L}{\partial x_i} = G_1w_{i1} + G_2w_{i2} + \cdots + G_{fan_{out}}w_{i,fan_{out}}

Using the same variance approximation, this gives

Var(LX)fanoutVar(G)Var(W)\operatorname{Var}\left(\frac{\partial L}{\partial X}\right) \approx fan_{out}\operatorname{Var}(G)\operatorname{Var}(W)

To keep gradient scale from growing or shrinking as it moves backward, we want Var(LX)Var(G)\operatorname{Var}(\frac{\partial L}{\partial X})\approx\operatorname{Var}(G). That gives Var(W)1/fanout\operatorname{Var}(W)\approx 1/fan_{out}.

Xavier initialization balances the forward constraint 1/fanin1/fan_{in} and the backward constraint 1/fanout1/fan_{out} by using their average scale.

Xavier uniform assumes the activation does not strongly change the variance after the linear layer. It chooses

v=2fanin+fanoutv = \frac{2}{fan_{in} + fan_{out}}

so the symmetric uniform bound is

a=6fanin+fanouta = \sqrt{\frac{6}{fan_{in} + fan_{out}}}

For ReLU-like activations, if pre-activations are roughly centered around zero at the start of training, about half of them are negative and get set to zero. That reduces the signal variance, so He initialization uses roughly twice the Xavier forward variance.

He uniform usually uses the forward-preserving choice

v=2faninv = \frac{2}{fan_{in}}

so the symmetric uniform bound is

a=6fanina = \sqrt{\frac{6}{fan_{in}}}

A backward-preserving variant uses

v=2fanoutv = \frac{2}{fan_{out}}

and therefore

a=6fanouta = \sqrt{\frac{6}{fan_{out}}}

Normal random initialization

Normal initialization uses the same variance targets, but samples from a normal distribution instead of a uniform interval:

WN(0,v)W \sim \mathcal{N}(0, v)

Here vv is the variance. For Xavier normal, use v=2/(fanin+fanout)v=2/(fan_{in}+fan_{out}). For He normal in the usual forward-preserving mode, use v=2/faninv=2/fan_{in}.

Normal and uniform initialization mostly differ in how they sample weights with the same target variance. Uniform initialization is bounded, so it cannot produce rare extreme weights. Normal initialization puts more weights close to zero, but has tails unless it is truncated. In many basic Xavier and He settings, the target variance matters more than whether the samples come from a uniform or normal distribution.

Truncated normal initialization keeps the normal shape near zero, but resamples values that are too far into the tails. This avoids rare large initial weights while still putting most weights near zero.

Bias initialization

Biases are often initialized to zero. This is usually fine because random weights already break symmetry between neurons. Zero bias does not make all neurons compute the same function by itself.