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 View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 17 code samples harvested from 2 repositories linked to this paper: 11 ran (of which 0 constructed an object rather than computing a result; 10 with no instrument failure: 0 honoured, 2 violated, 8 with no contract checked; 1 where Syntology's instrument failed) · 6 unverified. Where Syntology's instrument failed: 1 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 14 samples from 1 repository, 8 ran (7 with no instrument failure; 1 where Syntology's instrument failed); community (archive-listed): 3 samples from 1 repository, 3 ran (3 with no instrument failure; 0 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 3 of its repositories that Syntology harvested for other papers:

Levels written between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

wjmaddox/swa_gaussian officialmentioned in papermentioned on GitHubpytorchBSD-2-ClauseSyntology: 14 samples, 8 ran (1 instrument-failed) · 6 unverified report
NajibYavari/DD2412 mentioned on GitHubtfSyntology: not harvested report
SamuelGuilluy/Bayesian_ML_SWAG mentioned on GitHubpytorchSyntology: not harvested report
YeongHyeon/SWA-Gaussian-TF2 mentioned on GitHubtfMITSyntology: 3 samples, 3 ran (0 instrument-failed) · 0 unverified report
abdulmajid-murad/deep_probabilistic_forecast mentioned on GitHubpytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Spectral Temporal Graph Neural Network for Multivariate Time-series Forecasting (arXiv:2103.07719; that paper's own run record: 2 ran (of which 1 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 11 unverified); nothing checks that they implement this paper's method. report
lamantinushka/StructuredCovariance mentioned on GitHubpytorchSyntology: not harvested report
ENSTA-U2IS-AI/torch-uncertainty pytorchApache-2.0Syntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles (arXiv:1612.01474; that paper's own run record: 10 ran (of which 8 constructed an object rather than computing a result; 9 with no instrument failure: 0 honoured, 0 violated, 9 with no contract checked; 1 where Syntology's instrument failed) · 1 unverified), mixup: Beyond Empirical Risk Minimization (arXiv:1710.09412; that paper's own run record: 36 ran (of which 5 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 0 violated, 14 with no contract checked; 22 where Syntology's instrument failed) · 11 unverified), Laplace Redux -- Effortless Bayesian Deep Learning (arXiv:2106.14806; that paper's own run record: 1 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 1 honoured, 0 violated, 0 with no contract checked; 0 where Syntology's instrument failed) · 4 unverified) and 2 more (every one in this page's JSON twin); nothing checks that they implement this paper's method. report
lightning-uq-box/lightning-uq-box pytorchSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to Uncertainty Sets for Image Classifiers using Conformal Prediction (arXiv:2009.14193; that paper's own run record: 26 ran (of which 1 constructed an object rather than computing a result; 13 with no instrument failure: 4 honoured, 0 violated, 9 with no contract checked; 13 where Syntology's instrument failed) · 37 unverified), ZigZag: Universal Sampling-free Uncertainty Estimation Through Two-Step Inference (arXiv:2211.11435; that paper's own run record: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 1 honoured, 0 violated, 1 with no contract checked; 0 where Syntology's instrument failed) · 4 unverified) and Variational Bayesian Last Layers (arXiv:2404.11599; that paper's own run record: 11 ran (of which 1 constructed an object rather than computing a result; 6 with no instrument failure: 3 honoured, 1 violated, 2 with no contract checked; 5 where Syntology's instrument failed) · 12 unverified); nothing checks that they implement this paper's method. 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

