TL;DR
Federated learning trains one model across many devices whose data never leaves them. The standard method, FedAvg, lets each device take several local steps and then averages the results, but it is hard to tune and converges poorly on some tasks. This paper proposes a framework, FedOpt, in which the server treats the averaged change from the devices as a gradient and applies an optimiser to it. Using Adagrad, Adam or Yogi on the server adds adaptivity without extra cost on the devices. The authors prove convergence for nonconvex losses with heterogeneous data, and on seven tasks the adaptive servers match or beat FedAvg while being easier to tune.
Builds on: Communication-Efficient Learning of Deep Networks from Decentralized Data, Adam Optimizer, AdaGrad · Leads to: Federated Optimization in Heterogeneous Networks (a related fix for the same client-drift problem)
Why it mattered
Federated learning trains a model without collecting the training data in one place. The paper's main concern is the cross-device setting, where a small fraction of devices such as phones join each round and none can keep state between rounds. Several strong methods, including SCAFFOLD, need clients to remember state across rounds. That is workable between institutions such as hospitals, but not between phones. This paper gave a clean recipe for the harder cross-device setting: the server carries all the adaptive state, and each device still sends one model update per round. The authors also released a benchmark of seven federated tasks across five datasets, with open-source code, so that later methods could be compared on the same ground. By their own account these are the first methods for federated learning to use adaptive server optimisation.
The problem
FedAvg has three practical difficulties, and the paper names two of them directly:
- Client drift. After several local steps on its own data, a device's model moves toward the minimum of its local loss, which may differ from the global minimum. Averaging drifted models gives a worse update than the true global gradient would.
- Lack of adaptivity. FedAvg is essentially stochastic gradient descent with a fixed server step. Text models in particular produce heavy-tailed gradient noise and sparse gradients, where rare words update rarely, and per-parameter step sizes help.
The known fix for drift, SCAFFOLD, uses control variates that each client must store and update across rounds. That is impossible when clients are sampled rarely and keep no state. Adaptive methods, meanwhile, need an accumulator for each parameter. Doing that on each device, as in earlier adaptive federated methods, means the accumulators must be communicated and averaged across clients. The paper notes that keeping the adaptive state on the server means at most half the communication and client memory per round of those designs. The question is whether adaptivity can live on the server alone.
How it works
Take a tiny example with two parameters, , starting at , two sampled clients, and a server step . Assume the adaptivity constant is negligible for the arithmetic.
flowchart LR A["Server sends model x_t"] --> B["Clients run local SGD for K steps"] B --> C["Each client sends its change Delta_i"] C --> D["Server averages to Delta_t"] D --> E["Treat minus Delta_t as a gradient"] E --> F["Server optimiser: Adagrad, Adam or Yogi"] F --> G["New server model x_t+1"] G --> A
- Broadcast. The server sends to the sampled clients.
- Local training. Each client runs several steps of ordinary SGD on its own data. Client 1 ends at , and client 2 ends at . Their changes are and . Check: the clients only send these changes, not their optimiser state.
- Average the changes. . The server reads as a gradient, which the paper calls the pseudo-gradient.
- The FedAvg step, for comparison. Plain averaging is equivalent to applying gradient descent with step 1 to this pseudo-gradient, so the new model is . Check: each coordinate moves by the averaged change.
- The FedAdagrad step. Adagrad keeps a running sum of squared pseudo-gradients, . Check: the sum starts from the first round's squared changes, taking the paper's initial value as zero.
- Scale each coordinate. The update is . Coordinate 1 becomes , and coordinate 2 becomes . So .
- Interpretation. Averaging moved coordinate 1 by and coordinate 2 by . Adagrad moved both by , because each coordinate is divided by its own history. A coordinate with large past updates takes smaller steps; one with small past updates takes larger ones. The client cost is unchanged, because clients still send one change per round.
The math
Let be the loss of client out of clients, and let be the global objective the server wants to minimise. FedAvg with local steps on each client produces, for a sampled set of clients, the average change
Step 4 in symbols: FedAvg as server gradient descent
Treat as a gradient. A gradient-descent step with server rate on it is . Setting recovers FedAvg exactly. This is the observation that makes the framework possible: any other gradient-based optimiser can be run on the server in place of this step.
Step 5 in symbols: the adaptive server updates
The paper's Algorithm 2 writes FedAdagrad, FedYogi and FedAdam with a server state (a momentum of the pseudo-gradient) and (a per-coordinate second moment):
and then, depending on the method,
The server model is then
The adaptivity constant controls how adaptive the method is: a smaller means larger coordinate-wise differences in step size. In the walkthrough, , so , and , which is the step 6 arithmetic. The client side is ordinary SGD with client rate .
Step 6 in symbols: the convergence rate
The paper assumes Lipschitz gradients, bounded per-coordinate gradients , and bounded variance. It measures heterogeneity with , the variance of the client gradients around the global gradient; means all clients are identical in distribution. For FedAdagrad and FedAdam with full participation, the paper's Corollaries 1 and 2 give, for suitable learning rates and ,
where and is the variance within a client. The leading term decays as , which the authors note matches the best known rate for this nonconvex setting. Heterogeneity enters through , which appears only in the later terms. The paper's Remark 1 says the effect of heterogeneity can be reduced by choosing the client and server rates well, but not removed.
Results
All numbers are from the paper's Table 1, which gives validation performance averaged over the last 100 rounds. Higher is better, except for EMNIST AE, which reports mean squared error times 1000.
| Task | FedAdagrad | FedAdam | FedYogi | FedAvgM | FedAvg |
|---|---|---|---|---|---|
| CIFAR-10 | 72.1 | 77.4 | 78.0 | 77.4 | 72.8 |
| CIFAR-100 | 47.9 | 52.5 | 52.4 | 52.4 | 44.7 |
| EMNIST CR | 85.1 | 85.6 | 85.5 | 85.2 | 84.9 |
| Shakespeare | 57.5 | 57.0 | 57.2 | 57.3 | 56.9 |
| Stack Overflow NWP | 23.8 | 25.2 | 25.2 | 23.8 | 19.5 |
| Stack Overflow LR (Recall@5) | 67.1 | 65.8 | 65.9 | 36.9 | 30.0 |
| EMNIST AE (MSE ×1000, lower is better) | 4.20 | 1.01 | 0.98 | 1.65 | 6.47 |
Where adaptivity helps most. The largest gaps are on the sparse-gradient text tasks and the image tasks where the baseline is weakest. On Stack Overflow next-word prediction, FedAdam and FedYogi reach 25.2 against 19.5 for FedAvg. On Stack Overflow tag prediction, FedAdagrad reaches 67.1 against 30.0. On CIFAR-100, FedAdam reaches 52.5 against 44.7. The paper's explanation for the text tasks is that words absent from a client's data give near-zero updates, so their accumulators stay small and rare words can take large steps when they do appear.
Where the gaps are small. On Shakespeare and EMNIST CR, all methods are within a point or so of each other, and the paper's own bolding treats anything within 0.5 points of the best as tied. Adaptivity does not hurt there, but it is not what makes the difference.
Comparison with SCAFFOLD. On every task SCAFFOLD performed comparably to or worse than FedAvg and the adaptive methods. On Stack Overflow it was nearly identical to FedAvg, because the 342,477 clients make it unlikely any client is sampled twice, so its control variates never get used. The authors suggest that rarely sampled clients make control variates stale.
Ease of tuning. For FedAvgM, only a few client learning rates work for each server rate. For FedAdam and FedYogi, many pairs work. The adaptivity constant mattered little: worked almost as well as the alternatives on nearly all tasks.
Limits. The authors tuned hyperparameters by minimising average training loss over the last 100 rounds, because validation data is often unavailable in federated settings, so the numbers are not the usual held-out comparison. Each experiment is a simulation with uniform client sampling in TensorFlow Federated, not a deployment. The theorems assume full participation, and extending them to partial participation adds a term that depends on the sampled fraction. The analysis also assumes bounded gradients, which is a strong assumption for deep networks. And the paper does not claim that adaptivity removes client heterogeneity, only that it works well for the moderate heterogeneity found in these tasks.
Reading guide
- Abstract and Section 1, Introduction. The problem (client drift and lack of adaptivity) and the claimed contributions. Read with Federated Learning and Stochastic Gradient Descent in mind.
- Section 2, Federated learning and FedAvg. The FedAvg update rewritten as a pseudo-gradient step, and Algorithm 1, the general FedOpt framework. The key idea of the paper is that FedAvg is the special case where clients and server both run SGD and the server learning rate is 1. Prerequisites: Gradient Descent, and Momentum for the server-momentum variant FedAvgM.
- Section 3, Adaptive federated optimization. Algorithm 2 and the theorems. Read the algorithm box closely, then the corollaries; skip the constants in Theorems 1 and 2 on a first pass. Prerequisites: AdaGrad, Adam Optimizer, and Learning Rate for the step-size roles.
- Section 4, Datasets, models and tasks. The seven tasks and the models: ResNet-18 with group normalisation in place of ResNet's batch normalisation (see Group Normalization), a recurrent network for Shakespeare, Bag of Words logistic regression for tag prediction, and a Recurrent Neural Network language model for next-word prediction.
- Section 5, Results. Table 1 carries the headline claims. Figures 2 and 3 give the tuning results, which matter as much as accuracy for practitioners.
- Appendix A. The proof strategy. The main difficulty, as the appendix puts it, is that client updates are pseudo-gradients, biased and high-variance, not gradients.
Check yourself
QuestionRecall: which choice of server optimiser and server learning rate makes FedOpt equal to FedAvg?Show answer
Plain stochastic gradient descent on the server, with server learning rate . Applied to the pseudo-gradient , one such step adds the averaged client change to the server model, which is exactly the FedAvg update.
QuestionComputation: a server starts at . In the first round the averaged change is . With FedAdagrad, server rate and negligible, what is ?Show answer
Here , so . Coordinate 1 becomes , and coordinate 2 becomes . So . Each coordinate moved by the same size, although their averaged changes were different.
QuestionWhy: why does the paper say that adaptive server optimisation avoids the extra cost that client-side adaptive methods pay?Show answer
Client-side adaptive methods keep per-parameter accumulators on each device, so those accumulators must be sent and averaged across clients each round, which the paper estimates costs up to twice the communication and client memory per round. In the server-side design the accumulators live only on the server, and each client still sends one model change and receives one model. The server is the only place the adaptive state is kept, so the cost on the devices is unchanged.
QuestionApplied: you deploy federated training on phones, where each round samples a small fraction of devices and no device keeps any state between rounds. Which method from the paper is ruled out, and which is compatible? What would you expect from each?Show answer
SCAFFOLD is ruled out, because its control variates must be stored and updated by each client across rounds, which devices sampled rarely cannot do. FedAdam or FedYogi is compatible, because the adaptive state lives on the server and devices only run ordinary SGD. The paper's experiments suggest FedAdam or FedYogi would beat FedAvg on text tasks and on some image tasks, while SCAFFOLD would perform no better than FedAvg. Verify on your own task, since the paper's numbers come from simulations.