Skip to content
AI.info

Neural networks

Initialization and the Scale of Signals

Understand symmetry breaking, variance-preserving initialization, activation-aware scaling, bias choices, and reproducible initialization diagnostics.

By the end you can

The first forward pass already reveals architecture health

Initialization sets the starting function. No example has changed a parameter yet. Poor scale can make activations vanish, saturate, or explode across depth.

A first-batch diagnostic should inspect activation means, standard deviations, zero fractions, and gradient norms. Waiting for several failed epochs wastes evidence available immediately.

Every failure in this lesson was decided before the first update. A 30-layer rectifier network that never starts learning. A detector that diverges on its first attempt. A 1.82-point spread in final accuracy produced by nothing but the random seed. None of them is a bug in the training loop. Each is a choice about the scale or the distribution of the initial parameters.

Initialization is part of model design, not random housekeeping.

Case

A 30-layer network stalled entirely under the wrong initialization

One 30-layer rectifier network was trained twice, changing nothing but how its weights were drawn. Under a fan-in-based rule it converged. Under the Xavier rule it never started: “the ‘Xavier’ method completely stalls the learning, and the gradients are diminishing as monitored in the experiments”. He and three co-authors reported both runs in 2015.

At 22 layers the same two rules were indistinguishable. Xavier finished at 33.90/13.44 top-1/top-5 error, the fan-in rule at 33.82/13.34 — about a tenth of a point apart. That is exactly why a scale problem can pass every shallow test. The same paper reports 4.94% top-5 error on ImageNet 2012, and notes that its own 30-layer model, at 38.56/16.59, was worse than the shallower one.

Figure

The two rules are indistinguishable at 22 layers and one of them has no result at all at 30 — a scale problem passes every shallow test before it appears. He, Zhang, Ren and Sun, ICCV 2015; the gaps are derived from the published pairs.

Key idea

Why all-zero weights fail in hidden layers

If two hidden units begin with identical incoming and outgoing conditions, they receive identical gradients and remain copies. The layer then behaves as though those units were one.

Random initialization breaks this symmetry. Biases can often start at zero because distinct random weights already separate the units. That is why the frameworks can disagree about the bias default without either of them being broken.

Symmetry breaking requires different parameter paths, not random numbers everywhere.

Visual

Variance propagation across a deep stack

Initialization rules choose weight scale from the number of incoming and sometimes outgoing connections. The rule now shipped in every framework was derived by measuring this chain as it broke.

The standard draw at the time was W ~ U[-1/sqrt(n), 1/sqrt(n)], scaled from the fan-in alone. In 2010 Glorot and Bengio replaced it with what they called the normalized initialization, W ~ U[-sqrt(6)/sqrt(n_j+n_{j+1}), +sqrt(6)/sqrt(n_j+n_{j+1})]. The scale now comes from the fan-in and the fan-out together. Then they measured the per-layer quantity the stages below multiply: the average singular value of each layer's Jacobian at initialization. “With our normalized initialization, this ratio is around 0.8 whereas with the standard initialization, it drops down to 0.5.”

That is the whole of the depth problem in two numbers. A per-layer factor near 0.8 is survivable for a long way down the stack. A factor of 0.5 is a halving repeated once per layer, in both directions.

FigureProcess · 5 steps
  1. 1

    Input variance

    Data or normalized activations enter with a characteristic scale.

  2. 2

    Weighted sum

    Fan-in and weight variance determine pre-activation scale.

  3. 3

    Activation response

    The nonlinearity changes mean and variance.

  4. 4

    Next layer

    Repeated imbalance can shrink or grow signals exponentially.

  5. 5

    Backward path

    Related scaling affects gradient propagation in reverse.

Comparison

Common initialization families

The names are less important than the assumptions they encode — and each family is a published result with a measurement attached, not a preference.

Xavier / Glorot is the 2010 rule above, and it ships today unchanged. PyTorch's xavier_uniform_ draws from a symmetric interval with a = gain * sqrt(6/(fan_in+fan_out)), and Keras's GlorotUniform uses limit = sqrt(6 / (fan_in + fan_out)). The paper's own table records what the change bought on a 5-hidden-layer tanh network: test error from 27.15% to 15.60% on Shapeset-3x2, and from 55.9% to 52.92% on CIFAR-10.

