Skip to main content
Distributed Machine Learning

Overlapping SGD, Quantized SGD, and Federated Learning

Published: 2026-09-11
Level: postgraduate
Audience: Postgraduate students in Distributed Machine Learning

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • Quantization of Weights and Gradients — covered in Lecture 6
  • Synchronous and Asynchronous Distributed SGD — covered in Lecture 8

# Overlapping SGD, Quantized SGD, and Federated Learning

Two SGD communication tricks still sit on the table after the earlier distributed training variants: overlapping SGD and quantized SGD. Overlapping mixes compute with network traffic so a GPU does not sit idle. Quantization shrinks the bit-width of numbers so those messages (and often the math itself) get cheaper. Gradient buckets sit between those two ideas: they group many gradients into one packet so overlap can start as soon as a chunk is ready.

After these SGD variants, the story shifts to federated learning (FL): train where the data already lives, share updates instead of raw records, and then face the new attack that reconstructs training-like samples from those shared weights. The second half of the session is the start of the federated half of the course: definition, a voice-assistant loop, FedAvg arithmetic, hospital silos, and why “I only sent numbers” is not a privacy proof.

Keep the two halves separate in your notes. Overlap, quantization, and buckets are still lab-style distributed training: data can be sharded by a trainer who already owns it. Federated learning is the different setting where the trainer is not allowed to own the raw records. The same averaging algebra will return later as FedAvg, but the threat model changes.

9.1 Overlapping SGD: Mixing Compute with Communication

Each GPU in a pipelined or partitioned model has two jobs, not one. The first job is computation: in the forward pass, input activations enter the local layer (or the local slice of the model), the GPU runs the layer math, and activations leave toward the next stage. The second job is communication: in the backward pass, gradients must travel back toward earlier layers, and in the forward pass the activations themselves must travel toward later layers.

Why should a GPU that already finished its local layer math sit still while a gradient packet crawls across a link? The idle gap is wasted training time, and it grows every time you add another stage to the pipeline.

The design goal is to intermix computation and communication on the same machine so neither side idles while the other runs. Think of a chain of GPUs that each own one layer or a small block of layers. Data walks forward through GPU 1, GPU 2, GPU 3, and so on. Gradients walk backward along the same chain. The naive habit is to finish one of those jobs completely before starting the other. Overlapping SGD refuses that wait.

A kitchen picture helps. The cook (compute) chops the next plate while the waiter (the interconnect) already carries the previous plate. The kitchen does not wait for the waiter to return empty-handed before the knife moves. The analogy breaks when the waiter's trip is longer than the chopping: then the cook still finishes first and the wait is the network, not the math.

Training uses many batches. Each batch must be handed to the right GPUs, turned into gradients, and used to update layer weights. Layer 1 should update before (or at least independently of) later layers in the backward order, because the backward wave starts at the loss and moves toward the input. At the same time, the next forward wave already wants those GPUs. If a device waits until it has both finished sending every gradient and finished applying every update, the pipeline stalls.

Purpose. Overlapping SGD is a schedule, not a new loss. It exists to hide communication latency under useful math so the GPU cores stay busy.

What goes in. A pipelined or partitioned model, a stream of mini-batches (or micro-batches), and hardware that can copy tensors while compute units keep running (a copy engine, DMA, or an equivalent async send).

What comes out. The same gradients and weight updates as ordered SGD, but with a shorter wall time per stage whenever send and math can run together.

Standard treatments of data-parallel training make the same point in a different costume. After each iteration you still have to aggregate gradients and then push updated weights. Those two communication steps cannot collapse into one instant: GPUs wait for the sum of both transfer times unless later work is allowed to start early. Overlap is the pipeline version of “do not add those waits if the hardware can hide one of them.”

9.1.1 Forward Compute and Backward Send on the Same GPU

In the forward process, the GPU performs operations on the data it currently holds. That data may be a full model or a subset, such as a single layer. The local layer produces an output tensor. That tensor is the input of the next stage. After the last stage produces a prediction, backward computation starts. Gradients with respect to activations and weights are formed and then sent back along the pipeline: back to the previous GPU, then the one before that, and so on.

Each GPU then faces traffic in two directions:

  • Activations toward the “upper” (later) layers in the forward pass.
  • Gradients toward the “down” (earlier) layers in the backward pass.

The verbal explanation of the two tasks is: the input goes through, the GPU performs the computation and gives the output in the forward pass, and in the backward pass it has to communicate, passing through the gradients. Those two tasks do not have to be a strict sequence. Once a layer has produced its forward output, it can start sending that output while it also prepares or continues other local work. Once a later layer has gradients ready for an earlier layer, it can start sending those gradients while it still computes remaining local backward terms.

Name the tensors so the two jobs stay distinct. Let be the activation arriving at stage , and let be the activation that stage produces with local weights . The send of toward stage can start as soon as exists. In the backward pass, let be the incoming activation gradient. Local weight gradients can be formed while is already on the wire toward stage .

9.1.2 Staggered Compute-Then-Send Timeline

A classroom demo walks layer by layer. Layer 5 computes. Then it sends. The next layer computes while the previous layer’s send may still be in flight. Then that next layer sends. The pattern is compute, send, compute, send, compute, send. When one layer has finished computing and has already handed its tensor to the next layer, it can be in a sending state while the neighbor is in a computing state. That staggered overlap is the whole trick.

Picture a Gantt chart. The horizontal axis is time in milliseconds. The vertical axis is stage index (layer 1 at the bottom, later layers above). Each stage has two bars: a compute bar and a communicate bar. In the ordered picture the communicate bar starts only after the compute bar ends, so the bars sit end to end. In the overlap picture the communicate bar of stage slides under the compute bar of stage . The landmark to watch is the first moment a communicate bar sits under a neighbor's compute bar: that is where idle time died.

Write the two clocks as follows. Let be the time a stage spends on local math for a micro-batch, and let be the time it spends moving activations or gradients across the link.

If you are not overlapping, first compute will be done, next send will be done, and that wait is what you want to avoid. In the non-overlap (ordered) case the stage pays the sum:

When compute and send run together as much as the hardware allows, the stage delay shrinks toward the longer of the two:

The classroom demo was qualitative, not a numbered slide equation. The form is the usual overlap bound: the critical path is the slower of math and copy, not their sum.

The saving is the hidden wait. If send is fully nested under compute (or the reverse), you drop the smaller term from the critical path. If they only partially overlap, you still beat the strict sum. Let be the leftover that did not hide. Then

and . When you overlap the computation and the communication steps, you cut the idle times, which you cannot cut in the non-overlap case.

Numeric sense-check. Suppose one stage spends on a micro-batch and copying activations.

  • Ordered: .
  • Full overlap: .
  • Saving: , which is exactly the smaller clock, now hidden.

If the copy is only half nested (2.5 ms still exposed), the stage pays . Still better than 13 ms. The 8 ms compute bound is the floor until you shrink the math itself.

Scope. The bound assumes the device can actually copy while it computes: a separate copy engine, pinned memory, and a send that does not steal all the same SMs. It also assumes the tensor to send is already ready. If the backward kernel and the NCCL send contend for the same memory bandwidth, creeps back toward . The bound is a stage delay, not a proof that end-to-end epoch time falls by the same ratio when every stage is already compute-bound.

9.1.3 Worked Timeline: Several Batches on One Machine

Take a short pipeline of layers and several mini-batches already waiting in memory. Batch 1 enters layer 1. Layer 1 computes activations and starts sending them to layer 2. Layer 2 computes while layer 1 may already be receiving or preparing the next slice. After the forward wave reaches the last layer, backward gradients form and travel back: sending back, sending back, sending back. While those gradients for batch 1 are still on the wire toward earlier layers, batch 2 can already be in the forward pipeline.

One machine is then doing two things at once: receiving or sending gradients for the previous batch, and computing the current batch. That is the single-machine overlap picture. Computation of the current batch and communication of the previous batch’s gradients share the same device. Both run in parallel. The processing time drops because the idle gap between “I finished math” and “I finished the network copy” shrinks.

Three-stage, two-batch trace. Stages A, B, C. Two micro-batches and . Each local compute is 4 time units; each neighbor send is 3 time units.

Ordered (no overlap), one batch: A compute 4, A send 3, B compute 4, B send 3, C compute 4, then the backward sends add another . The GPU that owns A sits idle during every later stage.

Overlap: after A finishes compute it starts the send of activations to B and can accept work for as soon as its send buffer is free. While C is still finishing backward, A is already computing forward. The verbal classroom line is: for this data I am receiving the gradients; for this data I am performing the computation; computation and communication you want to overlap into a single machine; that is how you reduce the processing time.

Final picture: current-batch math and previous-batch gradient traffic share the device. Idle bubbles shrink from “full send time” toward “whatever send tail did not hide.”

A second numeric check uses unequal clocks. If compute is 10 ms and send is 2 ms, overlap buys you almost the whole 2 ms. If compute is 2 ms and send is 10 ms, overlap buys you the 2 ms of math and you are still network-bound. Overlap never invents bandwidth. It only refuses to add the two clocks when they can run together.

9.1.4 Ordered SGD versus Overlapped SGD

In ordered SGD, compute must finish first. Only then does communication start. That barrier is the problem. Overlap SGD cuts that latency. Quantized SGD, treated in the next section, attacks a different cost: the number of bits in each number. Overlap does not change how fat each gradient is. It changes when the send starts relative to the math. Communication volume can stay the same while wallclock time still falls, because the GPU stays busy instead of waiting on a barrier.

Dimension Ordered SGD Overlapped SGD Quantized SGD (next)
What changes Barrier: math, then send Schedule: math with send Representation: fewer bits
Volume of gradients Unchanged Unchanged Shrinks
Typical win Simpler to reason about Lower wait on the critical path Faster copies and often faster math
Typical failure GPU idle during send Copy engine contention; bubbles remain Rounding error; worse minima

When to pick which: use overlap whenever the hardware can copy during compute and the send is large enough to be worth hiding. Use quantization when the size of the message is the bottleneck. Use both when you have a fat model on a slow link.

Pitfalls.

  1. Treating overlap as a new optimizer. The loss and the SGD update rule stay the same.
  2. Claiming overlap reduces bytes on the wire. It does not. Bytes can stay identical while time falls.
  3. Forgetting the pipeline bubble: the first wave and the last tail still show exposed communication.
  4. Starting the send before the tensor is finished. You must wait until that chunk is ready (buckets, next section, are how frameworks make “chunk ready” a real event).

Gradient buckets are the systems trick that lets this schedule start early: you do not wait for the entire backward pass. The next section first shrinks the numbers themselves; buckets then pack those numbers so overlap has something to send.

Recap. Overlapping SGD intermixes local math with activation and gradient traffic so a stage pays about instead of the sum. Exam note: contrast overlap (schedule compute with send) against quantization (shrink the numbers). They compose; they are not substitutes.

On-device voice models and hospital imaging nets will later need the same idea: keep the accelerator busy while updates move. First, though, shrink the payload those updates carry.

9.2 Quantized SGD: Shrinking the Numbers You Move

Quantized SGD cuts the bit-width used to store and send values. A student restatement that matches the classroom target is: in quantized SGD we reduce the size of the data that is being transferred. Quantization here means representation, not a new optimizer. The algorithm that decides when to average or whether to wait for all workers can stay the same. What changes is how each scalar is stored: a wide float, a short integer, or even a single sign bit.

A gradient payload that looks harmless as “just numbers” can still be hundreds of megabytes per step. If each number is fatter than it needs to be, you pay that fatness on every link and often on every multiply.

Quantization is not the same trick as overlap. Overlap cares about whether communication happens on one side of the machine while computation happens on the other. Quantized SGD “just works on the numbers.”

Everyday picture: you are mailing a box of receipts. Overlap is starting the next envelope while the truck is already rolling. Quantization is writing each amount as 8.3 instead of 8.321000 so the box itself is lighter. The analogy breaks when two nearby amounts round to the same short code: the truck is faster, but the bookkeeping is coarser.

Standard distributed-training notes say the same thing in memory language: use fewer physical bits to represent a single value. A 32-bit integer uses 4 bytes; a quantized code may use 2 bytes, 1 byte, or 1 bit. That transform is lossy. Values such as and can collapse to the same code, so you lose the . Mixed-precision libraries (for example NVIDIA AMP wrapping an SGD optimizer) often keep some tensors in a 32-bit format and shrink others to FP16. The lecture’s ladder goes further, down through 8-bit and 1-bit, because communication volume is the live cost.

9.2.1 Bit-Width as the Control Knob

High-end representations include 32-bit floating point and 16-bit floating point. One spoken slip in class said “FP36”; the intended high-end type is FP32. Narrower choices include 8-bit integers and, at the extreme, 1 bit. The verbal list is: if you use a higher representation like FP32 and FP16, then 8, into 4, only 1 bit. (A muttered “98, into 4” is noise; later numbers lock onto FP32, 8-bit, and 1-bit.)

Those cuts drastically reduce communication time and can reduce computation time as well, because narrower types move faster and often run faster on the device.

Let be bits per scalar and let be the number of gradient values in one payload. Communication volume in bytes is

Relative to FP32,

So INT8 is of the FP32 volume, and a pure 1-bit code is of the FP32 volume before headers and padding.

Quantization is a data representation choice. You pick a codebook that maps a real value to a short code . SGD, whether synchronous or asynchronous, still adds those codes (or dequantized values) into a weight update. Changing does not by itself change the averaging rule.

9.2.2 Worked Size Example: 400 MB, 100 MB, and 12 MB

A demo starts from a gradient payload that needs 400 MB when each value is an FP32 float. One shown value looks like in that wide format. After a step that switches to 8-bit integer representation (spoken as “B8”), the same payload is described as 25 percent of the original size, which is 100 MB. The classroom reason is the 8-versus-32 ratio: .

Let be the communication volume at 32 bits per value. The verbal explanation is: if I use FP32 bit float, 400 MB is required for communication; if I do with 8-bit, I am able to do it with 25 percent; 100 MB is enough for the same communication.

Classroom payload. Start from the FP32 envelope:

Switch every scalar to 8 bits:

The example number cannot survive as four decimal digits in an 8-bit integer code. An INT8 signed integer holds integers in . In practice you scale: pick a scale , store , and reconstruct . If , then , which rounds to , and the stored value comes back as . The leftover is quantization error.

Push the same idea to one bit per value: keep only the sign, positive or negative. The payload is described as 3 percent of the FP32 size. Taking 400 MB as 100 percent, 3 percent is 12 MB.

A strict bit-ratio would be of 400 MB, which is (about 3.125 percent). The classroom figure 12 MB / 3 percent is the teaching number; is the exact check. Headers, padding, and a scale tensor make either envelope a lower bound, not a wire dump.

The 1-bit map is a sign send:

If , then . If , then . Magnitude is dropped on the wire. The verbal explanation is: if I do only one bit, either positive or negative; I am not sending the full data; send only the sign; it requires only 3 percent; if it is 100 percent, 400; 3 percent means only 12 MB.

Sense-check. Cutting bits by cut the envelope from 400 MB to 100 MB. Cutting bits by should land near MB, and 12 MB is the rounded classroom cousin. The arithmetic matches the story.

That 1-bit scheme looks weird for ordinary neural training. It is not widely used. The practical default called out in class is 8-bit. The 1-bit story is for special settings: parity-style checks, outlier flags, or scientific codes where you already hold the original magnitudes locally and only need a plus-or-minus action from the other side. In those cases you send one bit and skip the bulky payload.

Error after quantization still exists. The demo shows a leftover error once gradients have been packed this way. That error is the price of the smaller envelope. You still complete the gradient step; you just complete it with coarser numbers.

Scope. The volume ratio assumes every stored value uses bits and that you count payload bytes, not protocol headers. It also assumes you still send all values. Sparsity (skipping zeros) is a different compression trick. Training can still converge under quantization, but the run may stop at a worse local minimum than full precision, because rounding is a biased, lossy map.

Draw the ladder as a bar chart. Horizontal axis: representation (FP32, FP16, INT8, 1-bit). Vertical axis: payload megabytes. Landmarks: 400 MB at FP32, 100 MB at INT8, 12 MB at 1-bit. Takeaway: each cut in bit-width is a direct cut in bytes if you keep the same number of tensors.

9.2.3 Quantization on Compute, Communication, or Both

Q: Do we apply quantized SGD during communication or during computation?

A: Either, or both. It depends on the representation. In the forward pass the weights themselves can be stored as FP32, FP16, or 8-bit. Backward values use a representation too. Wherever there are numbers — any data representation, any form — you can thin the bits for compute, for communication, or for both.

If you have ample compute and ample network, you can stay on a high-end type and skip quantization. If you must deploy on a low-end device such as a Raspberry Pi, you want lower representations and quicker communication, so you quantize. That is where the 25 percent and 3 percent cuts matter: they drastically reduce the representations you store and send.

A Raspberry Pi-class board has a small DRAM budget and a modest interconnect. An FP32 400 MB gradient buffer does not fit a comfortable training loop there. An INT8 100 MB buffer is already a different product story. The same 8-bit tensors also run as integer math on many edge chips, so both compute and communication get cheaper together.

9.2.4 Quantization Is Not a Separate Optimizer

Q: Quantized SGD can be synchronous as well as asynchronous, right?

A: Yes. Quantization is just for the numbers. The algorithm may be synchronous SGD or asynchronous SGD. How you represent the input is what “quantized” means. Think of it like this: or can be whichever rule you like. The separate question is how you store : a high-end 32-bit float, a 16-bit float, or an 8-bit integer. That is representation. The other question is how you communicate the gradients. That is the algorithm.

The same correction is repeated later: quantized SGD is not a separate technique. You can use quantized values inside overlap SGD, inside asynchronous SGD, or inside synchronous SGD, because it is data only. It is not the algorithm. Communication size changes under quantization. Overlap timing changes under the overlap technique. The GPU-busy benefit of overlap is a scheduling effect. The bit-width benefit of quantization is a representation effect.

Pitfalls.

  1. Calling quantized SGD a third optimizer beside sync and async. It is how you encode tensors those methods already move.
  2. Treating 1-bit sign SGD as the default production choice. Class called 8-bit the widely used point on the ladder.
  3. Forgetting the scale. drops magnitude; without a shared scale or error-feedback, updates can be the wrong size.
  4. Assuming zero error. The leftover after packing is real; you still take the step, just with coarser numbers.

Exam note: if a question asks whether quantized SGD replaces FedAvg or replaces overlapping, the answer is no. It is how you encode the tensors those methods already move. Recap. Bit-width is the knob: FP32 400 MB → INT8 100 MB → 1-bit 12 MB in the demo. Next, pack those shorter numbers into buckets so overlap can start before the whole backward pass finishes.

Real-world: 8-bit is the widely used practical point on this ladder. 1-bit sign-only traffic is reserved for niche scientific or parity-like needs. Raspberry Pi-class devices are the motivating low-end deployment.

9.3 Gradient Buckets: One Packet per Group of Gradients

Sending every scalar gradient as its own tiny message is slow. Frameworks bucket gradients: they group many gradients into one communication packet. The bucket idea is what lets overlap start early. You do not wait until the entire model’s backward pass is done. You wait until one bucket is full, then you ship that bucket.

Would you mail a thousand separate envelopes, one for each receipt, or one padded envelope with a stack inside? Each envelope pays a stamp of startup cost. Gradients are the same: the stamp is the launch overhead of a send.

The analogy breaks when the envelope is so large that you delay a neighbor who already needed the first receipts. Bucket size is that trade: too small and you pay stamps; too large and overlap starts late.

Purpose. Bucketing is a systems packing trick. It exists so communication can begin as soon as a chunk of the backward pass is ready, which is how overlapping SGD gets something to send.

Inputs. A stream of per-parameter gradients from backpropagation, a chosen bucket length (count of scalars, or bytes once you pick a dtype), and the list of destination ranks.

Outputs. One communication packet per filled bucket, plus a leftover tail packet for whatever did not fill the last bucket.

9.3.1 Why Individual Gradient Sends Hurt

Without buckets you might send on the order of a thousand messages, with a cited overhead on the order of five milliseconds in the demo story. That pair is a spoken classroom figure, not a derived law of physics. Each tiny send pays startup cost: queue a work request, ring doorbells on the NIC, wait for completion. The fix is: do not send continuously. Store gradients into a bucket, then send the bucket.

The verbal definition is: grouping the gradients; sending each gradient individually is very slow; frameworks group them into buckets and one communication packet per bucket. A size used in the demo is 500k gradients as one bucket, then that packet goes out to the GPUs so they can adjust their gradients together.

Thousand tiny sends versus one 500k bucket.

Suppose the launch tax is about whenever you post a swarm of tiny messages, as in the demo. If you instead pack gradient scalars into one packet, you pay that tax once per bucket, not once per scalar.

Let each scalar be FP32 ( bytes). One 500k bucket is

of payload (before headers). That is a real DMA-sized copy, not a 4-byte ping. If INT8 quantization from the previous section is on, the same 500k values occupy .

Sense-check. A thousand messages for a thousand scalars would mean each message carried about one value. Frameworks refuse that. They wait until a bulk of values fills , then they ship.

Let be the bucket length in number of gradient scalars (or in bytes, once you pick a dtype). A bucket is ready when the backward pass has produced entries. Then one packet leaves. Start sending as soon as the first bucket is ready. Do not send a smaller trickle if you have already chosen a bucket size. Decide the volume, fill it, then communicate back to the layers that need those gradients.

If the model has parameters, the number of full buckets is , and the tail has leftovers. Overlap can start after the first bucket, which is after scalars exist, not after all scalars exist.

9.3.2 Buckets, Overlap, and the Tail

The compute–communication diagram with buckets looks like: compute, communicate, compute, communicate, and finally a tail. The tail is the leftover work after the last full bucket, including finishing the output-side communication. Because the first bucket can leave before later layers finish, communication rides under later compute. That is the link back to overlapping SGD.

Ordered SGD still waits: first the full compute, then communication. Overlap plus buckets cuts that wait. Quantization, again, is orthogonal: it shrinks each value inside the bucket.

Visualize two stacked timelines. Top lane: backward compute producing gradient blocks . Bottom lane: sends. In the bucket picture, send() starts as soon as hits size , while compute is already writing . The landmark is the tail bar after the last full send: a short leftover copy that cannot hide under later math because the backward pass is done.

9.3.3 Student Questions: One Model, Bulk Updates, Not Every Layer at Once

Q: When we bucket, are we bucketing all gradients of a single model? Without bucketing we send one by one, which takes more time. Is this about different models’ SGD or a single model?

A: Always a single model with multiple layers. It is not “run SGD on model A and model B.” The model has layer 1, layer 2, and so on.

Several students reached for a second, related confusion: maybe you must collect every layer, save, and only then update. That reading is plausible if you think of “a bucket” as “the whole backpack.” It is the wrong backpack.

Q: In bucketing, do we bucket all the layers’ gradients and then save, and only then update?

A: No. You compute gradients (spoken as “do y, do theta”), and can belong to any layer. You wait until you have a bulk, for example some adding up to about 10k gradients, and then you update. Then you compute more parameters and update again. Rather than updating one parameter or two parameters at a time, the bucket does a bulk update. That saves computation and communication time. Wait until you have a bulk, then you update. You do not bucket all the layers’ gradients and then save as a single all-or-nothing dump.

So the misconception to drop is “collect the entire model, then send once.” The useful picture is: fill a bucket of chosen size, send that packet, keep computing the rest. Layer-1 gradients can leave before layer- gradients exist.

The spoken derivative pair was and . Training usually writes the loss in the numerator, so the same object is . In class, is the quantity you differentiate (prediction or loss, spoken loosely) and is any layer’s parameters:

Spoken as “do y, do theta.” Notation note: many texts write . Here we keep the classroom pair and read it as “gradient of the training objective with respect to whatever parameters currently sit in the bucket.”

A 10k bulk update is a smaller classroom bucket than the 500k demo packet. Both numbers teach the same rule: pick a bulk, fill it, send it. They are not a contradiction. 500k is a systems-sized packet on the wire. 10k is the “do not update one or two parameters at a time” intuition.

Pitfalls.

  1. Thinking buckets mix two different models. Always one model, many layers.
  2. Waiting for the entire backward pass before any send. That kills overlap.
  3. Sending a trickle smaller than after you already chose , except for the true tail.
  4. Confusing buckets with a new loss. The loss is unchanged; only packing and schedule change.

Exam note: buckets are a systems packing trick that enables overlap. They are not a new loss function. Recap. Fill about 500k (or a 10k bulk) gradients, ship one packet, hide that send under later compute, then handle the tail. With SGD communication variants in place, the course leaves the lab cluster and moves to federated learning, where the raw data is not yours to shard.

9.4 Federated Learning: Train Locally, Share Updates

With the SGD communication variants done, the course leaves traditional distributed machine learning and moves to federated learning. FL is widely used when data must not leave its home. A first student definition is already in the right shape: whenever there is a constraint that data cannot be shared, you train locally and then share the gradients to a master, which aggregates them with a federated aggregator.

If a hospital, a phone, or a car already holds the only legal copy of a record, why would training require a second copy in your data center? Federated learning is the attempt to train anyway, by moving the model to the record instead of moving the record to the model.

Textbook language matches that split. In ordinary data-parallel training, every worker can still see a global shard of a dataset the trainer owns. In federated learning, each user or node does not get global access to the whole training set. Workers keep local data private and communicate knowledge: local weights or local gradients. The local pile is often too small and too biased to train a useful net by itself, so you still need a server (or a peer mix) that combines those updates.

The kitchen picture from overlap still helps, with a new rule: the waiter is no longer allowed to carry the ingredients, only a note about how the recipe changed.

9.4.1 Device-Generated Data and the Privacy Constraint

Why refuse to share the data? Privacy rules and geographic regulations can block movement of records. The data is getting generated in the devices. That often means personal data. People do not want that raw stream sent to a company server. The FL move is: develop models on the device, share the models (parameters, weights, or gradients) with a server, and let the server build an aggregated version.

The verbal core is: I am sending this model instead of the data. When I say model, it can be the parameters, weights, or gradients. Parameters here means weights and gradients as the things you actually ship.

Q: What is federated learning?

A: When data cannot be shared, train locally and send gradients (or weights) to a master that aggregates them. The data stays on the device because it may be personal or because rules and regulations on geographic data block sharing. The server never needs the raw records in the vanilla privacy story. It only needs the updates.

A four-step loop, aligned with the usual server–worker picture, is:

  1. The server broadcasts the current global weights to the workers that are awake this round.
  2. Each worker trains on its own local data only.
  3. Each worker updates its local weights (many local SGD steps are allowed, because the link may be choppy).
  4. The server collects those weights (or gradients) and writes a new global model.

Sharing a gradient after every mini-batch is often impossible: a phone may be offline. Sharing weights after a local stretch of training is the more practical message.

Federated learning (train at the data’s home, written FL) means many clients solve one learning problem without shipping raw examples. The payload is a parameter vector , a gradient, or a difference . The raw matrix of examples never becomes one file on the server in the vanilla design.

9.4.2 What Success Means: Match a Pooled-Data Model

Technically, many clients collaborate on one learning problem. One mental picture is: you could, in theory, gather every client’s samples onto one machine and train a single model on the union of those samples. FL’s requirement is that the aggregated model should behave as close as possible to that pooled-data model, even though the pooled matrix never exists in one place.

Let be client ’s local dataset and let be the model you would get by training on the union. Let be the model after federated aggregation. The verbal requirement is: the single model which we are aggregating must be as close as possible to the model trained with all this data used in multiple clients. That is why aggregation is a problem, not a footnote.

If that match were automatic, FL would be a simple copy of centralized SGD. It is not automatic. Clients join and drop mid-round. Data is non-IID. Some clients send huge updates from tiny local sets. Aggregation has to respect those facts.

The is a design target, not an identity. Write a gap if you need a number:

should stay small on the task metric you care about (loss, accuracy, word-error rate), not only in Euclidean weight space. Two weight vectors can look far apart and still classify the same, or look close and still fail on a silo the server never saw.

Assumption. The vanilla story treats an update as non-identifying: “I sent weights, not records.” Later in this lecture that assumption breaks. Data impressions show that weights can still carry training patterns. Success-as-pooled-match is a statistical goal. It is not a privacy proof.

9.4.3 Roadmap: Types, Aggregation, and Later Papers

The rest of the course, as announced here, will study the fundamentals of federated learning (spoken “vertical” in one pass as a slip, then corrected into types), types of federated learning including horizontal and vertical learning, and various aggregation algorithms. Aggregation algorithms play a major role. How you pass the data, how differential privacy wraps it, and how you extract features all depend on that stack.

Supporting definitions that the lecture pointed at, and that reference notes spell out:

Type Also called What is shared across silos Everyday picture
Horizontal FL Homogeneous, sample-based Same feature columns, different rows (different people) Many phones, each with the same “next-word” table schema but different typing histories
Vertical FL Heterogeneous, feature-based Same people (sample IDs), different columns A bank and a shop that both know Ms. A, but one holds credit fields and the other holds purchase fields

Horizontal FL is the Gboard-style, cross-device default. Vertical FL needs a private way to align identities (the notes mention private set intersection) and is the natural language for “same patient, different hospital departments.” Cross-silo FL is the hospital and bank setting: few fat institutions, not millions of phones.

Named methods already on the color-coded list include FedProx (spoken “FedProxy”) and SCAFFOLD. The plan is also to read later papers, including work from 2026, rather than only the older vanilla story.

FedProx keeps FedAvg’s averaging but changes local training. Slow clients may take fewer steps. A proximal term penalizes wandering far from the current global weights , which fights the client-drift that appears when local data is unlike the global mix.

SCAFFOLD (Stochastic Controlled Averaging) attacks the same drift with control variates: a server direction and a per-client direction . The local step subtracts an estimate of how this client’s gradient disagrees with the global direction. You will swap the mixer, not the rest of the client loop, when those papers arrive.

Exam note: treat aggregation quality as a first-class topic. FedProx and SCAFFOLD are named follow-on algorithms, not decorations. Recap. FL trains at the device, ships weights or gradients, and aims for . Next: a paper that mines synthetic training-like samples from those shared weights, which is why privacy engineering enters the stack.

