# On the Convergence of FedAvg on Non-IID Data

Partial device participation keeps FedAvg converging on non-iid federated data

Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, Zhihua Zhang · arXiv · 2019-7-4

- **Problem** Earlier convergence proofs for FedAvg assumed iid data and that every device is active. Real federated data is non-iid and devices often drop out, so FedAvg had no guarantee.
- **Method** The authors analyze FedAvg with partial participation. Instead of waiting for every device, the server averages only K of N returned models, using one of two sampling schemes.
- **Results** The authors prove an O(1/T) convergence rate for strongly convex, smooth problems on non-iid data. The bound shows a trade-off between communication and convergence rate.

## Why FedAvg lacked guarantees

FedAvg is the usual starting point in federated learning, because each device runs SGD locally and talks to the server only now and then. That saves communication, which matters most when the link between the server and each device is slow. The setting still has three traits that make a convergence proof hard.

The training data are spread over a very large number of devices, and the links to them are slow. The server has no control over the devices, so a phone that is switched off becomes a straggler that delays the round. Waiting for every device is therefore impractical, which pushes the design toward partial participation. Finally the data are non-iid, so one device's samples can't stand in for the overall distribution.

Earlier convergence proofs for federated algorithms assumed that the data are iid and that every device is active. Some analyses assumed only that every device is active, while others assumed both conditions. FedProx comes closest, since FedAvg is its special case when the proximal term vanishes. Its theory needs that proximal term to exist, so it does not cover FedAvg itself.

## How one FedAvg round works

The key idea is to let each device take E local steps, and then to have the server average only K of the N returned models. If the learning rate is small enough and the sampling and averaging are chosen well, each global update behaves like one SGD update. Partial participation adds variance to the averaged sequence, but the learning rate can keep that variance under control.

Each device sets its local model to wt and runs E local updates, each a gradient step on one sample drawn uniformly from its local data. The server then aggregates the returned models into the new global model, and the weights used in that step separate the schemes.

Full participation makes the server wait for the slowest device, which the authors call the straggler's effect. Under partial participation the server takes the first K responders and stops waiting for the rest. The aggregation then scales the sum of the weights of those K devices by N over K, and this sum equals one in expectation. Each block of E local iterations costs one broadcast and one aggregation.

Scheme I draws K device indices with replacement according to the weights pk and averages their models with weight 1/K. Scheme II draws K devices uniformly without replacement and needs balanced data, meaning every pk equals 1/N. Real federated data is unbalanced, so the authors multiply each local objective by pk N, which turns the global objective into a plain average of scaled objectives.

## What the convergence bounds say

The main result is an O(1/T) rate for FedAvg without assuming iid data or that all devices are active. The analysis assumes each local objective is L-smooth and µ-strongly convex, and that stochastic gradients have bounded variance and bounded second moment. The ratio κ is L over µ, and the step size is tied to γ, which is the larger of 8κ and E.

With full participation and the decaying step size, the expected gap after T iterations is bounded by a term that shrinks as T grows. The constant B that enters that bound is defined as follows. \\\[B=\\sum\_{k=1}^{N}p\_k^2\\sigma\_k^2+6L\\Gamma+8(E-1)^2G^2\\\] Γ measures how far the global optimum is from the weighted optimal values of the local objectives, so it captures how non-iid the data are.

Under Scheme I the bound keeps the same form, with B replaced by B plus C, where C equals 4KE²G². The extra C term is where the cost of sampling a subset of devices enters the bound.

Under Scheme II with balanced data, the constant C is multiplied by (N−K)/(N−1), and the same bound holds. Because the balance requirement is strict, the authors add the rescaling step to cover unbalanced data.

Dividing the number of communications by E gives an expression in E that first falls and then rises, so both very small and very large E cost communication. For iid data Stich showed that E can be set to order √T, but the authors state that E must not exceed order √T for non-iid data, or convergence is not guaranteed.

## Why the learning rate has to decay

The analysis relies on a decaying learning rate, so the authors ask whether a fixed rate would also work. They build a strongly convex, smooth example, a ridge regression model, in which FedAvg with E greater than 1 and a fixed step size fails to reach the optimum even with full batches. The result states that the squared distance between the output and the optimum is of order (E−1)η times the squared norm of the optimum.

\\\[\\\|\\tilde w^\*-w^\*\\\|^2=\\Omega\\big((E-1)\\eta\\big)\\cdot\\\|w^\*\\\|^2\\\]

With E equal to 1 and full batches, FedAvg is plain full gradient descent, which converges under a proper fixed rate. So the gap appears only when local steps are added, and the authors call the difference a sign that FedAvg behaves very differently from gradient descent. The authors explain that a constant rate combined with biased local steps forms a suboptimal update, while a diminishing rate can remove that bias.

This does not contradict Khaled et al., whose result places the iterate near the optimum rather than at it. Decay has a cost, because smaller steps slow convergence and can cancel the benefit of performing several local updates.

## What the experiments confirm

They also build a balanced MNIST split, an unbalanced split with a power-law sample count, and synthetic(α, β) sets, using synthetic(0,0) and synthetic(1,1). Each run starts from w0 equal to 0, and the initial learning rate is picked from 1, 0.1 and 0.01.

On the unbalanced datasets the required rounds first fall and then rise as E grows, which is the trade-off the bound predicts. The balanced MNIST set does not show this pattern, and the authors leave the reason for future work.

