{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/averaging-weights-leads-to-wider-optima-and","title":"Averaging Weights Leads to Wider Optima and Better Generalization","arxiv_id":"1803.05407","date":"2018-03-14","proceeding":null,"authors":["Pavel Izmailov","Dmitrii Podoprikhin","Timur Garipov","Dmitry Vetrov","Andrew Gordon Wilson"],"abstract":"Deep neural networks are typically trained by optimizing a loss function with\nan SGD variant, in conjunction with a decaying learning rate, until\nconvergence. We show that simple averaging of multiple points along the\ntrajectory of SGD, with a cyclical or constant learning rate, leads to better\ngeneralization than conventional training. We also show that this Stochastic\nWeight Averaging (SWA) procedure finds much flatter solutions than SGD, and\napproximates the recent Fast Geometric Ensembling (FGE) approach with a single\nmodel. Using SWA we achieve notable improvement in test accuracy over\nconventional SGD training on a range of state-of-the-art residual networks,\nPyramidNets, DenseNets, and Shake-Shake networks on CIFAR-10, CIFAR-100, and\nImageNet. In short, SWA is extremely easy to implement, improves\ngeneralization, and has almost no computational overhead.","url_abs":"http://arxiv.org/abs/1803.05407v3","url_pdf":"http://arxiv.org/pdf/1803.05407v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/timgaripov/swa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/GeorgOhneH/WerbeSkip","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/Morxrc/kaggle_generate-dogs_public-1st-private-16th-solution","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/NajibYavari/DD2412","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/benathi/fastswa-semi-sup","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/cmu-enyac/Renofeation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/dice-group/aswa","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/greyhound101/IEEE-CIS-Fraud","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/izmailovpavel/contrib_swa_examples","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/izmailovpavel/torch_swa_examples","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/julianfaraone/SWA","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/kristpapadopoulos/keras-stochastic-weight-averaging","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/pycroscopy/atomai","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/simon-larsson/keras-swa","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":null},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/wjmaddox/swa_gaussian","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/zlwangustc/SWA_paddle","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"paddle","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"averaging-weights-leads-to-wider-optima-and","repo_url":"https://github.com/ENSTA-U2IS-AI/torch-uncertainty","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"stochastic-optimization","task_name":"Stochastic Optimization"}],"methods":[{"method_slug":"1x1-convolution","method_name":"1x1 Convolution"},{"method_slug":"average-pooling","method_name":"Average Pooling"},{"method_slug":"batch-normalization","method_name":"Batch Normalization"},{"method_slug":"bottleneck-residual-block","method_name":"Bottleneck Residual Block"},{"method_slug":"concatenated-skip-connection","method_name":"Concatenated Skip Connection"},{"method_slug":"convolution","method_name":"Convolution"},{"method_slug":"cosine-annealing","method_name":"Cosine Annealing"},{"method_slug":"dense-block","method_name":"Dense Block"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"global-average-pooling","method_name":"Global Average Pooling"},{"method_slug":"kaiming-initialization","method_name":"Kaiming Initialization"},{"method_slug":"max-pooling","method_name":"Max Pooling"},{"method_slug":"pyramidnet","method_name":"PyramidNet"},{"method_slug":"pyramidal-bottleneck-residual-unit","method_name":"Pyramidal Bottleneck Residual Unit"},{"method_slug":"pyramidal-residual-unit","method_name":"Pyramidal Residual Unit"},{"method_slug":"relu","method_name":"ReLU"},{"method_slug":"residual-block","method_name":"Residual Block"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sgd","method_name":"SGD"},{"method_slug":"shake-shake-regularization","method_name":"Shake-Shake Regularization"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"stochastic-weight-averaging","method_name":"Stochastic Weight Averaging"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wide-residual-block","method_name":"Wide Residual Block"},{"method_slug":"wideresnet","method_name":"WideResNet"},{"method_slug":"zero-padded-shortcut-connection","method_name":"Zero-padded Shortcut Connection"}],"datasets_introduced":[],"methods_introduced":[{"slug":"stochastic-weight-averaging","name":"Stochastic Weight Averaging","full_name":"Stochastic Weight Averaging"}],"results":[{"leaderboard":"/sota/image-classification-on-cifar-10","task":"Image Classification","dataset":"CIFAR-10","model":"ShakeShake-2x64d + SWA","rank_in_archive_order":91,"of":265,"metrics":{"Percentage correct":"97.12"},"uses_additional_data":false},{"leaderboard":"/sota/image-classification-on-cifar-10","task":"Image Classification","dataset":"CIFAR-10","model":"WRN-28-10 + SWA","rank_in_archive_order":100,"of":265,"metrics":{"Percentage correct":"96.79"},"uses_additional_data":false},{"leaderboard":"/sota/image-classification-on-cifar-100","task":"Image Classification","dataset":"CIFAR-100","model":"PyramidNet-272 + SWA","rank_in_archive_order":78,"of":211,"metrics":{"Percentage correct":"84.16"},"uses_additional_data":true},{"leaderboard":"/sota/image-classification-on-cifar-100","task":"Image Classification","dataset":"CIFAR-100","model":"WRN+SWA","rank_in_archive_order":110,"of":211,"metrics":{"Percentage correct":"82.15"},"uses_additional_data":true},{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"ResNet-152 + SWA","rank_in_archive_order":797,"of":1060,"metrics":{"Top 1 Accuracy":"78.94%"},"uses_additional_data":false},{"leaderboard":"/sota/image-classification-on-imagenet","task":"Image Classification","dataset":"ImageNet","model":"DenseNet-161 + SWA","rank_in_archive_order":832,"of":1060,"metrics":{"Top 1 Accuracy":"78.44%"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/1803.05407","atlas_url":"https://app.syntology.ai/?focus=1803.05407","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1803.05407"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ENSTA-U2IS-AI/torch-uncertainty","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/wjmaddox/swa_gaussian","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/greyhound101/IEEE-CIS-Fraud","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kristpapadopoulos/keras-stochastic-weight-averaging","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pycroscopy/atomai","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/julianfaraone/SWA","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/cmu-enyac/Renofeation","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/izmailovpavel/torch_swa_examples","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/benathi/fastswa-semi-sup","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dice-group/aswa","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Morxrc/kaggle_generate-dogs_public-1st-private-16th-solution","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/NajibYavari/DD2412","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/GeorgOhneH/WerbeSkip","reach":{"status":"ok"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/timgaripov/swa","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/simon-larsson/keras-swa","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/izmailovpavel/contrib_swa_examples","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zlwangustc/SWA_paddle","reach":{"status":"ok","spdx":"BSD-2-Clause"}}],"summary":{"ran_honours":1,"ran_violates":1,"ran_draft_wrong":2,"ran":1,"unverified":4},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1},"listed":{"samples":7,"ran":3,"repositories":2}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"14ebf34e2f003912","entry":"adjust_learning_rate","repo":"dice-group/aswa","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"14ebf34e2f003912"}},{"code_sha256_prefix":"6e59364a7cf6008f","entry":"check_bn","repo":"dice-group/aswa","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"6e59364a7cf6008f"}},{"code_sha256_prefix":"00e569acd6b45ef0","entry":"conv3x3","repo":"timgaripov/swa","repo_kind":"official","path":"models/wide_resnet.py","file_url":"https://github.com/timgaripov/swa/blob/HEAD/models/wide_resnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"00e569acd6b45ef0"}},{"code_sha256_prefix":"583f9780bdd00a45","entry":"conv3x3","repo":"timgaripov/swa","repo_kind":"official","path":"models/preresnet.py","file_url":"https://github.com/timgaripov/swa/blob/HEAD/models/preresnet.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"583f9780bdd00a45"}},{"code_sha256_prefix":"4a29d37fffcfd8b1","entry":"make_layers","repo":"dice-group/aswa","repo_kind":"listed","path":"models/vgg.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/models/vgg.py","link_basis":"plan_row","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4a29d37fffcfd8b1"}},{"code_sha256_prefix":"8d543b4110270e15","entry":"adjust_learning_rate","repo":"zlwangustc/SWA_paddle","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/zlwangustc/SWA_paddle/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"8d543b4110270e15"}},{"code_sha256_prefix":"ff618422d0032e4e","entry":"eval","repo":"dice-group/aswa","repo_kind":"listed","path":"utils.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"ff618422d0032e4e"}},{"code_sha256_prefix":"24584656ffcaea3e","entry":"schedule","repo":"dice-group/aswa","repo_kind":"listed","path":"ddp_train.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/ddp_train.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"24584656ffcaea3e"}},{"code_sha256_prefix":"fd2f0d7779c8d75b","entry":"selected_epochs","repo":"dice-group/aswa","repo_kind":"listed","path":"analysis.py","file_url":"https://github.com/dice-group/aswa/blob/HEAD/analysis.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"fd2f0d7779c8d75b"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}