# Xavier initialization (2010)

> Why deep networks were hard to train, and a way to set the starting weights so signals neither vanish nor explode.

Page: https://mralbu.github.io/ai-datasets/p/xavier-init

## Key facts

- Title: Understanding the difficulty of training deep feedforward neural networks
- Authors: Xavier Glorot, Yoshua Bengio
- Venue: AISTATS 2010
- Category: Foundations
- Paper: https://proceedings.mlr.press/v9/glorot10a.html

## Why it matters

In 2010, deep networks were usually pretrained one layer at a time before they would train at all. This paper explained why and showed that a better starting point helps. Xavier (or Glorot) initialization became the default in deep learning frameworks, and its adaptation for ReLU units by Kaiming He in 2015 is what ResNets use.

## The idea

Watch the activations and gradients layer by layer during training. With the usual small random weights, their size shrinks or grows from layer to layer, and sigmoid units saturate. Choosing each layer's random weights with a variance based on its number of inputs and outputs keeps that size roughly constant through the network, forward and backward.

## The result

With this "normalized initialization", networks with five hidden layers trained faster and generally reached lower test error, on MNIST and CIFAR-10 as well as on the synthetic shapes, without any layer-by-layer pretraining.

## The data

- [MNIST (1998)](https://mralbu.github.io/ai-datasets/d/mnist.md): 70,000 handwritten digits, 28×28 grayscale, 10 classes.
- [CIFAR-10 (2009)](https://mralbu.github.io/ai-datasets/d/cifar10.md): 60,000 tiny 32×32 color images in 10 classes.
- Also tested on: A synthetic shape dataset (Shapeset-3×2) and a small subset of ImageNet.

## Part of

- [Making deep networks trainable](https://mralbu.github.io/ai-datasets/t/deep-nets-trainable.md) (step 2 of 7)