9.5 Data Impressions: When Shared Weights Leak Training Patterns

The vanilla FL pitch is: I will not share data; I will share the model. A research paper discussed in class attacks that pitch. Pre-trained deep models hold latent knowledge in the form of model parameters. Those parameters act as memory for trained models and help them generalize on unseen data. If you only have the trained model and not the training set, people used to say the model is still useful for inference or as a better initialization for a new task. This paper goes further: it extracts synthetic data by using the learned model parameters. The authors dub those samples data impressions. Data impressions act as a proxy to the training data and can be used for a variety of tasks.

If a weight vector is a memory of training, is “I never uploaded the photos” still a full privacy claim? The paper’s answer is no: you can mine stand-in images from the memory itself.

The classroom target is not a new generator network trained on extra public photos. It is: take a trained network’s parameters and mine samples that behave like the original training distribution. The published method names those samples data impressions because they are the training set as the model understood it.

9.5.1 Student Readings of the Paper, Then the Correction

Q: From the title and abstract, is this unsupervised learning that uses limited data to create surrogate data, maybe like data augmentation, to train further when data is not present?

A: That reading is in the right neighborhood (synthetic stand-ins), but the classroom target is not autoencoders. The move is: take a trained network’s parameters and mine samples that behave like the original training distribution. You are not starting from a small labeled set and stretching it. You start from the weights alone.

A second, sharper mix-up compared the paper to autoencoders.

Q: Is this related to autoencoders and decoders?

A: No. In federated learning a device generates data from sensors, trains a local model on that data, and when it communicates it sends the model instead of the data. The paper says: if you give me that model, I can extract weights and parameters and use them as a path to synthetic data. The rejected picture is an encoder–decoder that you train to reconstruct inputs. Data impressions are not an autoencoder lecture. The device generates data, trains a local model, and sends the model instead of the data; the attack then reads that model.

Another restatement that was accepted: large models have learned from a huge amount of data; for a specific task you may lack data; you can try to create data from that large model. The paper’s own highlight, read in class, is the sentence about extracting synthetic data by using the learned model parameters, and dubbing them data impressions that act as a proxy to the training data.

9.5.2 Last-Layer Templates: Cat, Dog, Elephant

Why would weights contain the training distribution? Because a classifier learns a template per class. Look at the last layer of a network and the layer just before it. One output node is the cat probability, one is the dog probability, one is the elephant probability. The weights that feed the cat node are the features for the cat class. The weights that feed the dog node (drawn green in the demo) are the dog features. Another bundle of weights is some other class. If you can extract the last layer, or one step before it, you learn which classes exist and what feature directions those classes used.

At test time, an input is pushed through the net until it becomes a feature vector. That vector is compared, in effect, to the class templates. If the extracted features of a test sample sit closer to the cat template than to the dog template, the model calls it cat. Those templates were carved from real training images. Sampling around them (the classroom phrase is “digital sampling, some sampling techniques”) can yield impressions that look like the original trained data.

The verbal logic of the attack is: every model learns a template for every class; the previous layer’s connections into this node are the features learned for this class; each node learned the template for each class; it is a vector; how close a test sample’s features are to that vector decides the class. If you hold the templates, you hold a generative handle on the training patterns.

Cat / dog / elephant templates. Let the last linear layer map a feature vector to three logits:

Here is the cat template in feature space: the direction the net learned for “this looks like the cats I trained on.” Same for dog (green in the demo) and elephant.

A new feature is scored by which template it aligns with. If wins, the model says cat.

To mine an impression, you invert that test: choose a target softmax vector (high mass on elephant, a little mass on similar classes), start from a random image , and adjust until the trained net’s last layer matches that target. The resulting is not an original hospital scan or pet photo. It is a synthetic sample that the templates treat as in-distribution.

Sense-check. You never stored a photo of an elephant on the server. You stored . That vector still points toward elephant-like features, so sampling along it leaks a proxy of the training patterns.

The paper’s extra algebra, after that template picture, is a way to pick the target softmax vectors. From the last-layer weight matrix you read a class-similarity structure: classes that share features have aligned template vectors. Those similarities become concentration parameters of a Dirichlet distribution over -class probability vectors. You sample a soft label from that Dirichlet, then optimize the input until the teacher network’s softmax matches the sample. No training images and no extra metadata are required. The lecture’s cat–dog–elephant picture is the same last-layer handle, told without Dirichlet notation.

9.5.3 The FL Principle Breaks, Then Differential Privacy Enters

If a server (or a thief who intercepts updates) can mine impressions from the shared parameters, the fundamental principle on which federated learning is built is gone: “I did not share data” is no longer a full privacy guarantee. Similar samples can be generated from the model parameters you just sent. The fundamental principle of federated learning fails if impressions reconstruct training data.

Q: Is there a possibility to reconstruct the data from the weights?

A: Yes. That is what the data-impressions paper is doing: creating new data from the model parameters. That should still be a privacy concern. The fundamental principle failed. That is why differential privacy came into the picture.

The mitigation named here is differential privacy (DP), plus an encryption layer. Rather than sending the model in the clear, you apply private techniques, add encryption, and only then send. On arrival you decrypt (in the allowed protocol) and continue training. Classroom pointers also include a privacy-in-AI thread and the monograph title The Algorithmic Foundations of Differential Privacy. Secure aggregation is named alongside DP: carefully calibrated random noise is added so that the contribution of one individual becomes difficult to identify, and you may also encrypt the information.

Reference notes on DP match that recipe. Each participant can add random noise to local parameters, often from a zero-mean Gaussian or Laplace law, so that one person’s influence is hard to spot. When many parties aggregate, those zero-mean noises tend to cancel, and the global model stays close to the no-noise mix. The catch: with only a handful of hospitals the noise may not cancel, and the global model suffers. Secure aggregation and (partial) homomorphic encryption are the complementary tools: mix under encryption so the server sees a sum, not each raw update.

A later analogy uses signatures. Suppose you have English signatures and a model trained from millions of signatures. An attacker takes the shared model, mines impressions, reframes data from those impressions, and trains a new task that had no labels of its own. The stolen proxy set becomes that attacker’s training set.

Pitfalls.

  1. Equating “no raw upload” with “no leakage.” Impressions attack the second claim.
  2. Mixing this paper with autoencoders. The source is a trained classifier’s parameters, not a reconstruction net you trained for this purpose.
  3. Treating DP noise as free. Too few clients, or too much noise, and the aggregate is junk.
  4. Forgetting encryption and secure aggregation. DP is the statistical cloak; encryption is the transit cloak. Class named both.

Exam note: FL reduces raw data movement but does not, by itself, prove that updates are empty of personal detail. Expect the impressions attack as the reason DP and secure aggregation appear. Recap. Last-layer templates (cat, dog, elephant) are a generative handle; impressions are the mined proxy set. Next, a Siri-style voice loop shows the product workflow that those privacy tools have to wrap.

Real-world: this is the break that turns FL from “just average the weights” into a privacy-engineering problem.

9.6 Voice Assistant Workflow: Central Collection versus On-Device Training

A running demo uses a voice assistant in the style of Siri on iPhone hardware, with Apple as the central organization. The product goal is that the assistant should self-learn to recognize the user’s voice more accurately. The same workflow is the teaching scaffold for FL: traditional centralized machine learning first, then the federated reverse of data movement.

Can a phone assistant get better at your voice without a company vault of your spoken commands? That design question is the whole federated product story in this demo.

Think of tutors visiting each home instead of every household mailing its diary to one school. The tutor (the model) travels. The diary (raw voice) stays. The analogy breaks when the tutor’s notebook still describes the diary well enough for a stranger to fake new pages — that is the impressions attack from the previous section, and it returns at the end of this one.

9.6.1 Traditional Centralized Voice Training

In the old centralized system, the company could collect data. When you speak, the phone connects to the company server. Actual audio samples spoken by users are collected: commands such as “call mom” and “open maps.” Regional and individual speaking styles are captured, including how words are spoken, and sometimes background noise. The problem: private data leaves the user’s phone. Even if the link is wrapped, the central organization may still need to store or process very large quantities of personal data. Personal voice clips and commands leave the device. A central database holds them. Administrators of that store, if they know the password or the key, could listen to all the voice. Systems must also comply with privacy laws and data protection rules. If the server is compromised, the leak is the raw audio.

The design question FL is built to answer: can the assistant improve without collecting and centrally storing every user’s raw audio?

9.6.2 Reverse the Data Movement

Federated learning moves the training process closer to where the data already exists. Training happens at the data location: the user device. iPhone A keeps using its voice data locally. In a picture that still shows “voice data uploading,” the old world uploads millions of voice samples, trains on the server, and sends a better assistant down. FL reverses the usual direction of data movement. Instead of moving raw voice data, the company creates an initial assistant model and sends that model to selected phones. Each phone trains using its own data. Only model updates are returned. Raw voice stays on the phone. The phone sends only the local learning: parameters of what it learned; only mathematical model updates.

Purpose. Reverse the data movement: send the model to the phones, keep spoken audio on the device, return updates.

Inputs. An initial global weight vector , a selected cohort of devices, and each device’s local voice examples (never uploaded).

Outputs. Per-device updates (or new local weights), then a server-side mix that becomes model version 2.

Steps in order:

  1. The company prepares model version 1, a vector of learned parameters (weights). For teaching, pretend there is a single weight. In reality a neural net has many numerical weights.
  2. That same initial weight is sent to a selected group of phones. Example initial value: 0.42.
  3. Local commands differ. One user says “call mom.” Another says “open maps.” Clips remain on that user’s phone and are used only for local computation.
  4. After local training, the weight moves. Different users speak differently and sit in different environments, so each device learns a slightly different update.
  5. Phone A sends an update of +0.05 (one feature). If there were 100 features, there would be 100 such numbers. Other phones send their own updates.
  6. The server aggregates (average or weighted average). It builds model version 2 and redistributes it. Meanwhile new sensor-like data keeps appearing (the demo also mentions temperature and similar on-device streams). Devices train again on the latest model. The loop repeats.

The verbal explanation of the reverse is: traditional machine learning moves raw voice data toward the server; here we create an initial model, send it to selected phones, each phone trains using its own data, only model updates are returned, raw voice data stays on the phone.

