Thousands of phones each train a little, and the server averages the results. Give the server Adam’s memory and it takes smarter steps, so rare words finally move.
Learn how a server can treat the average of its clients’ changes as a gradient, and why letting an adaptive optimizer take that step beats plain averaging.
Drag the server learning rate. Three servers learn from the same five phones per round: plain averaging, averaging with momentum, and FedAdam. Watch which ones reach the rare weight. Then we build, piece by piece, what a federated round is, why averaging has limits, and what the paper changes.
You need a feel for gradient descent (walking downhill in small steps) and a little Python. We build the rest from zero: federated learning, the pseudo-gradient, and Adam.
Based on Adaptive Federated Optimization by Sashank J. Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konečný, Sanjiv Kumar and H. Brendan McMahan (Google Research, ICLR 2021). It is a reading of the optimizers lesson and of the Core Automation post The Hitchhiker’s Guide to Training on Compute Islands by Rohan Anil, which names this paper as the source of the inner and outer optimizer idea. Every idea is re-taught here in our own words and devices.
Illustrative toy, computed live in your browser: 50 phones, 5 sampled per round, 5 local steps at 0.1; two weights, one every phone uses and one only 2 of 50 phones use. The paper’s own results are in Chapter 8. The gap is the larger of the two weights’ remaining distances to the optimum.
Chapter 0
See why a server that cannot see anyone’s data must still teach one shared model, and why every trip to the server is expensive
Think about the keyboard on your phone. It suggests the next word as you type. To suggest well, it must learn from what people actually type. But what you type is private: messages, names, passwords half-typed. Nobody wants that sent to a company’s computers.
So the company turns the problem around. It sends the model to the phones. Each phone trains the model a little on its own text, and sends back only the change. The server combines the changes. The text never leaves the phone. This idea is called federated learning: many clients (phones, or any machine holding private data) teach one shared model under a coordinating server, and the raw data stays where it is.
The paper we read here, Adaptive Federated Optimization, is about the step the server takes with those changes. To see why that step matters, we first need the loop and its vocabulary.
Training happens in rounds. In one round the server does the following:
The model is a list of d numbers called weights (or parameters). In the paper it is a vector x in Rd: d real numbers. Everything that crosses the network in a round is a vector of that same length d.
A phone is slow at talking and fast enough at computing. Sending a few million numbers over a mobile link, at night, while charging, on Wi-Fi, is the real cost. In the paper’s words, ordinary distributed SGD (the step-by-step recipe where machines share a gradient after every single step) can incur high communication costs. So federated methods let each client take many local steps before it talks. The paper uses the number of communication rounds as its measure of training time, because every method it compares sends objects of the same size.
The same trade-off sits at the heart of the Core Automation post that sent us to this paper. Its author, Rohan Anil, writes that federated learning “added two more ingredients: treat each worker’s parameter change between exchanges as a pseudo-gradient, and apply a separate outer optimizer to it.” Those two ingredients are exactly this paper’s subject. Two data centers joined by a slow link are, to an optimizer, a few very large clients. Turn the dial below to see why local steps are so attractive.
Each client must do 1,000 gradient steps of work. The top bar is one trip to the server after every step. The bottom bar is one trip after every K local steps. Drag K.
Counting only. This says how many trips are saved, not whether the model is still good: that is the question of Chapters 1 and 2. 1,000 steps is an illustrative workload.
With K = 20, a client that must do 1,000 steps of work makes 50 trips instead of 1,000. That is twenty times less talking. The catch is what the local steps do to the answer. Each client improves the model for its own data, and its own data is not like anyone else’s.
First, heterogeneity: client data differs. One phone types in Spanish, one in code, one mostly emoji. Statisticians say the data is non-IID (not identically distributed). A step that helps one client can hurt another. The paper measures this with a number called σg, and we meet it in Chapter 7.
Second, who is online. The paper separates two settings. In cross-silo federated learning the clients are a few large institutions, most take part in every round, and they can keep notes between rounds. In cross-device learning, the paper’s main focus, the clients are phones: only a tiny fraction take part in any round, and a client “cannot maintain state across rounds.” Stack Overflow, the largest benchmark in the paper, has 342,477 training clients. A given phone may be picked once, or never.
The most common method, FedAvg (federated averaging), just averages the clients’ models. It works, but it can be hard to tune. The authors name two causes. One is client drift, where local models wander away from what is best for everyone. The other is a lack of adaptivity: FedAvg behaves like plain SGD, and plain SGD struggles with the heavy-tailed noise common in language models. This paper attacks the second cause. It lets the server use an adaptive optimizer, one that keeps a memory of past steps and gives each weight its own step size.
A server-side change is attractive for one reason: the phones do not change. They do the same local training and send the same size message. Nothing extra to store, nothing extra to send. We will check that claim with numbers in Chapter 3.
For the background on momentum and Adam, our lesson on optimizers and momentum goes slower than we can here. For the bandwidth arithmetic behind “trips are expensive”, see bandwidth arithmetic. We repeat only what we need.
Chapter 1
Write one federated round as an equation, then watch many local steps pull the average away from the best answer
Two friends, Ana and Ben, share one thermostat. Ana likes the room at 0 degrees above the baseline, Ben at 4. Ana is very sensitive: one degree off and she complains loudly. Ben is mild. If we ask each of them to fix the temperature for a while by themselves, Ana will reach her favourite setting fast, and Ben will drift toward his slowly. Then we average their settings. Is the result the best compromise?
Not quite. Ana’s loud complaints should count for more in the final answer, but after a long solo session both sit at their own favourite, and the average treats them as equals. This small story is the whole problem of this chapter. We will make it exact.
The paper states the goal as a minimisation. There are m clients. Client i has a loss function Fi(x), a score of how badly the model x fits that client’s data (lower is better). The server wants the single model with the lowest average loss.
At round t the server holds the model xt. FedAvg then does what Chapter 0 listed. It samples a set S of clients and sends xt to each. Client i runs SGD (stochastic gradient descent: repeatedly nudge the weights against the gradient of the loss on a small batch of its data) for K steps with a client learning rate ηl. The step is x ← x − ηl g, where g is the gradient. The result is the client’s model xit. The server sets the next model to the average of these:
Data flow: down the wire goes one vector of shape (d). Back up comes one vector of shape (d) per client. The server stores one vector. That is cheap, and it explains why FedAvg won early: when the clients’ data agree, it matches plain SGD with far fewer trips.
Take the thermostat story with real numbers. Model: a single weight x. Ana (client A) has loss ½·4·(x − 0)2: sharp, with favourite 0. Ben (client B) has loss ½·1·(x − 4)2: mild, favourite 4. The global loss averages the two, and its minimum is where the total pull cancels: x* = (4·0 + 1·4)/(4 + 1) = 0.8. Ana’s sharpness counts four times as much, so the answer sits close to her.
Use client learning rate 0.1. A local step on a quadratic shrinks the distance to the favourite by a fixed factor: Ana by (1 − 0.1·4) = 0.6, Ben by (1 − 0.1·1) = 0.9. After K steps the factors are 0.6K and 0.9K.
This gap is client drift. With many local steps each client runs to its own favourite, so the average weighs the clients by how far they could run, not by how sharply they care. Ana’s sharp loss, which should dominate, ends up counting as much as Ben’s. Try it.
The curve is the global loss. The blue marks are Ana’s and Ben’s favourites. Green is the true best weight, 0.8. The coloured dot is where FedAvg stops. Drag K.
Toy, computed exactly: two clients with losses ½·4·x² and ½·(x − 4)², client learning rate 0.1, full participation. The fixed point is mean(bi(1 − ri)) / (1 − mean(ri)) with ri = (1 − 0.1ai)K.
Drag K from 1 up to 40 and the dot slides from 0.80 to 1.99. The loss at the dot rises from 3.20 (the best possible) to 4.96. More local steps saved trips in Chapter 0, and here they cost accuracy. That is the trade-off every method in this paper has to live with.
There is a known cure. The SCAFFOLD method gives each client a control variate: a stored correction that cancels its drift. The authors note it “requires clients to maintain state across rounds”, so it cannot work in cross-device settings, where a phone may appear once. This paper takes the other road. It leaves the clients alone and improves what the server does with their changes. We will see in Chapter 8 that SCAFFOLD also performed worse than FedAvg on most of its tasks.
Chapter 2
Rewrite FedAvg as one gradient step on the server, and see that its fixed step size of 1 was a choice nobody had to make
Picture a hiking group. Each hiker walks off in a different direction for an hour, then radios back where they stand. The leader does not move to the average of those places. The leader asks something different: how far did the group move, and in which direction? Then the leader walks that way, maybe a bit further, maybe a bit less.
That small change of viewpoint is the whole idea of this chapter. A client’s model is a place. Its change is an arrow. The server can follow the average arrow with any step size it likes.
At round t, client i starts at the server model xt and ends at xit after its local steps. The client’s model delta is the difference. The server averages the deltas of the sampled clients.
Now FedAvg’s update, xt+1 = average of the xit, is the same as xt + Δt. Check: every xit equals xt + Δit, and the average of (xt + Δit) is xt + Δt. Now compare with the usual gradient-descent step, x − η g. If we say “the gradient is −Δt” and η = 1, they match exactly:
A true gradient is a slope measured at one point. Here is a cleaner case: if the client takes a single step, Δi = −ηlgi, a scaled gradient. With K steps, the client adds up K gradients, each measured at a different place along its path. The paper’s appendix explains the consequence: these deltas are “not gradients, or even unbiased estimates of gradients”. They can have “both high bias” and “high variance (due to compounding variance across client updates)”. They are an arrow with a gradient’s shape and none of its guarantees. That makes the paper’s theory hard, and it makes the question in the paper worth asking: can the negative average delta be used as a pseudo-gradient in general server optimizer updates? The paper answers yes.
In our toy there is something lovely to see. For the two clients of Chapter 1 with K = 5, the average delta at any server weight x equals (1 − r̄)(xfp − x), where r̄ = 0.334 is the average shrink factor and xfp = 1.23 is the fixed point of FedAvg. That is the exact gradient of a bowl, but a bowl centred on 1.23, not on the true best weight 0.8. The server descends this surrogate bowl, one step per round. Its steepness is 1 − r̄ = 0.666.
Descending a bowl with steepness 0.666 and step η shrinks the distance to the bottom by the factor 1 − 0.666η each round. At η = 1 that factor is 0.334. The best step is the one that jumps straight to the bottom: η = 1/0.666 = 1.5, where the factor is 0.001. At η = 3 the factor is −1: the server hops back and forth over the bottom and never settles. Beyond that it blows up. Try it: the server starts at 3.
The line is the distance from the server’s weight to the round’s fixed point, on a log scale, over 12 rounds. The dashed line marks 0.01. Drag the server learning rate, starting at 1, FedAvg.
Toy, exact: the two clients of Chapter 1, K = 5, client rate 0.1, start at 3, fixed point 1.23. Each round multiplies the distance by 1 − 0.666η. In the paper, tuned server learning rates beat 1 (Remark 1 and Appendix E.4).
At η = 1 the server needs 5 rounds to come within 0.01 of the fixed point. At η = 1.5 it needs 1. At η = 0.5 it needs 13. Past η = 3 it never arrives. The paper puts the lesson in one sentence: “The server learning rate η = 1 typically used in FedAvg does not necessarily minimize the upper bound.”
Once the server step is a gradient step, the server may swap in any optimizer. Momentum, Adam, anything. The server calls ServerOpt(x_t, −Δ_t, η, t): the current model, the pseudo-gradient, a learning rate and the round number. The paper names the family FedOpt. The next chapter spells it out.
Chapter 3
Split the round into a client optimizer and a server optimizer, then count the bytes to see why the adaptive part belongs on the server
A relay race has two kinds of runner. Sprinters run short legs fast and alone. The coach, watching from the stands, decides who runs next and how to adjust the plan after every lap. In a federated round the clients are the sprinters. The server is the coach. Chapter 2 gave the coach a way to read the laps: the pseudo-gradient. Now the coach needs a method.
The paper writes the round as a general recipe, FedOpt. It has two slots. ClientOpt is the optimizer each client runs on its own data. ServerOpt is the optimizer the server runs on the pseudo-gradient. Here is the round, in the paper’s structure:
FedOpt, one round t S = sample a subset of clients for each client i in S, in parallel: x_i = x_t # receive the model, shape (d,) for k = 0 .. K-1: g = unbiased estimate of grad F_i(x_i) # from a batch, shape (d,) x_i = ClientOpt(x_i, g, eta_l, t) delta_i = x_i - x_t # send this back, shape (d,) delta = average of delta_i over S # shape (d,) x_t+1 = ServerOpt(x_t, -delta, eta, t)
Two learning rates appear. ηl is the client learning rate, the step size of the sprinters. η is the server learning rate, the step size of the coach. Each optimizer may also depend on the round number t, which lets learning-rate schedules in.
Plug in plain SGD for both and set η = 1: you get FedAvg. Plug in SGD with momentum on the server: FedAvgM, proposed by Hsu et al. (2019). Plug in an adaptive optimizer on the server: the paper’s new methods. The choices of the paper’s five main methods, all with plain SGD on the clients:
| Method | ClientOpt | ServerOpt | Server state |
|---|---|---|---|
| FedAvg | SGD | SGD, η = 1 (or tuned) | none |
| FedAvgM | SGD | SGD with momentum 0.9 | momentum m |
| FedAdagrad | SGD | Adagrad | v |
| FedAdam | SGD | Adam | m and v |
| FedYogi | SGD | Yogi | m and v |
The paper’s theory counts K steps. Its experiments follow practice instead. Each client runs E epochs over its own data in mini-batches (E = 1 throughout), so clients with more data take more steps. The server then weights each delta by the client’s share of the examples: Δt = ∑i (ni/n) Δit, where ni is client i’s number of examples and n their sum. Batch sizes are fixed per task, from 4 for Shakespeare up to 100 for the Stack Overflow logistic regression.
Adaptive optimizers keep state: extra numbers, one per weight, that remember the past. They could live on the clients or on the server. The paper argues for the server, and the argument is about bytes.
The paper compares with AdaAlter (Xie et al., 2019), which puts the adaptive state on the clients. The accumulator is as big as the model. So the client must receive it with the model, update it, and send it back. The paper says the communication “doubles for this method, relative to FedAvg”, in both directions, and the client must also hold the extra numbers in memory. A server-side method sends and receives exactly what FedAvg does, and keeps the state at home. The authors summarise: “at most half as much communication and client memory usage per round”. Count it yourself for a model size you pick.
Choose a design and a model size. Bars show what one client downloads and uploads in a round, what extra memory it needs, and what the server stores.
Illustrative: 4 bytes per weight (32-bit numbers). Server state sizes follow Algorithm 2 (x, m, v). Client-adaptive stands for AdaAlter-style designs, where the paper says the accumulator is the size of the model weights (Appendix B.3). The slider runs from 1 to 1,000 million weights.
For a model of 10 million weights (40 MB), FedAvg and FedAdam each send 40 MB down and 40 MB up per client. A client-adaptive design sends 80 MB each way and needs 40 MB more memory on the phone. The server’s own memory goes up for FedAdam: it stores x, m and v, three vectors of d numbers, 120 MB. A server can afford that. A phone cannot.
In cross-device learning a given client is rarely seen twice, so it cannot keep state between rounds. Client-side accumulators would be reset or stale. Server-side state has no such problem: the server is always there. This is why the paper says its choice “ensure[s] compatibility with cross-device FL”.
Chapter 4
Build the adaptive optimizer from the idea that a word seen daily and a word seen yearly should not move at the same speed
A teacher marks homework. Most students hand in work every day, so the teacher knows them well and nudges their grade by a tiny amount each time. One student hands in work twice a year. When that work finally arrives, a tiny nudge would waste it. The teacher should react strongly, because this is rare information.
A language model has the same two kinds of weights. The weights tied to the word “the” get a signal on nearly every example. The weights tied to a word like “zebra” get a signal only when a client happens to write about zebras. Text has this shape everywhere: a few words are very common and a long tail is very rare. The paper calls these approximately sparse gradients: most entries of the gradient are close to zero most of the time.
SGD moves every weight by the same rule: new weight = old weight − η × gradient. One learning rate η serves all d weights. If η is right for “the”, a rare word moves only a little each time it appears, and because it appears seldom, it barely moves at all. If η is large enough to help the rare word, “the” overshoots and the training blows up. No single η works for both. (Chapter 0’s hero shows this on a toy.)
Momentum keeps a running average of recent steps, like a rolling ball that keeps some of its speed. In the paper’s notation mt = β1 mt−1 + (1 − β1) Δt, a blend of the old average and the newest signal. It smooths noise. It does not fix the problem above, because every weight still shares one step size. Our optimizers lesson covers momentum slowly.
Adagrad (Duchi et al., 2011) gives each weight its own memory. For weight j it keeps a running total vj of the squares of every signal that weight has received. Then it divides the step by the square root of that total:
In the federated setting the signal is the average delta Δt from Chapter 2, not a gradient. The server runs this update on the whole vector at once. Everything is element-wise: d different step sizes, one per weight.
The paper explains why this suits language tasks: “words that do not appear in a client’s dataset produce near-zero client updates. Thus, the accumulators vt,j in Algorithm 2 remain small for parameters tied to rare words, allowing large updates to be made when they do occur.” Watch it happen. Both weights below receive a signal of size 1 whenever they fire. “The” fires every round. “Zebra” fires in only some rounds.
The vertical axis is the step multiplier 1/(√v + τ): how big a step one unit of signal buys. Plain SGD is always 1. Drag how rare “zebra” is.
Toy: signals of size 1 on firing, 0 otherwise; both weights fire in round 1; τ = 0.001; the rare weight fires when a fixed seeded random number is below 1/N. Adagrad with β1 = 0 and η = 1, as in Algorithm 2.
After 200 rounds, “the” has fired 200 times, so its v is 200 and a unit of signal buys a step of 0.07. “Zebra” at 1 in 20 has fired only 8 times in our seeded run, so its v is about 8 and a unit buys 0.35: five times larger. Slide the rarity to 1 in 50 and the gap widens to 6.3 times. The rare word gets the bigger kick exactly when its rare news arrives.
The paper has a second motive. Language models often have heavy-tailed noise: now and then a gradient is far larger than usual. SGD, which scales steps by the raw gradient, is thrown off by such spikes. Methods that divide by a running size of the signal are steadier. The citation is Zhang et al. (2019a). We take this as the authors’ stated motive; the paper itself tests it only through its benchmarks (Chapter 8).
Chapter 5
Read Algorithm 2 one line at a time and see how the three servers differ in a single line: how they remember the size of past signals
Three accountants keep the books for one shop. All three write down every day’s sales, squared, because big days matter more. The first never throws anything away: the book only grows. The second fades old pages by 1% a day. The third makes a fixed small correction each day toward today’s figure, up or down. They agree on almost everything, and they differ in one habit. That habit is the whole difference between FedAdagrad, FedAdam and FedYogi.
Algorithm 2 in the paper starts exactly like FedOpt with SGD on the clients. Lines 3 to 10 are what you already know: sample clients, each runs K local SGD steps (xi,k+1 = xi,k − ηl gi,k), return Δi = xi,K − xt, average to Δt. Then the server does three things. Every quantity below is a vector of d numbers, and every operation is element-wise.
The signal is divided by the square root of the size memory, as in Chapter 4. Here are the three rules for vt, side by side:
With the paper’s settings β1 = 0.9 and β2 = 0.99 for FedAdam and FedYogi, the blend keeps 99% of the old v and takes 1% of the new. A signal from 100 rounds ago still counts for 0.99100 = 37% of its original weight. Note what is absent: unlike the textbook Adam, Algorithm 2 has no bias correction, and the paper’s own runs use the same plain form.
Take one weight with τ = 0.001, v−1 = τ2 = 10−6, m−1 = 0, η = 0.1, and an average delta of 1 in the first round. FedAdam: m0 = 0.9·0 + 0.1·1 = 0.1. v0 = 0.99·10−6 + 0.01·1 = 0.01. The step is 0.1 × 0.1/(√0.01 + 0.001) = 0.1 × 0.1/0.101 = 0.099. The adaptive division turned a signal of 0.1 into a step close to 0.1 × 1: the step does not depend on the signal’s scale. If the delta had been 100 times smaller, 0.01, then m0 = 0.001 and v0 = 0.99·10−6 + 0.01·0.0001 = 2.0·10−6, so √v0 = 0.0014. The step is 0.1 × 0.001/(0.0014 + 0.001) = 0.042. A signal 100 times smaller gave a step only 2.4 times smaller, because v shrank with it. The leftover difference comes from τ, which starts to matter once the signal is as small as τ itself (Chapter 6). This near scale-freeness is why adaptive servers are easier to tune (Chapter 8).
Feed the three rules the same story. For 40 rounds the delta for one weight is 1. Then it changes to a level you choose and stays there for 80 more rounds. Watch each rule’s v.
The vertical axis is v on a log scale. At round 40 the signal drops (or rises) to the level you choose. Drag it.
Computed from Algorithm 2 exactly, for one weight: β2 = 0.99, v−1 = τ² with τ = 0.001, constant Δ before and after the change. The step multiplier is 1/(√v + τ).
At the default level 0.3, FedAdagrad’s v ends at 47, so its step multiplier is 0.15 and keeps shrinking: it never forgets the 40 big rounds. FedAdam’s v rises to 0.33 by round 40, then fades toward the new level 0.09, reaching 0.20 at round 120: multiplier 2.2. FedYogi climbs by 0.01 a round, to 0.40, then falls by only 0.0009 a round because the new signal is small, ending at 0.33: multiplier 1.7. Yogi forgets the old high level more slowly than Adam when the signal gets quieter. That is the practical difference. The paper does not run a head-to-head ablation of the sign rule; its comparisons are in the tasks of Chapter 8.
The paper covers convergence for FedAdagrad and FedAdam and says FedYogi’s proof “is very similar”, so it is omitted.
Chapter 6
Turn the one new number in the formula and watch the server slide between plain momentum and fully adaptive
A car has a gearbox. In low gear the engine pulls hard whatever the road does. In high gear the car adapts to speed. The adaptive server also has a gearbox, and the paper calls its lever τ (tau), the adaptivity parameter. Earlier we called τ “a number that stops division by zero”. That is its smallest job. Its real job is to set how much the server listens to the history in v.
The step in Algorithm 2 is xt+1 = xt + η mt / (√vt + τ). Call s = √vt the typical size of a weight’s past signals. The divisor is s + τ. Look at two cases.
So τ draws the line. Weights whose history is bigger than τ are adapted. Weights whose history is smaller are treated alike. The paper says it directly: “smaller values of τ representing higher degrees of adaptivity.” If τ is huge, FedAdam is FedAvgM with a rescaled learning rate. If τ is tiny, it is Adam in full.
Here is a derivation the paper states without proof. Suppose you multiply the client learning rate ηl by a constant c. For small steps every client delta gets multiplied by about c, so Δt becomes cΔt. Then m becomes c·m. And v, a sum of squares, becomes c²·v, so √v becomes c√v. Put them into the step:
The paper states it as: the server updates “are invariant to fixed multiplicative changes to the client learning rate ηl for appropriately chosen τ”. In practice it means τ has a unit. It is measured in the same units as the client deltas. If you raise the client rate tenfold and leave τ alone, you have made the server ten times more adaptive in effect.
Here is why this matters for FedAvg and FedAvgM. Their update m has the client scale built in and nothing divides it out. The paper finds (Appendix E.4) “a clear inverse relationship” between the best client rate and the best server rate for them: raise one, lower the other, and the two have to be tuned together. For the adaptive methods, “we see much more stability in the best server learning rate η as the client learning rate ηl varies”.
Three weights have history sizes s of 0.5 (a common word), 0.02 and 0.0005 (a rare word). The device draws the step multiplier 1/(s + τ) as a curve over s. Drag τ.
The curve is 1/(s + τ). Left of τ it goes flat: every weight gets the same multiplier. Right of τ it falls with s: each weight gets its own. The dots are three weights.
Toy history sizes (0.5, 0.02, 0.0005), not measured values. The slider covers the paper’s search grid for τ, 10−5 to 10−1 (Appendix D.2).
At τ = 0.001 the rare weight (s = 0.0005) gets a multiplier of 667 and the common one (s = 0.5) gets 2.0: a ratio of 334. That is strong adaptivity. At τ = 0.1 the rare weight gets 10 and the common one 1.7: a ratio of 6.0, nearly plain momentum. At τ = 0.00001 the ratio is 980, the most adaptive end of the grid.
The paper tunes τ over {10−5, …, 10−1} in its headline runs (Table 9 shows the winners, e.g. 10−5 for FedAdam on Stack Overflow, 10−1 for FedAdam on CIFAR-100). But a separate test asks whether the extra knob costs more tuning than it saves. Figure 3 re-tunes the learning rates for each fixed τ. The answer: “For nearly all tasks and optimizers, τ = 10−3 works almost as well as all other values.” Only FedAdam and FedYogi on Stack Overflow logistic regression show a clear difference. The authors tie this to Zaheer et al. (2018), who found that moderately large τ helps centralized adaptive optimizers.
The theory has its own default. Corollary 1 sets τ = G/L, where G bounds the size of gradient entries and L is the smoothness constant of the loss (how fast its slope can change). We use it only to name where τ sits in the bound; Chapter 7 shows the bound.
Chapter 7
Read the paper’s guarantee as a recipe: which terms shrink with more local steps, and which one stays no matter what
An engineer promises a bridge will carry 40 tonnes. The promise has fine print: the steel must be this grade, the wind below that speed. A convergence bound is the same kind of promise for training. It says: if the problem has these properties, then after T rounds the model is this close to a good answer. The value of the promise is in the fine print and in the shape of the formula, not in the exact number.
The paper proves its results for nonconvex losses, the kind neural networks have, with many valleys. It makes three assumptions.
For simplicity the analysis also assumes full participation (every client joins every round) and sets β1 = 0. The paper says both can be relaxed; partial participation adds a variance term that depends on the fraction of clients sampled.
The quantity bounded is mint E‖∇f(xt)‖2: how small the gradient of the global loss gets at the best of the T rounds. A model with zero gradient is at a stationary point (flat ground: a valley floor or a pass). The guarantee is that you get near one. With the choices ηl = Θ(1/(KL√T)), η = Θ(√(Km)) and τ = G/L, Corollary 1 for FedAdagrad (and Corollary 2 for FedAdam, which has the same form) says:
O(·) hides constants, so numbers from this formula are not predictions. What survives is the shape.
First, the leading terms scale as 1/√(mKT): the rate the paper calls “the best known rate for the general non-convex setting”. When T is large, more clients m, more local steps K and more rounds T all help.
Second, look inside σ2/(KT): it equals σl2/(KT) + 6σg2/T. The first part shrinks with K. The second part does not. However many local steps you take, heterogeneity leaves a floor of about 6σg2/(GT) (plus a smaller one from the last term). More rounds lower the floor. More local steps do not. The paper reads this as a limit on K: a larger K cuts rounds “as long as K = O(Tσl2/σg2)”. If clients are identical (σg = 0), K can be very large.
Third, the learning rates have a rule. Decay the client rate, like 1/√t, not the server rate: “the client drift introduced by the local updates does not vanish as T → ∞ when ηl is constant.” The server rate should grow with √(Km), which shows η = 1 is not the minimiser (Chapter 2). Careful rates, the paper says, can reduce the effect of heterogeneity “but not removed entirely”. When heterogeneity is extreme, control variates may be needed, and the algorithms “can be directly combined with such mechanisms”.
The four terms of Corollary 1 and their sum, as local steps K grow from 1 to 1,000. Drag the client disagreement σg and the rounds T.
Illustrative: every constant set to 1 (f(x0) − f* = L = G = σl = 1) and m = 100 clients, so only the shape is meaningful. Formula: Corollary 1, constants inside O(·) dropped.
Set σg = 0.5 and T = 1,000. The bound is about 0.0128 at K = 1 and falls to about 0.0029 at K = 100. Letting K go on to infinity would bring it only to about 0.0020, the floor. Move σg to 0 and the floor drops away: the curve keeps falling with K.
Chapter 8
Read the paper’s main table and its tuning heat maps, and learn which claims they support and which they do not
A cook who says “my sauce is better” has to bring it to a tasting. The tasting needs fair rules: the same dishes, the same tasters, and the same effort spent on every recipe. The paper’s second contribution, after the algorithms, is the tasting: a benchmark of seven learning tasks that others can re-run.
The paper uses five datasets and seven tasks. Three datasets (EMNIST, Shakespeare, Stack Overflow) are split by the real person who wrote the data. For CIFAR-100 the authors invented a split (Appendix F): a Pachinko allocation that gives each client a taste for related classes.
| Task | Model | Train clients | Train examples |
|---|---|---|---|
| CIFAR-10 images | ResNet-18 (group norm) | 500 | 50,000 |
| CIFAR-100 images | ResNet-18 (group norm) | 500 | 50,000 |
| EMNIST characters (CR), autoencoder (AE) | CNN; bottleneck autoencoder | 3,400 | 671,585 |
| Shakespeare next character | RNN | 715 | 16,068 |
| Stack Overflow tags (LR), next word (NWP) | Logistic regression; RNN | 342,477 | 135,818,730 |
Rules of the tasting (Section 4 and Appendix D). Every method is implemented in TensorFlow Federated. Each round samples 10 clients, except 50 for Stack Overflow next word. Each client trains one epoch (E = 1). Rounds: 1,500 for EMNIST CR, Shakespeare and Stack Overflow, 3,000 for EMNIST AE, 4,000 for the CIFAR tasks. The client learning rate, server learning rate and (for adaptive methods) τ are chosen by a grid search that minimises the training loss averaged over the last 100 rounds, because real federations often have no validation data. The reported number is validation performance, averaged over those same last 100 rounds. The measure of time is communication rounds, because all methods send equal-sized messages.
Pick a task. Five bars show the paper’s Table 1 numbers: FedAdagrad, FedAdam, FedYogi, FedAvgM and FedAvg. For accuracy tasks higher is better. For the autoencoder (mean squared error × 1,000) lower is better.
Numbers are the paper’s Table 1: average validation performance over the last 100 rounds. Accuracy in % for CIFAR, EMNIST CR, Shakespeare and SO NWP; Recall@5 × 100 for SO LR; mean squared error × 1,000 for EMNIST AE, where lower is better.
Three readings. Sparse text tasks: on Stack Overflow, the gap is large. Next-word accuracy is 25.2 for FedAdam and FedYogi against 19.5 for FedAvg and 23.8 for FedAvgM. Logistic regression Recall@5 is 67.1 for FedAdagrad against 30.0 for FedAvg, more than double. This matches Chapter 4: rare words get large updates when they finally appear. Dense tasks: on CIFAR-10, FedYogi reaches 78.0 against FedAvg’s 72.8, and on CIFAR-100 FedAdam 52.5 against 44.7. FedAvgM is close behind (77.4 and 52.4), so on dense tasks much of the gain is momentum. On the autoencoder FedAvg’s error is 6.47 against 0.98 for FedYogi. Easy tasks: EMNIST CR (84.9 to 85.6) and Shakespeare (56.9 to 57.5) are close; the paper calls Shakespeare “relatively easy”.
Two more notes on honesty. SCAFFOLD, the control-variate method, “performs comparably to or worse than FedAvg and our adaptive methods” everywhere. The authors give two possible reasons: with a small fraction of clients per round the stored corrections go stale, and variance-reduction methods often disappoint in deep learning. They offer these as explanations, not as tested claims. And on Stack Overflow, with 342,477 clients, a client is almost never sampled twice, so SCAFFOLD cannot use its state and equals FedAvg.
The second claim is about effort. Figure 2 plots Stack Overflow next-word accuracy for every pair of client and server learning rates, one heat map each for FedAdam, FedYogi and FedAvgM. Below are the real cells. Choose a method and set what counts as a good run.
Cells are the paper’s Figure 2: Stack Overflow next-word validation accuracy (%), averaged over the last 100 rounds; τ = 10−3 for FedAdam and FedYogi. Rows run from server rate 101 down to 10−3, columns from client rate 10−3 to 100.5.
At a bar of 20%, FedAdam has 18 good cells out of 72, FedYogi 19, FedAvgM only 5. Lower the bar to 10% and the counts are 28, 29 and 21. The good cells of FedAdam form a wide block: any server rate between 10−2 and 10−1.5 works over a range of client rates. FedAvgM’s good cells form a thin diagonal, the “inverse relationship” of Chapter 6. The paper calls the adaptive methods “arguably easier to tune”, and the word “arguably” is fair: this is one task in the main text. The other tasks are in the appendix and the paper says “similar results hold”.
Appendix E.6 asks whether there is more to gain. On EMNIST CR, centralised training reaches about 88% (88.0 for Adagrad and Yogi, 87.9 for Adam). Federated runs with constant client rates reach 85.1 to 85.6. When the client rate is cut by a factor of 10 every 500 rounds, they reach 85.2 to 86.2: better, still short of 88. The authors write that the added benefit of decay “seems to be modest” when communication is limited.
Chapter 9
Keep the numbers, the checklist and the code, and see where this paper sits in the story of training across slow links
Federated learning has many clients with private data and a server that cannot see it. Clients train for K local steps and send back a change Δi = xi − xt. The server averages the changes and treats −Δt as a pseudo-gradient. FedAvg takes one SGD step on it with learning rate 1. The paper’s idea, FedOpt, lets the server use any optimizer on that pseudo-gradient. With Adagrad, Adam or Yogi on the server and plain SGD on the clients, you get FedAdagrad, FedAdam and FedYogi: per-weight step sizes, no extra bytes on the wire, no state on the clients. A single parameter τ sets how adaptive they are, and 10−3 is a safe default. The theory matches the best known rate, 1/√(mKT), and shows that client disagreement leaves a floor that local steps cannot lower. On seven tasks the adaptive servers are never clearly worse than FedAvg and are often much better, most of all on sparse text.
| What | Number | Why it matters |
|---|---|---|
| Sampled clients per round | 10 (50 on Stack Overflow next word) | Cross-device: a tiny slice of clients per round |
| Local epochs | E = 1 | Every run does one pass over each client’s data |
| Adam settings | β1 = 0.9, β2 = 0.99 | FedAdam and FedYogi; FedAdagrad uses β1 = 0 |
| τ grid and default | 10−5 to 10−1; 10−3 is nearly as good | One extra knob, and a safe start |
| Rounds | 1,500 / 3,000 / 4,000 | Training length by task group |
| Stack Overflow clients | 342,477 (135,818,730 examples) | A client is almost never seen twice |
| SO next word, FedAdam vs FedAvg | 25.2 vs 19.5 % accuracy | Adaptivity on a sparse task |
| SO tags, FedAdagrad vs FedAvg | 67.1 vs 30.0 Recall@5 × 100 | The largest gap in the paper |
| CIFAR-10, FedYogi vs FedAvg | 78.0 vs 72.8 % | Gains also appear on dense tasks |
| EMNIST CR, centralised vs federated | 88.0 vs 85.1 to 85.6 (86.2 with decay) | A gap to centralised training remains |
| Bytes versus a client-adaptive design | half the communication per round | Why the state lives on the server |
This is a sketch of one FedAdam round in NumPy. local_train stands for your own SGD loop over a client’s batches.
pythonimport numpy as np def client_delta(x, data, lr_l, epochs, batch): w = x.copy() # receive x_t, shape (d,) for _ in range(epochs): for b in batches(data, batch): w -= lr_l * grad(w, b) # ClientOpt = plain SGD return w - x # Delta_i, shape (d,) def fedadam_round(x, m, v, clients, lr_l=0.1, eta=0.1, b1=0.9, b2=0.99, tau=1e-3): n = sum(len(c) for c in clients) delta = sum(len(c) / n * client_delta(x, c, lr_l, 1, 20) for c in clients) # (d,) m = b1 * m + (1 - b1) * delta # momentum v = b2 * v + (1 - b2) * delta ** 2 # FedAdam; Adagrad: v + delta**2 # FedYogi: v = v - (1 - b2) * delta**2 * np.sign(v - delta**2) x = x + eta * m / (np.sqrt(v) + tau) # the server step, element-wise return x, m, v x, m, v = x0, np.zeros_like(x0), np.full_like(x0, 1e-6) # v = tau**2 for t in range(1500): x, m, v = fedadam_round(x, m, v, sample_clients(10))
The server holds three vectors of shape (d). Each round sends one vector down and receives one per client. That is the same traffic as FedAvg.
The idea of a separate outer optimizer acting on workers’ changes returns in large-model training. The Core Automation post lists this paper (“FedOpt, Reddi et al.”) in its timeline as the “inner/outer optimizer formulation with server-side momentum and adaptive outer steps”, and describes DiLoCo as using “AdamW inner optimizer, Nesterov outer optimizer, hundreds of local steps between exchanges”. The post’s sentence about federated learning that opened this lesson names the two ingredients that carry over: the pseudo-gradient and the outer optimizer. What changes is the scale: two data centers rather than thousands of phones, and a model of billions of weights.
Keep going:
Credit. Adaptive Federated Optimization, Sashank J. Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konečný, Sanjiv Kumar and H. Brendan McMahan, Google Research, ICLR 2021. arXiv 2003.00295. All figures quoted here come from that paper unless marked as toy. Context from Rohan Anil, The Hitchhiker’s Guide to Training on Compute Islands, Core Automation, 2 November 2026.
Now press Present or Teach and explain one FedAdam round out loud, from memory: what a client sends, what the server does with it, why v makes rare words move, and what τ does. Then go back to the three servers at the top, set the learning rate to 1.0 and then to 8, and explain why FedAvg stalls at one and blows up at the other while FedAdam stays calm.