Federated Learning: Training Models Without Peeking at Your Diary

· 2 min read · Syed Omar Faruk Towaha
Federated Learning: Training Models Without Peeking at Your Diary

Your phone keyboard predicts the next word you'll type. It's learned from millions of people's typing. But you probably don't want every message you've ever typed uploaded to a server so a model can learn from it. That would be like improving a diary by reading everyone's diary.

Federated learning is a way around that: bring the model to the data, instead of the data to the model.

How it works

One round
The raw data stays on each device. Only model updates travel.
  1. A server has a shared model and sends a copy to many devices.
  2. Each device improves its copy using its own local data.
  3. Devices send back only the update (the changes to the model), not the data.
  4. The server combines the updates, typically by weighted averaging (this is the classic FedAvg algorithm).
  5. Repeat for many rounds.

The diary never leaves your house. Only the lesson learned from it does.

Where it's useful

Why it's harder than it sounds

Devices aren't alike. One phone types mostly Bangla, another mostly English; one hospital sees mostly older patients. When local data differs a lot (researchers call it "non-IID" data), local updates pull the model in different directions, and the combined model learns more slowly and can be worse for some groups.

Accuracy over rounds
Illustrative: the more different the devices, the harder it is to match centralised training.

Communication is expensive. Models can be large, and devices are often on slow or metered connections, only charging overnight, or simply offline.

Updates can leak information. Model updates are not the raw data, but clever attacks can sometimes infer things about the training examples from them. So federated learning is often combined with:

Some participants may be malicious, sending poisoned updates to steer the model. Robust aggregation methods try to limit the damage.

The research angle

This is a field I find genuinely exciting, especially where it meets IoT and real business problems: how do you get the benefits of shared learning while respecting that the data belongs to the people who generated it? There's no free lunch. You trade some accuracy and a lot of engineering complexity for privacy. But for data that should never be centralised, that's a trade worth making.

The core idea is beautifully simple, though: learn together, keep your diary to yourself.

// related

// prefer the terminal?

Open the terminal blog and type read federated-learning-without-peeking-at-your-diary.