EasyDeepLearn

What is Stochastic Weight Averaging (SWA)?

medium

Answer

  • During the last part of training (with a constant or cyclical LR), keep a running average of the weights: θswa  =  mean{\theta}_{\mathrm{swa}}\; = \;\mathrm{mean} of θt{\theta}_{t} across recent steps.
  • Use θswa{\theta}_{\mathrm{swa}} at inference.
  • Averaging in the loss landscape moves toward the center of a flat minimum, which generalizes better than any individual point.
  • Adds ~0 cost and often gains 0.5-1% accuracy.
  • Extended to EMA of weights (used in EMA-teacher / EMA distillation).
Check yourself — multiple choice
  • SWA averages predictions
  • Average weights over the last training steps → flatter effective minimum, better generalization
  • Same as gradient averaging
  • Doubles training cost

SWA: weight averaging → moves to the center of a flat minimum → better generalization.

#training#regularization

Practise Deep Learning

214 interview questions in this topic.

Related questions