What is LLM "memorization," and why does it happen?
LLMs can reproduce verbatim training examples — including PII — because rare sequences seen across multiple training epochs get stored, and models have no forgetting mechanism.
* Membership inference: high-confidence/verbatim recall betrays a training record. *
* Why memorization happens, and how DP-SGD defends by limiting each record's gradient influence. *
LLMs memorize verbatim training examples. Research on GPT-2 (2020) extracted phone numbers, email addresses, URLs, and code snippets — even from a relatively small 1.5-billion-parameter model — just by prompting it. This discovery fundamentally changed how we think about LLM privacy.
Why memorization happens:
- Multiple training epochs see the same examples repeatedly.
- Rare/unique sequences are more likely to be memorized (they stand out).
- Larger models have greater memorization capacity.
- There's no built-in forgetting mechanism — once learned, it stays.
Real-world impact: leaked personal information, copyrighted content reproduced verbatim, API keys & secrets, and medical/financial/legal records.
Tip: Counterintuitively, the rare data (a unique SSN, an unusual address) is the most likely to be memorized and regurgitated — precisely the most sensitive data.
Go deeper:
Membership Inference Attacks (Shokri et al., arXiv) — the foundational attack showing models leak whether a record was in training.
Deep Learning with Differential Privacy (Abadi et al., arXiv — DP-SGD) — the standard defense against the memorization.