Lion Cipher Lab

Leak training data from gradients in federated learning — and defend it

Why it matters

Federated learning is sold on one promise: 'your data never leaves your device — we only share gradients.' Phone keyboards, hospital consortia, and bank fraud models all lean on it. This lab breaks that promise and then repairs it, which is exactly the arc a privacy engineer has to be able to reason about. The uncomfortable fact, established by Zhu, Liu & Han's 'Deep Leakage from Gradients' and sharpened by iDLG and Geiping et al.'s 'Inverting Gradients', is that a gradient is NOT an anonymous summary of your data — it is a deterministic function of the exact input that produced it, and for a…

What you'll learn

Steps in this lab

  1. Why a shared gradient is not anonymous
  2. Build a tiny federated setting: one model, one private image, one shared gradient
  3. Run the DLG attack: optimize noise until its gradient matches
  4. iDLG: recover the label for free, and measure the reconstruction
  5. Find the edge: leakage degrades as the batch grows
  6. Defend with the DP-SGD mechanism: clip, then add Gaussian noise
  7. Name the cost: the privacy/utility tradeoff, and where secure aggregation fits
  8. The judgment: 'we only share gradients' is not a privacy control

Open the full interactive lab →