He / Kaiming is the rectifier-aware rule from the 30-layer experiment above. Its mode is a choice of which direction to protect, and PyTorch states the trade in its own documentation for kaiming_uniform_: “Choosing 'fan_in' preserves the magnitude of the variance of the weights in the forward pass. Choosing 'fan_out' preserves the magnitudes in the backwards pass.”

Orthogonal initialization is not folklore either. Saxe and two co-authors derived it for deep linear networks in 2013, and their abstract states: “We further exhibit a new class of random orthogonal initial conditions on weights that, like unsupervised pre-training, enjoys depth independent learning times.” A 2017 paper then computed the full singular-value spectrum of the input-output Jacobian and found the limit of the idea. ReLU networks cannot achieve dynamical isometry at all, while “sigmoidal networks can achieve isometry, but only with orthogonal weight initialization” — and isometric networks learn “orders of magnitude faster”. PyTorch ships the draw as torch.nn.init.orthogonal_, which will “Fill the input Tensor with a (semi) orthogonal matrix”, citing Saxe (2013). It is a structural constraint with a known scope, not a universal replacement.

FigureComparison · 3 columns

Xavier / Glorot

Balances fan-in and fan-out for roughly symmetric activations.

  • Designed for variance preservation
  • Often paired with tanh-like responses
  • Several uniform or normal variants
  • Check framework fan convention

He / Kaiming

Uses rectifier-aware scaling based primarily on fan-in or fan-out.

  • Accounts for ReLU zeroing
  • Common in deep rectifier networks
  • Mode depends on forward or backward goal
  • Gain changes with activation slope

Orthogonal or specialized

Imposes matrix structure or architecture-specific scaling.

  • Useful in recurrent or residual settings
  • May preserve norms in selected dimensions
  • Not a universal replacement
  • Still requires empirical checks

Example

Parameters that deserve special treatment

Not every trainable tensor should use the same random distribution. For two of these, the published record is a training run that failed until the initial value was changed.

  • Bias vectors often start at zero, but the two dominant frameworks disagree by default. Keras's Dense takes bias_initializer="zeros" alongside kernel_initializer="glorot_uniform". PyTorch's nn.Linear gives the bias the same draw as the weight — both “initialized from U(-sqrt(k), sqrt(k)), where k = 1/in_features” — so its default bias is not zero at all. Gates or output priors may justify deliberate offsets on top of either.
  • Embedding tables usually use small random values whose scale should match downstream normalization.
  • Normalization gains commonly start near one and offsets near zero.
  • Residual branches may use a final scale near zero so the block begins close to identity, and two independent groups showed what that buys. Fixup, published in 2019, rescales a standard initialization and removes the normalization layers entirely. Its abstract reports: “We find training residual networks with Fixup to be as stable as training with normalization -- even for networks with 10,000 layers.” ReZero, published in 2021, gates each residual connection with a single zero-initialized parameter. It trains thousands of fully connected layers and 120-layer Transformers, and converges 56% faster on enwiki8 at 12 layers.
  • Output heads can encode known class priors through initial biases, and omitting one has sunk a detector. RetinaNet's own paper reports the failure and the fix in one paragraph: “Our first attempt to train RetinaNet uses standard cross entropy (CE) loss without any modifications to the initialization or learning strategy. This fails quickly, with the network diverging during training. However, simply initializing the last layer of our model such that the prior probability of detecting an object is pi = .01 (see §4.1) enables effective learning.” That single changed bias already gave 30.2 AP on COCO with a ResNet-50. The constant is reproduced in Keras's official RetinaNet example as tf.constant_initializer(-np.log((1 - 0.01) / 0.01)).

A seed supports comparison but does not define quality

Fixing a random seed makes one initialization reproducible under a controlled software and hardware stack. Reproducing a number is not the same as trusting it. A fixed seed does not show that a result is robust to other initial conditions.