Scope. This loop assumes selected phones are awake, willing, and able to train. Real phones drop off, run dry batteries, and sit on slow radios. Those failures are first-class FL challenges, not rare glitches. It also assumes the returned update is the only thing the server needs. Impressions still apply: the update is informative.

9.6.3 Worked Numbers: 0.42, Plus 0.05, Average, Then Version 2

For easy understanding the model is treated as one weight. Everyone starts at . Phone A, after local training, reports an update . The local weight on that phone is

The verbal explanation is: old weight is 0.42; phone A will send update 0.05; 0.47 I updated. Other phones send their own signed updates (plus or minus). The server’s job in the vanilla loop is to average those updates (or the resulting weights) and push version 2 to everyone.

Toy single weight.

  • Global version 1: .
  • Phone A local train: , so .
  • Suppose three phones send .

Plain mean of updates:

If instead the server averages the local weights , , :

Both views agree here because each phone started from the same and added its . They will disagree later if some phones skip the round or train from a stale version. FedAvg’s -weighted mix is the next section.

Sense-check. Phone A moved . The group did not jump all the way to 0.47; the mean pulled it to 0.44. One loud phone does not own version 2 in this toy.

If phones send updates and we take a plain mean:

Class also described averaging the local weights themselves. Both views appear in the FedAvg section. They match when every client starts from the same broadcast and reports a full new .

Millions of users can participate over time. Every phone contributes experience from a different user environment: American English, British English, older speakers, car noise, office noise. Apple need not receive raw information: no plain audio, clips, conversations, or commands are shared. What is shared are model parameters, gradients, weight differences, and counts such as how many local samples were used.

Personal voice now enters the local model, gets trained there, and the gradients or weight tables are what travel to the server.

9.6.4 Traditional ML versus Federated Learning, Side by Side

Traditional machine learning: data goes to the server; that creates stronger centralized privacy concerns; it requires a large central store of user data.

Federated learning: raw data stays on the device; in-device data never takes that trip; there is no need to store central raw audio; in its place you send gradients that still must be stored and aggregated. FL also introduces challenges: unreliable devices, communication limits, and hard learning dynamics. Those are not small print. They are the next technical chapters.

Traditional centralized ML Federated learning
What moves to the server Raw voice, “call mom” / “open maps” clips Updates: weights, gradients, , sample counts
Where training runs Company cluster On the phone, then a mix on the server
Main privacy worry A vault of personal audio Informative updates (impressions, inversion)
Extra systems pain Huge central store Dropped devices, slow radios, non-IID voices

When to pick which: if you legally own a single IID pile and a cluster, classical distributed training is simpler. If the data cannot leave the phone, FL is the setting, not a synonym for All-Reduce on your GPUs.

Q: Federated learning trains so that data privacy is maintained: we send the model to the data and just collect updates. But a paper showed we can create synthetic data from weights, so random noise might be added, and it is still a concern. Why is that attack possible?

A: Every model learns a template for every class. For cat versus dog, the previous layer’s connections into each output node are the features for that class. A test vector is checked against those templates. Holding the templates lets you sample impressions. Noise and encryption (differential privacy, secure aggregation) are the response, not a claim that the attack is imaginary.

Federated learning reverses data movement by sending the model to the phones. Recap. Version 1 weight , phone A plus yields , the server mixes, version 2 goes out. Next: that mix is FedAvg, and a one-sample client must not drown a hundred-sample client.

Real-world: Siri-style on-device voice improvement is the product story. The same loop applies anywhere a phone or sensor owns private audio, text, or telemetry.

9.7 Federated Averaging: Plain Mean versus Sample-Count Weights

Federated averaging (FedAvg) is the basic aggregation rule. Every client reports local weights (or gradients). The server mixes them into one global weight and sends that mix back as the next model version. You may send weights or gradients; the server holds those values and updates.

If phone A trained on one shouty sample and phone B trained on a hundred quiet ones, should they tug the global model equally? A blind mean says yes. FedAvg’s useful variant says no.

Textbook FedAvg is the parameter-wise mix of local models with local dataset sizes and :

The original algorithm also samples a fraction of clients each round rather than waiting for everyone. Class here focuses on the mix itself: plain mean versus -weighted mean. Later papers replace that mixer (FedProx, SCAFFOLD) without rewriting the rest of the loop.

9.7.1 Vanilla Average

In the vanilla version, whatever you send, the server takes the average. If phone A sends as its update and others send theirs, the server averages. Then it redistributes model version 2. The verbal picture is: every client will respond “these are all my local weights,” and this is the aggregate weight after doing this; suppose 0.47 I updated; compute the average value and then send back to all other users.

For clients with updates ,

Every client has mass , including a client who saw one sample.

9.7.2 Weighted Average by Local Sample Count

A weighted version also sends : how many local samples phone used. Phone A used samples to justify its recommendation. The server forms a weighted average of updates (or of weights):

The verbal explanation is: into the weight you said 0.05 plus , and totally we will take the average; weight average of the updates. You can set how the global weight will be; you can play with that mix. This is also a live research area: metrics for building a global model are not a blind average.

The same weights are the first bias knob. A client who trained on one sample should not drown a client who trained on a hundred.

Let . Then

If you mix weights instead of deltas, replace by . That is the same fraction you will see per layer in the code walk-through.

Mix with other counts.

Phone A: , . Phone B: , .

Weighted:

Plain mean would have been , almost twice as large, because A’s small set got equal votes.

A classroom toy of dilution: others trained with 8, 25, 25, up to 100 or 101 samples. A one-sample client’s value gets diluted. Out of 40 that a client sent, you might treat it as only one unit of mass after normalization.

Sense-check. Ten samples at contribute mass . Ninety samples at contribute mass . The crowd of ninety should win, and sits close to , not close to .

Scope. Weighting by assumes more samples means a more trustworthy local fit. That fails if the hundred samples are all the same biased source, or if they are fake. It also assumes clients report honestly. A bad actor can lie about sample count. is the simple knob shown here, not a full defense.

9.7.3 Bias, Accents, and Why Is Not Enough

Q: Localized learning authenticity might be a problem because we never see the original data. If the data is not real, or it is instrumented, learning might be biased. What if there are bad actors?

A: Yes. The local dataset may be biased. That is a named FL challenge, next to communication cost and data heterogeneity. Combining many clients is one reason to federate: a single client’s data may be very small and skewed. Instrumented or fake local data can still poison the mix. Sample counts shrink small honest clients; they do not detect a liar.

A second bias is linguistic, not fake labels.

Q: The local model that is getting trained has more British accent compared to an Indian model, so the model will converge more toward the British accent. Can that also have bias?

A: Yes. There are bias mitigation techniques. In vanilla FedAvg they do not blindly accept a weight. They normalize by , the number of samples you used. If you used only one sample, the importance given to that weight shrinks. If another device used many samples, its influence grows. That is one simple way to reduce that impact.

Sample-count weighting shrinks a one-sample client so it cannot overflow the global model. A single model with high bias, high loss, and high gradients should not overflow the global model creation.

Advanced methods go further than . Those are later in the course. The sample-count weight is the simple technique shown here.

Pitfalls.

  1. Writing a plain mean when the question wants an -weighted mean, or the reverse. Mixing them is a common error.
  2. Believing fixes accent bias by itself. It only reweights by count. A large British-accent silo still dominates a small Indian-accent silo.
  3. Trusting reported from an adversary.
  4. Averaging deltas from clients that started from different global versions without saying so.

Exam note: write whether you mean a plain mean or an -weighted mean. Mixing them is a common error. Recap. Vanilla = equal votes. Weighted = over . Next: the same arithmetic on hospital mammograms, where 10,000 local samples should outweigh a tiny clinic.

9.8 Cross-Silo Federated Learning for Hospitals

Map the voice-assistant loop onto medicine. Leave “privacy” as a slogan and name a scenario.

Q: In medical data, is there scope for federated learning? If so, why and how? Map it from the voice-assistant demo.

A: Different hospitals, different patients, and different sensor nodes collecting different non-IID data. The main problem in hospitals is that they do not want to share the data. That is the scenario where this method belongs.

Different hospitals, different patients, different sensor nodes, and different (non-IID) data: that is a natural FL setting. Hospitals often will not share raw records. That is where this comes into the picture. Healthcare is also where a lot of early FL product energy went: medical imaging, drug discovery, and electronic health records all hit the same wall of data that cannot legally sit in one vendor cloud.

9.8.1 Mammogram Demo across Sites

A cross-silo demo: a federated server stores the global model. Hospital A captured local mammograms specific to its area (an India-area site in the story). Another hospital is in the US. Others are in other countries. Data stays with the hospital. You are not going to leak images, names, reports, history, or doctor annotations; those remain inside the hospital. For this teaching pass, assume the counter-paper (data impressions) is paused and that sending gradients is “safe,” so we can see the statistical gain of collaboration.

The loop matches Siri:

  1. The server creates a global model and sends the same one to all hospitals.
  2. Local training uses local mammograms.
  3. Each hospital returns model changes (weight updates, gradients, or other aggregate information, possibly wrapped for transit).
  4. The server aggregates and redistributes. Another round begins.

Hospital A’s model learns dense breast tissue patterns. Another hospital learns a different set of patterns from a different scanner: rare abnormalities, early-stage patterns, other tissue patterns. When you combine those experiences, quality can rise. The final global model may generalize better across hospitals, patient groups, and imaging equipment, because it saw images from different devices, not only Hospital A’s scanner. How you combine that information is the scientific core.

9.8.2 Worked Aggregation: 10,000 Samples Times 0.6

Hospital A has 10,000 local samples and a local trained weight (the demo pairs this with a factor 0.6 in the weighted product). You can take a simple average: blindly mix the upgrades sent by various hospitals. Or you take a weighted average because 10,000 samples should count more than a tiny site:

Hospital A mass. Local sample count . Classroom factor (a local trained weight, or a scaled contribution, in the demo).

The verbal explanation is: hospital A local samples 10,000 so local trained weight is this one; 10,000 into 0.6; that is how the bias is getting mitigated; if a very high update is coming with one sample, you kill that influence so the value becomes small.

