Detecting Memorization in Large Language Models

Eduardo Slonski
12/2/2024
cs.LGcs.AIcs.CL

No official code found. Best implementation: robomotic/memorization-llm (0 stars, last commit 2025-04-03).

Abstract

Large language models (LLMs) have achieved impressive results in natural language processing but are prone to memorizing portions of their training data, which can compromise evaluation metrics, raise privacy concerns, and limit generalization. Traditional methods for detecting memorization rely on output probabilities or loss functions, often lacking precision due to confounding factors like common language patterns. In this paper, we introduce an analytical method that precisely detects memorization by examining neuron activations within the LLM. By identifying specific activation patterns that differentiate between memorized and not memorized tokens, we train classification probes that achieve near-perfect accuracy. The approach can also be applied to other mechanisms, such as repetition, as demonstrated in this study, highlighting its versatility. Intervening on these activations allows us to suppress memorization without degrading overall performance, enhancing evaluation integrity by ensuring metrics reflect genuine generalization. Additionally, our method supports large-scale labeling of tokens and sequences, crucial for next-generation AI models, improving training efficiency and results. Our findings contribute to model interpretability and offer practical tools for analyzing and controlling internal mechanisms in LLMs.

View on arXivView PDF

Code Implementations(1)

A tool for detecting memorization in Large Language Models

00PythonMar 26, 20251 years ago

Similar Papers

Cite this paper

@article{slonski2024detecting,
  title  = {Detecting Memorization in Large Language Models},
  author = {Eduardo Slonski},
  year   = {2024},
  eprint = {2412.01014},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2412.01014v1}
}

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/2412.01014.svg)](https://codeofpaper.com/paper/2412.01014)

Discussion