Cyberpediaby Brain
ENDEFR

Recovering an AI's training data

An attacker who queries an AI can guess whether a document was used to train it, or even bring out memorized excerpts.

In 30 seconds

Where it happens
On public AI models or models supplied by a provider, which people query through a chat interface or an online service.
What the attacker wants
To find out whether a specific piece of data was used for training, or to recover information the model has kept in memory, such as public personal information1.
The reflex
Do not enter sensitive data into a public AI tool, and ask your suppliers what they do with the data entered and how they train their models.
If it is already done
Tell the company's security team and check with the tool's publisher whether it is possible to refuse the use of your data for training4.

What it is

An AI model, such as the one behind a chat assistant, learns from a very large number of texts, images or records. An attacker can query it to find out whether a person or a document was in that data, or to make pieces the model has memorized reappear. The first case is called membership inference, the second inversion or extraction.

For an employee, what matters is what the company and the employee themselves enter into an AI tool, since that data can end up in the training model4. This page explains the principle, two dated real cases and the reflexes that limit exposure.

Straight answers

What is the difference between membership inference and extraction?

Membership inference answers a yes-or-no question. With a record in hand and "black box" access to the model, the attacker tries to determine whether that record was part of the training data3. Extraction goes further: the attacker recovers individual training examples by querying the model1. Inversion consists of reconstructing sensitive information or input data from what the model reveals4.

Why can a model "spit out" data?

The sources speak of memorization. Researchers define "extractable memorization" as training data that an adversary can efficiently extract by querying a model, without knowing the dataset in advance2. The attack on GPT-2 works even if each extracted sequence appears in only one document of the training data1.

Are large models safer?

No, according to the GPT-2 study: the authors find that larger models are more vulnerable than smaller ones1. The 2023 study adds that current alignment techniques do not eliminate memorization2.

Can a confidential document I pasted into an assistant come out for another user?

OWASP describes this risk: a user receives a response containing another user's personal data, because of insufficient data sanitization4. The organization recommends that applications prevent user data from entering the training model and that users be able to refuse to have their data included in it4. The sources cited here do not put a number on the likelihood of such a case.

1Inside the attacker's head1 min

The attacker does not need to break into the company's system. Access to the model is enough, and it is often public. For membership inference, the researchers Shokri and his co-authors train their own inference model, which learns to recognize the differences between the target's responses on data seen during training and on data it has never seen3.

For extraction, the adversary queries the model without knowing anything about the training dataset2. The adversary looks for sequences that come out word for word: in the GPT-2 study, hundreds of verbatim text sequences were extracted1.

The goal depends on the target. For a model trained on sensitive records, knowing that a person appears in them can already be information. The 2016 authors illustrate this with a dataset of hospital discharges, whose membership is sensitive from a privacy standpoint3.

2What you see on screen1 min

The sources cited here describe no visible sign for an employee. The attack consists of asking questions to an accessible model, and its queries can look ordinary. The trace shows up rather in a model response that contains a memorized excerpt.

The text below is a neutralized illustration, not a command to reproduce. It shows what a request looks like when it tries to pull personal data out of a model's memory.

Excerpt
Illustration: fictional exchange with an assistant, address in .invalid.
Question: [a repetitive or mundane request, paraphrased]
Model response: [a memorized excerpt: name, number, fictional email
  [email protected]]
3Under the hoodIT teams2 min

The mechanism rests on differences in a model's behavior between what it has learned and what it has never seen3. The attacker exploits these differences, either by measuring them (membership inference) or by provoking the output of memorized sequences (extraction).

The targeted models are of various kinds. The 2016 researchers tested "on demand" machine learning services from commercial providers such as Google and Amazon, and show that these models can be vulnerable3. The 2023 researchers extract gigabytes of data from open models such as Pythia, semi-open models such as LLaMA and closed models such as ChatGPT2.

NIST publishes a taxonomy of adversarial machine learning, whose keywords include "privacy breach"5. OWASP also cites the "Proof Pudding" attack (CVE-2019-20634): leaked training data made it easier to extract and invert the model there, which made it possible to bypass email filters4. It links these techniques to three entries in the MITRE ATLAS database: inferring membership in training data, inverting a model, extracting a model4.

On the defense side, OWASP recommends sanitizing data before training, restricting access according to the principle of least privilege, and using federated learning and differential privacy, which adds noise to the data or to the outputs4. It specifies that an instruction given to the model about the types of data not to return can be bypassed by prompt injection4. The UK NCSC reminds readers that AI systems are subject to new vulnerabilities, which add to the usual threats6.

4Case filesReal cases2 min

December 2020: data extraction from GPT-2

On 14 December 2020, Nicholas Carlini and eleven co-authors posted on arXiv a study showing that an adversary can recover individual training examples by querying a language model1. They attack GPT-2, trained on data collected from the public internet, and extract hundreds of verbatim text sequences from it1. Among them are public personal information (names, phone numbers, email addresses), IRC conversations, code and 128-bit UUIDs1. A revised version is dated 15 June 20211.

November 2023: data extraction from ChatGPT

On 28 November 2023, Milad Nasr, Nicholas Carlini and eight co-authors published a study on extracting training data from production models2. To attack ChatGPT, an aligned model, they develop a so-called "divergence" attack: it makes the model leave its conversational style and emit training data at a rate 150 times higher than during normal operation2. They conclude that practical attacks can recover much more data than was previously thought2. The OWASP page points to a press article on this case, titled "ChatGPT Spit Out Sensitive Data When Told to Repeat ‘Poem’ Forever"4.

For the employee, the reflex follows from these cases. OWASP classes personal data, financial information, health records, confidential company data, security credentials and legal documents as sensitive data: they are not entered into a public AI tool4. For tools bought by the company, written guarantees are requested from suppliers, because OWASP recommends clear policies on data retention, use and deletion4.

Fact sheet

Identifier
CP-291
Wing
4. Artificial intelligence
Brain skill
Protecting Data When Using AI (protect_data)
Brain reflex
air-008
Diagram
G1 · Attack vs Defense Chain
Languages
de, en, fr
Sources
6 sources checked on 3 November 2026
Sources6 sources
  1. arXiv, “Extracting Training Data from Large Language Models”, 14 December 2020. https://arxiv.org/abs/2012.07805 (accessed 3 November 2026)
  2. arXiv, “Scalable Extraction of Training Data from (Production) Language Models”, 28 November 2023. https://arxiv.org/abs/2311.17035 (accessed 3 November 2026)
  3. arXiv, “Membership Inference Attacks against Machine Learning Models”, 18 October 2016. https://arxiv.org/abs/1610.05820 (accessed 3 November 2026)
  4. OWASP, “LLM02:2025 Sensitive Information Disclosure”. https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/ (accessed 3 November 2026)
  5. NIST, “AI 100-2 E2023, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations”. https://csrc.nist.gov/pubs/ai/100/2/e2023/final (accessed 3 November 2026)
  6. NCSC (UK), “Principles for security of Machine learning ML”, 22 May 2024. https://www.ncsc.gov.uk/collection/machine-learning-principles (accessed 3 November 2026)

Cite this article

Brain, “Recovering an AI's training data”, Cyberpedia, 2026. https://startbrain.io/cyberpedia/en/articles/model-inversion-membership-inference/

BibTeX
@misc{brain_cp291_en_2026,
  author = {Brain},
  title = {Recovering an AI's training data},
  year = {2026},
  howpublished = {Cyberpedia},
  url = {https://startbrain.io/cyberpedia/en/articles/model-inversion-membership-inference/},
  note = {CC BY 4.0}
}