Foundations to Frontier
Tests
E. Deep Learning › E0 Core Concepts (concept pages)

Weight Initialization: Xavier/Glorot, He/Kaiming, Orthogonal, LSUV

How a network's weights are set before training decides whether signals and gradients survive the trip through its layers. Xavier (Glorot) initialisation chooses the weight variance to keep the variance of activations and gradients roughly constant for symmetric, near-linear activations such as tanh; He (Kaiming) initialisation doubles it to compensate for ReLU zeroing half its inputs; orthogonal initialisation uses rotation-like matrices whose singular values are all one; LSUV rescales each layer on real data until its outputs have unit variance. This page derives the variance rules, explains fan-in versus fan-out and normal versus uniform variants, covers orthogonal and data-dependent schemes and the role of biases, and connects initialisation to signal propagation theory. In the exercises you implement all four schemes and track activation variance through 50 layers, then compare how quickly 12-layer tanh and ReLU networks train from each.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Tuning the volume knobs before the concert

Before a concert, every amplifier in a long chain is set so the signal leaves each stage as loud as it entered. Set them too low and the music fades; too high and it distorts. Weight initialisation sets the volume of each layer, so that activations going forward and gradients going backward neither fade away nor blow up.

Initialisation: keeping signals alive through 50 layers
init:
after layer 1
after layer 10
after layer 25
after layer 50
mean square of activations, layer 1 → 50 (log scale)
mean square after layer 50: 9.69e-2
Histograms span −3 to 3. With ReLU, Xavier halves the mean square every layer, and by layer 50 everything sits in the spike at 0. He and √2-scaled orthogonal weights keep it of order 1, wandering by up to a decade because 64 units per layer is a small sample (try new weights). With tanh, Xavier lets the signal fade slowly toward 0, while He keeps it larger (mean square about 0.3), in a mildly chaotic regime. LSUV rescales each layer to unit variance on the batch itself, so it holds the profile flat for either activation.
Why engineers care

A wrong initialisation silently wastes compute: the network sits at chance or diverges, and the cause is not obvious from the code. Framework defaults are not always right for a custom architecture, for example a deep MLP for control or a new sensor-fusion block. Knowing the variance rules lets you set and check the initialisation deliberately.

📝 Quick check (Level 0)
0/3 answered
  1. 1. The goal of initialisation is to…
  2. 2. Initialising all weights to zero…
  3. 3. He initialisation is designed for…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The variance rules by hand

For z = Σᵢ wᵢxᵢ with independent zero-mean weights of variance σ² and n inputs, Var(z) = n σ² E[x²].

  • Xavier (Glorot, 2010). Keep the forward variance (needs nσ² = 1) and the backward variance (needs n_out σ² = 1) as a compromise: σ² = 2/(n_in + n_out). For a 100 → 300 layer that gives std √(2/400) ≈ 0.0707.
  • He (Kaiming, 2015). ReLU keeps only half of the second moment, so use σ² = 2/n_in. For fan-in 512, the std is √(2/512) = 0.0625.
  • Uniform versions. U(−a, a) has variance a²/3, so Glorot uniform uses a = √(6/(n_in + n_out)): ±0.1225 for 100 → 300.
  • Orthogonal. A random orthogonal matrix Q (with QᵀQ = I) has every singular value equal to 1, so it preserves norms exactly in a linear network. Multiply by a gain: √2 for ReLU.
  • LSUV (Mishkin and Matas, 2016). Start orthogonal, then for each layer in turn measure the output variance v on a batch and rescale the weights by 1/√v. If the output variance is 4, scale by 0.5.

Biases are usually initialised to 0. They do not affect variance at the start.

📝 Quick check (Level 1)
0/3 answered
  1. 1. He std for fan-in 200?
  2. 2. Xavier variance for a 50 → 50 layer?
  3. 3. LSUV scale for an output variance of 0.25?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 30 minUndergraduate students and practising engineers.

Tracking signals through 50 layers

Exercise 1. Mean square of the activations after layers 1, 10 and 50, for width 128 and batch 256:

activation scheme after layer 1 after layer 10 after layer 50
tanh Xavier 0.392 0.0543 0.00557
tanh He 0.518 0.318 0.303
tanh orthogonal 0.394 0.0524 0.0104
tanh LSUV 0.394 0.395 0.395
ReLU Xavier 0.498 0.000806 1.9 × 10⁻¹⁶
ReLU He 0.996 0.825 0.209
ReLU orthogonal (gain √2) 0.995 0.488 0.237
ReLU LSUV 0.497 0.425 0.447
  • Xavier is wrong for ReLU. It halves the mean square every layer, a factor of 2⁻⁵⁰ by layer 50.
  • He and gain-√2 orthogonal keep ReLU signals of order 1. Their slow drift is finite-width noise.
  • With tanh, Xavier and unit-gain orthogonal let the signal fade slowly. At this “critical” scale, tanh decays polynomially, not exponentially.
  • LSUV, which uses the data, held both activations flat.