Compare a one-sample clinic that reports an update of size :

versus Hospital A:

In a weighted sum, 6,000 dominates 1. The one-sample spike cannot overflow the global model.

If a second hospital B has and factor , its mass is . The -style mix of those two masses is

Sense-check. Ten thousand images should outvote a tiny site. The product is the classroom mass that encodes that vote.

The global model is then redistributed and another training round begins.

Real-world: mammography across countries and scanners is the medical story. The same silo pattern applies to any hospital network that will share parameters but not DICOM dumps.

9.8.3 Why the Medical Model Gets Better

Each hospital contributes knowledge from its own environment. Sample counts grow in effect because experience is pooled through parameters. More important than raw count: different learning patterns, different devices, different patient groups (one site may see older patients, another middle age). Equipment differences enter the high-level model. In some cases that is exactly why federated learning succeeds.

Challenges still bite. Non-IID data: each hospital may have a different patient population and disease distribution. That is the main problem. A harder variant: one hospital stores cardiology information, another eye information, another kidney information. Feature distributions then differ. Training one model across those distributions is more challenging. Weight aggregation, domain adaptation, and strong combination all matter. Compression is mentioned as not having much impact in this demo.

Cardiology versus eye versus kidney is already a vertical-flavored split: different feature families, sometimes different patients, often both. Horizontal mammography (same image task, different people and scanners) is the easier collaboration. Mixing heart traces with retinal photos into one net is the harder one, and it is why aggregation research is not optional.

Pitfalls.

  1. Pausing the impressions attack in the teaching pass and then forgetting it in a privacy question. The pause was for statistics, not a claim that medical gradients are empty.
  2. Treating all hospitals as IID replicates of Hospital A’s scanner.
  3. Letting a tiny site with a huge update dominate because you used a plain mean.
  4. Assuming compression is the main medical-FL problem. In this demo it barely moved the needle; non-IID mix did.

Recap. Cross-silo FL keeps mammograms inside each hospital, ships updates, and reweights by sample mass such as . Bridge. Why federate at all when you already know distributed SGD? Bandwidth, locked data, and domain shift — including scripts and signatures that are not the target language.

9.9 Challenges, Domain Adaptation, and Federated versus Central Distributed Training

Federated learning is a shift from a centralized data pile to training on locked-in machines. Data is locked in the devices. Models move to the data, train, and recombine into a global model. Step one: send the current global model out. Step two: send updated models or gradients back and aggregate. Privacy issues, communication cost, many clients, missed rounds, new clients joining later, data heterogeneity, system heterogeneity, mixed network bandwidths, mixed hardware, and security all make FL hard.

If the data already sits on a thousand locked machines, is the hard part the SGD update or the fact that those machines and those tables do not match? In FL both are hard, and the mismatch is the new one.

9.9.1 Why Federate at All

Sending the data may be too costly compared with sending the parameters. Self-driving cars are expected to generate several terabytes of data a day. Some wireless devices have limited bandwidth, so you cannot ship the raw stream; you can ship model parameters. You may also be blocked by sensitivity: you cannot send data, but you can send parameters. A local dataset may be too small and may overload a purely local model; you need data from multiple clients. Bias in one silo can be reduced by adding other clients, using the idea and later algorithms.

In distributed training in the classical lab sense, data is centrally stored in a single place, often treated as IID, and you do not pay the same “move hospital records across borders” threat. In federated learning, data is naturally distributed. There is no single central place to store it. Data is not independent and is not identically distributed. Parameters collected in one hospital may follow a different distribution than those from another hospital, and you still have to combine them. Class imbalance across silos is the same story: maybe only two patients went through cardiology, while 100 people went through the eye clinic.

Coordination can be a single server, or peers can talk among themselves to come up with a common model. That peer mix is the decentralized picture: no one silo has to own the hub.

Classical distributed training Federated learning
Where the data lives A store the trainer controls Locked devices or silos
Typical IID story Shards of one shuffled pile Each silo is its own world
Why you split Speed and memory Law, bandwidth, and ownership
Who is missing this round Rare crashed GPU Phones asleep, cars offline, clinics down
Hardware Homogeneous cluster, often Mixed phones, Pis, hospital GPUs

When to pick which: if you already have the pile and the cluster, use classical data-parallel SGD (with overlap, quantization, and buckets as needed). If you cannot move the pile, you are in FL, and FedAvg is the first mixer, not All-Reduce on shared disk.

T1’s edge-device list matches the classroom pain: weaker chips than data-center GPUs, battery budgets, flaky links, devices that power off, users who produce noisy labels. Those are system heterogeneity, not footnotes.

Q: What is domain adaptation? Is it training a model on a particular domain, like continued pretraining, exposing a pretrained model to more data of that domain so it adapts?

A: Related. You have data in one domain and you want a model in another. Example: you have Japanese signatures and some French signatures, and you want an English online signature verification system with almost no English samples. Japanese signatures help more than an unrelated domain such as cat-versus-dog or apples. You use that related domain. You may reach about 70 percent accuracy, not 90 percent, but 70 percent can still be useful. Another language example: Telugu and Tamil text datasets exist; you want Kannada character recognition and you have no Kannada texture; you use the related scripts and accept a similar accuracy drop. Another pairing: train on one signature set (spoken “MCY 800”) and test on SVC data. That gap is adapting across datasets.

Japanese signatures toward English verification.

You hold many Japanese (and some French) online signatures. You want English verification and you almost have no English samples.

  • Unrelated source (cats versus dogs): transfer is weak. Those images do not share stroke dynamics with handwriting.
  • Related source (Japanese signatures): stroke timing and shape still live in a handwriting domain. Classroom outcome: about 70 percent accuracy, not 90 percent.
  • Same idea for scripts: Telugu and Tamil as sources, Kannada character recognition as the target with no Kannada texture. Expect a similar drop, not a miracle match.
  • Dataset shift: train on the 800-sample signature set, test on SVC. That is adapting across datasets, not across languages.

Sense-check. Seventy percent is not a failed exam score here; it is a usable bootstrap when the target domain has no labels. Ninety percent was the in-domain dream you did not get.

The verbal summary is: related domain, get those samples, use that information for a new domain; the model is trained with one dataset and you want to test with a different dataset; that is adapting.

In the hospital FL setting, domain adaptation sits next to aggregation: scanners, populations, and disease mixes are different domains that the global model must survive.

Kannada character recognition can borrow Telugu and Tamil scripts at about 70 percent. That is the same 70-not-90 lesson as the signature story, told with South Indian scripts.

9.9.3 Student Summary of the FL Loop

Q: Can you summarize federated learning?

A: It addresses privacy concerns where data cannot be stored at a central location. Process the data at the source. Instead of sharing raw data, train the model locally and share the trained weights with the server. The server runs federated averaging over the client weights and sends the learned weights back. Clients update their local models. Other problems FL also helps with include communication bottlenecks and the cost of transporting huge data, and — as a distinct FL-shaped bonus discussed next — filling missing features from overlapping entities.

Pitfalls.

  1. Treating FL as “distributed SGD with extra marketing.” Classical distributed training assumes a central IID pile. FL does not.
  2. Expecting 90 percent after a domain hop. Class’s teaching number is about 70 percent for related handwriting/scripts.
  3. Ignoring join/leave. New clients appear; old ones miss rounds.
  4. Shipping terabytes from a car “just this once.” The daily volume is the reason parameters are the affordable message.

Exam note: be able to list FL challenges (non-IID, systems heterogeneity, communication, bias, client drop-in/drop-out) and to contrast FL with centralized distributed training (IID pile vs locked non-IID silos). Recap. Federate when you cannot move data or cannot afford to move terabytes. Domain adaptation is the cousin problem of “train here, test there.” Next: a bonus that is not privacy and not bandwidth — filling missing columns from overlapping patients.

Real-world: IoT sensor data, medical data, in-device phone data, and self-driving terabyte-per-day logs are the motivating sources.

9.10 Feature Completion from Overlapping Patients

Privacy and bandwidth are not the only reasons to federate. A feature-level bonus appears when the same entity shows up in several silos with different measured fields.

If person B’s heart fields sit in one hospital and eye fields sit in another, do you throw B away, or do you learn how those fields move together from people who visited both? Overlap is that second path.

This is the vertical flavor from the FL types roadmap: same sample IDs, different columns. Horizontal FL (same columns, different people) does not by itself fill a missing column. Overlap patients are the bridge.

9.10.1 The Overlap Picture

Think of three hospitals and three people, A, B, and C. Person A is present in all of them: a cardiac hospital, another site, and a third site (the demo names a cardiac hospital in the style of a large private chain, then an X hospital and a Y hospital). Cardiac features, heart features, and eye features are not stored together. Person B is in the cardiac silo along with A, but some of B’s columns are missing there and present elsewhere. Hospital 1 has a subset of columns. Hospital 2 has a different subset. Hospital 3 has yet another. For the same person B, feature block 1 is missing in one silo, feature block 2 is missing in another, and feature block 3 is missing in the third. Federated collaboration can help fill the holes. Shipping huge raw tables is a different story (bandwidth). The extra FL-shaped prize is this column completion.

The verbal claim is: this federated learning will help me to fill these features; I can get these features; that is the advantage, more than only shipping smaller messages.

How? Learn the correlation on overlapping patients, then apply it where a column is missing. A toy numeric pattern:

  • In one silo the overlapping pair looks like .
  • In the other silo the matching overlap looks like .
  • That suggests a relation between the two views of A and B.

Carry the same pattern to a row that is only partly known: something like filled as in the toy, and filled as . The classroom warning is that real filling is not this simple; the toy only shows “learn the overlap pattern, then apply it where values are missing.”

Times-two overlap, then fill 12.

On patients who appear in both silos you observe

So view 2 is twice view 1 on the overlap. Now a row is only partly known. One spoken fragment was “1, 4, say 6”: if a related column scaled by a different factor, you still transfer a pattern, not a unique physical law. A second fragment used a map:

Start from 2, observe 8 on the other side (), then apply to 3 and fill 12. The spoken “2, 8 … 12” pair is that transfer. There is not one true algebra for every hospital table. The intended lesson is pattern transfer on overlaps.

