Quantifying and Analyzing Entity-Level Memorization in Large Language Models

Zhenhong Zhou, Jiuyang Xiang, Chaomeng Chen, Sen Su

Abstract

Large Language Models (LLMs) pose a significant privacy risk by memorizing sensitive training data. While previous research focused on verbatim memorization—reproducing exact sequences—this study investigates "entity-level" memorization, where models store relationships between specific entities (e.g., names and email addresses). We propose Efficient Memorization Extraction (EME), an automated approach using soft prompts and attribute annotations to trigger these associations. Our results demonstrate that EME is up to three times more effective than handcrafted prompts and that the risk of data leakage scales significantly with model size.

Introduction

The phenomenon of LLMs leaking training data is well-documented, often exemplified by the "Grandma Exploit," where users manipulate chatbots into revealing sensitive information like software keys. However, quantifying this risk has been challenging. Traditional metrics focus on verbatim memorization, which requires an attacker to possess exact prefixes from the training set. This paper addresses the gap by defining entity-level memorization: the model's ability to associate fine-grained, sensitive entities (like PII) without needing the original training context.

Methodology: Efficient Memorization Extraction (EME)

The authors introduce two core innovations to quantify this risk:

  1. Entity-Level Memorization Definition: A metric assessing if a model can provide a missing entity (e.g., a phone number) when prompted with related identifiers (e.g., a name and company).
  2. Efficient Memorization Extraction (EME): An automated method that utilizes "Soft Prompts"—trainable continuous vectors—combined with structured attribute annotations (e.g., "Sender:", "Recipient:"). This technique "nudges" the model into a memorized state more effectively than natural language prompts.
The EME process (bottom) compared to traditional verbatim memorization (top), illustrating how entity extraction and attribute annotation activate memorized associations.

Experimental Framework

The study utilized "The Pile" dataset, specifically the Enron Email Dataset, due to its semi-structured nature. Evaluation was conducted on the GPT-Neo family, with OPT and Llama models serving as controls. Since OPT and Llama were not trained on Enron, they provided a baseline to ensure successful extractions were indeed results of memorization rather than logical inference.

The EME method proved significantly more potent than manual prompting. On the 6B parameter GPT-J model, EME achieved a three-fold increase in extraction success compared to handcrafted textual prompts. Furthermore, for entity pairs appearing frequently (over 200 times) in the training data, reconstruction accuracy reached 61.2%.

Entity extraction rates as a function of model size, showing that larger models are significantly more prone to entity-level leakage, especially when using the EME method.

Key Insights and Analysis

  • Association-Based Storage: LLMs store data as a web of connections. Knowing one entity (e.g., a workplace) drastically increases the likelihood of the model leaking associated private data (e.g., an email).
  • The "Short Prompt" Paradox: Counter-intuitively, shorter soft prompts (5–10 tokens) were more effective than longer ones. The authors hypothesize that short prompts allow the model to "reach back" into its internal weights more easily, whereas long prompts force focus on the prompt's internal logic.
  • Memorization vs. Reasoning: The failure of control models (OPT and Llama) to reconstruct Enron entities confirms that the target models were truly "remembering" specific data points rather than using general reasoning to fill in the blanks.

Conclusion

As LLMs grow in size, the risk of sensitive entity leakage increases. While this study focused on the GPT-Neo family and the Enron dataset, the implications for privacy are broad. Future research will focus on scaling these extraction strategies and developing robust mitigation techniques, such as differential privacy and improved data deduplication, to safeguard sensitive information in training sets.

Summary updated

BibTeX
@inproceedings{zhou2024quantifying,
  author = {Zhenhong Zhou and Jiuyang Xiang and Chaomeng Chen and Sen Su},
  title = {{Quantifying and Analyzing Entity-Level Memorization in Large Language Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i17.29948},
}
Figure