nn.init.xavier_normal_(w)                          # tanh / sigmoid
nn.init.kaiming_normal_(w, nonlinearity="relu")    # ReLU (PyTorch's Linear default is kaiming_uniform with a=√5)
nn.init.orthogonal_(w, gain=nn.init.calculate_gain("relu"))
🐍 Exercise 1: four initialisation schemes
Implement Xavier, He, orthogonal (via QR) and LSUV initialisation, and track the mean square of activations through 50 tanh and ReLU layers.
📝 Quick check (Level 2)
0/3 answered
  1. 1. With Xavier and ReLU, the mean square per layer…
  2. 2. Which scheme uses data to set the scales?
  3. 3. The gain for orthogonal weights with ReLU is…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Signal propagation (mean-field) theory. For wide networks, the pre-activation variance q_l follows a deterministic map q_l = σ_w² E[φ(√q_(l−1) z)²] + σ_b² (Poole et al., 2016; Schoenholz et al., 2017).

  • Correlations between inputs evolve too. The order–chaos boundary, where χ = σ_w² E[φ′(·)²] = 1, is the edge of chaos.
  • At it, gradients neither vanish nor explode, and the depth over which information propagates diverges.
  • For tanh with zero bias, the critical point is σ_w² = 1 (Xavier), where q_l → 0 slowly, which is the fade seen in exercise 1.
  • For ReLU the critical point is σ_w² = 2 (He).

Orthogonal and dynamical isometry. Orthogonal weights make every singular value of the linear part equal to 1. With tanh near the critical point, this gives well-conditioned input–output Jacobians and much faster training of very deep networks (Saxe et al., 2014; Pennington et al., 2017). Xiao et al. (2018) trained 10 000-layer CNNs this way.

Practical details.

  • Fan-in mode preserves forward signals; fan-out mode preserves backward gradients.
  • Residual networks often zero-initialise the last layer of each block (Fixup, “zero-γ”), so blocks start as the identity.
  • Transformers scale residual branches by about 1/√(2L).

Interview questions.

  • Why not initialise all weights to the same value? Every unit in a layer would compute the same function and receive the same gradient, and that symmetry is never broken.
  • When does initialisation matter less? With normalisation layers or residual connections, which repair scale problems. It still affects early training and stability.
📝 Quick check (Level 3)
0/3 answered
  1. 1. The edge of chaos for ReLU networks is at σ_w² =…
  2. 2. Zero-initialising the last layer of each residual block makes the block start as…
  3. 3. Fan-out mode aims to preserve…

Level 4: Expert

★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.

Does the initialisation change how fast networks train?

History.

  • Y. LeCun et al. (1998) recommended weights of variance 1/fan-in.
  • X. Glorot and Y. Bengio (2010) introduced Xavier initialisation.
  • A. Saxe, J. McClelland and S. Ganguli (2014) introduced orthogonal initialisation and exact learning dynamics.
  • K. He et al. (2015) introduced initialisation for ReLU.
  • D. Mishkin and J. Matas (2016) introduced LSUV.
  • B. Poole et al. (2016) and S. Schoenholz et al. (2017) developed the edge-of-chaos theory.

Exercise 2. Twelve-layer, width-32 networks on two moons (128 points), trained with full-batch SGD at learning rate 0.05 for 150 steps. Two seeds per setting.

activation initialisation mean final loss runs reaching 95% accuracy final losses per seed
tanh Xavier 0.220 0 of 2 0.225, 0.215
tanh He 0.005 2 of 2 0.006, 0.005
tanh orthogonal 0.232 0 of 2 0.239, 0.225
tanh LSUV 0.008 2 of 2 0.009, 0.008
ReLU Xavier 0.404 1 of 2 0.543, 0.265
ReLU He 0.006 2 of 2 0.008, 0.005
ReLU orthogonal (gain √2) 0.067 2 of 2 0.003, 0.130
ReLU LSUV 0.086 2 of 2 0.106, 0.067
  • Xavier crippled the 12-layer ReLU network, as exercise 1 predicted: its losses were 40–100 times those of He.
  • For ReLU, He, gain-√2 orthogonal and LSUV all trained reliably.
  • For tanh, the “textbook” Xavier and unit-gain orthogonal were slow. None reached 95% within 150 steps, while He and LSUV did in every run. At the critical scale tanh signals fade slowly, and slightly larger weights gave larger, more useful gradients at this fixed learning rate. Xavier is not wrong for tanh, but it is not the fastest choice here.
  • LSUV was good for both activations, because it adapts to whatever activation and data it is given.
🐍 Exercise 2 (research): initialisation and training speed
Train 12-layer tanh and ReLU networks on two moons from Xavier, He, orthogonal and LSUV initialisations, and compare final losses and how many runs solve the task.

Initialisation in AI, robotics and aerospace

  • Custom architectures: new fusion or control networks built from scratch need deliberate initialisation. Check activation statistics on real sensor data, as LSUV does.
  • Fine-tuning: pretrained weights replace initialisation for most layers. New heads are initialised small, so they do not disturb the pretrained features.
  • Reproducibility: fixed seeds and documented schemes are part of a traceable training pipeline for certified systems.

References

  1. X. Glorot, Y. Bengio (2010). “Understanding the difficulty of training deep feedforward neural networks.” Proc. AISTATS.
  2. K. He, X. Zhang, S. Ren, J. Sun (2015). “Delving deep into rectifiers.” Proc. ICCV.
  3. A. M. Saxe, J. L. McClelland, S. Ganguli (2014). “Exact solutions to the nonlinear dynamics of learning in deep linear neural networks.” Proc. ICLR.
  4. D. Mishkin, J. Matas (2016). “All you need is a good init.” Proc. ICLR.
  5. S. S. Schoenholz, J. Gilmer, S. Ganguli, J. Sohl-Dickstein (2017). “Deep information propagation.” Proc. ICLR.