Be like a Goldfish, Don't Memorize! Mitigating Memorization in Generative LLMs

Abhimanyu Hans, Yuxin Wen, Neel Jain, John Kirchenbauer, Hamid Kazemi +6 more
2/3/2026

No official code found. Best implementation: ahans30/goldfish-loss (98 stars, Apache-2.0, last commit 2024-11-17).

Abstract

Large language models can memorize and repeat their training data, causing privacy and copyright risks. To mitigate memorization, we introduce a subtle modification to the next-token training objective that we call the goldfish loss. During training, randomly sampled subsets of tokens are excluded from the loss computation. These dropped tokens are not memorized by the model, which prevents verbatim reproduction of a complete chain of tokens from the training set. We run extensive experiments training billion-scale Llama-2 models, both pre-trained and trained from scratch, and demonstrate significant reductions in extractable memorization with little to no impact on downstream benchmarks.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

[NeurIPS 2024] Goldfish Loss: Mitigating Memorization in Generative LLMs

988Shell, PythonJun 17, 20241 years agoApache-2.0
deep-learningmemorizationtransformer

Similar Papers

Cite this paper

@article{hans2026like,
  title  = {Be like a Goldfish, Don't Memorize! Mitigating Memorization in Generative LLMs},
  author = {Abhimanyu Hans and Yuxin Wen and Neel Jain and John Kirchenbauer and Hamid Kazemi and Prajwal Singhania and Siddharth Singh and Gowthami Somepalli and Jonas Geiping and A. Bhatele and Tom Goldstein},
  year   = {2026},
  eprint = {2406.10209},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2406.10209},
  url    = {https://arxiv.org/abs/2406.10209},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2406.10209.svg)](https://codeofpaper.com/paper/2406.10209)

Discussion