Sense-check. and are consistent with one scale. If the next overlap had been , you would not force . Fit what the overlap shows, then impute.

These shared people are overlapped patients: present in more than one hospital. If a few features are missing, use the places where features are present to learn the pattern, then fill.

9.10.2 Do Not Drop Incomplete Records

If 80 percent of features are present and 20 percent are missing, you should not throw out the patient. You have to fill. A numbered filling path:

  1. Find overlapped patients: the same person appears in more than one hospital.
  2. On those overlapping rows, estimate a relation among the columns that are present on both sides (the toy, or a richer fit in real data).
  3. For a person who is missing 20 percent of fields, apply that relation to the missing slots.
  4. Feed the completed row to the model. Do not drop the row only because a minority of fields is empty.

Overlap is that filling path: for A you have all the samples; for B you are missing some; understand the overlapping pattern; apply it wherever those features are missing. Once the features are filled, you automatically feed that vector to the model. The missingness itself is no longer a reason to discard medical history.

Q: Other than data privacy, is there any other problem federated learning solves?

A: Communication bottlenecks and expensive transport of huge data are real. A further FL-shaped advantage is feature filling. Client hospitals hold different feature sets for overlapping people. By learning correlations on those overlaps, you impute unavailable features, then feed the completed rows to the model.

Do not throw out a patient when 80 percent of features are present and 20 percent missing. That warning is the clinical version of “missingness is not a delete key.”

Q: So this is like data preprocessing — feature filling?

A: Yes. Feature filling. I do not have this value, but I observed the two views overlapping here, so I apply that pattern there. It is preprocessing in the sense that you complete the vector before the model sees it, using federated overlap rather than a central dump of every column.

Scope. Pattern transfer assumes the overlap is the same people (or a trustworthy ID match) and that the relationship is stable enough to copy. If hospital 2’s “2, 4, 6” is a different unit system, a blind invents nonsense. Real imputers can be regressions, graph models, or trained nets. The toy is the idea, not the production code.

Pitfalls.

  1. Dropping every incomplete record. You discard history you already paid to collect.
  2. Treating the toy as a law of medicine.
  3. Filling from non-overlap (different people) as if they were the same entity.
  4. Forgetting that privacy still applies to the filled values. Imputed heart fields are still sensitive.

Exam note: when asked “why FL besides privacy,” include bandwidth, small local sets, bias mixing, and overlap-based feature completion. Recap. Overlapped patients teach the map ; missing slots such as get filled; 20 percent missing is not a reason to delete the row. Next: the same mix written in code, plus an L2 size of the update.

9.11 FedAvg in Code: Update Size and Client Fractions

A code walk-through after the break shows local training, a size measure of the update, and a fed_average routine. The main engineering claim: aggregation is the hard part. FedAvg is written as its own function so later papers can replace that mix without rewriting the rest of the loop.

If local SGD is “the easy for-loop,” why is the server function the piece papers keep swapping? Because how you mix non-IID clients is the scientific problem. FedProx and SCAFFOLD change this mixer (or the local objective beside it), not the fact that clients train and send.

9.11.1 L2 Norm of the Weight Delta

After local steps you have new weights. You also compute a scalar size of the update: the L2 norm of the difference (spoken “L2 norm of delta”). That number measures the size of an update. The verbal recipe is: for in the weight list, take a square-root / sum form that is the L2 norm, and share that to the server as well as appending the new weights.

The speech mixed “square root of W” with “sum of squares.” Use the usual Euclidean norm unless the code shows otherwise. For a list of tensors, flatten the delta into one vector (or sum the squared entries across tensors) and take the square root.

Purpose. Report how large a client’s step was, in one number, while still uploading the full new weights.

Inputs. Old weights (the broadcast global model) and new weights after local SGD.

Outputs. The delta , the scalar , and the payload of new weight tensors.

Walk the client loop as the demo code does:

  1. Train on the local set and get new weights.
  2. Form the per-tensor difference (the delta).
  3. Reduce that delta to and keep it as a size report.
  4. Append every new weight tensor into the payload you will upload.
  5. Send the new weights (and the size) to the server.

The server is not a blind dump. It runs FedAvg using client sizes (how many local samples each client used). It loops over the clients it heard from, applies each weight delta into a running mix, and then writes a new global model. Global weights are copied into that global model. After the mix, the demo evaluates: it reports loss and accuracy so you can see whether the round helped. That evaluate-after-aggregate step is how the demo shows that the model learns. The hard piece remains the mix, not the local SGD.

The standard reconstruction of that spoken L2 is the Euclidean norm:

If the weights are a collection of tensors, the sum runs over every scalar entry of every tensor. In vector form, for parameters and .

Tiny Euclidean delta. Suppose two scalars moved: and .

Sense-check. Both changes are a few hundredths, so a size near is in the right ballpark, not (that would have been the weight itself) and not (that would have been a sloppy sum of absolute values). The Euclidean mix of 0.05 and 0.04 should sit between them, closer to 0.05.

Clients send new weights (and sizes). The server loops over clients, applies weight deltas, builds a new global model, writes global weights into that model, evaluates loss and accuracy, and repeats. That is how the model learns in this demo. The challenging task is still how you aggregate.

Time cost: each round ships numbers per participating client. Space on the server is one running mix of size , plus whatever client payloads you buffer. It gets slow when is huge and is huge; that is why quantization and client sampling () return as systems knobs.

9.11.2 Layer-Wise Client-Size Fractions

The separate fed_average function takes the client weights and the client sizes (how many samples each client used). It computes a total, then a fraction per client. For each layer, it multiplies that client’s fraction by that client’s weights in that layer, appends, and averages across clients. For that layer, it takes the average over all clients, weighted by those fractions.

Let be client ’s sample count, , and the weights of layer on client . The mix is

The verbal explanation is: it got the clients; taking the total; client size average; fractions it computed; with the fraction of that client it is multiplying with that client weight in that layer; taking the average of each, all the clients’ average; for that layer it is taking the average for each layer.

That is the same idea as in the Siri and hospital demos, now written per layer so convolutional layers and dense layers each get a consistent mix. A conv kernel and a dense matrix are different shapes, but each is a tensor you mix independently with the same scalar fraction . You do not average a conv tensor with a dense tensor. You average conv with conv, dense with dense.

Two clients, one dense layer, one conv-shaped tensor.

Client 1: , dense weight , conv entry . Client 2: , dense weight , conv entry . Total . Fractions: , .

Dense mix:

Conv entry mix:

Sense-check. Three-quarters of the mass is client 2, so 3.5 sits near 4.0, and 4.0 sits near 5.0. A plain mean would have given dense and conv , which over-credits the small client.

When to use / alternatives. Use this fraction-weighted per-layer mix as the default FedAvg skeleton. Replace it when client drift is the failure mode: FedProx adds a proximal penalty on the client; SCAFFOLD adds control variates. Do not replace it with a plain mean just because the code is shorter. Do not mix tensors of different layers as if they shared axes.

Pitfalls.

  1. Implementing L2 as “square root of ” without summing squares. The Euclidean form sums squares first.
  2. Using one global flatten when you meant per-layer mix — or the reverse — without saying so. The demo mixes per layer with one fraction.
  3. Forgetting and accidentally coding .
  4. Skipping the post-aggregate evaluate, then claiming the round “must have helped.”

Exam note: walk through one round: local train → form and → send weights and → fraction-weighted sum per layer → broadcast new global weights. Later algorithms (FedProx, SCAFFOLD) swap this mixer. Recap. Euclidean sizes the step; mixes every layer, conv and dense alike. That skeleton is what a “smarter aggregate” paper replaces.

Real-world: this is the skeleton you replace when a paper proposes a smarter aggregate. The rest of the client loop (local SGD, send, receive) stays.

Exam Guidance Summary

This session does not hand out a mark table. It does lock a study map for the federated half of the course and a contrast you should not blur on an exam.

  1. SGD communication variants: Overlap SGD vs quantized SGD vs buckets. Overlap changes timing of compute vs send. Quantization changes bit-width (FP32 400 MB → INT8 100 MB → 1-bit 12 MB in the demo). Buckets pack ~500k gradients (or a 10k bulk update) so you do not send one scalar at a time. Quantization is representation, not a new optimizer, and it composes with sync, async, and overlap.
  2. Federated learning definition: Train at the data location. Share weights or gradients, not raw records. Success means the aggregate is close to a model trained on the union of client datasets.
  3. Attack and defense: Data impressions mine synthetic samples from shared parameters via last-layer class templates. Differential privacy, secure aggregation, and encryption are the named fixes. Do not claim FL alone makes updates non-informative.
  4. FedAvg arithmetic: Plain mean vs -weighted mean. Toy values 0.42, +0.05, 0.47. Hospital product . Per-layer fraction . L2 norm of the delta as an update-size statistic.
  5. Challenges: non-IID silos, systems heterogeneity, client join/leave, small and biased local sets, bad or instrumented data, accent or population bias, domain shift (Kannada from Telugu/Tamil, SVC vs the 800-sample signature set, Japanese signatures toward English verification at ~70% not 90%).
  6. Extra FL value: overlap patients and feature filling when 20% of fields are missing; do not drop the row.
  7. Named follow-ons: FedProx (FedProxy), SCAFFOLD, 2026-era papers, horizontal vs vertical FL, The Algorithmic Foundations of Differential Privacy. Read the shared code before the next meeting; the next meeting goes deeper on these algorithms.

Exam note: if a prompt says “quantized SGD is a third algorithm beside sync and async,” correct it. If a prompt says “FL is safe because we only send numbers,” bring up data impressions. If a prompt says “quantized SGD replaces FedAvg or overlapping,” the answer is no: it encodes the tensors those methods already move.

