Skip to content
mlmentorship

Weight initialization: trace signal scale through a layer

Derive ReLU second-moment scaling, compare fan-in and fan-out, and recompute the rule when the activation or path structure changes.

Published · 8 min read ·Core ·Intermediate

Visual quick review

Predict why a ReLU layer needs weight variance 2 divided by fan-in to preserve activation scale, and how a smaller or larger factor compounds through depth.

Learning objective

Activation second moment through four ReLU layers at three initialization scales

Activation second moment through four ReLU layers at three initialization scales Under independent zero-mean symmetric preactivations, each ReLU layer multiplies activation second moment by fan-in times weight variance divided by 2. All three paths start at q zero equal to 1. Weight variance 1 over fan-in multiplies by one half per layer and ends at 1 over 16. Kaiming variance 2 over fan-in multiplies by 1 and remains at 1. Variance 3 over fan-in multiplies by three halves and ends at 81 over 16, about 5.06. Circle, square, and triangle markers plus dotted, dashed, and solid paths distinguish the cases without color. activation second moment q_l / q_0 · log scale 3 / fan-in: gain 1.5 / layer 2 / fan-in: gain 1 (Kaiming) 1 / fan-in: gain 0.5 / layer 5.0610.0625 01234 ReLU layers traversed

Forward scaling counts four inputs; backward scaling counts eight outputs in the unequal-width example below.

Read it this way: start each path at second moment one. Independent symmetric weights give a ReLU multiplier of fan-in times weight variance divided by two. Circles end at 1/16, squares at one, and triangles at 81/16. The vertical axis uses shared logarithmic spacing. Marker shapes also distinguish paths. Sources are Glorot and Bengio (2010) and He et al. (2015).
Check: Why does weight variance 2/fan-in preserve the illustrated ReLU second moment? What assumptions make that recurrence valid?
Full explanation 8 min read
Reading depth

Weight initialization sets a layer’s starting scale before data or optimization can correct it. Which weight variance prevents repeated shrinking or growth through a simple ReLU chain?

Summary

Track the activation second moment , not just centered variance. For a layer with four inputs and zero bias, compare weight variances , , and . Under the assumptions below, their per-layer second-moment multipliers are , , and . Four layers therefore yield , , and from .

Learning objective

Separate ten-layer chain: uncompensated second-moment loss compounds

Compensating for ReLU can preserve the second moment through depthFor symmetric, zero-centered inputs, ReLU discards half the expected squared signal. Equal halving at each layer compounds. Wider layers need smaller initial weights; ReLU’s lost half needs compensating weight scale. This preserves the expected second moment under independence assumptions, not every activation or gradient in a trained network.Second-moment scale crosses eachlayerUncompensated: lose half per layer1 in0.0009766 outCompensated: keep the scale1 in1 outUncompensated loss compounds.
Read it this way: For symmetric, zero-centered inputs, ReLU discards half the expected squared signal. Equal halving at each layer compounds. Wider layers need smaller initial weights; ReLU’s lost half needs compensating weight scale. This preserves the expected second moment under independence assumptions, not every activation or gradient in a trained network. Can repeatedly losing half the second moment preserve its initial scale?
Reference drawing

Learning objective

Compensating for ReLU can preserve the second moment through depth

Compensating for ReLU can preserve the second moment through depthFor symmetric, zero-centered inputs, ReLU discards half the expected squared signal. Equal halving at each layer compounds. Wider layers need smaller initial weights; ReLU’s lost half needs compensating weight scale. This preserves the expected second moment under independence assumptions, not every activation or gradient in a trained network.Second-moment scale crosses eachlayerUncompensated: lose half per layer1 in0.0009766 outCompensated: keep the scale1 in1 outUncompensated loss compounds.
Derivation
Activation second moment through four ReLU layers at three initialization scales Under independent zero-mean symmetric preactivations, each ReLU layer multiplies activation second moment by fan-in times weight variance divided by 2. All three paths start at q zero equal to 1. Weight variance 1 over fan-in multiplies by one half per layer and ends at 1 over 16. Kaiming variance 2 over fan-in multiplies by 1 and remains at 1. Variance 3 over fan-in multiplies by three halves and ends at 81 over 16, about 5.06. Circle, square, and triangle markers plus dotted, dashed, and solid paths distinguish the cases without color. activation second moment q_l / q_0 · log scale 3 / fan-in: gain 1.5 / layer 2 / fan-in: gain 1 (Kaiming) 1 / fan-in: gain 0.5 / layer 5.0610.0625 01234 ReLU layers traversed

