# How does a batch normalization layer work?

I understood that we normalize to input features in order to bring them on the same scale so that weights won't be learned in arbitrary fashion and training would be faster.

Then I studied about batch-normalization and observed that we can do the normalization for outputs of the hidden layers in following way:

Step 1: normalize the output of the hidden layer in order to have zero mean and unit variance a.k.a. standard normal (i.e. subtract by mean and divide by std dev of that minibatch).

Step 2: rescale this normalized vector to a new vector with new distribution having $$\beta$$ mean and $$\gamma$$ standard deviation, where both $$\beta$$ and $$\gamma$$ are trainable.

I did not understand the purpose of the second step. Why can't we just do the first step, make the vector standard normal, and then move forward? Why do we need to rescale the input of each hidden neuron to an arbitrary distribution which is learned (through beta and gamma parameters)?

Definition and Explaination

For how Batch Normalization works exactly, I'll suggest you to read the following papers:

The recent interpretation on How BN works is that it can reduce the high-order effect as mentioned in Ian Goodfellow's lecture. So it's not really about reducing the internal covariate shift.

Intuition

For how it works intuitively, you can think that we want to normalize the intermediate outputs (zero mean and unit variance) if the normalization won't remove too much useful information.

However, normalization may not be suitable for all intermediate outputs. So $$\beta$$ and $$\gamma$$ is introduced to provide additional flexibility, if normalization removes too much useful information then $$\beta$$ and $$\gamma$$ will learn to become the original mean and variance, making the BN layer an identity transformation, as if it doesn't exist.

In practice, $$\beta$$ and $$\gamma$$ won't become the original mean and variance, since all intermediate outputs can be normalized in some certain way without losing too much useful information. So you can think of it to be a customized normalization for each BN layer.

tl;dr

BN layer normalize the intermediate outputs in default, however, if the neural network find out that these intermediate outputs should not be normalized, then the neural network undos or provide more flexibility to the normalization.

• What is the "high-order effect"? – nbro Dec 24 '19 at 21:39
• @nbro You can see Ian Goodfellow's lecture or this post. It's mainly about the high-order interactions. – J3soon Dec 26 '19 at 8:46
• It's funny because the post doesn't actually explain how high order terms interact with normalized vs not. Only staying that it does. – FourierFlux Sep 19 at 14:49