Abstract
Large language models (LLMs) are susceptible to memorizing training data, raising concerns about the potential extraction of sensitive information at generation time. Discoverable extraction is the most common method for measuring this issue: split a training example into a prefix and suffix, then prompt the LLM with the prefix, and deem the example extractable if the LLM generates the matching suffix using greedy sampling. This definition yields a yes-or-no determination of whether extraction was successful with respect to a single query. Though efficient to compute, we show that this definition is unreliable because it does not account for non-determinism present in more realistic (non-greedy) sampling schemes, for which LLMs produce a range of outputs for the same prompt. We introduce probabilistic discoverable extraction, which, without additional cost, relaxes discoverable extraction by considering multiple queries to quantify the probability of extracting a target sequence. We evaluate our probabilistic measure across different models, sampling schemes, and training-data repetitions, and find that this measure provides more nuanced information about extraction risk compared to traditional discoverable extraction.
Introduction
Large Language Models (LLMs) are known to memorize snippets of their training data, posing significant risks for the accidental leakage of sensitive information, such as personally identifiable information (PII) or proprietary code. To quantify this risk, researchers typically rely on discoverable extraction. This method involves prompting a model with a prefix from the training set and checking if it can perfectly reproduce the corresponding suffix using "greedy sampling"—always selecting the single most likely next token.
However, this binary metric is fundamentally limited. In practice, users rarely rely solely on greedy sampling; they use stochastic methods like temperature or top-k sampling. Furthermore, an adversary might query a model multiple times. This paper argues that traditional benchmarks significantly underestimate the true risk of data extraction by ignoring these non-deterministic behaviors.
The Limitations of Greedy Sampling
The core issue with greedy sampling is what the authors term the "Rank-2 Trap." A model might assign a very high probability (e.g., 99%) to the correct token at almost every step. However, if at just one step the correct token is the second-most likely (e.g., 49% vs. 51%), greedy sampling will deviate and fail to extract the sequence.
As shown in the figure above, while the greedy suffix might mismatch the target after a single low-rank token, the target sequence often remains highly probable within the model's distribution. Consequently, greedy sampling acts as a floor for extraction risk, not a ceiling.
Probabilistic Discoverable Extraction
To address these flaws, the researchers introduce $(n, p)$-discoverable extraction. This framework defines extraction risk through two parameters:
- $n$: The number of independent queries an adversary makes.
- $p$: The probability that the target sequence is extracted at least once within those $n$ queries.
The "Zero-Overhead" Innovation: Measuring $(n, p)$-extraction does not actually require running $n$ separate queries. By performing a single forward pass on a target sequence to calculate its total probability ($p_z$), researchers can use a closed-form equation—$n \ge \frac{\log(1-p)}{\log(1-p_z)}$—to determine the query budget required to extract the data with a specific confidence level. This allows for a continuous, risk-based evaluation without increasing computational costs.
Experimental Results
The study evaluated various model families, including Pythia (up to 12B), GPT-Neo, Llama, and OPT, using training data from The Pile and Common Crawl. To ensure the metrics captured genuine memorization rather than general linguistic patterns, the researchers validated their findings against the TREC 2007 Spam dataset as "unseen" test data.
The results demonstrate a massive gap between traditional metrics and actual risk:
- Underestimation: For the Pythia 2.8B model, the greedy extraction rate was approximately 1.3%. However, the probabilistic measure revealed that with a sufficient query budget, the extraction rate could reach 9.04%—nearly a seven-fold increase in risk.
- Scaling and Repetition: The gap between greedy and probabilistic extraction grows as models increase in size. Furthermore, the probability of extraction spikes for data repeated multiple times in the training set (e.g., 11-50 repetitions), where the "Rank-2 Trap" becomes even more prevalent.
Conclusion
By moving from a binary "yes-or-no" determination to a probabilistic framework, this research highlights that LLM memorization is a far more pervasive issue than previously understood. The $(n, p)$-discoverable extraction framework provides a more accurate and nuanced tool for auditing model safety, revealing that even sequences that appear "safe" under greedy sampling may be easily extractable by a persistent adversary.
Summary updated