Averaging Weights Leads to Wider Optima and Better Generalization

Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, Andrew Gordon Wilson
3/14/2018
cs.LGcs.AIcs.CV

Official code: timgaripov/swa (983 stars, BSD-2-Clause, last commit 2021-08-01).

Abstract

Deep neural networks are typically trained by optimizing a loss function with an SGD variant, in conjunction with a decaying learning rate, until convergence. We show that simple averaging of multiple points along the trajectory of SGD, with a cyclical or constant learning rate, leads to better generalization than conventional training. We also show that this Stochastic Weight Averaging (SWA) procedure finds much flatter solutions than SGD, and approximates the recent Fast Geometric Ensembling (FGE) approach with a single model. Using SWA we achieve notable improvement in test accuracy over conventional SGD training on a range of state-of-the-art residual networks, PyramidNets, DenseNets, and Shake-Shake networks on CIFAR-10, CIFAR-100, and ImageNet. In short, SWA is extremely easy to implement, improves generalization, and has almost no computational overhead.

View on arXivView PDF

Code Implementations(1)

timgaripov/swaOfficial100%
BSD-2-Clause

Stochastic Weight Averaging in PyTorch

983130PythonMar 21, 20185 years agoBSD-2-Clause

Similar Papers

Cite this paper

@article{izmailov2018averaging,
  title  = {Averaging Weights Leads to Wider Optima and Better Generalization},
  author = {Pavel Izmailov and Dmitrii Podoprikhin and Timur Garipov and Dmitry Vetrov and Andrew Gordon Wilson},
  year   = {2018},
  eprint = {1803.05407},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1803.05407}
}

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/1803.05407.svg)](https://codeofpaper.com/paper/1803.05407)

Discussion