How Models Leak Data — The Attacks That Make Privacy Necessary

A trained model feels like a safe abstraction — it's just numbers, a learned function, surely it reveals nothing about the specific data it saw. That intuition is wrong, and a family of attacks proves it: models memorize their training data and can be made to give it up. Understanding these attacks is what turns privacy from a vague worry into a concrete threat you can defend against — and it's why the formal techniques in the rest of the series exist.

Post 1 claimed that securing the data isn’t enough because the model leaks. This post makes that concrete by walking the actual attacks. You defend against threats you understand, so before the defenses (differential privacy, federated learning), it’s worth seeing exactly how a model betrays its training data — and why “it’s just an aggregate” is false.

Memorization: the root of the problem

The foundation of every privacy attack is a single fact: models memorize their training data. A model with enough capacity doesn’t just learn general patterns — it also memorizes specific examples, especially rare or unusual ones and especially when a datapoint is seen many times. This is related to overfitting (ML series, post 5), but it happens even in well-generalizing models: large models in particular have been shown to memorize and regurgitate verbatim training examples.

This is most vivid in large language models, which have been demonstrated to emit verbatim chunks of their training data — someone’s leaked personal information, a copyrighted passage, a secret key committed to a public repo — when prompted the right way. The model didn’t “understand” it was private; it statistically memorized it and reproduced it. Memorization is not a bug you can fully eliminate without cost; it’s an inherent tendency of high-capacity models trained to fit data, and it’s the vulnerability every privacy attack exploits. If models didn’t memorize, privacy would be easy; because they do, it’s a discipline.

The attack family

Researchers have developed a progression of attacks, each extracting more from the model, and together they define the threat model that privacy-preserving ML defends against:

The crucial point is the access model: many of these attacks work with only black-box access — the ability to query the model and see outputs — not access to its internals. So deploying a model behind an API does not protect its training data; the API is exactly the attack surface. And the attacks get stronger with white-box access (the parameters), which is why sharing or open-sourcing a model trained on sensitive data is especially risky.

Why this changes everything

These attacks demolish the comfortable intuitions from post 1 and reshape how you must think about models trained on sensitive data:

This last point is the motivation for the rest of the series. Because memorization is inherent and the attacks work through normal access, ad-hoc defenses aren’t enough — you need differential privacy (posts 3–4), whose guarantee is precisely “the model is provably almost the same whether or not any individual was in the training data,” which is exactly the property that defeats membership inference and extraction at its root. The attacks define the threat; differential privacy is the principled answer. Seeing the attacks first is what makes the formal machinery feel necessary rather than academic.

The throughline: models memorize their training data — especially rare examples and in high-capacity models (LLMs demonstrably emit verbatim training data) — and that memorization is the root vulnerability behind a family of attacks: membership inference (detect whether a record was in training — serious even alone, e.g. “was this person in the disease dataset?”), model inversion (reconstruct features/faces or infer attributes), training-data extraction (pull verbatim examples back out), and model stealing. Critically, many work with only black-box query access, so putting a model behind an API doesn’t protect its training data — the API is the attack surface. This refutes post 1’s naive intuitions: the model is sensitive data, aggregation isn’t anonymization, and generalization helps but doesn’t guarantee privacy — which is exactly why you need formal techniques like differential privacy (posts 3–4), whose guarantee defeats these attacks at the root.

Key takeaways

Further reading

Sources & References