Parallel SGD: When does averaging help?

Jian Zhang, Christopher De Sa, Ioannis Mitliagkas, Christopher RéarXiv 2016

Abstract

Consider a number of workers running SGD independently on the same pool of data and averaging the models every once in a while -- a common but not well understood practice. We study model averaging as a variance-reducing mechanism and describe two ways in which the frequency of averaging affects convergence. For convex objectives, we show the benefit of frequent averaging depends on the gradient variance envelope. For non-convex objectives, we illustrate that this benefit depends on the presence of multiple globally optimal points. We complement our findings with multicore experiments on both synthetic and real data.

Introduction

In large-scale machine learning, Stochastic Gradient Descent (SGD) is the primary optimization method. To accelerate training, practitioners often parallelize the process by running multiple workers. A popular strategy is to let these workers compute independently and average their models periodically. However, the theoretical justification for the frequency of this averaging has been unclear. Does more frequent averaging lead to better performance, or is it merely a source of communication overhead?

A 2016 study from Christopher Ré’s group at Stanford addresses this question, moving beyond standard "coarse" models to explain why intermediate averaging is vital for both convex and non-convex landscapes.

Methods: The Gradient Variance Envelope

Traditional models often assume gradient noise is constant. This paper introduces a more nuanced Model for Gradient Variance, where noise increases as the model parameters $w$ move away from the optimum $w^*$: $$\Delta(w) \leq \beta^2 \|w - w^*\|^2 + \sigma^2$$ The parameter $\beta$ represents the "envelope" of the noise. By incorporating this term, the authors demonstrate that the frequency of averaging (the "phase length") directly impacts the asymptotic variance. In non-convex settings, averaging serves as a consensus mechanism, preventing workers from drifting into disparate local minima.

Error reduction in PCA simulation with increased averaging steps.

Key Insights: Consensus and Variance Reduction

The benefit of frequent averaging is twofold:

  1. Variance Reduction: In convex problems, frequent averaging keeps the "noise ball" small, especially when $\beta$ is high. If your data has a high $\beta$, you must average frequently to maintain stability.
  2. Consensus in Non-Convexity: Without frequent communication, workers may converge to different basins of attraction. Averaging them at the end (one-shot) can result in a model that performs poorly on the training data, as seen in the PCA simulation above where error drops sharply once averaging is introduced.

Experimental Results

The researchers evaluated their theory on several real-world datasets, including E2006-tfidf, HIGGS, and RCV1. The results confirm that periodic averaging consistently outperforms one-shot averaging in terms of convergence speed.

Convergence performance and speedup across multiple datasets.

On the E2006-tfidf dataset, periodic averaging reached the target error 2.26x faster than one-shot averaging. For E2006-log1p, the speedup exceeded 3x. In contrast, for RCV1, where the gradient variance is naturally lower, the benefit of frequent averaging was less pronounced, demonstrating that the optimal averaging frequency is data-dependent.

Conclusion

This work bridges the gap between the practical success of periodic model averaging and its theoretical understanding. By accounting for the gradient variance envelope and the consensus requirements of non-convex landscapes, the authors provide a framework for choosing optimal averaging frequencies. While the current analysis focuses on shared-memory multicore environments, it lays the groundwork for future research into distributed settings where communication costs are more significant.

Summary updated

BibTeX
@misc{zhang2016parallel,
  author = {Jian Zhang and Christopher De Sa and Ioannis Mitliagkas and Christopher Ré},
  title = {{Parallel SGD: When does averaging help?}},
  year = {2016},
  eprint = {1606.07365},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.07365},
}
Figure