5
$\begingroup$

The traditional approach to batch normalization is to estimate the mean and variance from the batch and use it to normalize the data at different layers, while keeping moving averages that you should later use at test/prediction time. My question is, wouldn't it be better to use the moving averages at training time too?

Of course, it would be worse at the very beginning, but if you use, for example, an exponential moving average with a small initial decay (you can increase it later) the moving average will be okay after a few mini-batches. And then, if you get a mini-batch that, just by chance, is further than usual from the average, wouldn't you rather train using the same average that you'll have at test time?

The extreme case would obviously be an online learning setup with one example per batch; basically every single example would turn to zero at training time, but not at test time.

$\endgroup$
1
  • $\begingroup$ I was thinking exactly the same. I don't know if there would be a down side to that. It seems that especially when you have small batches training with the batch statistics and then testing with the training set statistics is not a good idea. $\endgroup$
    – Chrigi
    Oct 8, 2017 at 19:55

1 Answer 1

8
$\begingroup$

There is a follow-up paper by Sergej Ioffe (i.e. Batch Renormalization) which discusses this issue:

https://arxiv.org/abs/1702.03275

A quote from that paper regarding regular batch normalization:

It is natural to ask whether we could simply use the moving averages $\mu, \sigma$ to perform the normalization during training, since this would remove the dependence of the normalized activations on the other example in the mini-batch. This, however, has been observerd to lead to the model blowing up. As argued in [6, the original batch norm paper], such use of moving averages would cause the gradient optimization and the normalization to counteract each other.

In that paper the this issue is fixed by introducing an additional affine transformation from the batch statistics to the moving average statistics, the coefficients of which are treated as constants by the optimisation. With this change the moving average can be used both during training and testing time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.