3
$\begingroup$

The aim of weight initialization is to prevent layer activation outputs from exploding or vanishing during the course of a forward pass through a deep neural network

I am really having trouble understanding weights initialization technique and Xavier Initialization for deep neural networks (DNNs).

In simple words (and maybe with an example), what is the intuition behind the Xavier initialization for DNNs? When should we use Xavier's initialization?

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Weight initialization is one of the most critical factors for successfully training a deep neural network. This explanation by deeplearning.ai is probably the best that one could give for the need for initializing a DNN with Xavier initialization. Here is what it talks about in a nutshell:

The problem of exploding and vanishing gradients has been long-standing in the DL community. Initialize all the weights as zeros and the model learns identical features across all hidden layers, initialize random but large weights and the backpropagated gradients explode, initialize random but small weights and gradients vanish. The intuition is aptly captured by this simple mathematical observation: $1.1^{50} = 117.390$, while at the same time, $0.9^{50} = 0.00515$. Note that the difference between the two numbers is just $0.1$ but it has a tremendous effect when multiplied repeatedly! A typical NN is a series of function compositions involving weight matrices and linear/non-linear activation functions. When stripped to a bare minimum, it essentially is a series of matrix multiplications. Therefore, the way in which the elements of these weight matrices are initialized plays a major role in how the network learns.

The standard weight initialization methods come into the picture here. They reinforce what are the de-facto rules of thumb when it comes to weight initializations: (1) the mean of the activations should be zero, and (2) the variance of these activations across all the layers should be the same.

Note: The link given above has complete mathematical justification for why Xavier initialization works, along with an interactive visualization for the same.

$\endgroup$
1
  • $\begingroup$ But even with Xavier initialization we can have vanishing gradients. For example in a FC with 10 layers and 1 neuron per layer, each neuron will be initialized from $\mathcal{N} (0, 1)$. These numbers can still be small, and as such their product $0.5^{10}$ can also be small. $\endgroup$
    – ado sar
    Commented Jun 13, 2023 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .