Training Data Memorisation and Extraction
Language models reproduce fragments of their training corpus verbatim, and an adversary with only API access can pull that data back out, which turns a training-set decision into a permanent disclosure risk.
Ask ChatGPT to repeat the word "poem" forever. In late 2023 the model would comply for a while, then diverge from its assistant persona and start emitting long stretches of text copied verbatim from its pretraining corpus: email signatures with real phone numbers, blocks of code, bitcoin addresses. The attack cost about $200 in API queries and recovered more than ten thousand unique memorised examples (Nasr et al., 2023, Scalable Extraction of Training Data from (Production) Language Models, arXiv:2311.17035).
That is not a bug in one product. Memorisation is a structural property of maximum-likelihood training on text, and the attack surface it creates is why privacy is an architectural concern rather than a policy footnote.
Two definitions that are constantly conflated
The literature separates two notions, and confusing them makes results incomparable.
Discoverable memorisation asks: if I already hold the training document and prompt the model with its true prefix, does the model complete the true suffix? This is the auditor's measurement. It requires access to the training set and gives an upper bound on what is stored.
Extractable memorisation asks: can an adversary who has never seen the training set construct some prompt that makes the model emit a training example? This is the attacker's measurement, and it is the one that governs disclosure risk.
Extractable memorisation is a strict subset of discoverable memorisation, and historically a small one, which is why early results looked reassuring. The divergence attack's contribution was showing that the gap can be closed cheaply: it raised the rate at which ChatGPT emitted training data by roughly 150x compared with ordinary prompting.
Memorisation scales, predictably
The clearest quantitative result is that memorisation is not random. It grows log-linearly in three variables at once (Carlini et al., 2022, Quantifying Memorization Across Neural Language Models, arXiv:2202.07646):
- Model capacity. Bigger models memorise more of the same corpus.
- Duplication count. A sequence appearing many times in the corpus is far more likely to be emitted than one appearing once. This is the mechanism that makes deduplication an effective, if partial, defence; see deduplication and memorisation.
- Context length. The more of the true prefix you supply, the more reliably the suffix follows.
The practical reading is uncomfortable. Every axis the field is scaling along is an axis along which memorisation increases. The original GPT-2 extraction work recovered on the order of 600 sequences (Carlini et al., 2020, Extracting Training Data from Large Language Models, arXiv:2012.07805); the 2023 follow-up recovered between several hundred thousand and several million unique 50-token sequences from open models such as Pythia and GPT-Neo.
Why alignment is not a defence
The divergence attack works because RLHF changes the policy a model follows, not the knowledge it holds. Assistant behaviour occupies a narrow region of the model's output distribution. Push the sampler outside that region with a degenerate prompt and the underlying base-model distribution, memorised spans included, reasserts itself.
This generalises. Any defence operating on the conversational surface, refusal training, system-prompt instructions, output style constraints, is defeated by any technique that moves generation off-distribution. Defences that operate on the weights or the data are different in kind. See machine unlearning for LLMs and differential privacy for language models.
When it breaks
Verbatim string matching under-counts. Most extraction studies detect memorisation by exact substring match against a reference corpus. A model that reproduces a document with one word changed scores as clean. Real disclosure risk includes approximate and paraphrased reproduction, which is much harder to measure and consequently much less measured.
"No detectable memorisation" is a statement about a test, not about a model. When a lab reports zero memorisation, ask which prefix lengths, which suffix lengths, which sampling temperature, and which corpus was searched. All of those are knobs.
Deduplication helps and does not solve. Removing duplicates flattens the duplication axis but leaves capacity and context untouched, and near-duplicates survive most exact-match dedup pipelines.
Output filtering is a leaky patch. Blocking generations that match a known corpus requires holding that corpus at inference time, is defeated by minor perturbation, and cannot protect data the filter operator does not have.
The only defence with a formal guarantee is differential privacy applied during training, and it costs real capability. Everything else is mitigation with an unquantified residual.
12 flashcards for this concept
Click a card to reveal the answer.