Momentum Provably Improves Error Feedback!

Ilyas Fatkhullin, Alexander Tyurin, Peter Richtárik

TL;DR

Distributed machine learning relies on communication compression to save bandwidth, but standard "error feedback" methods require impractically large batch sizes to converge when using stochastic gradients. This paper introduces EF21-SGDM, which applies Polyak's momentum to the state-of-the-art EF21 algorithm, provably eliminating the need for massive batches while improving both sample and communication complexity.

What Problem Does This Paper Address?

In distributed and federated learning, multiple clients (workers) train a shared model. Sending full model updates back and forth across the network creates a massive communication bottleneck. To fix this, practitioners use compression (like Top$K$ sparsification, which only sends the largest $K$ gradient values).

However, naively compressing gradients causes optimization algorithms to diverge. The standard fix is Error Feedback (EF): storing the compression error locally and adding it to the next step. The state-of-the-art version of this is EF21.

But there is a catch. In the realistic "stochastic nonconvex" setting (training deep neural networks with mini-batches), EF21 has an unhealthy appetite for data. To converge, it requires all clients to use "mega-batches"—batch sizes that scale inversely with the target error rate. If you try to run EF21 with a standard small batch size (e.g., $B=1$), it diverges exponentially. Mega-batches are slow, computationally expensive, and sometimes impossible to obtain (like in reinforcement learning).

Divergence of EF21-SGD vs convergence of EF21-SGDM with batch size 1

The authors set out to design a distributed, compressed SGD method that works with small batch sizes and doesn't rely on unrealistic mathematical assumptions.

Methods

The authors propose a surprisingly simple but highly effective fix: injecting Polyak's momentum (heavy-ball momentum) into the local worker updates before compression.

  • EF21-SGDM: Instead of compressing the raw stochastic gradient, the workers compute a momentum-based gradient estimator and compress the difference between this new estimator and the previous state.
  • EF21-SGD2M (Double Momentum): The authors push the idea further by proposing a two-step "double momentum" variant. This gives the estimator a richer memory of past gradients, further improving the sample complexity.
  • Novel Proof Technique: To prove these methods work, the authors develop a completely new Lyapunov function (a mathematical tool used to prove stability in dynamical systems). This allows them to prove convergence without relying on "Bounded Gradient" (BG) or "Bounded Gradient Similarity" (BGS) assumptions, which are common in the literature but rarely hold true in real-world heterogeneous data.

Key Insights and Ideas

  • Mega-batches are a fundamental flaw, not a math artifact: The authors mathematically prove that an idealized version of EF21 must diverge with small batches. It's not just that previous researchers couldn't find the right proof; the algorithm itself is inherently unstable with high-variance stochastic gradients.
  • Momentum acts as a variance reducer: In deep learning, momentum is usually thought of as a way to accelerate training (like a ball gaining speed rolling down a hill). Here, momentum serves a different critical purpose: it smooths out the variance introduced by the combination of stochastic mini-batches and biased compression, stabilizing the update.
  • Dropping crutches makes theory match reality: Previous proofs for error feedback relied on assuming gradients are strictly bounded, or that different workers have very similar data distributions (BGS). By dropping these assumptions, the authors' theoretical guarantees actually apply to real-world federated learning, where client data is highly heterogeneous.

Key Results

  • Batch-Free Convergence: EF21-SGDM is proven to converge even with a batch size of $B=1$.
  • Optimal Asymptotic Complexity: The method achieves an asymptotic sample complexity of $\mathcal{O}(\frac{\sigma^2}{\alpha n \epsilon^4})$. This matches the optimal rate for uncompressed SGD, meaning you get the communication savings of compression essentially for free in the long run.
  • Linear Speedup: As you add more worker nodes ($n$), the stochastic term in the sample complexity decreases linearly. In experiments (scaling up to 100 nodes), EF21-SGDM gets faster as nodes are added, whereas standard EF21 actually diverges faster.
  • Empirical Dominance: On MNIST with a Top10 compressor and a batch size of 1, EF21 diverges wildly. In contrast, EF21-SGDM and EF21-SGD2M converge smoothly and rapidly, matching the theoretical predictions.
Comparison of communication and sample complexities across different error feedback methods

Datasets Evaluated

The authors evaluated their algorithms on a mix of standard benchmarks and synthetic tasks:

  • Image Classification: MNIST and CIFAR10 (training a ResNet-18 model).
  • Tabular/Text Data: real-sim and w8a (logistic regression tasks).
  • Synthetic Data: Custom stochastic quadratic optimization tasks specifically designed to simulate highly heterogeneous (non-IID) client data.

Limitations and Future Work

While the asymptotic sample complexity is optimal, the non-asymptotic bound (early in training) for the single momentum method contains a middle term that doesn't perfectly match theoretical lower bounds. The double momentum method (EF21-SGD2M) was introduced specifically to suppress this term, though it requires storing one extra vector per client.

Looking forward, the authors suggest their novel Lyapunov proof technique could be a skeleton key for the field. They propose extending it to handle other biased compressors, decentralized training architectures, adaptive compression schemes, and other optimization techniques like proximal SGD or gradient clipping.

Summary updated

BibTeX
@inproceedings{fatkhullin2023momentum,
  author = {Ilyas Fatkhullin and Alexander Tyurin and Peter Richtárik},
  title = {{Momentum Provably Improves Error Feedback!}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=1h92PmnKov},
}
Figure