Subscribe
AI
7 min read

What Is a Membership Inference Attack? How Outsiders Prove a Model Read Your Data

A membership inference attack asks whether one specific record sits inside a model's training set. Ten years of research, from shadow models on Google's MLaaS to divergence prompts against ChatGPT, say the answer is often yes, and auditors still disagree about how confidently it can be proved.

What Is a Membership Inference Attack? How Outsiders Prove a Model Read Your Data

The question, stated precisely

A membership inference attack answers one narrow question: given a specific record and access to a trained model, was that record in the model's training set? It says nothing about whether the model is accurate, fair or safe. It asks whether the weights carry a trace of one row of data, and whether an outsider can read that trace back out.

The modern form of the attack comes from Reza Shokri, Marco Stronati, Congzheng Song and Vitaly Shmatikov in 2017. Their setup is deliberately weak on the attacker's side: black-box queries only, no model internals, no training data. They turned membership into a classification problem and trained a second model to tell "in" from "out" by looking at how the target model behaves on inputs it has seen versus inputs it has not. To label their own training data for that attack model, they invented shadow training: build many substitute models whose datasets you do control, learn the behavioural difference, then apply that learned rule to the target.

That paper was not a laboratory exercise. The authors ran the attacks against models built on commercial machine-learning-as-a-service platforms from Google and Amazon, and one of their datasets was hospital discharge records, where membership itself is the sensitive fact. The signal tracked overfitting almost exactly. A Google-trained model in their experiments scored 0.999 on its own training data and 0.656 on held-out data. Against that model, their attack reached a precision of 0.935 with recall of 0.994 on a consumer purchase dataset. The gap between train performance and test performance was the leak.

The attacks got cheaper, then the scoreboard changed

The 2017 result still assumed a lot: shadow models, a rough idea of the target architecture, data drawn from something like the same distribution. In 2019, Salem et al. published ML-Leaks, which dropped those assumptions one by one and still recovered membership across eight datasets, concluding the threat was broader and cheaper than first thought. The same paper proposed the first defences that kept model utility intact, including overregularisation and training with differential privacy.

Then Carlini and colleagues argued in 2021 that almost everyone had been measuring the wrong thing. Average accuracy, or AUC, describes how an attacker does on a pile of records. It says nothing about whether the attacker can confidently point at one named person's record and be right. The relevant metric is the true-positive rate at a very low false-positive rate, below 0.1 percent. Evaluated that way, most published attacks collapsed. Their replacement, the Likelihood Ratio Attack (LiRA), calibrated membership decisions against reference models and came out roughly ten times more powerful at those low false-positive rates.

That distinction matters for how to read any privacy audit of a model today. An attack that is right 70 percent of the time is a statistic. An attack that can name individual records with one false alarm in a thousand is evidence.

Two dot clusters separated by a dashed line with a magnifier over the boundary

Language models broke the neat story

Transformers do not overfit the way the 2017 attack assumed. The BAIR write-up of the GPT-2 extraction work put it plainly: large language models show almost no gap between train and test loss, so memorisation, if present, has to be a rare event. That reasoning sent a generation of membership inference results on language models toward noise.

It did not make the leak disappear; it moved it into the tail. In 2021, Carlini et al. showed an adversary querying GPT-2 could recover hundreds of verbatim training sequences, including names, phone numbers and email addresses, IRC conversations, code, and even 128-bit UUIDs, each of which had appeared in exactly one document in the corpus. Larger models were more vulnerable, not less. The conservative estimate in the accompanying Berkeley post was that at least 0.1 percent of GPT-2 generations contained long verbatim copies of a training document. One in a thousand sounds like nothing until you multiply it by the number of generations a frontier model serves in a day.

Two different attacks now live under the same roof. A membership test labels a string you already hold: was this in the training set? An extraction attack has no string to start with and instead coaxes the model into producing strings it memorised. The second is the one that reaches production chatbots.

Alignment did not remove the memory

In November 2023, Milad Nasr, Nicholas Carlini and eight co-authors published a method they called a divergence attack: prompts that push an aligned chatbot out of its assistant register and into raw recall. The most quoted example is absurd and effective, a request to repeat one word forever. Measured across open models such as Pythia and GPT-Neo, semi-open ones such as LLaMA and Falcon, and closed ones, they concluded an adversary could extract gigabytes of training data. On aligned ChatGPT, the divergence prompts emitted training data at a rate 150 times higher than normal behaviour, and in their strongest configuration more than five percent of the output was verbatim 50-token runs copied from the training set. The authors' own summary of the cost: several megabytes for roughly two hundred dollars of API queries, with a gigabyte plausible if you keep spending.

The disclosure trail is instructive. The team noticed the behaviour on 11 July 2023, understood what it meant on 31 July, gave OpenAI a draft on 30 August, and released the paper on 28 November after a standard 90-day window. Their conclusion was narrow and quotable: current alignment techniques do not eliminate memorisation.

A row of document cards with one card lifted out by a mechanical hook arm, leaving an empty slot

Can auditors even run this on a frontier model?

This is where the honest limits belong. A 2025 study, revised in January 2026, scaled LiRA to GPT-2 architectures from 10 million to one billion parameters, training reference models on more than 20 billion tokens of C4, three orders of magnitude more data than prior membership inference work. Four findings: strong membership inference can succeed on pretrained language models; in practical settings it stays weak, with AUC below 0.7; aggregate scores conceal per-sample instability, so many individual decisions are statistically indistinguishable from a coin flip; and membership inference success does not map cleanly onto other privacy metrics people report.

A 2026 follow-up in the Proceedings on Privacy Enhancing Technologies reached the same place from a different direction: at extreme low false-positive rates, which specific records get flagged changes from run to run. LiRA, in that reading, is a tool for ranking a model's exposure, not for naming a victim with confidence in one pass.

So a clean membership audit is not proof of a clean model. Weak aggregate leakage and a working extraction attack coexist comfortably, because they probe different parts of the distribution.

What the leak looks like when it is your number

In May 2026, MIT Technology Review reported a cluster of cases: a Reddit user flooded with calls from strangers looking for a lawyer, a designer and a locksmith after a chatbot surfaced his number; an Israeli software engineer who was messaged on WhatsApp because Gemini had listed his personal number as PayBox customer service; a University of Washington PhD student who got Gemini to produce a colleague's cell phone number. DeleteMe, a company that scrubs personal data from the internet, told the publication that queries referencing generative AI had risen 400 percent in seven months, with 55 percent naming ChatGPT, 20 percent Gemini and 15 percent Claude. Researchers quoted in the piece framed the harm as friction, not novelty: the details were often technically public somewhere, and generative AI lowers the effort required to reach them.

Those incidents are recall events, not formal membership tests. Both rest on the same physical fact, that record-level content survives in the weights and can be produced on demand.

What defenders actually have

Three levers, with different costs. Training with differential privacy, formalised by Abadi et al. in 2016, clips per-example gradients and adds calibrated noise, which buys an audit bound and spends accuracy. Data-side work, especially removing repetition, attacks the mechanism that makes sequences sticky, and the Berkeley authors' recommendation was blunt: better curation of training data rather than cleverer models. Output-side controls, restricting the prediction vector to top-k or flattening its precision, come from the 2017 paper itself and mostly raise the attacker's cost rather than closing the hole. Alignment is not on the list of working defences.

Four things to take away

One, read membership inference numbers at low false-positive rate or do not read them at all. Two, a near-chance result on a large language model is not evidence that nothing is memorised; it is evidence that per-record attribution is hard. Three, a memorisation rate of one in a thousand is a production-scale problem when the model generates at frontier scale. Four, the only reliable protection for a specific record is not being in the training set, which is why corpus provenance and takedown hygiene end up being privacy controls, not legal formalities.

Sources

AILLMeducational