Lion Cipher Lab

Attack a model's privacy with a membership inference attack

Why it matters

The standard reassurance about machine learning is that a trained model is not a copy of its training data — it is 'just weights', 'just patterns', the data is 'gone'. In this lab you will personally disprove that. You will train a model on a set of records, then, using nothing but the answers it gives to ordinary queries, work out which records it was trained on — correctly about three times out of four, against a 50% coin flip. That capability has a name in the research literature, membership inference, and it matters because membership is often the secret. A model trained on the records of…

What you'll learn

Steps in this lab

  1. What you are about to do, in plain language
  2. Five words you need before you touch anything
  3. The ethics line — read this before you run anything
  4. Open a terminal and install Python
  5. Make a project folder and a virtual environment
  6. Install scikit-learn — one package, no GPU, no downloads later
  7. Build the victim: a model that memorises
  8. Run the attack — three ways to ask 'were you trained on this?'
  9. If it did not work: the four things that go wrong
  10. You cheated — now do it properly with a shadow model
  11. Interrogate individual records — the part that should bother you
  12. Why it works: overfitting IS the leak
  13. The defence: turn down the memorisation, and count the cost
  14. The trap in your own results: averages hide the worst case
  15. Beyond regularisation: differential privacy and what it actually buys
  16. Where this bites in the real world
  17. What you just did

Open the full interactive lab →