A Simple Baseline for Bayesian Uncertainty in Deep Learning

Wesley Maddox, Timur Garipov, Pavel Izmailov, Dmitry Vetrov, Andrew Gordon Wilson
2/7/2019
cs.LGcs.AIcs.CV

Official code: wjmaddox/swa_gaussian (477 stars, BSD-2-Clause, last commit 2023-07-06).

Abstract

We propose SWA-Gaussian (SWAG), a simple, scalable, and general purpose approach for uncertainty representation and calibration in deep learning. Stochastic Weight Averaging (SWA), which computes the first moment of stochastic gradient descent (SGD) iterates with a modified learning rate schedule, has recently been shown to improve generalization in deep learning. With SWAG, we fit a Gaussian using the SWA solution as the first moment and a low rank plus diagonal covariance also derived from the SGD iterates, forming an approximate posterior distribution over neural network weights; we then sample from this Gaussian distribution to perform Bayesian model averaging. We empirically find that SWAG approximates the shape of the true posterior, in accordance with results describing the stationary distribution of SGD iterates. Moreover, we demonstrate that SWAG performs well on a wide variety of tasks, including out of sample detection, calibration, and transfer learning, in comparison to many popular alternatives including MC dropout, KFAC Laplace, SGLD, and temperature scaling.

View on arXivView PDF

Code Implementations(1)

BSD-2-Clause

Code repo for "A Simple Baseline for Bayesian Uncertainty in Deep Learning"

47783Python, Jupyter NotebookJun 7, 20183 years agoBSD-2-Clause

Cite this paper

@article{maddox2019simple,
  title  = {A Simple Baseline for Bayesian Uncertainty in Deep Learning},
  author = {Wesley Maddox and Timur Garipov and Pavel Izmailov and Dmitry Vetrov and Andrew Gordon Wilson},
  year   = {2019},
  eprint = {1902.02476},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1902.02476}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1902.02476.svg)](https://codeofpaper.com/paper/1902.02476)

Discussion