One experiment put a figure on that. A ResNet-9 was trained on CIFAR-10 under the first 10,000 seeds, with nothing else changed. David Picard reported the spread in 2021: “The interesting values of this test are the minimum and maximum accuracy among all run (obtained at the end of training), which is this case go from 89.01% to 90.83%, that is, a 1.82% difference.” Table 1 of the same paper gives 500 longer runs at 90.70 ± 0.20, with a minimum of 90.14 and a maximum of 91.41. A 1.82-point improvement is publishable in many venues. Here it is available for free, from the seed alone.

The seed is not even the largest source. A study of five deep-learning tasks, presented at MLSys 2021 by Bouthillier and 16 co-authors, concluded that “most evaluations focus on the effect of random weight initialization, which actually contribute a small part of the variance”. Their first recommendation is the opposite of fixing it: “randomize as many sources of variations as possible in the performance estimation”. Compare several seeds for unstable or high-stakes experiments, and report the selection rule so favorable runs are not mistaken for typical behavior.

And a fixed seed does not by itself buy back the run. PyTorch opens its own page on reproducibility with a disclaimer: “Completely reproducible results are not guaranteed across PyTorch releases, individual commits, or different platforms. Furthermore, results may not be reproducible between CPU and GPU executions, even when using identical seeds.” NVIDIA names the cuDNN kernels that are nondeterministic on identical hardware — cudnnConvolutionBackwardFilter with ALGO_0 or ALGO_3, cudnnConvolutionBackwardData with ALGO_0, cudnnPoolingBackward with CUDNN_POOLING_MAX, cudnnSpatialTfSamplerBackward and cudnnCTCLoss. They use atomic operations that introduce truly random floating-point rounding errors. NVIDIA also states flatly that “Across different architectures, no cuDNN routines guarantee bitwise reproducibility.” Most of the nondeterministic list is the backward pass, which is the half the seed was supposed to pin down.

Analogy

Setting microphone gain before recording

Microphone gain is set before a live recording. Too low loses quiet detail; too high clips the signal before later processing can recover it.

A network has many interacting layers and a backward signal, not one gain stage. Healthy scale must support both directions.

How far initialization alone can carry depth was settled at ten thousand layers. No residual connections. No normalization layers. Xiao and four co-authors reported it at ICML 2018: they “demonstrate that it is possible to train vanilla CNNs with ten thousand layers or more simply by using an appropriate initialization scheme”. Their condition is explicitly two-directional. It is dynamical isometry, “the equilibration of singular values of the input-output Jacobian matrix”. That requires the convolution operator to be norm-preserving.

The aim is usable dynamic range, not one magical distribution.

Steps

An initialization preflight

Test the untrained network before launching a long run.

Step 1 is not a formality. Every rule here depends on fan-in and fan-out, and those are defined against a tensor layout that may not be the one in your head. PyTorch says so in a Note under kaiming_uniform_ in torch.nn.init: “Be aware that fan_in and fan_out are calculated assuming that the weight matrix is used in a transposed manner, (i.e., x @ w.T in Linear layers, where w.shape = [fan_out, fan_in]). This is important for correct initialization.” The frameworks also disagree about what you get if you never call an initializer at all. Keras's Dense defaults to kernel_initializer="glorot_uniform" with bias_initializer="zeros". PyTorch's nn.Linear draws both weight and bias from U(-sqrt(k), sqrt(k)) with k = 1/in_features.

Step 5 is the one the seed section quantifies: 10,000 seeds of one ResNet-9 spanned 89.01% to 90.83% with nothing else changed. A single run tells you about a starting point, not about a design.

FigureProcess · 5 steps
  1. 1. Verify fan convention

    Confirm tensor orientation and the library’s definition of fan-in and fan-out.

  2. 2. Match the activation

    Choose gain or variance for the actual nonlinear response.

  3. 3. Run representative inputs

    Inspect layer-wise pre-activation and activation statistics.

  4. 4. Backpropagate one loss

    Check gradient norms, zeros, and non-finite values across depth.

  5. 5. Repeat across seeds

    Distinguish a stable design from a lucky starting point.

Key takeaways