Quant Memo
Core

He (Kaiming) Initialization

ReLU zeroes out roughly half of every layer's outputs, so a weight scheme that keeps signal variance stable through a tanh network quietly halves it through a ReLU network unless the variance is doubled to compensate.

Prerequisites: Xavier/Glorot Initialization

Xavier initialization keeps a layer's output variance equal to its input variance — but that derivation assumes the activation function is roughly symmetric around zero, like tanh. ReLU isn't: it clips every negative input to exactly zero, discarding about half the signal outright. Plug Xavier's weight scale into a ReLU network and each layer's surviving variance is roughly halved, compounding into a signal that vanishes within a dozen layers. He (Kaiming) initialization fixes this with one change: double the variance to make up for what ReLU throws away.

The analogy: a filter that blocks half the light

Imagine light passing through a chain of one-way filters, each one blocking every ray coming from below a certain angle — roughly half the incoming light, on average, for a filter facing a random scene. If you want the same brightness on the far side of ten stacked filters as you started with, each filter needs to inject roughly twice the light it's given, because half is discarded at each stage. ReLU is that filter: it passes positive values through unchanged and blocks every negative value completely. He initialization is the "inject twice as much" correction, computed exactly rather than guessed.

The formula

For a layer with ninn_{in} inputs feeding a ReLU activation, He initialization draws weights with mean 0 and variance:

Var(W)=2nin\text{Var}(W) = \frac{2}{n_{in}}

In words: this is Xavier's variance formula (which used 2/(nin+nout)2/(n_{in}+n_{out}), roughly 1/nin1/n_{in} for equally-sized layers) with an extra factor of 2 built in, and using only fan-in rather than the average of fan-in and fan-out — the correction is applied at the point where the signal is actually halved, going into the ReLU, not spread across both directions.

Worked example 1: comparing the two schemes at the same layer size

A layer with nin=500n_{in} = 500. Xavier (assuming nout=500n_{out} = 500 too) gives variance 2/1000=0.0022/1000 = 0.002, standard deviation 0.045\approx 0.045. He gives variance 2/500=0.0042/500 = 0.004, standard deviation 0.063\approx 0.063 — about 2\sqrt{2} times larger. That factor of 2\sqrt{2} in standard deviation (factor of 2 in variance) is precisely what's needed to offset ReLU zeroing out half the units on average.

Worked example 2: what happens if you use Xavier weights with ReLU anyway

Take a 20-layer ReLU network where each layer has nin=200n_{in} = 200, using Xavier's variance 2/400=0.0052/400 = 0.005 instead of He's 2/200=0.012/200 = 0.01. Per layer, the expected output variance multiplier is roughly nin×Var(W)×12n_{in} \times \text{Var}(W) \times \tfrac{1}{2} (the 12\tfrac12 from ReLU zeroing half the units): with Xavier that's 200×0.005×0.5=0.5200 \times 0.005 \times 0.5 = 0.5 — variance is cut in half at every layer. After 20 layers, the surviving variance has shrunk by 0.5200.000000950.5^{20} \approx 0.00000095, essentially zero: the signal has vanished before training starts. With He's variance the same calculation gives 200×0.01×0.5=1.0200 \times 0.01 \times 0.5 = 1.0 per layer — variance stays flat across all 20 layers.

Distribution · normal
-0.130.000.13μvalue →
Within ±1σ 68.3%mean μ 0.00std σ 0.06

layer depth (1 to 20), ReLU network He: flat Xavier under ReLU: vanishes
He initialization's extra factor of 2 exactly offsets the variance ReLU discards at each layer; using Xavier's smaller variance under ReLU lets signal decay to near-zero within a moderate depth.

He (Kaiming) initialization uses Var(W)=2/nin\text{Var}(W) = 2/n_{in} — Xavier's scale doubled and based on fan-in alone — to compensate for ReLU zeroing out roughly half the signal at every layer, keeping variance stable through deep ReLU networks.

What this means in practice

He initialization is the default for any network using ReLU or its close relatives (Leaky ReLU, ReLU6) and is built into every major framework (nn.init.kaiming_normal_ in PyTorch, with a mode argument choosing fan-in or fan-out). It matters most in networks without normalization layers — batch norm or layer norm partially re-corrects variance drift on their own, which is why deep, unnormalized ReLU networks with the wrong initializer are the cases where this bites hardest, often showing up as a network that simply never starts learning.

The common confusion is treating He and Xavier as interchangeable "good enough" defaults regardless of activation function. They target the same underlying problem — keeping variance stable across layers — but ReLU changes the amount of signal actually surviving each layer, so the correct constant depends on the activation. Using Xavier with ReLU, or He with tanh (where it over-corrects and makes signal grow), reintroduces exactly the instability both schemes were designed to eliminate.

Related concepts

Practice in interviews

Further reading

  • He, Zhang, Ren & Sun, Delving Deep into Rectifiers (2015)
ShareTwitterLinkedIn