6.5.8 · D1Research Frontiers & Practice

Foundations — Federated learning

2,824 words13 min readBack to topic

Before you can read the parent note, you need to own every symbol it throws at you. This page builds each one from absolute zero — plain words first, then a picture, then why the topic can't live without it. Read top to bottom: each idea is a brick for the next.


1. What is a "model" and what is ?

Start with the thing everything else acts on.

A model is a machine that takes an input (a photo, a half-typed sentence) and produces a guess (a label, the next word). Inside that machine are knobs — numbers you can turn to change its behaviour. Turn them one way and the model predicts "cat"; turn them another way and it predicts "dog".

Figure — Federated learning

Look at the figure. On the left is the abstract "machine" with dials; on the right, we've unrolled every dial into a single vertical column of numbers — that column is . When the parent writes , , , every one of those is just a different column of numbers — a different setting of the same dials.

  • The little superscript in parentheses, , means "the value at round number " — a snapshot in time.
  • The subscript means "the version living on client number ".

2. Clients, data, and the counting symbols , , ,

Now we need to talk about many devices, each with some data.

The picture of the totals:

Figure — Federated learning

In the figure, each barrel is one client's data bag; the height of the barrel is . The total volume poured into the big tank on the right is . This picture is the whole reason for the weighting you'll meet next: a fat barrel should have more say than a thin one.


3. Loss , and why we average it into and

A model needs a way to know it is wrong. That is the job of loss.

Here is one input (the -th photo), is its true answer, and is just another index like but pointing at one example inside a bag.

One client's total badness is the average loss over its whole bag:

Read it slowly: sum the badness over every example in the bag , then divide by how many there were () to get the average. We average (rather than just sum) so a big bag isn't automatically "worse" just for being big.

The global badness stitches all clients together, giving each a vote proportional to its size:

Recall Why not just add the

without weights? A client with 10 noisy samples would count as much as one with 10,000 clean ones ::: exactly the failure the parent warns about in the "just average the models" mistake — small/noisy clients would drag the model around.


4. Minimising: , gradient , and the step size

We have a badness score . Training means hunting for the that makes it smallest.

To search, we need to know which way is downhill. That is the gradient.

Figure — Federated learning

The figure shows as a bowl-shaped valley (height = badness). A ball sits on the slope; the orange arrow is pointing uphill, the teal arrow points into the valley. Rolling repeatedly along lands us at the bottom .

SGD ("stochastic gradient descent") is the same idea but estimating from a handful of examples at a time instead of the whole bag — faster, a little noisy. "Epoch" = one full pass through a client's bag; epochs = passes.

The gradient of the global loss is the weighted sum of client gradients

Before we can average anything, we need the single identity that makes the whole scheme legal. Recall . The gradient of a weighted sum is the weighted sum of the gradients (differentiation passes through addition and through constant weights untouched), so:


5. Rounds, client subsets , and the FedAvg update rule

Federated training happens in rounds. In each round the server doesn't bother every device (that's slow and drains batteries) — it picks a small sample.

Here is yet another index letter — same meaning as , used to avoid confusion when two sums appear together.

What each client does in a round

A chosen client receives the current shared model and rolls it downhill on its own loss . Writing the round number explicitly, one local gradient step is:

Read it: "start from the shared model that just arrived, take a downhill step on my loss, and call the result my new model ." (Doing epochs just repeats this step times before sending.) Notice the two index habits meeting at last: the superscript says which round, the subscript says which client.

How the server combines them — the FedAvg rule

The server now has one improved model from each chosen client. It forms the new shared model as the size-weighted average over the present clients:

Why this equals one centralised step

Put the two boxes together for the simplest case — every client takes one step and everyone participates ( = all clients, so ). Substitute the local update into the aggregation:

The last equality is exactly the identity from Section 4. So one round of FedAvg with one local step is one honest gradient-descent step on the global loss — the server reproduces centralised training without ever touching the data.


6. Symbols for privacy: , ,

The later part of the parent guards against leakage. Meet its alphabet.


The prerequisite map

Model as knobs = theta

Loss on one example = ell

Average loss per client = F_k

Client counts n_k and n

Weighted global loss = F

Gradient nabla and step eta

Local SGD training

Federated objective arg min F

Rounds t and subset S_t

FedAvg aggregation

Federated Learning

Noise sigma clip S eps delta

Read it as a flow: knobs and loss make a per-client score; counts turn many scores into one weighted global score; gradients let each client descend; rounds and subsets glue their descents together into FedAvg; privacy noise wraps the whole thing. All arrows drain into the topic, Federated learning.

Adjacent tools you can safely postpone until later child pages: Optimization Theory (the convergence proofs), Edge Computing (where clients physically live), Model Compression (shrinking what costs to send), Byzantine Robust Learning and Multi-Task Learning (handling malicious or personalised clients).


Equipment checklist

Cover the right side and answer aloud. If any answer surprises you, re-read its section above.

What is , in plain words?
The full list of a model's knob settings — one column of numbers that fully specifies one model.
What does versus mean?
Superscript = the model at round ; subscript = the version living on client .
What does literally instruct you to do?
Write the expression once for each from 1 to , then add all the copies.
What are and ?
= number of examples on client ; = total examples across all clients, .
Why does weight each client by ?
So bigger data-bags vote proportionally more, making decentralised averaging behave like pooling all data.
What does measure?
The badness of the model's prediction on one example — 0 is perfect, big is wrong.
What does return?
The knob-setting that makes smallest (not the smallest score itself).
What does the gradient point toward, and which way do we walk?
It points steepest uphill; we step along to go down.
What is and what breaks if it's too large?
The step size; too large and updates overshoot and bounce instead of settling.
Write the per-round local update for a chosen client.
— step downhill on my loss from the shared model.
Write the FedAvg aggregation rule.
— size-weighted average of returned client models.
Which identity makes FedAvg equal centralised SGD?
— the global gradient is the weighted sum of client gradients.
What do , , , each control?
noise spread, update-clip cap, privacy strength (smaller = stronger), tiny allowed slip probability.