Part III: Distributed Machine Learning
Chapter 14: Federated and Decentralized Learning

Federated and Decentralized Learning

Every distributed method so far assumed you owned the data and could move it: shard it across workers, co-locate it with compute, partition it onto whatever machines the scheduler chose. This chapter removes that assumption. The training data now lives on phones, in hospitals, and on edge devices you do not control and may not legally touch, and it cannot be centralized. Federated and decentralized learning train a shared model where the data stays put, shipping model updates instead of examples, and they must do so under non-identically-distributed shards, intermittent and unreliable participants, communication budgets measured in rounds rather than messages, and privacy constraints that forbid pooling the data at all.

Conceptual illustration for Chapter 14: Federated and Decentralized Learning

"I never see the data. A million phones train in the dark and mail me their second thoughts; I average the whispers, send the model back, and hope nobody charged less than half a battery overnight."

A Federated Coordinator Who Has Learned to Trust the Average

Chapter Overview

This is the fifth and final chapter of Part III, and it closes the part by dropping the assumption that has quietly held through every distributed method so far: that you own the training data and may move it wherever the computation is. Chapter 10 ran distributed SGD over shards the scheduler scattered; Chapters 11 and 12 sharded parameters and classical models the same way; Chapter 13 spread a single graph across a cluster you controlled. In all of them the data was yours to co-locate. Federated learning begins where that ends. The data is generated and retained on the participants, phones, hospitals, banks, and edge sensors, and it must not leave them. The whole chapter is organized around training a shared model under that one binding constraint, and around the three difficulties the constraint creates: heterogeneous data, scarce communication, and privacy.

Read in order, the nine sections take you from "the data is on a billion phones and the law forbids collecting it" to "train, personalize, privately aggregate, and decentralize a model that those phones never give up." The thread to watch is that federation reframes every quantity the rest of the book optimized: the gradient is now a biased estimate because the shards are not IID, the communication budget is measured in rounds rather than bytes per step, and the aggregation must reveal nothing about any single participant. The local-SGD-and-average move of Chapter 10 reappears in every section, but it now runs on data you cannot inspect, over participants who come and go, under a privacy boundary you are not permitted to cross.

Prerequisites

This chapter assumes the distributed-optimization background of the earlier part. From Chapter 10: Distributed Optimization you carry the single most important idea, local SGD: the move of taking several gradient steps on local data before communicating, rather than synchronizing every step, because FedAvg is local SGD pushed to its extreme, many local epochs between rare communication rounds, and the convergence reasoning of Sections 14.3 through 14.5 builds directly on the local-SGD analysis you saw there. From the same chapter you carry the data-parallel gradient and the synchronous-versus-asynchronous tradeoff, which return as the server-coordinated rounds of FedAvg and the server-free gossip of Section 14.8. From Chapter 4: Communication Primitives for Distributed Training you carry all-reduce and the cost of a communication round, which decentralized learning in Section 14.8 replaces with neighbor-averaging over a gossip topology. The chapter assumes comfortable Python, a working understanding of mini-batch SGD and of training a neural network, and basic probability, since non-IID data in Section 14.4 is a statement about differing local distributions. The differential-privacy and secure-aggregation material in Section 14.6 is developed from first principles and assumes no prior cryptography.

Learning Objectives

Chapter Roadmap

What's Next?

This chapter closes Part III, and with it the assumption that you own and can co-locate your training data, an assumption that held quietly through distributed optimization, parameter servers, classical machine learning, and distributed graph learning, and finally fell away here. Part IV turns from the question of where the data lives to the question of how to train a single very large model fast, and it returns to the world where you own a tightly coupled cluster and the data is yours to scatter. Chapter 15: Data-Parallel Deep Learning opens that part by taking the data-parallel gradient of Chapter 10 and engineering it for deep networks on many accelerators: replicating the model across GPUs, overlapping the backward pass with gradient all-reduce, bucketing and scheduling the communication, and scaling the batch without wrecking convergence. The local-SGD intuition you built here returns there as one point on a spectrum that runs from synchronous every-step all-reduce to the rare-communication federation you just left. Read it next, and watch the federated coordinator's patient averaging tighten back into the microsecond-budgeted all-reduce of a training cluster that owns every byte of its data.

Bibliography & Further Reading

Foundations and Surveys

McMahan, B., Moore, E., Ramage, D., Hampson, S., Aguera y Arcas, B. "Communication-Efficient Learning of Deep Networks from Decentralized Data (FedAvg)." arXiv:1602.05629, 2016. arxiv.org/abs/1602.05629

The paper that introduced federated learning and the FedAvg algorithm of local SGD plus periodic averaging, the starting point for the entire chapter and the core of Section 14.3.

πŸ“„ Paper

Kairouz, P., McMahan, H. B., et al. "Advances and Open Problems in Federated Learning." arXiv:1912.04977, 2019. arxiv.org/abs/1912.04977

The comprehensive survey that frames cross-device versus cross-silo federation, non-IID data, privacy, and communication, the organizing reference behind Sections 14.1, 14.2, and 14.6.

πŸ“„ Paper

FedAvg Variants and Heterogeneity

