Federated Learning
Train one shared model across many devices without collecting their data. Run a live round with three clients, change how their work is combined, and see what one dishonest client can do.
Start this course →Lessons
- 1Learn on each deviceFollow one training round from start to finish.6 min
- 2Sample weightingUnderstand federated averaging, the standard way to combine updates.5 min
- 3Equal weightingCompare federated averaging with treating every client alike.4 min
- 4Harmful updatesSee how one dishonest client can damage the shared model.6 min
- 5The median defenceUse robust aggregation to blunt an attack, and learn its limits.5 min
What you will learn
- In federated learning the data stays with each client and only updates travel.
- One round: send the model, train locally, return updates, aggregate.
- Keeping data local helps privacy but does not guarantee it, because updates can still leak clues.
- A weighted mean lets some values count more than others.
- Federated averaging weights each client by its sample count.
- A client's weight is its sample count divided by the total.
- The equal-weight mean gives every client the same share.
- Under equal weighting, a client's sample count has no effect on its influence.
- Neither method is always better. The right choice depends on whether sample counts can be trusted.
- A malicious update is sent on purpose to damage the model.
- Averaging, weighted or equal, lets one extreme update move the result.
- Precision and recall show which kind of mistake the damage causes.
- The median takes the middle value, so the size of an extreme value stops mattering.
- This is a simple kind of robust aggregation.
- It is not a complete defence: an attacker can still shift which value ends up in the middle.
Terms explained in this course
- federated learning
- A way to train a shared model in which several clients each train on their own data and send only their changes to a coordinator. The raw data never leaves the clients.
- client
- A device or organisation that holds its own data and does its own training, such as a phone, a hospital or a sensor.
- coordinator
- The server that sends out the shared model and combines the changes the clients send back. Also called the server or aggregator.
- local training
- Training that a client carries out on its own data, on its own machine.
- update
- The change a client sends to the coordinator after local training.
- round
- One full cycle of federated learning: send the model out, train locally, send updates back, combine them.
- aggregation
- Combining the updates from all clients into one change to the shared model.
- global model
- The shared model that the coordinator maintains and every client receives.
- sample
- One record in a client's data. The sample count is how many records the client trained on.
- score
- In this lab, a number from 0 to 100 describing how unusual a network record looks.
- threshold
- A cut-off value. In this lab the model flags every record whose score is at or above the threshold.
- mean
- The ordinary average: add the values and divide by how many there are.
- weighted mean
- An average in which some values count more than others. Each value is multiplied by its share of influence before adding.
- federated averaging
- The standard aggregation method, in which each client's update is weighted by its sample count. Often shortened to FedAvg.
- median
- The middle value after sorting. Half the values are below it and half are above.
- honest client
- A client that sends the update it really learned.
- malicious update
- An update made deliberately harmful in order to damage the shared model. Sending such updates is called a poisoning attack.
- false positive
- A normal item that the model wrongly flags.
- false negative
- An item that should have been flagged and was missed.
- precision
- Of everything the model flagged, the share that deserved it.
- recall
- Of everything that deserved a flag, the share the model caught.
- robust aggregation
- Aggregation designed so that a small number of bad updates cannot drag the result far. The median is one example.