17 samples harvested: 11 ran (of which 0 constructed an object rather than computing a result; 10 with no instrument failure: 0 honoured, 2 violated, 8 with no contract checked; 1 where Syntology's instrument failed) · 6 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

2ran · violated contract
1ran · our draft was wrong
8ran
6unverified

Licence: 9 of the 17 samples are pointer only, meaning Syntology does not serve that copy's text. For 9 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. 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; the list below is grouped by repository, each group headed by its name and what it is to the paper. “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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

wjmaddox/swa_gaussian official repository 14 samples, 8 ran (1 instrument-failed) · 6 unverified
adversarial_cross_entropy swag/losses.py ran BSD-2-Clause (permissive) here; the stored copy is pointer only · e11996f54eea8253 · report fixture: signature model:callable/0/?, input:Tensor/2/float, target:Tensor/1/int, lossfn:callable/0/?, epsilon:float/0/float · returned tuple · level recorded 2026-09-24
center_crop in 48 papers swag/models/layers.py ran fingerprinted BSD-2-Clause (permissive) here; the stored copy is pointer only · 9d5555c9ff725b7f · report fixture: signature layer:Tensor/4/float, max_height:int/0/int, max_width:int/0/int · returned Tensor · level recorded 2026-09-24
conv3x3 in 1,376 papers swag/models/preresnet.py ran · our draft was wrong BSD-2-Clause (permissive) here; the stored copy is pointer only · 583f9780bdd00a45 · report fixture: signature in_planes:int/0/int, out_planes:int/0/int, stride:int/0/int · returned Conv2d · level recorded 2026-09-22
cross_entropy in 92 papers
census: 6 implementations from 8 papers, 5 distinct outputs across 2 buckets, one shared input per bucket
swag/losses.py ran BSD-2-Clause (permissive) here; the stored copy is pointer only · fc2aaf6fd20bc53f · report fixture: signature model:callable/0/?, input:Tensor/2/float, target:Tensor/1/int · returned tuple · level recorded 2026-09-24
has_file_allowed_extension in 38 papers swag/camvid.py ran · violated contract BSD-2-Clause (permissive) here; the stored copy is pointer only · 1d7c68b369e70ab0 · report fixture: signature filename:str/0/str, extensions:list/1/str · returned bool · level recorded 2026-09-24
is_image_file in 157 papers swag/camvid.py ran · violated contract BSD-2-Clause (permissive) here; the stored copy is pointer only · af447e65a04b459e · report fixture: signature filename:str/0/str · returned bool · level recorded 2026-09-24
loaders swag/data.py ran BSD-2-Clause (permissive) · 9dc1a3ebe60f97ec · report fixture: signature dataset:str/0/str, path:str/0/str, batch_size:int/0/int, num_workers:int/0/int, transform_train:callable/0/?, transform_test:callable/0/?, use_validation:bool/0/bool, val_size:int/0/int, split_classes:NoneType/0/?, shuffle_train:bool/0/bool · returned tuple · level recorded 2026-09-25
nll in 20 papers experiments/ensembling/swa_ecdf_ensembles.py ran BSD-2-Clause (permissive) · 3ccff5ae337f212a · report fixture: signature outputs:ndarray/2/float, labels:ndarray/1/float · returned float32 · level recorded 2026-09-25
camvid_loaders swag/data.py unverified BSD-2-Clause (permissive) here; the stored copy is pointer only · e1ae5ee1960f180e · report
find_models experiments/ensembling/swa_ecdf_ensembles.py unverified BSD-2-Clause (permissive) · 28c6926bada96fe8 · report
loaders experiments/imagenet/data.py unverified BSD-2-Clause (permissive) · 99e3815602045644 · report
masked_loss in 8 papers swag/losses.py unverified BSD-2-Clause (permissive) here; the stored copy is pointer only · 8bbca7799326d580 · report
schedule in 32 papers experiments/imagenet/run_swag_imagenet.py unverified BSD-2-Clause (permissive) here; the stored copy is pointer only · 7478bf872b01d269 · report
svhn_loaders in 5 papers swag/data.py unverified BSD-2-Clause (permissive) · d1432df89765a54c · report
YeongHyeon/SWA-Gaussian-TF2 community (archive-listed) 3 samples, 3 ran (0 instrument-failed) · 0 unverified
bayesian_sampling source/utils.py ran MIT (permissive) · b99c1d7b48976895 · report fixture: signature theta_bank:list/1/ndarray · returned ndarray · level recorded 2026-09-24
min_max_norm in 19 papers
census: 3 implementations from 6 papers, 3 distinct outputs across 2 buckets, one shared input per bucket
source/utils.py ran fingerprinted MIT (permissive) · bbf4ede63ece446f · report fixture: signature x:Tensor/2/float · returned Tensor · level recorded 2026-09-24
sorted_list source/utils.py ran MIT (permissive) · d68d9e1382bea360 · report fixture: signature path:str/0/str · returned list · level recorded 2026-09-24

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