Preventing Generation of Verbatim Memorization in Language Models Gives a False Sense of Privacy

Daphne Ippolito, Florian Tramèr, Milad Nasr, Chiyuan Zhang, Matthew Jagielski, Katherine Lee, Christopher A. Choquette-Choo, Nicholas Carlini

TL;DR

This paper argues that simply preventing language models from regurgitating exact training data verbatim (verbatim memorization) provides a false sense of privacy. The authors demonstrate that models can still leak sensitive information through paraphrased or "style-transferred" outputs, even when verbatim memorization is blocked. This highlights the need for broader definitions of memorization and more robust defenses.

What Problem Does This Paper Address?

Neural language models (LLMs) have a tendency to memorize parts of their training data. This memorization can lead to privacy risks (e.g., revealing personal information) and copyright issues. Many existing defenses focus on preventing "verbatim memorization," where a model's output is an exact copy of a training data substring. However, the authors contend that this definition is too narrow and that LLMs can still leak memorized information through subtle variations, such as paraphrasing or stylistic changes, which are not caught by verbatim filters. This leaves users with a false sense of security regarding data privacy.

Methods

The core technical contribution is MEMFREE decoding, an inference-time defense designed to prevent verbatim memorization. MEMFREE works by checking each generated n-gram against a Bloom filter containing n-grams from the training set. If a generated n-gram is found in the Bloom filter, that token is suppressed, and the model resamples. To make this efficient, they employ several optimizations:

  • n-gram checking: Only checking n-grams ending in the current predicted token.
  • Frequency-based filtering: Only storing n-grams that appear more than once in the training set, as duplicated content is more likely to be memorized.
  • Bloom filters: Using probabilistic data structures to efficiently query for n-grams, accepting a small chance of false positives (blocking non-memorized content) to guarantee no false negatives (never releasing memorized content).

They also introduce the concept of "style-transfer" prompting to demonstrate how verbatim defenses can be bypassed. This involves modifying prompts with techniques like adding comments, translating to another language, or changing capitalization, which can cause models to output memorized content in a new style.

Datasets

  • Training Data: The paper mentions using large datasets like "The Pile" (800GB) for training models.
  • Evaluation Data:
    • Substrings from The Pile dataset (30k strings of length 150 tokens).
  • Standard benchmark tasks for evaluating downstream performance: abstractive summarization (TIFU, Arxiv, Pubmed, BillSum), question answering (SQUAD2.0, WebQuestions, COQA), and GEM benchmark tasks (CommonGen, E2E clean, MLSum-de, MLSum-es, Schema-Guided Dialog, ToTTo, XSum, WebNLG-en, WebNLG-ru, WikiAuto + Turk/ASSET).
  • Specific datasets for style-transfer experiments: "Top 100 Speeches," two-minute monologues, Time Magazine's Top 100 All-Time Novels, and Billboard Year-End Hot 100 singles lists.

Key Insights and Ideas

  • Verbatim memorization is insufficient: Blocking exact copies of training data doesn't prevent models from leaking memorized information.
  • "Style-transfer" is a powerful evasion technique: Simple modifications to prompts can trick verbatim filters into allowing memorized content. This suggests models are capable of both understanding style and recalling memorized data.
  • Approximate memorization is widespread: The paper argues that existing literature has significantly underestimated memorization leakage by focusing solely on verbatim matches.
  • Defining memorization is hard: The paper highlights the difficulty in defining memorization, especially "approximate" memorization, due to its subjective and domain-dependent nature.

Key Results

  • MEMFREE effectively prevents verbatim memorization: The proposed MEMFREE decoding reduced verbatim memorization by over 3000x on GPT-Neo models, with only 4 remaining memorized outputs out of over 12,000.
  • Style-transfer bypasses Copilot: Prompts modified with Python-style comments or French translations caused GitHub's Copilot to emit memorized code, even when its "block suggestions matching public code" feature was enabled.
  • Approximate memorization is more prevalent than verbatim: Using a BLEU score threshold of 0.75, the paper found that significantly more examples were approximately memorized than exactly memorized in undefended generations.
  • Larger models exhibit more memorization: The study observed a trend where larger language models (GPT-3, PaLM) showed higher similarity to ground truth, indicating more memorization.
  • MEMFREE has minimal impact on utility: Experiments on downstream tasks showed that MEMFREE maintained high model utility, with only a small percentage of 10-grams in target sequences being affected by the bloom filter.

Limitations and Future Work

  • Defining approximate memorization: The paper acknowledges that their definition of approximate memorization (using BLEU score) is not perfect and may over- or under-count instances. They suggest this is an ongoing challenge.
  • Domain-dependency: The definition and detection of memorization can vary across different domains and languages.
  • Future work: The authors suggest exploring more nuanced definitions of memorization that capture paraphrased content, investigating the interplay between memorization and knowledge, and developing defenses that can anticipate and mitigate these more subtle forms of leakage. They also point to research in plagiarism detection as a potential source of inspiration for better approximate memorization metrics.

Summary updated

Abstract

Studying data memorization in neural language models helps us understand the risks (e.g., to privacy or copyright) associated with models regurgitating training data and aids in the development of countermeasures. Many prior works—and some recently deployed defenses—focus on “verbatim memorization”, defined as a model generation that exactly matches a substring from the training set. We argue that verbatim memorization definitions are too restrictive and fail to capture more subtle forms of memorization. Specifically, we design and implement an efficient defense that _perfectly_ prevents all verbatim memorization. And yet, we demonstrate that this “perfect” filter does not prevent the leakage of training data. Indeed, it is easily circumvented by plausible and minimally modified “style-transfer” prompts—and in some cases even the non-modified original prompts—to extract memorized information. We conclude by discussing potential alternative definitions and why defining memorization is a difficult yet crucial open question for neural language models.
BibTeX
@inproceedings{ippolito2023preventing,
  author = {Daphne Ippolito and Florian Tramèr and Milad Nasr and Chiyuan Zhang and Matthew Jagielski and Katherine Lee and Christopher A. Choquette-Choo and Nicholas Carlini},
  title = {{Preventing Generation of Verbatim Memorization in Language Models Gives a False Sense of Privacy}},
  booktitle = {INLG},
  year = {2023},
  doi = {10.18653/v1/2023.inlg-main.3},
}
Figure