Forward scaling counts four inputs; backward scaling counts eight outputs in the unequal-width example below.

Read it this way: start each path at second moment one. Independent symmetric weights give a ReLU multiplier of fan-in times weight variance divided by two. Circles end at 1/16, squares at one, and triangles at 81/16. The vertical axis uses shared logarithmic spacing. Marker shapes also distinguish paths. Sources are Glorot and Bengio (2010) and He et al. (2015).
Check: Why does weight variance 2/fan-in preserve the illustrated ReLU second moment? What assumptions make that recurrence valid?
Read it this way: For symmetric, zero-centered inputs, ReLU discards half the expected squared signal. Equal halving at each layer compounds. Wider layers need smaller initial weights; ReLU’s lost half needs compensating weight scale. This preserves the expected second moment under independence assumptions, not every activation or gradient in a trained network. Can repeatedly losing half the second moment preserve its initial scale?

The variance argument

Let with and zero bias. At initialization, weights are mutually independent, zero-mean, symmetric, and independent of the inputs. Each input coordinate has finite second moment . Write . Cross terms vanish because distinct weights have zero expected product:

This expectation averages the initialized weights as well as the input law. It is not an exact guarantee for every sampled matrix. For zero-mean inputs, equals input variance.

Symmetry of makes each half-line contribute half its second moment. Therefore

Setting preserves this expected second moment: the He/Kaiming fan-in rule. For , variance gives multiplier one. Variances and give multipliers and .

ReLU outputs need not be centered. If is equally likely to be or , its ReLU second moment is . Its mean is and its centered variance is only .

Change the activation

Leaky ReLU passes negative inputs with slope . Under symmetry, it retains of the preactivation second moment. The preserving rule becomes

At , the activation is linear and this becomes . At and fan-in four, it gives . Recompute the activation factor rather than treating GELU or sigmoid as exact ReLU cases.

Change the path structure

Adding a centered branch to stream requires covariance accounting:

Independent unit-variance stream and branch give variance two when . If , the same addition gives variance four, not two. For mutually uncorrelated unit-variance branches, scaling each by makes their total added variance one. Correlated residual branches require their covariance terms; a serial-chain rule alone cannot justify that scaling.

Change the direction

The linear backward map uses , so its analogous independent-gradient calculation counts terms. With unequal widths, one variance cannot preserve both linear directions exactly. Glorot’s compromise is . For fan-in four and fan-out eight, gives forward factor and backward factor . Real backpropagated gradients can depend on weights; this scale argument is an initialization approximation.

Reconstruct: can a rectangular orthogonal map preserve all forward and backward vector norms?

Answer

No, not in both unequal-dimensional spaces. Orthonormal columns give , preserving every forward input norm. Orthonormal rows give , preserving the reverse direction instead. The other direction generally preserves only the corresponding subspace.

Practical defaults

ComponentStarting pointLimit to check
ReLU linear or convolutionHe scale in the intended fan directionCorrect connectivity and weight layout
Near-linear centered activationGlorot scaleSigmoid offsets and tanh saturation change propagation
GELUArchitecture-tested scaleIts second-moment factor depends on its input law
EmbeddingArchitecture-specific distributionVocabulary, width, scaling, and downstream normalization
Normalization affine parametersOften scale one, shift zeroResidual designs sometimes choose another scale
BiasOften zeroRecurrent gates and architectural offsets can justify nonzero values

Do not infer a framework default from an initializer’s name. Check its version, arguments, fan convention, and resulting bounds.

Special cases

Residual output scaling is architecture-specific; it depends on branch count and covariance, not only network depth. Embedding scales such as are model conventions, not universal variance laws. Identity initialization for ReLU recurrent networks changes recurrent products but does not remove temporal state. Orthogonal recurrent weights preserve a linear multiplication’s norm; nonlinear derivatives can still shrink gradients. Rectangular matrices need the row/column distinction above.

Common pitfalls

  • Balanced expected moments do not prove convergence or control every finite-width realization.
  • Nonzero bias changes preactivation symmetry; random weights, not zero bias alone, break neuron symmetry.
  • Normalization, optimizer state, residual correlations, and activation saturation lie outside the simple serial-chain calculation.
  • A training run succeeding does not establish the assumed propagation law or an optimal scale.