On synthetic(0,0), K was set to 10, 30, 50, 70 and 100 out of N = 100 devices, and the global loss curves differ little. The curve for a large K is slightly better, so a small number of devices can be used without severely harming training. The authors tie this to the condition that the sampling variance is small relative to the other term, that is B much larger than C.

On balanced data Scheme I and Scheme II reach nearly the same performance, and both beat the original scheme. The original scheme carries a history term and may be conservative, so the authors tuned its initial learning rate carefully.

On unbalanced data Scheme I performs best, Scheme II suffers from instability, and transformed Scheme II stays stable at a lower convergence rate. The authors say this does not contradict their theory, because they do not guarantee convergence of Scheme II on unbalanced data.

## Limitations

The bounds rely on strong convexity and smoothness of every local objective, plus the bounded-variance and bounded-moment assumptions. Scheme II's bound needs balanced data, and the authors give no convergence guarantee for Scheme II on unbalanced data.

Under non-iid data the dependence on K is weak, so FedAvg can't achieve linear speedup in the number of active devices. The authors therefore suggest keeping the participation ratio K/N small to ease stragglers without hurting the rate. E must also stay below order √T for convergence to be guaranteed.

The experiments use one logistic regression model and the MNIST and synthetic federated datasets only. The reason the balanced MNIST set does not show the E trade-off is left open.

## Paper info

- **Authors**: Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, Zhihua Zhang
- **Venue**: arXiv · Preprint
- **First published**: 2019-7-4
- **Added**: 2026-11-12
- **Updated**: 2020-6-25
- **Version**: v4
- **arXiv**: 1907.02189
- **Category**: stat.ML · cs.LG · math.OC
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1907.02189v4) · [PDF ↗](https://arxiv.org/pdf/1907.02189v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Xiang Li, Kaixuan Huang, Wenhao Yang, Shusen Wang, Zhihua Zhang (2019). On the Convergence of FedAvg on Non-IID Data. arXiv:1907.02189v4. https://arxiv.org/abs/1907.02189v4

**BibTeX**

```
@misc{li2019convergence,
  title = {{On the Convergence of FedAvg on Non-IID Data}},
  author = {Xiang Li and Kaixuan Huang and Wenhao Yang and Shusen Wang and Zhihua Zhang},
  year = {2019},
  eprint = {1907.02189},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1907.02189v4}
}
```

## Other paper commentary

- [On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima](https://refivu.com/en/papers/9954c18e-def9-48fe-bfea-2f52f4ed7acb-on-large-batch-training-for-deep-learning-generalization.md)
- [On the Convergence of Adam and Beyond](https://refivu.com/en/papers/0071643a-b21a-4f45-ab31-5fa27e061226-on-the-convergence-of-adam-and-beyond.md)
- [On Hyperparameter Optimization of Machine Learning Algorithms: Theory and Practice](https://refivu.com/en/papers/e35d8e99-a32c-4e33-acef-50ee792021f2-on-hyperparameter-optimization-of-machine-learning.md)
- [Understanding deep learning requires rethinking generalization](https://refivu.com/en/papers/cb138997-32a3-4005-82f2-6597e2492ff8-understanding-deep-learning-requires-rethinking.md)
- [Federated Optimization in Heterogeneous Networks](https://refivu.com/en/papers/2cd45774-4d0c-4ae9-9650-6a1593f93832-federated-optimization-in-heterogeneous-networks.md)
- [CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features](https://refivu.com/en/papers/5b819733-3817-45f5-9d87-61545a63f83b-cutmix-regularization-strategy-to-train-strong-classifiers.md)
- [A Structured Self-attentive Sentence Embedding](https://refivu.com/en/papers/a8cbdabb-c63d-415b-8edf-e85be94428b8-a-structured-self-attentive-sentence-embedding.md)
- [Deep Speech 2: End-to-End Speech Recognition in English and Mandarin](https://refivu.com/en/papers/a706b06b-386b-46f0-b3bc-637c9d25b331-deep-speech-2-end-to-end-speech-recognition.md)
- [Meta-Learning in Neural Networks: A Survey](https://refivu.com/en/papers/c729f50c-a819-4d71-934d-d46e25ac8859-meta-learning-in-neural-networks-a-survey.md)
- [ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness](https://refivu.com/en/papers/57e803cb-75a6-462c-b1bd-4b3c2848753b-imagenet-trained-cnns-are-biased-towards-texture-increasing.md)
- [DualGAN: Unsupervised Dual Learning for Image-to-Image Translation](https://refivu.com/en/papers/d55f8c4a-20b7-4a6d-b036-ba23c6b476bc-dualgan-unsupervised-dual-learning-for-image-to-image.md)
- [BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://refivu.com/en/papers/072fcecb-6c6d-400e-ac1c-93885521831b-blip-bootstrapping-language-image-pre-training-for-unified.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [Stochastic Gradient Descent (SGD)](https://refivu.com/en/terms/5c2447143b09-stochastic-gradient-descent-sgd)
- [FedProx](https://refivu.com/en/terms/a65de99075ee-fedprox)
- [non-IID](https://refivu.com/en/terms/83ef54c01151-non-iid)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/be876672-3359-432a-aef6-283efba8fc24-on-the-convergence-of-fedavg-on-non-iid)
