Exponential Moving Average of Weights in Deep Learning: Dynamics and Benefits
Daniel Morales-Brotons, Thijs Vogels, Hadrien Hendrikx
TL;DR
This work systematically studies the Exponential Moving Average (EMA) of weights as an external, lightweight plug in to SGD training. It demonstrates that EMA reduces parameter noise, induces implicit regularization, and delivers better generalization, robustness to label noise, calibration, and transferability, with notably strong early performance that explains EMA based teacher setups. The authors provide practical guidance on hyperparameter tuning, including cosine annealing and early stopping, and reveal interactions with Batch Normalization that shape the feasible averaging windows. Overall, EMA offers a simple, effective means to improve deep learning models without altering the training trajectory. The study confirms that EMA solutions differ from last-iterate SGD solutions and often yield more robust and transferable representations.
Abstract
Weight averaging of Stochastic Gradient Descent (SGD) iterates is a popular method for training deep learning models. While it is often used as part of complex training pipelines to improve generalization or serve as a `teacher' model, weight averaging lacks proper evaluation on its own. In this work, we present a systematic study of the Exponential Moving Average (EMA) of weights. We first explore the training dynamics of EMA, give guidelines for hyperparameter tuning, and highlight its good early performance, partly explaining its success as a teacher. We also observe that EMA requires less learning rate decay compared to SGD since averaging naturally reduces noise, introducing a form of implicit regularization. Through extensive experiments, we show that EMA solutions differ from last-iterate solutions. EMA models not only generalize better but also exhibit improved i) robustness to noisy labels, ii) prediction consistency, iii) calibration and iv) transfer learning. Therefore, we suggest that an EMA of weights is a simple yet effective plug-in to improve the performance of deep learning models.