Li, T., Sahu, A. K., Zaheer, M., Sanjabi, M., Talwalkar, A., Smith, V. "Federated Optimization in Heterogeneous Networks (FedProx)." arXiv:1812.06127, 2018. arxiv.org/abs/1812.06127

The proximal-term variant of FedAvg that stabilizes training under heterogeneous data and stragglers, one of the two corrections developed in Section 14.3 and motivated by Section 14.4.

πŸ“„ Paper

Karimireddy, S. P., Kale, S., Mohri, M., Reddi, S. J., Stich, S. U., Suresh, A. T. "SCAFFOLD: Stochastic Controlled Averaging for Federated Learning." arXiv:1910.06378, 2019. arxiv.org/abs/1910.06378

The control-variate method that corrects the client drift caused by non-IID data, the second FedAvg variant of Section 14.3 and a direct response to the difficulty in Section 14.4.

πŸ“„ Paper

Privacy and Secure Aggregation

Bonawitz, K., Ivanov, V., Kreuter, B., Marcedone, A., McMahan, H. B., Patel, S., Ramage, D., Segal, A., Seth, K. "Practical Secure Aggregation for Privacy-Preserving Machine Learning." ACM CCS, 2017. dl.acm.org

The protocol that lets a server compute the sum of client updates without learning any individual update, the cryptographic core of the secure aggregation in Section 14.6.

πŸ“„ Paper

McMahan, H. B., Ramage, D., Talwar, K., Zhang, L. "Learning Differentially Private Recurrent Language Models." arXiv:1710.06963, 2017. arxiv.org/abs/1710.06963

The work that combines federated training with differential privacy to bound what the released model reveals about any participant, the privacy half of Section 14.6.

πŸ“„ Paper

Personalized Federated Learning

Fallah, A., Mokhtari, A., Ozdaglar, A. "Personalized Federated Learning: A Meta-Learning Approach (Per-FedAvg)." arXiv:2002.07948, 2020. arxiv.org/abs/2002.07948

The meta-learning formulation that trains an initialization each client can quickly adapt to its own distribution, the personalization approach developed in Section 14.7.

πŸ“„ Paper

Decentralized Learning

Lian, X., Zhang, C., Zhang, H., Hsieh, C.-J., Zhang, W., Liu, J. "Can Decentralized Algorithms Outperform Centralized Algorithms? A Case Study for Decentralized Parallel SGD (D-PSGD)." arXiv:1705.09056, 2017. arxiv.org/abs/1705.09056

The analysis showing decentralized neighbor-averaging SGD can match centralized SGD while removing the central bottleneck, the foundation of the gossip-averaging view in Section 14.8.

πŸ“„ Paper

Federated Foundation Models and Efficient Fine-Tuning

Zhang, Y., et al. "FedLLM: A Survey of Federated Learning for Large Language Models." arXiv:2503.12016, 2025. arxiv.org/abs/2503.12016

A comprehensive survey of federated fine-tuning of foundation models, covering FedLoRA, federated prompt tuning, communication efficiency, and the shifted privacy surface when adapter weights rather than full gradients are aggregated. The primary reference for Section 14.9's discussion of federated fine-tuning at scale.

πŸ“„ Paper

Security: Gradient Inversion and Byzantine Robustness

Zhu, L., Liu, Z., Han, S. "Deep Leakage from Gradients." NeurIPS 2019. arXiv:1906.08935. arxiv.org/abs/1906.08935

The paper that introduced gradient inversion, demonstrating that a client's training examples can be reconstructed near-exactly from the gradient it uploads, motivating the privacy hardening in Section 14.6.

πŸ“„ Paper

Geiping, J., Bauermeister, H., DrΓΆge, H., Moeller, M. "Inverting Gradients: How Easy Is It to Break Privacy in Federated Learning?" NeurIPS 2020. arXiv:2003.14053. arxiv.org/abs/2003.14053

Sharpened the gradient-inversion attack to work on larger batches and more realistic architectures, reinforcing the case that differential privacy is necessary alongside secure aggregation. Cited in Section 14.6's discussion of reconstruction attacks.

πŸ“„ Paper

Carletti, M., et al. "SoK: Attacks and Defences in Federated Learning." USENIX Security 2025.

A systematization-of-knowledge paper surveying the full attack-and-defence landscape for federated aggregation, including poisoning, backdoor, and gradient-inversion attacks and the robust aggregation rules (Krum, coordinate-wise median, FLTrust) that defend against them. The primary reference for Byzantine robustness in Section 14.6.

πŸ“„ Paper

Frameworks and Tools

Beutel, D. J., Topal, T., Mathur, A., Qiu, X., Fernandez-Marques, J., Gao, Y., Sani, L., Li, K. H., Parcollet, T., de Gusmao, P. P. B., Lane, N. D. "Flower: A Friendly Federated Learning Framework." flower.ai

The framework-agnostic federated learning library used to prototype the FedAvg rounds, client sampling, and aggregation strategies that run through Sections 14.3 to 14.7.

πŸ› οΈ Tool

Google. "TensorFlow Federated: Machine Learning on Decentralized Data." tensorflow.org/federated

The open-source stack for expressing federated computations and simulating cross-device training, a reference implementation for the algorithms of this chapter.

πŸ› οΈ Tool