Papers › A Simple Baseline for Bayesian Uncertainty in Deep Learning

A Simple Baseline for Bayesian Uncertainty in Deep Learning

7 Feb 2019NeurIPS 2019 12arXiv:1902.02476archive 2025-07-28

Wesley Maddox, Timur Garipov, Pavel Izmailov, Dmitry Vetrov, Andrew Gordon Wilson

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1902.02476")

Code

Syntology Ran 6 of 17 code samples harvested from 2 repositories linked to this paper; 11 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 5 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 6 ran; community (archive-listed): 3 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

wjmaddox/swa_gaussian officialmentioned in papermentioned on GitHubpytorchBSD-2-Clause report
NajibYavari/DD2412 mentioned on GitHubtf report
SamuelGuilluy/Bayesian_ML_SWAG mentioned on GitHubpytorch report
YeongHyeon/SWA-Gaussian-TF2 mentioned on GitHubtfMIT report
lamantinushka/StructuredCovariance mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

17 samples harvested; 6 ran; 0 honoured the contract we drafted; 11 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
5ran
11unverified

Licence: 0 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

adversarial_cross_entropy wjmaddox/swa_gaussian/swag/losses.py official repository ran BSD-2-Clause (permissive) · e11996f54eea8253 · report
center_crop wjmaddox/swa_gaussian/swag/models/layers.py official repository ran fingerprinted BSD-2-Clause (permissive) · 9d5555c9ff725b7f · report
conv3x3 wjmaddox/swa_gaussian/swag/models/preresnet.py official repository ran · our draft was wrong BSD-2-Clause (permissive) · 583f9780bdd00a45 · report
cross_entropy wjmaddox/swa_gaussian/swag/losses.py official repository ran BSD-2-Clause (permissive) · fc2aaf6fd20bc53f · report
has_file_allowed_extension wjmaddox/swa_gaussian/swag/camvid.py official repository ran BSD-2-Clause (permissive) · 1d7c68b369e70ab0 · report
is_image_file wjmaddox/swa_gaussian/swag/camvid.py official repository ran BSD-2-Clause (permissive) · af447e65a04b459e · report
camvid_loaders wjmaddox/swa_gaussian/swag/data.py official repository unverified BSD-2-Clause (permissive) · e1ae5ee1960f180e · report
find_models wjmaddox/swa_gaussian/experiments/ensembling/swa_ecdf_ensembles.py official repository unverified BSD-2-Clause (permissive) · 28c6926bada96fe8 · report
loaders wjmaddox/swa_gaussian/experiments/imagenet/data.py official repository unverified BSD-2-Clause (permissive) · 99e3815602045644 · report
loaders wjmaddox/swa_gaussian/swag/data.py official repository unverified BSD-2-Clause (permissive) · 9dc1a3ebe60f97ec · report
masked_loss wjmaddox/swa_gaussian/swag/losses.py official repository unverified BSD-2-Clause (permissive) · 8bbca7799326d580 · report
nll wjmaddox/swa_gaussian/experiments/ensembling/swa_ecdf_ensembles.py official repository unverified BSD-2-Clause (permissive) · 3ccff5ae337f212a · report
schedule wjmaddox/swa_gaussian/experiments/imagenet/run_swag_imagenet.py official repository unverified BSD-2-Clause (permissive) · 7478bf872b01d269 · report
svhn_loaders wjmaddox/swa_gaussian/swag/data.py official repository unverified BSD-2-Clause (permissive) · d1432df89765a54c · report
bayesian_sampling YeongHyeon/SWA-Gaussian-TF2/source/utils.py community (archive-listed) unverified MIT (permissive) · b99c1d7b48976895 · report
min_max_norm YeongHyeon/SWA-Gaussian-TF2/source/utils.py community (archive-listed) unverified MIT (permissive) · bbf4ede63ece446f · report
sorted_list YeongHyeon/SWA-Gaussian-TF2/source/utils.py community (archive-listed) unverified MIT (permissive) · d68d9e1382bea360 · report

Tasks

Bayesian InferenceDeep LearningTransfer LearningUncertainty Quantification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

SGDStochastic Weight Averaging

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections