10 minute read

“We deleted the customer’s data from the database. The model still remembers it.”

TL;DR

A simple sampling attack recovered about 35% of the known memorized training data from GPT-Neo 6B. A divergence attack on ChatGPT produced generations in which 16.9% of 15,000 tested contained memorized PII. Fine-tuning on private data creates memorization risk for that data. Differential privacy gives a formal guarantee at an accuracy cost that depends on epsilon. Machine unlearning remains impractical at scale. The GDPR right to erasure doesn’t have a technical implementation for model weights. For how memorized data gets extracted through prompt injection, see Indirect prompt injection.


A RAM module with thermal imaging overlay showing warm active regions against cool inactive sectors

How does memorization actually work?

LLMs memorize training data through three mechanisms, ranging from exact reproduction to subtle pattern retention.

Verbatim memorization means the model generates an exact substring from its training set. Ask a model to complete a specific passage and it produces the next sentences word-for-word from the training corpus. Nicholas Carlini and colleagues demonstrated this against GPT-2 in their 2021 USENIX Security paper (Carlini et al.). They generated large numbers of samples, ranked them with membership-inference signals, and recovered hundreds of verbatim training sequences, including names, phone numbers, email addresses, code and 128-bit UUIDs, some of which appeared in only one training document. Larger models were more vulnerable than smaller ones.

Template extraction captures semantic patterns rather than exact strings. The model doesn’t reproduce text verbatim but generates content that follows the structure, key phrases, and distinctive patterns of memorized data. This is harder to detect through simple string matching but still leaks meaningful information about the training data.

Approximate extraction produces subtle reformulations that evade verbatim detection while revealing training content. Ippolito et al. (2022, with Carlini among the coauthors) showed that definitions of memorization focused on verbatim matching are too narrow: a filter that perfectly blocked verbatim reproduction still leaked training data through plausible, minimally modified “style-transfer” prompts.

Extraction scales with model size. Carlini et al. (2022) found that memorization grows log-linearly with model capacity, with the number of times an example is duplicated in the training data, and with the length of the prompt context. Larger models memorize more and leak more. This is a direct tension with the industry trend toward ever-larger models.


What does the data show about extraction risk?

The numbers are worse than most organizations assume, and recent research suggests they’re underestimates.

Finding Value Source
Known memorized data recovered by a simple sampling attack (GPT-Neo 6B) About 35% Nasr et al., 2023
ChatGPT generations containing memorized PII under a divergence attack 16.9% of 15,000 tested Nasr et al., 2023
Generations with apparent PII that contained real PII 85.8% Nasr et al., 2023
Underestimation of leakage by the standard Extraction Rate metric Up to 2.14x Tiwari and Suh, 2024
Sequences easier to extract with a shorter prefix or a smaller model 30.4% to 41.5% Tiwari and Suh, 2024

The inference-time versus training-time distinction matters. Much of the practical privacy exposure happens at inference time: users paste credentials, share personal information, and discuss sensitive topics, and that data flows into logs, retrieval stores and sometimes future training sets. Training data extraction is harder, but it gives the attacker data they never directly shared, which changes the threat model entirely.

Tiwari and Suh (December 2024) found that Extraction Rate, the predominant metric in earlier work, underestimates the leakage threat from randomized (sampled) decoding by as much as 2.14x. Looking at individual sequences also overturns averages: although larger models and longer prefixes extract more data on average, 30.4% to 41.5% of the sequences they studied were easier to extract with a shorter prefix or a smaller model.

Prompts can also amplify or suppress extraction. Using prompt-tuning (learned soft prompts) on GPT-Neo models, Ozdayi et al. (2023) raised the extraction rate of the 1.3B model by 9.3 percentage points with an attack prompt, and cut it by up to 97.7% relative to baseline with a defensive prompt, at the cost of a 16.9% increase in perplexity.


Does fine-tuning make this worse?

For the data you fine-tune on, yes. A model fine-tuned on private data can memorize and leak that data, and the method matters. Mireshghallah et al. (2022) found that fine-tuning only the model head was the most vulnerable to membership inference and extraction attacks, while fine-tuning small adapters was less vulnerable. Das et al. (2025) went further: in their measurements, LoRA (Low-Rank Adaptation) reduced privacy risk about as much as differentially private fine-tuning. One plausible reason is that LoRA restricts parameter updates to low-rank matrices, which limits how much the model can absorb about individual examples.

RLHF behaves differently from supervised fine-tuning. Pappu et al. (2024) found that RLHF significantly reduces the chance that data used for reward modeling and reinforcement learning is memorized, compared with fine-tuning directly on that data. But examples memorized during the supervised fine-tuning stage mostly stay memorized after RLHF, and IPO, a direct preference-learning method, increased regurgitation compared with RLHF.

If you’re fine-tuning with private or sensitive data, LoRA combined with differential privacy is a sensible default for the privacy-accuracy tradeoff.


What can differential privacy actually do?

Differential privacy (DP) provides a mathematical guarantee: the model’s outputs shouldn’t change significantly whether any single individual’s data is included in the training set or not. DP-SGD implements this by clipping gradients (limiting the influence of any single training example) and adding calibrated random noise.

The privacy-accuracy tradeoff is controlled by epsilon (ε):

  • ε ≤ 1: Strict privacy. Significant accuracy degradation. Appropriate for compliance-critical applications.
  • ε = 3 to 8: The settings most DP fine-tuning papers report (ε = 3 and ε = 8 are common benchmarks). Meaningful protection, with an accuracy cost that depends heavily on dataset size and model.
  • ε > 10: Weak formal guarantee.

The guarantee is a worst-case bound, and measured attack success usually falls well short of it, so setting epsilon unnecessarily small can cost accuracy without a matching gain against the attacks you actually face. Calibrate epsilon to your actual threat model rather than defaulting to the smallest possible value.

Google Research has published work on fine-tuning LLMs with user-level differential privacy (May 2025), which protects everything one user contributed rather than single examples, and found it practical and better than staying with the pre-trained model. Combining DP-SGD with a parameter-efficient method such as LoRA restricts both which parameters are updated and how much any single data point can influence those updates.


Can you actually delete data from a model?

Not in any practical sense. This is the core tension between privacy regulation and ML engineering.

Model weights are complex, distributed integrations of the entire training dataset. A person’s data doesn’t live in a specific location in the model that can be deleted. It’s diffused across billions of parameters, entangled with every other training example that influenced those same parameters. Even removing the original data and reprocessing doesn’t guarantee the learned patterns are gone.

The only fully effective approach is retraining from scratch on a dataset that excludes the target data. For a model that cost millions of dollars to train, this is prohibitively expensive and impractical for individual erasure requests.

Machine unlearning research is trying to solve this. Researchers at UC Riverside proposed certified unlearning without access to the source data (Basaran et al., 2025): it uses a surrogate dataset that approximates the statistics of the original training data, so a model owner can remove data without keeping the full training set. This is a promising direction but not yet scalable to production LLMs.

The GDPR right to erasure (Article 17) creates the legal obligation. The technical ability to comply at scale doesn’t exist yet. The European Data Protection Board’s December 2024 opinion on AI models (Opinion 28/2024) says a model trained on personal data counts as anonymous only if it is very unlikely that individuals can be identified or their data extracted through queries, to be assessed case by case. No technical standard for erasing data from model weights has emerged.

This creates a real compliance risk for organizations that fine-tune models on personal data. The data can be deleted from the fine-tuning dataset, but its influence remains in the model weights. Whether this satisfies Article 17 is legally untested at the time of writing.


Key takeaways

  • A simple sampling attack recovered about 35% of the known memorized training data from GPT-Neo 6B. Larger models memorize and leak more.
  • Under a divergence attack, 16.9% of 15,000 tested ChatGPT generations contained memorized PII
  • Fine-tuning on private data creates memorization risk for that data. LoRA leaks less than full fine-tuning, and RLHF data is less likely to be memorized than SFT data
  • Differential privacy at the commonly used epsilon values of 3 to 8 gives meaningful protection. Smaller epsilon costs accuracy that may not buy a matching gain against real attacks
  • Machine unlearning remains computationally impractical. Retraining from scratch is the only fully effective approach
  • GDPR Article 17 requires data erasure. Model weights don’t forget. The technical compliance gap is real and legally untested.
  • Standard extraction metrics underestimate true leakage by up to 2.14x

FAQ

How much training data can be extracted?

A simple sampling attack recovered about 35% of the known memorized data from GPT-Neo 6B. Under a divergence attack, 16.9% of 15,000 tested ChatGPT generations contained memorized PII, and 85.8% of generations with apparent PII contained real PII. The standard Extraction Rate metric can underestimate leakage by up to 2.14x.

Does fine-tuning make memorization worse?

For the fine-tuning data, yes. LoRA leaks less than full fine-tuning, and RLHF makes its training data less likely to be memorized than supervised fine-tuning on the same data. For sensitive data, combine LoRA with differential privacy.

What epsilon should I use for differential privacy?

Published DP fine-tuning work commonly uses 3 to 8. Below 1 degrades accuracy significantly, and the extra cost may not buy a matching gain against real attacks. Calibrate to your threat model, not the theoretical minimum.

Can you delete data from a deployed model?

Not practically. Model weights are distributed integrations of training data. Source-free unlearning is promising but not yet scalable. Complete retraining from scratch on a filtered dataset is the only fully effective approach.

How does GDPR apply to memorized training data?

Article 17 requires data erasure. Model weights don’t forget. The technical compliance gap is real and legally untested. Organizations fine-tuning on personal data face unresolved compliance risk.