Paper commentary
Towards Federated Learning at Scale: System Design
A production system trains models across decentralized mobile phones using TensorFlow
- Problem Running federated learning across very many phones is hard because devices are often unavailable, connections drop, and storage and compute are limited.
- Method The authors build a system where the server picks a few hundred phones per round, each trains on local data, and Federated Averaging combines their updates.
- Results The federated next-word RNN reached 16.4% top-1 recall, against 13.0% for an n-gram baseline.
Why the design is built on synchronous rounds
The central design choice is between asynchronous and synchronous training. Asynchronous training has driven much successful deep learning work, but data-center training has moved toward synchronous large-batch methods, and Federated Averaging follows that direction. Privacy mechanisms push the choice further. Differential privacy and Secure Aggregation both need some notion of synchronization over a fixed set of devices, so that the server only consumes an aggregate of many users' updates.
The authors accept the synchronization overhead and limit its cost with several techniques described later, such as pace steering and pipelining of rounds. The resulting system can run large-batch SGD-style algorithms as well as Federated Averaging, which is the algorithm the authors run in production.
One round from check-in to model update
From tens of thousands of available devices, the server picks a few hundred to join one task.
Selected devices receive an FL plan, which holds a TensorFlow graph and execution instructions, together with an FL checkpoint that carries the current global parameters. Each device trains on its local data and returns an update as a checkpoint.
During Reporting the server folds updates into the model with Federated Averaging as they come in, and the round completes only if enough devices report in time. Stragglers and dropouts are ignored rather than awaited, and the tolerance for dropouts is configurable per FL task.
Pace steering shapes when devices connect
Pace steering is a flow control mechanism. A rejected device is told a time window in which to reconnect, and it follows that suggestion unless it is no longer eligible.
For a small population, the goal is to have enough devices check in at about the same moment, which matters for task progress and for the security properties of Secure Aggregation. The server picks reconnection times with a stateless probabilistic rule, so no extra device-server communication is needed to make later check-ins likely to coincide.
For a large population, the same mechanism spreads check-ins out to avoid a thundering-herd effect, while keeping each device connecting only as often as its scheduled tasks require. Pace steering also follows the daily cycle of active devices, reducing activity at peak hours without hurting FL performance at other times of the day.
On-device runtime and its guardrails
Applications expose their local data to the FL runtime as an example store through an API. An example store could be an SQLite database that records the suggestions shown to a user and whether they were accepted. Applications are advised to limit the storage footprint of their example stores and to delete old data after an expiration time where appropriate.
The FL runtime is started through Android's JobScheduler, and it asks for the job only when the phone is idle, charging and on an unmetered network. If those conditions stop holding, the runtime aborts and frees its resources.
Plans can also encode evaluation on held-out data, which plays the role of validation in data-center training.
The runtime supports several FL populations in one app or service, and it can run inside the application that configured it or in a centralized service in another app. Communication uses Android's AIDL IPC mechanism. Participation is anonymous, so the system uses Android remote attestation to confirm that only genuine devices and applications take part, which protects against data poisoning by compromised devices.
Content farms that steer a model with real phones are not addressed in the paper's scope.
Monitoring devices without personal data
Much of the platform activity runs on devices the operators neither control nor access, so the system logs activity and health parameters such as training state, duration, memory use, errors and runtime version, without personally identifiable information. These entries are aggregated into dashboards and fed to time-series monitors that raise alerts on substantial deviations.
Each training round also produces a sequence of state events, which is rendered as a short ASCII string, so that counting the strings separates failure types. A model that trained but failed to upload produces a different string from one that failed right after loading the model. The analytics layer has repeatedly exposed device-side problems, such as training running when it should not, and server-side problems, such as drop-out rates higher than expected.
Actor-based server design
The server is built on the Actor Programming Model, in which actors communicate only by messages and handle each message stream one at a time. Running many instances of one actor type scales the system, and actors can be placed on one machine or across regions.
A Coordinator is responsible for one FL population and registers its address in a shared locking service, so a single owner exists for each population. It advances rounds and spawns Master Aggregators. Selectors accept device connections and use counts from the Coordinator to decide how many devices to accept. Master Aggregators run the rounds of each task and spawn Aggregators when device counts or update sizes demand it.
After the Master Aggregator and Aggregators exist, the Coordinator instructs Selectors to forward devices to them. Selectors can therefore sit close to devices and contact the remote Coordinator rarely.
Selection does not depend on the previous round, so Selectors run it continuously and it overlaps with Configuration and Reporting of the earlier round. Pipelining needs no extra machinery beyond the Selectors themselves.
After a failure, a round either completes or restarts from the last committed result. A crashed Aggregator or Selector loses only its own devices, while a failed Master Aggregator fails its round and the Coordinator restarts it. If a Coordinator dies, the Selectors detect this and respawn it, and the locking service makes that respawn happen exactly once.
Secure Aggregation inside the server
Secure Aggregation encrypts device updates so that the server reveals only their sum, and only after enough updates arrive. It protects against honest-but-curious access to the memory of Aggregator instances, and the sums are all that Federated Averaging needs.
The protocol has four rounds. The first two establish shared secrets, and devices that drop out at that stage are excluded from the final aggregation. In the third round devices upload masked updates and the server accumulates them. Every device that completes this round is included in the final aggregate, or the entire aggregation fails.
In the fourth round devices reveal enough secrets for the server to unmask the sum, and a sufficient number of devices must survive through this final phase for the protocol to succeed.
Costs grow quadratically with the number of users, mainly on the server, so in practice a Secure Aggregation handles only hundreds of users. Each Aggregator therefore runs its own Secure Aggregation over its devices. The Master Aggregator sums the intermediate results without Secure Aggregation, and each FL task sets a parameter k so that updates are securely aggregated in groups of at least k.
From a Python model to a deployed plan
Device-side examples cannot be inspected, so engineers test with proxy data in simulation. Models cannot be run interactively on devices; they are compiled into FL plans and deployed through the FL server. Resource use and runtime compatibility are checked automatically.
Engineers define tasks in Python, with TensorFlow functions that map inputs to metrics such as loss or accuracy, and configuration such as devices per round and learning rate. Tasks can be grouped, for example to run a grid search over learning rates. Simulation runs the same code as devices on cloud jobs emulating a fleet against proxy data.
Proxy data has a similar shape to device data but comes from another distribution, such as Wikipedia text standing in for keyboard input.
An FL plan has a device part and a server part. The device part holds the TensorFlow graph, selection criteria for training data, batching and epoch instructions, and labels for weight loading and saving. The server part holds the aggregation logic.
A plan is accepted for deployment only if it was built from auditable, peer-reviewed code, its bundled test predicates pass in simulation, and its resource use is within a safe range for the target population. It must also pass on every TensorFlow runtime version the task claims to support, which is checked by running the plan in an Android emulator.
Devices can run a TensorFlow runtime many months older than the one the current plan needs, so the infrastructure generates versioned FL plans by rewriting the computation graph. Versioned and unversioned plans pass the same release tests. The authors encounter about one incompatible change every three months that a graph rewrite can resolve, and a slightly smaller number that needs complex workarounds.
When a round closes, its aggregated parameters and metrics are written to the storage location the engineer chose, annotated with the task name and round number. The metrics are summaries such as approximate order statistics and means.
Next-word prediction on a mobile keyboard
Gboard used the FL platform to train a recurrent neural network for next-word prediction. The model has about 1.4 million parameters and converged in 3000 FL rounds. Training processed 6e8 sentences from 1.5e6 users over 5 days, and each round took about 2–3 minutes.
Top-1 recall rose from 13.0% for the n-gram baseline to 16.4% for the federated RNN. The server-trained RNN needed 1.2e8 SGD steps, and the federated RNN performs on par with it.
In live A/B experiments the federated RNN outperformed both the n-gram model and the server-trained RNN.
Operational profile of production rounds
The deployed system spans several applications, with a cumulative population of approximately 10M daily active devices. At any time only a subset connects, and up to 10k devices participate at once.
On average between 6% and 10% of devices drop out because of computation errors, network failures or eligibility changes, so the server selects 130% of the target number of devices. For most models, a few hundred devices per round is enough, because gains in convergence rate diminish with larger counts.
Limits of the current system
The next-word RNN converged about 7× slower than comparable data-center training. The proxy data for the data-center model differed, and the authors do not treat this comparison as their main goal, which is training on data that the data center does not have.
Federated Averaging can efficiently use only hundreds of devices in parallel, while many more are available, so the authors see benefit from algorithms that use more parallelism.
Devices train only on unmetered networks while charging, and in some countries most people rarely have such access. Deployment is also limited to certain phones, with recent Android versions and at least 2 GB of memory, which is another possible source of bias. Models are not used for user-visible predictions during training. Once trained, they are compared in live A/B experiments, so bias that leads to an inferior model should appear at that stage.
The authors have not seen this in practice, but say it is likely application and population dependent.
Time windows for selection and reporting are configured statically per population, and the authors suggest adjusting them dynamically, possibly with online ML that uses time of day as context.
Where the design departs from other approaches
MapReduce is a close relative, with the FL server acting as reducer and devices as mappers. The differences are that devices own their data and leave rounds at will, and the server chooses subsets of available devices for each round. Those requirements, including frequent dropouts and availability that changes a lot over time, are better handled by a domain-specific framework than by a generic MapReduce.
Pihur et al. (2018) learn from user data without server-side aggregation and argue that their approach scales because it avoids synchronization and need not store device updates. The authors argue that their server design shows updates can be processed online as they arrive, without storing them, which answers the scalability concern about synchronous approaches.
Federated Computation beyond ML
The device and server architecture does not depend on any ML logic, since it refers to plans, models and updates in general terms. The authors aim to generalize it to Federated Computation, which would support general MapReduce-like workloads rather than only TensorFlow training. The authors name Federated Analytics as one application area, which would allow aggregate device statistics to be monitored without sending raw device data to the cloud.
Paper info
- Authors
- Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Konečný, Stefano Mazzocchi, H. Brendan McMahan, Timon Van Overveldt, David Petrou, Daniel Ramage, Jason Roselander
- Venue
- arXiv · Preprint
- First published
- 2019-2-4
- Added
- 2026-11-12
- Updated
- 2019-3-22
- Version
- v2
- arXiv
- 1902.01046
- Category
- cs.LG · cs.DC · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
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
Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Konečný, Stefano Mazzocchi, H. Brendan McMahan, Timon Van Overveldt, David Petrou, Daniel Ramage, Jason Roselander (2019). Towards Federated Learning at Scale: System Design. arXiv:1902.01046v2. https://arxiv.org/abs/1902.01046v2
BibTeX
@misc{bonawitz2019towards,
title = {{Towards Federated Learning at Scale: System Design}},
author = {Keith Bonawitz and Hubert Eichner and Wolfgang Grieskamp and Dzmitry Huba and Alex Ingerman and Vladimir Ivanov and Chloe Kiddon and Jakub Konečný and Stefano Mazzocchi and H. Brendan McMahan and Timon Van Overveldt and David Petrou and Daniel Ramage and Jason Roselander},
year = {2019},
eprint = {1902.01046},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1902.01046v2}
}