Federated learning

Training on Data You Can’t See

6 November 2026 · 8 min read

Imagine three hospitals that each want a better model for reading chest X-rays. Together they have far more scans than any one of them alone, and a model trained on all of them would be better for every patient. But patient records cannot leave the building.

Federated learning is a way to train one shared model on all of that data without ever collecting it in one place. This post explains how it works in plain language, with just one short formula.

Why not just pool the data?

Machine learning models get better with more examples. The obvious move is to copy everyone’s data to one server and train there. Often that is not allowed, or not wise.

Medical records are protected by law. Banks cannot share customer transactions with each other. Your phone has years of your typing, photos and voice, and you would rather it stayed on your phone. Even when sharing is legal, moving terabytes of data around is slow and expensive, and every extra copy is one more thing that can leak.

So the data is stuck where it is. Federated learning asks: if the data cannot come to the model, can the model go to the data?

Send the model, not the data

In federated learning, a central server holds one shared model but never sees any raw data. Instead, it sends a copy of the model to each participant, called a client. A client might be a hospital, a bank, or a single phone.

Each client improves its copy using only its own data, then sends back just the changes it made. The server combines those changes into a better shared model. The data never moves; only what the model learned from it does.

Traditional training: every hospital copies its raw data to one central server.TraditionalAll data is copied to one placeCentral serverraw dataHospital AHospital BHospital CPatient records leave every hospitalFederated training: the server sends the model to each hospital and receives only model updates back. Data stays at each hospital.FederatedThe model travels, the data staysServerHospital AHospital BHospital CPatient records never leave
In the usual setup, everyone uploads their data to one server. In federated learning, the server sends the model out (blue) and only gets what the model learned back (green).

One round, step by step

Training happens in rounds. Every round has the same four steps:

One round: 1, the server sends the shared model to every hospital. 2, each hospital trains it on its own data. 3, each hospital sends back only its update. 4, the server averages the updates into a new shared model.Server4averageHospital AHospital BHospital C132model goes outupdates come back
One round of federated learning. The numbers match the steps below. The same round repeats many times until the shared model is good enough.
  1. The server sends out the current model. Every participating hospital receives an identical copy.
  2. Each hospital trains it locally. It runs ordinary training on its own patients for a short while, so its copy gets a little better at its own cases.
  3. Each hospital sends back only its update. That is the difference between the model it received and the model it ended up with: a list of numbers, not patient records.
  4. The server averages the updates. The result becomes the new shared model, and the next round begins.

After tens or hundreds of rounds, the shared model has learned from every hospital’s patients without any of them ever leaving the building.

How the averaging works

The standard recipe is called Federated Averaging, or FedAvg. It is a weighted average: a hospital that trained on more patients gets a bigger say than one that trained on fewer.

Hospital A has 1,000 patients, B has 600 and C has 400, so in the new model A’s update counts 50 percent, B’s 30 percent and C’s 20 percent.Hospital A1,000 patientsHospital B600 patientsHospital C400 patientsA · 50%B · 30%C · 20%New shared modelMore data means a bigger say
Federated averaging: each hospital's update counts in proportion to how much data it trained on.

Written as a formula, if client kk has nkn_k examples out of nn in total, and returns model weights wkw^{k}, the new shared model is

wnew=∑k=1Knkn wkw_{\text{new}} = \sum_{k=1}^{K} \frac{n_k}{n}\, w^{k}

That is the whole trick. In the example above, 10002000=50%\tfrac{1000}{2000} = 50\% for Hospital A, 30%30\% for B and 20%20\% for C.

Where it is used

One of the best-known deployments is Google’s Gboard keyboard, which used federated learning to improve next-word suggestions from what people type on their phones, without uploading the text itself.

Other common settings follow the same pattern: hospitals building diagnostic models together, banks spotting fraud patterns across institutions, and cars or cameras learning from what they see on the road. Anywhere data is valuable but cannot be pooled, federated learning is a candidate.

What makes it hard

Every client’s data looks different. In a normal training set the examples are shuffled together. Here they are not. A children’s hospital sees mostly children; a heart clinic sees mostly older patients. Researchers call this non-IID data (not independent and identically distributed).

Bar charts of patient age groups. The children’s hospital has mostly children, the heart clinic mostly seniors, and the general hospital an even mix.Children's hospitalChildAdultSeniorHeart clinicChildAdultSeniorGeneral hospitalChildAdultSeniorShare of patients by age group
Each hospital sees very different patients. A model trained on only one of them would learn a skewed picture, and their updates can pull the shared model in different directions.

When clients see such different data, their updates can pull the shared model in opposite directions, and averaging them can produce a model that is worse for everyone. A lot of federated learning research is about handling exactly this.

Communication is the bottleneck. Models can have millions of numbers, and sending them back and forth every round over a phone connection is slow. That is why each client trains for a while locally before reporting back, instead of after every single example.

Clients come and go. Phones go offline, run low on battery or are simply busy. Each round usually uses whichever clients happen to be available, so the system has to cope with partial participation.

Is it automatically private?

No. Keeping data on the device is a big step, but the updates themselves can leak information. Researchers have shown that, in some settings, an attacker who sees an individual update can reconstruct training examples, such as images, from it.

Two protections are commonly layered on top:

Three noisy updates go into a secure aggregation step, and the server receives only their combined total, never an individual hospital’s update.A's update + noiseB's update + noiseC's update + noiseSecureaggregationadds them upServer seesonly the total
Two common protections. Each hospital adds a little random noise to its update (differential privacy), and the updates are combined with cryptography so the server only ever sees their sum (secure aggregation).

Differential privacy adds carefully measured random noise to each update, so that no single person’s data can noticeably change what is sent. Secure aggregation uses cryptography so the server can compute the sum of all updates without being able to see any individual one.

There is also the opposite problem: a client can be dishonest and send poisoned updates that quietly damage the shared model. Detecting such clients, and removing the influence they already had, is an active research area, called federated unlearning.

The mental model

  1. Move the model, not the data. Raw data stays with whoever owns it.
  2. Learn in rounds. Send the model out, train locally, send updates back, average.
  3. Bigger datasets get a bigger say in the average.
  4. Different data is the main difficulty. Clients rarely see the same kinds of examples.
  5. Private by design, not by default. Updates can still leak, so add noise and secure aggregation when it matters.

References

  1. McMahan et al. Communication-Efficient Learning of Deep Networks from Decentralized Data (2017). Paper
  2. Hard et al. Federated Learning for Mobile Keyboard Prediction (2018). Paper
  3. Zhu, Liu, and Han. Deep Leakage from Gradients (2019). Paper
  4. Bonawitz et al. Practical Secure Aggregation for Privacy-Preserving Machine Learning (2017). Paper
  5. Kairouz et al. Advances and Open Problems in Federated Learning (2019). Paper