Key Industry Applications

  1. On-device voice assistants (Siri / iPhone / Apple): Traditional path uploads “call mom” / “open maps” audio, styles, and noise to a central store. Federated path sends model version 1 (example weight 0.42) to phones, trains on-device, returns updates such as +0.05, averages, and ships version 2. Raw audio never needs to enter the server.
  2. Low-end and edge hardware: Raspberry Pi and other tight devices use 8-bit (or narrower) tensors so compute and communication fit the box. 1-bit sign traffic is for niche scientific or parity-like needs, not the default product path.
  3. Hospital silos and mammography: India-area, US, and other sites train on local mammograms (dense tissue, rare findings, different scanners). Names, images, reports, and annotations stay inside the hospital. Parameters move. Sample counts such as 10,000 reweight the mix. The same pattern shows up in medical imaging more broadly: large daily scan volume, strict privacy rules, and scanners that do not match across sites.
  4. Self-driving and wireless IoT: Cars can generate several terabytes per day. Radios cannot always ship that volume. Parameters are the affordable message. IoT and in-device medical sensors are the same pattern.
  5. Signature and script systems: English / Japanese / French signature verification and Telugu / Tamil / Kannada character recognition show domain adaptation: related domains transfer some accuracy (about 70%, not 90%) when the target script or language has no samples. SVC versus an 800-sample signature set is the dataset-shift cousin of that story.
  6. Privacy stack: Data-impression mining against shared deep models; differential privacy noise; secure aggregation; encryption of updates; literature pointer The Algorithmic Foundations of Differential Privacy; aggregation research FedProx and SCAFFOLD.
  7. Peer FL: A single federated server is the usual picture; peers can also mix among themselves toward a common model when no one silo should own the hub.

These deployments share one engineering spine: keep raw records at the source, ship updates, mix with when sample counts differ, and do not treat those updates as empty of personal detail.

DML Lecture 9 notes · Overlapping SGD, Quantized SGD, and Federated Learning

Distributed Machine Learning· postgraduate· 2026-09-11

Sections Breakdown

1Overlapping SGD: Mixing Compute with Communication

Overlap schedules local math with activation and gradient sends so a stage pays about max(compute, communicate) instead of the sum, hiding idle GPU time without shrinking message size.

2Quantized SGD: Shrinking the Numbers You Move

Quantized SGD is a representation choice that cuts bit-width so payloads shrink (FP32 400 MB to INT8 100 MB to 1-bit 12 MB) and can run on compute, communication, or both, including Raspberry Pi-class devices.

3Gradient Buckets: One Packet per Group of Gradients

Frameworks pack gradients into one packet per bucket (demo sizes 500k or a 10k bulk) so overlap can start when a chunk is ready instead of sending a thousand tiny messages.

4Federated Learning: Train Locally, Share Updates

Federated learning trains at the device because geographic and privacy rules block raw sharing, ships weights or gradients, and aims for an aggregate close to a model trained on the pooled union of client sets.

5Data Impressions: When Shared Weights Leak Training Patterns

Data impressions mine synthetic training-like samples from last-layer class templates (cat, dog, elephant), so sending weights is not a full privacy guarantee and differential privacy plus encryption enter.

6Voice Assistant Workflow: Central Collection versus On-Device Training

Siri-style FL reverses data movement: phones keep raw voice, train locally from a 0.42 initial weight, send updates such as plus 0.05, and the server mixes a version-2 model.

7Federated Averaging: Plain Mean versus Sample-Count Weights

Vanilla FedAvg gives each client equal votes; the useful mix weights each update by local sample count n_k so a one-sample client cannot overflow the global model.

8Cross-Silo Federated Learning for Hospitals

Hospitals keep mammograms on site, train locally, and mix updates with sample mass such as 10,000 times 0.6 equals 6,000 so tiny clinics cannot dominate.

9Challenges, Domain Adaptation, and Federated versus Central Distributed Training

FL exists because data is locked and streams such as self-driving terabytes cannot move; it is not IID cluster SGD, and related-domain transfer (Japanese signatures, Kannada from Telugu/Tamil) lands near 70 percent not 90 percent.

10Feature Completion from Overlapping Patients

Overlapped patients let silos learn column maps such as (1,2,3) to (2,4,6) and fill missing values (2,8 to 12); do not drop a row that is 80 percent present.

11FedAvg in Code: Update Size and Client Fractions

Each client reports the Euclidean L2 size of its weight delta and new tensors; the server mixes every layer, convolutional and dense, by client-size fractions n_k/N.

12Exam Guidance Summary

Study map: overlap vs quantization vs buckets; FL definition and pooled-data target; impressions plus DP; FedAvg plain vs n_k mix; challenges and feature filling; named follow-ons FedProx and SCAFFOLD.

13Key Industry Applications

Product map: Siri on-device voice, Raspberry Pi 8-bit edge, hospital mammography silos, self-driving terabyte logs, signature and Kannada script transfer, DP and secure aggregation, optional peer FL.

Postgraduate students in Distributed Machine Learning

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Overlapping SGD: Mixing Compute with Communication

Must-know: Overlap is a schedule that intermixes compute with send; it does not change communication volume.

⚠️ Top pitfall: Treating overlap as a new optimizer or claiming it reduces bytes on the wire.

Self-check: If compute is 8 ms and send is 5 ms, what are ordered time and full-overlap time?

Connects to: 9.2, 9.3

Quantized SGD: Shrinking the Numbers You Move

Must-know: Quantization encodes tensors; it does not replace sync SGD, async SGD, overlap, or FedAvg.

⚠️ Top pitfall: Calling quantized SGD a third optimizer beside sync and async, or treating 1-bit as the production default instead of 8-bit.

Self-check: A 400 MB FP32 payload becomes how many megabytes at INT8 and at the classroom 1-bit figure?

Connects to: 9.1, 9.3

Gradient Buckets: One Packet per Group of Gradients

Must-know: Buckets are a packing trick that enables overlap; they are not a new loss and they apply to one model with many layers.

⚠️ Top pitfall: Waiting to collect every layer before any send, or thinking buckets mix two different models.

Self-check: Why does filling a 500k-gradient bucket beat sending about a thousand tiny messages?

Connects to: 9.1, 9.2

Federated Learning: Train Locally, Share Updates

Must-know: FL success is matching a pooled-data model without pooling records; aggregation quality is first-class, with FedProx and SCAFFOLD as named follow-ons.

⚠️ Top pitfall: Treating the vanilla privacy story (I sent weights, not records) as a proof that updates carry no training patterns.

Self-check: State the four-step server-worker loop and the statistical target of w_FL.

Connects to: 9.5, 9.6, 9.7

Data Impressions: When Shared Weights Leak Training Patterns

Must-know: The FL principle fails if impressions reconstruct training-like data from parameters; DP, secure aggregation, and encryption are the named response.

⚠️ Top pitfall: Reading the paper as autoencoders or data augmentation, or claiming FL is safe because only numbers move.

Self-check: Why do last-layer weights for cat, dog, and elephant let an attacker sample proxy training images?

Connects to: 9.4, 9.6

Voice Assistant Workflow: Central Collection versus On-Device Training

Must-know: Federated learning sends the model to the phones; averaging updates and averaging local weights agree when every client starts from the same broadcast.

⚠️ Top pitfall: Claiming the attack is imaginary because only updates move, or storing central raw audio while calling the system federated.

Self-check: Start at 0.42, apply plus 0.05 on phone A, then average with two other signed updates of -0.01 and +0.02. What is version 2?

Connects to: 9.4, 9.5, 9.7

Federated Averaging: Plain Mean versus Sample-Count Weights

Must-know: Write whether you mean a plain mean or an n_k-weighted mean; n_k shrinks a one-sample client but does not fix a large biased silo or a liar.

⚠️ Top pitfall: Mixing plain-mean arithmetic with n_k-weighted arithmetic, or believing sample counts remove accent bias by themselves.

Self-check: Mix n_1=10, Delta_1=0.05 with n_2=90, Delta_2=0.01. What is the weighted global update?

Connects to: 9.6, 9.8, 9.11

Cross-Silo Federated Learning for Hospitals

Must-know: Cross-silo medical FL is the non-share setting; 10,000 local samples times 0.6 is the classroom weighted mass, and cardiology versus eye versus kidney is a harder feature-distribution split.

⚠️ Top pitfall: Pausing the impressions attack for the stats demo and then claiming medical gradients are empty of patient detail.

Self-check: Why does 10,000 times 0.6 beat a one-sample update of size 1.0 in a weighted sum?

Connects to: 9.6, 9.7, 9.9, 9.10

Challenges, Domain Adaptation, and Federated versus Central Distributed Training

Must-know: List FL challenges (non-IID, systems heterogeneity, communication, bias, join/leave) and contrast locked non-IID silos with a central IID pile.

⚠️ Top pitfall: Treating federated learning as ordinary distributed SGD with extra marketing, or expecting 90 percent after a domain hop.

Self-check: Name two reasons to federate besides privacy, and the classroom accuracy drop for related-script transfer.

Connects to: 9.4, 9.8, 9.10

Feature Completion from Overlapping Patients

Must-know: Besides privacy, FL can help bandwidth and overlap-based feature filling; 20 percent missing is not a reason to delete the patient.

⚠️ Top pitfall: Throwing out incomplete records, or treating the times-two toy as a unique algebraic law.

Self-check: Given overlap 2 maps to 8, what do you fill for 3, and why keep a row that is 80 percent complete?

Connects to: 9.8, 9.9

FedAvg in Code: Update Size and Client Fractions

Must-know: One round is local train, form delta and L2, send weights and n_k, then fraction-weighted per-layer sum; FedProx and SCAFFOLD swap this mixer.

⚠️ Top pitfall: Coding L2 as square root of W without summing squares, or mixing conv tensors with dense tensors as if they shared axes.

Self-check: For n=(10,30) and dense weights (2.0, 4.0), what is the fraction-weighted dense mix?

Connects to: 9.7, 9.8

Exam Guidance Summary

Must-know: Quantized SGD is representation, not a third optimizer; FL is not safe merely because numbers move.

⚠️ Top pitfall: Blurring overlap with quantization, or claiming updates are non-informative.

Self-check: List the three SGD communication variants and the named impressions defense stack.

Connects to: 9.1, 9.2, 9.3, 9.4, 9.5, 9.7, 9.11

Key Industry Applications

Must-know: Name at least one on-device, one hospital, one bandwidth, and one privacy-stack deployment from this lecture.

⚠️ Top pitfall: Describing centralized voice collection as federated, or calling 1-bit the default edge product path.

Self-check: How does the Apple voice loop differ from uploading call-mom audio, and what bit-width fits a Raspberry Pi story?

Connects to: 9.2, 9.6, 9.8, 9.9

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.