Data augmentation in Bayesian neural networks and the cold posterior effect

Seth Nabarro, Stoil Ganev, Adrià Garriga-Alonso, Vincent Fortuin, Mark van der Wilk, Laurence Aitchison

Abstract

Bayesian neural networks that incorporate data augmentation implicitly use a “randomly perturbed log-likelihood [which] does not have a clean interpretation as a valid likelihood function” (Izmailov et al., 2021). This paper investigates whether the "Cold Posterior Effect" (CPE)—the phenomenon where Bayesian Neural Networks (BNNs) perform better when their posterior is artificially sharpened—is simply an artifact of how we handle data augmentation. By developing principled, mathematically valid likelihoods for data augmentation, the authors demonstrate that the CPE persists, effectively falsifying the hypothesis that it is merely a side effect of "unprincipled" augmentation.

Introduction

Bayesian Neural Networks (BNNs) offer a mathematically rigorous framework for uncertainty quantification. However, a persistent anomaly known as the "Cold Posterior Effect" (CPE) has challenged the standard Bayesian paradigm. In practice, BNNs often achieve superior predictive performance when the posterior distribution is tempered by a factor $1/T$ where $T < 1$, effectively "cooling" the distribution to make it more peaked. This contradicts standard Bayesian theory, which prescribes $T=1$.

One prominent hypothesis suggested that the CPE is an artifact of Data Augmentation (DA). Standard DA techniques, such as random cropping or flipping, lack a rigorous interpretation as valid likelihood functions. Critics argued that if BNNs were trained using principled likelihoods that correctly account for the dependencies introduced by DA, the need for a cold posterior might vanish. This study rigorously tests this hypothesis by constructing BNNs with valid DA likelihoods.

Principled Data Augmentation Likelihoods

The authors propose several methods to integrate DA into BNNs using valid likelihood functions. Rather than treating each augmented image as an independent data point—which is technically incorrect as they share labels and source data—they define the likelihood as an average over the "orbit" of all possible augmentations of an image.

Two primary strategies for computing this average are explored:

  1. Averaging Logits: Computing the average of the raw neural network outputs.
  2. Averaging Probabilities: Computing the average of the softmax outputs (predictive probabilities).

To address the computational challenge of averaging over infinite orbits (e.g., all possible rotations), the authors derive tight multi-sample lower bounds using Jensen’s inequality. Furthermore, they introduce a "Finite Orbit" setting where the number of possible augmentations is restricted to a small, fixed set. This allows for the calculation of the exact log-likelihood, eliminating approximation errors as a potential source of the CPE.

Figure 3: Comparison of test log-likelihood and accuracy across different datasets. Averaging probabilities (red/green) consistently outperforms averaging logits (blue/orange) as the number of training augmentations (Train K) increases.

Experimental Results

The researchers evaluated these methods on standard image classification benchmarks, including CIFAR-10, CIFAR-100, MNIST, and Fashion-MNIST, using ResNet and Fully Connected architectures.

Averaging Strategies and Multi-sample Bounds

Empirical results indicate that averaging probabilities generally outperforms averaging logits. As shown in Figure 3, averaging probabilities forces the network to maintain high confidence across different transformations, leading to more robust performance. Additionally, using multiple samples ($K > 1$) to estimate the DA likelihood significantly improves performance over the standard single-sample ($K=1$) approach, with benefits for CIFAR-10 plateauing around $K=8$.

The Persistence of the Cold Posterior Effect

The most critical finding is that the CPE remains robust even under principled DA. In the "finite orbit" setting, where the exact likelihood is known and no approximations are made, the best performance is still consistently found at low temperatures ($T \ll 1$).

Figure 5: Test metrics vs. Temperature. Across various models and datasets, peak accuracy and log-likelihood occur at temperatures significantly below $T=1$, even when using principled DA (Average probs/logits).

As illustrated in Figure 5, the performance at $T=1$ (the rightmost points on the x-axis) is markedly inferior to the performance at lower temperatures (e.g., $T=0.01$ or $T=0.001$). This persistence across both "full orbit" and "finite orbit" scenarios proves that the CPE is not merely a mathematical error caused by heuristic data augmentation.

Conclusion

By ruling out "unprincipled DA" as the primary driver of the Cold Posterior Effect, this work confirms that the CPE is a deeper phenomenon inherent to current BNN practices. While data augmentation is essential for state-of-the-art performance, its principled application does not resolve the "Bayesian crisis" of the CPE. Future research must look elsewhere for the cause, with prior misspecification—the possibility that standard weight priors do not accurately reflect the complexity of neural network functional spaces—and data curation biases remaining the most likely candidates.

Summary updated

BibTeX
@inproceedings{nabarro2022data,
  author = {Seth Nabarro and Stoil Ganev and Adrià Garriga-Alonso and Vincent Fortuin and Mark van der Wilk and Laurence Aitchison},
  title = {{Data augmentation in Bayesian neural networks and the cold posterior effect}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2022},
  url = {https://openreview.net/forum?id=NaVmV0GYte},
}
Figure