On Batch Normalisation for Approximate Bayesian Inference

Jishnu Mukhoti, Puneet K. Dokania, Philip Torr, Yarin Gal

TL;DR

Batch Normalisation (BN) can be safely integrated into standard Bayesian variational inference without shifting the Evidence Lower Bound (ELBO) optimum. However, treating BN's mini-batch sampling noise as an approximate posterior (Monte Carlo Batch Normalisation, or MCBN) fails as mini-batch sizes grow: epistemic uncertainty collapses to zero, leaving the model blind to out-of-distribution data.

What Problem Does This Paper Address?

Reliable uncertainty quantification is essential when deploying deep neural networks in safety-critical domains like autonomous driving and medicine. In Bayesian deep learning, exact posterior inference over weights is intractable, so researchers rely on variational inference (VI)—optimizing an approximating distribution $q_\phi(\theta)$ by maximizing the Evidence Lower Bound (ELBO).

Following the success of Monte Carlo (MC) Dropout, prior work proposed Monte Carlo Batch Normalisation (MCBN), claiming that the stochasticity of mini-batch statistics in BN layers could similarly serve as approximate Bayesian inference. This paper asks two foundational questions:

  1. Does standard batch normalisation break traditional VI objectives like Mean-Field VI or MC Dropout?
  2. Does MCBN hold up as a valid approximate inference framework across practical training settings (specifically, varying batch sizes)?

Methods

  • Theoretical Analysis of the ELBO with BN: The authors analyze the ELBO computed using mini-batch statistics against the full-dataset ELBO. By the law of large numbers, running mini-batch statistics converge to true population statistics in expectation, ensuring that the mini-batch ELBO remains an unbiased estimator of the full-batch ELBO.
  • Stochastic Forward Passes (MCBN): At test time, networks keep BN in training mode. Predictions are formed by running $T=20$ stochastic forward passes, each using a randomly sampled training mini-batch to supply the BN layer statistics $(\mu_B, \sigma^2_B)$.
  • Epistemic Uncertainty Metric: Model uncertainty is measured using the Mutual Information (MI) between the predictive distribution and the posterior parameter distribution.
  • Variational Re-framing: The authors propose that to theoretically patch MCBN, the mini-batch size itself must be treated as a variational parameter (akin to the dropout rate in MC Dropout).

Datasets

The authors evaluated epistemic uncertainty on standard benchmark image classification pairs:

  • In-distribution: CIFAR-10 and Fashion-MNIST.
  • Out-of-Distribution (OOD): SVHN (paired with CIFAR-10) and MNIST (paired with Fashion-MNIST).

Evaluations used ResNet-50 and VGG-16 architectures across mini-batch sizes ranging from 32 to 2048. No new datasets were introduced.

Key Insights and Ideas

  • Standard VI is unaffected by BN: Introducing batch normalisation into existing Bayesian neural networks (e.g., Bayes by Backprop or MC Dropout) does not alter the optimum of the ELBO.
  • The Law of Large Numbers breaks MCBN: In MCBN, posterior randomness stems solely from mini-batch statistics. As mini-batch sizes grow, sample means and variances converge to fixed population statistics. In the limit (batch size = dataset size), the network becomes entirely deterministic.
  • Epistemic uncertainty collapses: Because variance vanishes with larger batches, MCBN produces near-zero epistemic uncertainty precisely when it should be high (e.g., on out-of-distribution inputs).
  • Batch size is not just a compute knob in MCBN: If mini-batch statistics parameterize the posterior distribution, mini-batch size directly controls posterior variance. Therefore, batch size must be treated as a variational parameter tuned to maximize the ELBO, rather than chosen arbitrarily based on hardware capacity.

Key Results

  • Classification accuracy is invariant to batch size: Models trained on CIFAR-10 (ResNet-50) maintained high test accuracy across batch sizes (93.66% at $B=32$ to 95.45% at $B=512$). Fashion-MNIST accuracies remained stable across all batch sizes up to 2048 (~93.4% to 93.9% on ResNet-50; ~94.3% to 94.8% on VGG-16).
  • Mutual Information collapses: Despite stable accuracy, mutual information dropped precipitously as batch size increased:
  • On ResNet-50 trained on CIFAR-10, MI dropped significantly between batch sizes 32 and 512.
  • On Fashion-MNIST (both ResNet-50 and VGG-16), MI on both in-distribution and OOD (MNIST) data dropped to near 0 at batch sizes 1024 and 2048.
  • Loss of OOD discriminability: At large batch sizes, the gap in mutual information between in-distribution and OOD test sets vanished entirely, rendering the model incapable of detecting unfamiliar data.

Limitations and Future Work

  • Asymptotic scaling dilemmas: As the total dataset size $N \to \infty$, a parametric model's epistemic uncertainty should shrink to zero. For MCBN's uncertainty to shrink appropriately, batch size must also grow toward infinity ($B \to \infty$). However, tying batch size to asymptotic guarantees is computationally impractical.
  • Experimental constraints: Due to compute constraints, the authors could not evaluate ResNet-50 on CIFAR-10 with batch sizes 1024 and 2048.
  • Open implementation: The paper provides the conceptual fix (treating batch size as a variational parameter tuned via grid search or optimization), but leaves developing practical, scalable algorithms based on this insight to future work.

Summary updated

BibTeX
@inproceedings{mukhoti2020batch,
  author = {Jishnu Mukhoti and Puneet K. Dokania and Philip Torr and Yarin Gal},
  title = {{On Batch Normalisation for Approximate Bayesian Inference}},
  booktitle = {AABI},
  year = {2020},
  url = {https://openreview.net/forum?id=SH2tfpm_0LE},
}
Figure