Responsible AI
Memorization, Membership Inference, Model Inversion, and Extraction
Understand privacy attacks against models and outputs, including memorization, membership inference, inversion, attribute inference, and model extraction.
By the end you can
- Explain why trained models and interfaces can leak information through memorization, inference, inversion, extraction, or functional copying
- Distinguish De-identification, Privacy testing, and Formal privacy mechanism
- Identify evidence that connects membership inference to model extraction
- Design a review that moves from define the attacker to prepare response
Key idea
A regulator has already written down what a clean test proves
A successful attack test proves a vulnerability. A failed test does not prove privacy. That is not this lesson's opinion. It is a supervisory standard with a document number.
AI models trained on personal data cannot in all cases be considered anonymous. That is paragraph 34 of Opinion 28/2024, adopted by the European Data Protection Board on 17 December 2024 at the request of the Irish Data Protection Commission. Paragraph 55 tells supervisory authorities what to make of a clean test run: “SAs should take into account that successful testing which covers widely known, state-of-the-art attacks can only be evidence for the resistance to those attacks.”
The same Opinion lists the structured testing authorities should weigh: attribute and membership inference, exfiltration, regurgitation of training data, model inversion and reconstruction attacks. Attack coverage, auxiliary information, model updates and interface changes can each alter risk. Some leakage risk may remain even after filtering, access control and testing. High-sensitivity uses may require formal privacy guarantees, narrower access, or a decision not to train.
A clean result is scoped to the model, interface and auxiliary data of the day it ran; the next update puts the system outside that evidence.
The mechanism behind model privacy attacks, and the one part of it that has a measured price
Models can leak information through memorized outputs, differential behavior, learned representations, or query access. A model is not automatically anonymous merely because raw training records are not stored or returned. The threats have names: membership inference, attribute inference, model inversion, training-data extraction, and model extraction. Whether any of them succeeds depends on the model, data rarity, overfitting, access, auxiliary knowledge, defenses, and attacker resources. Every item on that list is something a team can test. None of them is something a team can assume.
One item has been measured rather than asserted. Duplicated training data drives regurgitation, and not in proportion to the duplication. The rate at which a language model regenerates a training sequence rises superlinearly with the number of copies in the training set. Kandpal and colleagues put a size on that in 2022: “For instance, a sequence that is present 10 times in the training data is on average generated ∼1000× more often than a sequence that is present only once.” Ten copies instead of one, and the model hands the sequence back about a thousand times as often.
The same paper reports something worse. Existing methods for detecting memorized sequences have near-chance accuracy on non-duplicated training sequences. So the duplication a pipeline failed to remove drives the leak. And the records that slipped through as singletons are the ones a memorization detector is least able to flag in advance.
Ten copies of a record instead of one, and the model gives it back about a thousand times as often — a failed deduplication pass is a privacy finding, not a housekeeping one.
Case
94% median membership accuracy in 2017, a face picked out of five in 2015
You can ask a trained model whether a particular person was in its training data, and be right most of the time. Shokri and colleagues named that attack in 2017: membership inference. They did not leave it as a possibility. They ran it against commercial services: “For multi-class classification models trained on 10,000-record retail transaction datasets using Google’s and Amazon’s services in default configurations, our membership inference achieves median accuracy of 94% and 74%, respectively.” Against Google-trained models the attack still reached 90% using purely synthetic shadow data. Against a model trained on the Texas hospital discharge dataset it exceeded 70%. Note what the attacker learns there. Not what a discharge record said — that a particular person's record was in it.
Two years earlier, confidence values had already been turned back into pictures. Fredrikson and colleagues ran a reconstruction attack against each of the 40 labels in the AT&T Face Database. Then they asked Amazon Mechanical Turk workers to match the reconstructed image to one of five faces: “Skilled humans (defined in Section 5) can correctly do so for the softmax classifier with close to 95% accuracy (average performance across all workers is above 80%).” That was 2015. The finding is a rebuilt face that strangers can put a name to, not a blur that resembles a person in general.
Case
604 memorized examples out of 1,800 candidates, queried out of GPT-2
The attack also works on a model anyone can download. Carlini and eleven co-authors took it to GPT-2 in 2021. They queried the model, collected candidate generations, then audited which of them were real training text: “In total across all strategies, we identify 604 unique memorized training examples from among the 1,800 possible candidates, for an aggregate true positive rate of 33.5% (our best variant has a true positive rate of 67%).”
What turns that from a curiosity into a privacy finding is the manual categorisation of the 604 samples. Of them, 46 were named individuals, counting non-news samples only. Another 32 contained contact info — physical addresses, email addresses, phone numbers, Twitter handles. The paper reports 78 examples in total of individual people's names, phone numbers, addresses and social media accounts. No access to a stored corpus was involved at any point. The model was queried, and people came out.
Position
Anonymity is a test result, not a property of storage
Over 10,000 unique verbatim-memorized training examples came out of a deployed, aligned, commercially operated chatbot for the price of a modest cloud bill. Nasr and nine co-authors reported it in November 2023: “Using only $200 USD worth of queries to ChatGPT (gpt-3.5-turbo), we are able to extract over 10,000 unique verbatim-memorized training examples.” Their divergence attack pushed the aligned model into emitting training data at a rate 150x higher than under normal chatbot behaviour.
That is what makes “the model does not contain personal data” a claim about storage offered in answer to a question about behaviour. The same gap runs through every result above it. 604 memorized examples audited out of GPT-2, 46 of them named individuals. Median membership inference accuracy of 94% against Google's service and 74% against Amazon's, on 10,000-record retail transaction datasets. Over 70% against a model trained on the Texas hospital discharge dataset. A reconstructed face that skilled Mechanical Turk workers matched to the right person out of five with close to 95% accuracy. None of those attackers read a database.
Removing identifiers from an evaluation set changes none of it.
The regulator has already ruled on where this leaves an anonymity claim. Paragraph 34 of Opinion 28/2024: models trained on personal data cannot in all cases be considered anonymous. Paragraph 55: successful testing which covers widely known, state-of-the-art attacks can only be evidence for resistance to those attacks. So a team asserting that a trained model is anonymous is asserting a test result. It can reasonably be asked which tests — memorization, membership, inversion, extraction — were run, against which attacker, with what auxiliary knowledge. Even then the claim stays narrow. A successful attack proves a vulnerability. A failed one proves only that this attack, under those assumptions, did not work. Nobody is obliged to run any of it. The alternative is asserting anonymity on the strength of not having looked.
A failed attack is evidence about the attack.
Visual
Five attacks, ordered by what the attacker wants
Five attacks, ordered by what the attacker wants. Whether a record was in the data: membership inference. What a sensitive attribute is: attribute inference. What the inputs looked like: model inversion, reconstructing representative or individual-level features from outputs. What the training text said: training-data extraction, eliciting memorized examples or rare sequences. What the model itself does: model extraction, approximating functionality through queries.
The last of the five is the one teams price wrongly, because it has been priced. In 2016 Tramèr and colleagues extracted 100%-equivalent copies of live ML-as-a-service models through the prediction API alone: “For both services, we show computationally fast attacks that use a small number of queries to extract models matching the targets on 100% of tested inputs.” An Amazon logistic regression on Digits took 650 queries and 70 seconds. Amazon on Adult took 1,485 queries. A BigML decision tree on German Credit took 1,150 queries and 631 seconds. A BigML decision tree on the Steak Survey took 4,013 queries and 2,088 seconds.
Training-data extraction and model extraction travel through the same query interface and want different things. A rate limit tuned to stop memorized text coming back is a result about memorized text. It says nothing about 650 queries in 70 seconds.
- 1
Membership inference
Estimate whether a person or record influenced training.
- 2
Attribute inference
Infer a sensitive attribute from other signals or model behavior.
- 3
Model inversion
Reconstruct representative or individual-level features from outputs.
- 4
Training-data extraction
Elicit memorized examples or rare sequences.
- 5
Model extraction
Approximate functionality or steal model behavior through queries.
Example
$200 of ordinary API queries, and over 10,000 memorized examples
The closest published thing to the scenario every model owner fears is not an anonymous incident report. It is a production system with a name. In November 2023, over 10,000 unique verbatim-memorized training examples came out of ChatGPT (gpt-3.5-turbo) for $200 USD worth of API queries. A divergence attack raised the model's rate of emitting training data 150x above normal chatbot behaviour. The target was aligned, deployed and commercially operated. The attacker had a paid API key and nothing else. Read the five conditions below as the anatomy of that class of failure. Each one has been measured somewhere in the work above.
- Rare sequence: Of the 604 memorized examples audited out of GPT-2's 1,800 candidate generations, 46 were named individuals and 32 contained contact info — physical addresses, email addresses, phone numbers, Twitter handles. 78 examples in all of individual people's names, phone numbers, addresses and social media accounts.
- Training exposure: Duplication has a measured cost. A sequence present 10 times in the training data is on average generated ∼1000× more often than one present only once. And detection methods run at near-chance accuracy on the non-duplicated sequences a pipeline leaves behind.
- Extraction interface: Adaptive querying is the whole attack surface. The ChatGPT divergence attack needed $200 USD of queries and no access to any stored record to return over 10,000 unique verbatim-memorized examples, at 150x the model's normal emission rate.
- False assumption: Paragraph 34 of EDPB Opinion 28/2024 concluded that AI models trained on personal data cannot in all cases be considered anonymous. Removing identifiers from an evaluation set answers a storage question that was never the one at issue.
- Response gap: The canary test is the one most teams have never run. The 2019 paper The Secret Sharer trained character-level models per Enron employee and found 10 pre-existing secrets heavily memorized — credit card and social security numbers: “Three secrets are extractable in < 1 hour; all are heavily memorized.”
Analogy
A sponge that can release traces under pressure
Sponges absorb a mixture, look dry, and release concentrated traces when squeezed a particular way. Ordinary use reveals nothing of what remains inside.
Squeeze a sponge and you get back what is in it. Query a model and what comes back depends on three things: how often the record appeared in training, what access the questioner has, and what they already knew. Ten copies rather than one raises the generation rate about a thousandfold. So the same model leaks different amounts to different people. To a user asking ordinary questions, nothing. To a divergence attack with $200 USD of API budget, over 10,000 unique verbatim-memorized examples.
A trained model should be tested as a potential information-bearing artifact.
Steps
How to test model privacy attacks before release
Testing starts with a named attacker and ends with a plan for the day a leak is confirmed. Define the attacker first — access, queries, auxiliary data, budget and objective — because every later result is scoped to that definition. Then prioritise the vulnerable data: rare, repeated, sensitive, identifying and high-consequence records. Then run the evaluations: memorization, membership, inversion and extraction. Then layer defenses: deduplicate, minimize, regularize, limit access, monitor, filter, and apply formal privacy where justified. Then prepare the response: deletion support, incident investigation, notification, retraining, and remedy for affected cases.
The third step is the one teams treat as vague, and it has a published shape. Plant a canary in the training data, then measure how hard it is to get back out. The 2019 paper The Secret Sharer inserted a single 9-digit canary once into the Penn Treebank corpus and recovered it with about 10^5 queries using shortest-path search. Brute force over the 10^9 candidates would have cost four orders of magnitude more. Carlini and colleagues turned that into an exposure metric a team can track across training runs. Pointed at real data rather than planted canaries, the same method found 10 pre-existing secrets heavily memorized in character-level models trained per Enron employee: “Three secrets are extractable in < 1 hour; all are heavily memorized.”
A canary inserted once and found is a memorization result you can report. A canary you never inserted is the reason a team has nothing to report.
1. Define the attacker
Specify access, queries, auxiliary data, budget, and objective.
2. Identify vulnerable data
Prioritize rare, repeated, sensitive, identifying, and high-consequence records.
3. Test the model
Run memorization, membership, inversion, and extraction evaluations.
4. Layer defenses
Deduplicate, minimize, regularize, limit access, monitor, filter, and apply formal privacy where justified.
5. Prepare response
Support deletion, incident investigation, notification, retraining, and affected-case remedy.
Comparison
De-identification, Privacy testing, or Formal privacy mechanism?
De-identification, privacy testing, and a formal mechanism answer three different questions. Only the third produces a bound rather than a result.
De-identification
Removes or transforms direct identifiers before training.
- Can reduce obvious disclosure
- Linkage and unique text may remain
- Does not guarantee model anonymity
- Needs reidentification and context analysis
Privacy testing
Actively probes model and interface for leakage.
- Uses attack-relevant evaluation
- Can find memorization and inference risk
- Coverage is never complete
- Needs realistic attacker assumptions
Formal privacy mechanism
Provides a mathematical or cryptographic guarantee.
- Can bound specified leakage under assumptions
- May reduce utility or add complexity
- Must account for composition and implementation
- Example: differential privacy
When evidence about model privacy attacks supports restriction or redesign
Model privacy attacks are evaluated against an assumed attacker. So those assumptions belong in the record beside the results: the access, the queries, the auxiliary data, the budget and the objective. Write them down before the tests rather than reconstruct them after. Paragraph 55 of Opinion 28/2024 is the reason. Testing against widely known, state-of-the-art attacks is evidence for resistance to those attacks, and to nothing else. A record that omits the attacker records a conclusion without its scope.
Decide, in advance, which leakage finding would make the owner redesign, restrict, remedy, or retire the model. A named individual recovered verbatim, as 46 were from GPT-2? A membership test that separates members from non-members at the rates the 2017 work reported? A functional copy taken in 650 queries? Naming the trigger before the result arrives is what keeps the answer from being written by whoever is least inconvenienced by it.
Key takeaways
- A trained model can retain and reveal personal information without storing a browsable copy of the dataset: 604 memorized examples were audited out of GPT-2's 1,800 candidate generations, 46 of them named individuals.
- Membership, attribute, inversion, extraction and model-stealing attacks have different objectives. A 2016 attack took a 100%-equivalent copy of an Amazon logistic regression in 650 queries and 70 seconds, without touching a training record.
- Risk depends on data rarity, repetition, overfitting, access and attacker knowledge: a sequence present 10 times in the training data is generated ∼1000× more often than one present only once.
- Failed attacks do not establish privacy, because coverage is incomplete. Paragraph 55 of EDPB Opinion 28/2024: successful testing which covers widely known, state-of-the-art attacks can only be evidence for the resistance to those attacks.
- De-identification reduces some risk but does not automatically make a model anonymous. Paragraph 34 of the same Opinion concluded that models trained on personal data cannot in all cases be considered anonymous.
- High-sensitivity training may require formal guarantees, narrow access or non-use: $200 USD of ordinary API queries pulled over 10,000 unique verbatim-memorized examples out of a deployed, aligned production model.