TL;DR
McMahan and colleagues at Google wanted to train a deep network on data that stays on users' phones, where the data is private and the connections are slow. Their method, FederatedAveraging (FedAvg), has each selected device run several passes of stochastic gradient descent on its own data, then sends its updated weights to a server, which averages them weighted by how much data each device holds. The paper reports that this needs 10 to 100 times fewer communication rounds than synchronized SGD.
Builds on: Federated Learning, Stochastic Gradient Descent, Feedforward Neural Network, Cross-Entropy Loss · Leads to: practical Federated Learning systems, and the communication-reduction and secure aggregation work the paper cites as follow-ups
Why it mattered
The paper gave the name federated learning to training that keeps data on the devices that produce it, and it showed a simple algorithm that works on deep networks. The authors argue that the privacy gain comes from sending only model updates, not raw data, and that the updates can be discarded once applied.
The paper's own list of follow-up work is a good map of what came after. It cites Bonawitz and colleagues for an efficient secure aggregation protocol, and Konečný and colleagues for algorithms that cut communication further. It also names stronger guarantees, such as differential privacy and secure multi-party computation, as future directions. Those are the places where the idea grew.
The problem
Training on data from phones breaks several assumptions of data-centre training. The data is non-IID, meaning one user's data is not a fair sample of the whole population, and unbalanced, meaning some users have far more data than others. Devices are often offline, and the upload bandwidth may be 1 MB/s or less. In a data centre, computation dominates the cost; on a phone network, communication dominates.
The paper's central question is how to reduce the number of communication rounds. The naive baseline, SGD with one gradient computed per round, needs very many rounds. Averaging models trained separately is a known idea, but earlier work on it considered only data-centre settings with fast networks and balanced, IID data. The paper adapts that style of averaging to the federated setting and tests it on the features that matter there.
How it works
Take a tiny example with two clients and one weight . Client 1 holds one example with target 0, and client 2 holds three examples with target 4. The loss for each example is . The global objective weights each client by its share of the data, so its minimum is the weighted mean . We use learning rate and one local gradient step per round.
-
Server sends the model. The server sends to both clients.
-
Each client takes one local step. A step on client with target is . Client 1 gets and client 2 gets . Check: each device moved halfway to its own target.
-
Server averages by data size. The new weight is . Check: client 2 counts three times as much because it holds three examples.
-
Repeat the round. From , client 1 gets and client 2 gets . The average is . Check: the distance to 3 has halved, from 1.5 to 0.75.
-
Keep going. Round three gives , and each round halves the remaining distance to 3. Check: the server converges toward the global optimum 3 without ever seeing an example.
flowchart LR S[Server sends weights] --> C1[Client 1 trains on its data] S --> C2[Client 2 trains on its data] C1 --> A[Server averages by data size] C2 --> A A --> S
The full algorithm works the same way, but each client takes many steps. A client with examples runs passes over its data in minibatches of size , so it takes about local steps per round. Each round the server picks a random fraction of the clients.
The math
Write the global objective as an average over all training examples, , where is the loss on example . If client holds the examples in the set , with examples, the objective can be rewritten as
Each is the average loss on client , and the weights add up to 1.
Step 2 in symbols: one local step
The naive federated gradient step with one gradient per client per round is , where . The paper shows that this equals a two-stage process: each client computes , and the server averages these with the same weights. This is the step in the toy example, where and give and , which is . Note that is the same as .
Step 3 in symbols: FedAvg
FedAvg replaces the single gradient with several local steps. In round the server selects a set of clients, and is the total number of examples they hold. Each selected client runs epochs of minibatch SGD on its own data, giving , and the server computes
The average is taken over the selected clients only, which is the correction the paper notes in its algorithm box. The expected number of updates per client per round is , which the paper uses to compare settings.
Results
Setup. The paper tests a two-layer MLP and a CNN on MNIST, a character LSTM on the complete works of Shakespeare, a CNN on CIFAR-10, and a word-level LSTM on a large social network dataset of 10 million posts from over 500,000 authors. The MNIST 2NN has 199,210 parameters, the CNN has 1,663,370, and the Shakespeare LSTM has 866,578. The Shakespeare clients are speaking roles in plays, 1146 in total, and the data is unbalanced.
Rounds to reach a target accuracy, MNIST CNN, 99 percent. With IID data, FedSGD needs 626 rounds. FedAvg with and needs 18 rounds, a speedup of 34.8 times. With non-IID data, FedSGD needs 483 rounds and the same FedAvg setting needs 173, a speedup of 2.8 times. The paper's abstract reports the 10 to 100 times reduction across its experiments.
MNIST 2NN, client fraction. With , and , the 2NN reaches 97 percent in 87 rounds with IID data, against 316 rounds at , a speedup of 3.6 times. With non-IID data, the same setting takes 664 rounds against 3275, about 4.9 times.
CIFAR-10. Baseline SGD reaches 86 percent after 197,500 minibatch updates. FedAvg reaches 85 percent after 2,000 communication rounds. For the 85 percent target, SGD needs 99,000 and FedAvg needs 2,000, a speedup of 49.5 times.
Large-scale word LSTM. Here FedAvg reaches 10.5 percent accuracy in 35 communication rounds, while FedSGD needs 820, a speedup of 23 times. The paper states that these runs were not tuned as thoroughly as the others.
Limits. The experiments partition existing datasets over clients in a controlled environment, not real phones, and the paper sets aside the practical deployment issues of a full federated system. Results are shown mainly in figures and tables for chosen targets, so the reader should check which target and setting a speedup refers to. The paper also reports that very large numbers of local epochs can make FedAvg plateau or diverge on the Shakespeare LSTM (its Figure 3), so more local work is not always better.
Reading guide
- Section 1, Introduction: the privacy motivation and the list of contributions. Needs Federated Learning as a term and the idea of Empirical Risk Minimization.
- Section 1, Federated optimization: the four properties (non-IID, unbalanced, massively distributed, limited communication). Needs Weighted Average and Data Parallelism as the data-centre contrast.
- Section 1, Related work: earlier averaging methods in data centres. Needs Stochastic Gradient Descent.
- Section 2, FederatedAveraging: the one-round equivalence with FedSGD and the Algorithm 1 box. Needs Learning Rate and Feedforward Neural Network. Figure 1 shows why averaging neural networks trained from different starting points can fail.
- Section 3, Experimental results: the MNIST, Shakespeare, CIFAR and word-LSTM experiments. Needs Convolutional Neural Network, Recurrent Neural Network, LSTM and Cross-Entropy Loss for the classification losses.
- Section 4, Conclusions: the follow-up directions, including Differentially Private SGD as a route to stronger privacy.
Check yourself
QuestionIn the two-client toy example, the client updates are 0 and 2, with 1 example on client 1 and 3 on client 2. What does the server send next, and why is client 2 weighted more?Show answer
The server sends . Client 2 holds three of the four examples, so its update counts three times as much, which matches the global objective that weights each example equally.
QuestionOn the MNIST CNN with IID data, FedSGD needs 626 rounds to reach 99 percent and FedAvg with , needs 18. How many times fewer rounds does FedAvg need?Show answer
. FedAvg needs about 35 times fewer rounds, which matches the speedup the paper reports for that row.
QuestionFor the Shakespeare LSTM, the non-IID speedup is larger than the IID speedup. What reason does the paper give?Show answer
The paper conjectures that some roles have relatively large local datasets, so extra local training on those clients is especially valuable. It reports a 95 times speedup for the non-IID case against 13 times for the IID case, with and .
QuestionA team sets the number of local epochs very high so that each device trains for a long time between rounds. What risk does the paper report, and what does it suggest?Show answer
For very large numbers of local epochs, FedAvg can plateau or diverge on the Shakespeare LSTM, so more local work does not always help. The paper suggests that in later stages of training it may help to reduce the local computation per round, with smaller or larger , in the same way that decaying the learning rate helps. The team must test this on its own model.