---
title: "Detecting Pretraining Data from Large Language Models (2023)"
description: "Detecting Pretraining Data from Large Language Models introduces WikiMIA and Min-k% Prob to test whether a passage appeared in training."
canonical: "https://research.elamur.ai/free/en/papers/shi-2023-detecting-pretraining-data-large-language/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/shi-2023-detecting-pretraining-data-large-language/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / Detecting Pretraining Data from Large Language Models

# Detecting Pretraining Data from Large Language Models

Paper · 2023 · Weijia Shi, Anirudh Ajith, Mengzhou Xia et al.

**Authors:** [Weijia Shi](https://md.research.elamur.ai/free/en/authors/weijia-shi/), [Anirudh Ajith](https://md.research.elamur.ai/free/en/authors/anirudh-ajith/), [Mengzhou Xia](https://md.research.elamur.ai/free/en/authors/mengzhou-xia/), [Yangsibo Huang](https://md.research.elamur.ai/free/en/authors/yangsibo-huang/), [Daogao Liu](https://md.research.elamur.ai/free/en/authors/daogao-liu/), [Terra Blevins](https://md.research.elamur.ai/free/en/authors/terra-blevins/), [Danqi Chen](https://md.research.elamur.ai/free/en/authors/danqi-chen/) and [Luke Zettlemoyer](https://md.research.elamur.ai/free/en/authors/luke-zettlemoyer/) · **Year:** 2023 · **Venue:** arXiv:2310.16789 · **Licence:** [CC BY 4.0 (arXiv)](http://creativecommons.org/licenses/by/4.0/)

[**13** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W4387985331) · [Cited by **214** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/shi-2023-detecting-pretraining-data-large-language/cited-by/) · [arXiv:2310.16789](https://openalex.org/S4306400194) · [licence](http://creativecommons.org/licenses/by/4.0/)

- [PDF](https://arxiv.org/pdf/2310.16789)
- [arXiv 2310.16789](https://arxiv.org/abs/2310.16789)
- [OpenAlex](https://openalex.org/W4387985331)

Citations: OpenAlex, 2026-10-14.

## Summary

A passage can sound familiar to a language model for several reasons. It may have appeared in training, or it may resemble many passages the system has learned to predict. When developers keep their training corpora private, an outside auditor has to distinguish those possibilities from the system’s behavior. The distinction matters when a training corpus may contain copyrighted books, personal information, or the very examples used to evaluate the system. The paper asks how much an auditor can learn about a specific passage by examining the probabilities assigned to its text. [Large language models](https://md.research.elamur.ai/free/en/concepts/large-language-models/)

The authors introduce WikiMIA, a benchmark built around the dates of Wikipedia events. They collect 394 entries about recent events using a cutoff of January 1, 2023, and randomly select 394 older entries from pre-2016 pages. An event that occurs after training supplies a strong basis for an unseen label. The older entries serve as likely members for systems trained on Wikipedia. An automated collection procedure allows the benchmark to move forward as new systems appear. Separate tests use original text and ChatGPT paraphrases, and results are reported by passage length.

Their detector, Min-k% Prob, focuses on the parts of a passage that the system finds hardest to predict. It takes the fraction of tokens assigned the lowest probabilities and averages their log probabilities. The authors expect unfamiliar passages to contain more severely surprising tokens, even when the rest of the passage reads predictably. Scoring needs access to token probabilities, with no additional training or separately trained reference system. On WikiMIA, Min-k% Prob reaches an average AUC of 0.72, a measure of how well the score separates likely members from nonmembers across decision thresholds. The paper reports a 7.4% improvement over perplexity, its strongest baseline. Detection also improves with longer passages and larger LLaMA variants in the comparisons the authors run.

The case studies show different uses for the score. In samples of copyrighted Books3 titles, it yields strong, indirect evidence of exposure in GPT-3, specifically text-davinci-003. In a controlled benchmark leakage experiment, examples are easier to detect when they occur more frequently or when training uses a higher learning rate. Adding more training data makes detection harder for examples drawn from the same distribution as the surrounding corpus, while the authors find the reverse for distinctive benchmark examples inserted into RedPajama text. In an audit of a LLaMA variant trained to forget Harry Potter, the score identifies passages and questions worth checking. Subsequent generation tests find story continuations that resemble the originals and answers that retain details from the books.

## Deep dive: Detecting Pretraining Data from Large Language Models

Detecting Pretraining Data from Large Language Models introduces WikiMIA and Min-k% Prob to test whether a passage appeared in training. · about 34 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Membership is a question about a particular passage

The paper starts from an information gap. Someone can hold a copy of the passage they want to investigate and have access to a system that scores text, while knowing little about the material used to train it. A person auditing a book wants to know whether passages from it entered training. A person auditing an evaluation wants to know whether a high score reflects performance on fresh examples or prior exposure to the test material. Those inquiries can start with the same observation, unusually confident predictions on a given piece of text, even though they have different reasons for asking it. [Language models & pretraining](https://md.research.elamur.ai/free/en/topics/language-models/)

A benchmark makes the consequences easy to see. Its test examples are supposed to reveal what a system can do when presented with material it has yet to learn from. If some of those examples enter pretraining, a correct answer can reflect knowledge of the item as well as skill at the task. The scope of the subsequent question matters. A researcher may want to know whether a dataset has leaked at all, which examples were affected, or how much exposure changed the reported task score. This paper concentrates on detecting individual examples. The test is whether a candidate looks like a training member, and the answer is an inference based on its score.

The privacy motivation comes from earlier observations that language systems can generate passages from copyrighted books or produce personal emails. Such behavior makes corpus provenance consequential even when users normally interact with a system through text prompts. A published training inventory could answer some questions directly. The authors describe a setting in which developers may give limited information about composition and sources, as in the discussion surrounding the releases of GPT-4 and Llama 2. In that setting, the external evidence comes from behavior on candidate material. [GPT-4 Technical Report](https://md.research.elamur.ai/free/en/papers/openai-2023-gpt-4-technical-report/) and [Llama 2](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-2-open-foundation-fine/)

The framework comes from membership inference. In this line of research, an investigator asks whether an example belonged to the data used to fit a system. The term *attack* reflects its use in privacy research, where identifying a member can reveal information that a developer intended to keep private. The same ability can serve an audit, where the aim is to assess what an interface reveals or whether a privacy measure has worked. The paper traces membership inference from earlier studies on tabular data and images to studies of language tasks, which had focused largely on the data used to adapt an already trained system. [Membership Inference Attacks against Machine Learning Models](https://md.research.elamur.ai/free/en/papers/shokri-2016-membership-inference-attacks-against-machine/)

#### What changes at pretraining scale

[Fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) adapts a pretrained system through further training. The paper emphasizes that some membership studies of fine-tuning deal with relatively small collections that the system sees over multiple passes. Pretraining changes the balance. The corpus is far larger, and a particular example may receive only a single exposure. The influence of that example can then be slight compared with the influence of related material. Even if training raises confidence on things the system has seen, the auditor still has to detect the effect of having seen the particular passage under investigation.

Prior research approached this problem by accounting for how intrinsically easy a piece of text is to predict. A standardized phrase can receive high probability under many systems because its words typically occur together. A straightforward score based on the target’s confidence can treat that predictable phrase as evidence of membership. A reference system offers a comparison. If both systems find the passage easy, the target’s confidence is less distinctive. If the target assigns it substantially greater probability, the contrast can be more informative. In the earlier approaches the paper discusses, this comparison frequently uses a similar architecture trained on samples from the same underlying distribution.

There are two obstacles to recreating that comparison for a large pretrained system. The auditor would need enough information about the target’s training distribution to obtain suitable data. The auditor would also have to train a reference system at a scale that makes the comparison meaningful. The first requirement runs into the problem the audit was intended to address. The second brings a computational cost even if the necessary data are available. The paper therefore treats the unknown training distribution as part of the problem definition and seeks a score that can be computed directly from the target’s response.

There is also a reason to expect detection difficulty to vary with training conditions. The authors draw on research about training stability, which concerns how much a training procedure changes when a particular example changes. If including an example makes little difference to the resulting predictions, a detector has little information to work with. The paper discusses an upper bound on the separation between output distributions and uses that argument to motivate studying corpus size, exposure frequency, and learning rate. It is a motivation for controlled comparisons because the same increase in corpus size can also change how distinctive the example is among its neighbors.

#### What earlier contamination checks could observe

An investigator who can inspect the training corpus can look for textual overlap with a benchmark. The studies described in the paper use several definitions of overlap. Some look for a matching 13-gram, where an [n-gram](https://md.research.elamur.ai/free/en/concepts/n-gram/) is a contiguous sequence of items in text. The PaLM study uses a criterion based on whether 70% of an example’s 8-grams occur in the training data. The Llama 2 study applies an overlap rule to tokenized inputs and considers a token contaminated when it lies within a matching sequence longer than 10 tokens. These definitions identify different units of contamination, from individual tokens to whole examples, using a direct comparison with training text. [PaLM](https://md.research.elamur.ai/free/en/papers/chowdhery-2022-palm-scaling-language-modeling-pathways/) and [Llama 2](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-2-open-foundation-fine/)

When the training corpus is unavailable, earlier work cited by the authors uses prompting to probe what can be recovered. Asking for examples from a named dataset and split can sometimes elicit original benchmark items. Supplying part of an instance can help produce more of it. Related work also recovers memorized snippets of Wikipedia through prompts. Such a successful generation provides evidence on its own terms. The user observes a particular string produced under particular conditions. In the paper’s account, these techniques offer no general membership decision for arbitrary individual items. A passage that fails to appear in a response could still have been present during training.

The authors also cite a proposal for developers to release tools that let users test membership in the training data. Such a tool would make an external audit a different exercise because the developer could answer through a record of what entered the corpus. The paper addresses the circumstances in which that record is unavailable, some candidate passages are already known, and the probabilities assigned to those passages can be obtained. These constraints give the paper its two design problems. It needs a score that requires little access, and it needs a benchmark on which the score can be checked against credible membership labels.

### The method, step by step

#### Read the passage as a series of predictions

Consider a passage that describes a particular event. The system scores the text from left to right. At each position, it provides a probability for the token that actually appears after the preceding text. A token is a unit produced by the system’s [tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/), so what looks like a single word to a reader may occupy several positions. The score at any given position concerns the observed token in its particular prefix. The same token can be highly probable in one sentence and surprising in another.

A long stretch of the passage may be predictable simply because it follows ordinary patterns. Its more distinctive details can still force the system to assign low probability to some observed tokens. Min-k% Prob asks whether those particularly hard predictions look different for previously seen passages. The method keeps the low-probability tail, converts those probabilities to log probabilities, and takes their average. Among texts that receive similar scores on an average across all positions, one can have much more severe surprises concentrated in its tail.

The method ranks positions by probability. It retains the same percentage for each passage, so the number of retained positions depends on passage length. It then averages the selected log probabilities. A larger score means the retained positions were less surprising and gives stronger evidence for membership under the authors’ hypothesis. A smaller score means the system assigned lower probabilities in that tail. In an audit that calls for yes-or-no predictions, an investigator can compare the score with a threshold. In a benchmark evaluation, the raw scores can be compared across possible thresholds.

How Min-k% Prob scores a candidate passage The steps in order.

The selected tokens can be scattered across the passage. They form a set of positions that scored poorly, instead of a span that must be read as a phrase. Their frequencies in a dictionary or another corpus play no role in the calculation. A token qualifies because the target assigned it a small probability in this instance. That distinction matters when a familiar word appears in an unfamiliar context or a distinctive name is easy to predict because the prefix already identifies it.

#### Write down the inputs and the decision

The target has an unknown collection of pretraining examples drawn from an underlying population of text. The paper writes that collection as follows.

```
𝒟 = {zᵢ}ᵢ∈[n]
```

Here, 𝒟 is the pretraining collection, zᵢ is the example at index i, and [n] denotes the range of indices for its n examples. The paper uses 𝔻 for the underlying distribution from which the examples are drawn. The detector lacks access to 𝔻 and the observed collection 𝒟. It can still score an arbitrary candidate x. Membership concerns whether x was included in the observed collection.

```
h(x, fθ) → {0, 1}
```

Here, h is the detector, x is the candidate passage, and fθ is the target language model with parameters θ. The arrow denotes a prediction in the set on its right. The value 0 denotes a predicted nonmember and 1 a predicted member. The target is a black box in the paper’s setup. That means the detector can obtain the token probabilities needed to score x while leaving the parameters and the training corpus unobserved.

The authors give the corresponding form for a prior approach that has a reference system.

```
h(x, fθ, gγ) → {0, 1}
```

The symbols x, fθ, θ and h have the same roles as before. The additional input gγ is a reference system with parameters γ. The values on the right again denote predicted nonmembership and membership. In the stronger reference-based setup discussed by the authors, the reference is trained on shadow data, a separate collection intended to represent the distribution 𝔻. Its predictions supply a measure of background difficulty against which to compare the target’s predictions.

The detection challenge can be expressed by considering a member z from the training collection and a nonmember y from the same underlying distribution. Their respective outputs are fθ(z) and fθ(y). The authors refer to total variation distance, a way to quantify how far apart probability distributions are, when discussing how much information separates the two cases. The stability argument cited in the paper concerns a bound that grows with example frequency and learning rate and shrinks as dataset size increases. This motivates the choice of training variables for the experiments. The detector’s score itself uses token probabilities without evaluating that bound.

#### Average log probabilities in the lower tail

The candidate sequence can be written as x₁ through xₙ, with the paper using N for the length of the sequence to distinguish it from the number of training examples. The quantity calculated for a token at position i is the conditional log probability below.

```
ℓᵢ = log p(xᵢ | x₁, …, xᵢ₋₁)
```

Here, ℓᵢ is the log probability at position i. The symbol p denotes the probability assigned by the target. The token at that position is xᵢ, and the vertical bar means its probability is conditional on the tokens preceding it. The ellipsis continues the prefix from x₁ to xᵢ₋₁, where the subscript i−1 indicates the preceding position. The logarithm, written log, preserves the ordering by probability and gives especially improbable observations strongly negative scores. The authors refer to those observations either as low-probability tokens or as tokens with high negative log-likelihood.

```
S(x) = (1 ÷ E) ∑ᵢ∈M(x) log p(xᵢ | x₁, …, xᵢ₋₁)
```

Here, S(x) denotes the Min-k% Prob score for passage x. The set M(x) contains the positions of its lowest-probability k% of tokens, where k is the percentage chosen for the detector. E is the number of selected positions. The summation symbol ∑ adds the terms for positions i that belong to M(x), indicated by ∈. The term added at each position is the conditional log probability defined above. Multiplication by 1 divided by E gives an average over the selected positions. The score therefore depends on the severity of the low probabilities within a tail of fixed relative size.

The log matters when interpreting the computation. The rule averages the logarithms of the selected probabilities. It also uses probabilities under the observed prefixes, so there is no need to generate a continuation to find out which tokens would be produced. The score asks how confidently the target could assign probability to what was actually written. Generation enters separately when the authors want evidence about the content a system can produce after unlearning.

The tuning procedure varies the fraction of tokens used for that average. The authors try k values of 10, 20, 30, 40, and 50 on a held-out validation set, using a target they identify as LLAMA-60B in their implementation description. The best validation result occurs at k = 20, which they carry into the remaining experiments. This choice is distinct from a classification threshold. The fraction controls what goes into each score, whereas the threshold controls how high a finished score must be to count as a member prediction. The main ranking metric can be computed without committing to a single cutoff. The book audit sets a cutoff separately because it needs to count passages classified as likely members.

#### Build the evaluation data around time

WikiMIA pairs stretches of text associated with old and new events. To collect recent examples, the authors query the Wikipedia API for pages in the event category and filter on creation date, using January 1, 2023 as the cutoff. Event timing has a role beyond page timing. A newly created article about a longstanding subject may contain descriptions that circulated well before the article appeared. A newly occurring event offers a stronger historical constraint on whether an account of that event could have been in an earlier training corpus.

For the positive class, the authors start from old event pages. Their collection description refers to pages created before 2017 as candidates and identifies the final sample as coming from pre-2016 pages. The reasoning is that Wikipedia dumps are a known training source for several target families released later. They remove list-like pages and timelines with little usable prose. The resulting benchmark has 394 recent events on the negative side and 394 randomly selected old events on the positive side. The two classes are equal in size by construction, with different evidence behind their membership labels.

The process is designed to be repeated. The API-based collection step can find later event pages for a future cutoff. This matters because a passage’s label as historically unavailable depends on when the target was trained. An event that followed the training of one release can precede the training of another. WikiMIA’s dynamic design is a way to preserve the temporal condition by refreshing the examples.

The paper evaluates the original Wikipedia wording and a rewritten version of the material. It uses ChatGPT to produce the rewrites. The paraphrase keeps the original example’s class for evaluation because the authors want to test whether the detector can pick up familiarity with the underlying content after the wording shifts. In the paraphrase setting, the label refers to the source material’s presumed membership. This is a different question from whether the exact rewritten string occurred in training. The authors also truncate the event text into length settings of 32, 64, 128, and 256 so that methods can be compared among passages of the same length. Each setting gives a view of what the score can recover from a different amount of text.

### Experiments and results

#### How to read the WikiMIA comparison

The WikiMIA experiments cover targets from the LLaMA, GPT-NeoX, OPT, and Pythia families. A scored example gets more or less evidence for membership, and a threshold turns that evidence into a decision. Among positives, the true positive rate is the share correctly called members. Among negatives, the false positive rate is the share incorrectly called members. Lowering the threshold for a positive call tends to include more of both groups. The receiver operating characteristic curve, or ROC curve, traces the resulting tradeoff. [LLaMA](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-open-efficient-foundation-language/), [GPT-NeoX-20B](https://md.research.elamur.ai/free/en/papers/black-2022-gpt-neox-20b-open-source/), and [OPT](https://md.research.elamur.ai/free/en/papers/zhang-2022-opt-open-pre-trained-transformer/)

The area under that curve, AUC, summarizes the separation across thresholds. It gives a comparison of the quality of the rankings before choosing how to weigh misses against false alarms. The paper also reports TPR@5%FPR, the share of members detected at an operating point where 5% of nonmembers are called members. That second metric represents a more specific audit goal. An investigation that plans to examine only confidently flagged examples may care most about how much material can be recovered while keeping false positives low. The same AUC can be compatible with different behavior in that part of the curve.

The simplest baseline is the loss attack, reported as PPL for perplexity. Perplexity summarizes how hard it is for the target to predict the entire text. Low perplexity suggests potential membership, since the target finds the example comparatively easy. Min-k% Prob shares that general intuition with PPL and changes the part of the passage that contributes to the score. It omits the higher-probability positions, giving the hardest portion of the text greater influence in the decision.

The neighborhood baseline asks how the target scores a text relative to nearby variants. The contrast is intended to reveal whether the original lies in a particularly favorable region of the target’s probability surface. The authors identify this probability-curvature procedure with the one used by DetectGPT. In the initial application discussed there, the classification task instead separates texts into machine-authored and human-authored categories. Here the same kind of local comparison supplies evidence for membership. [DetectGPT](https://md.research.elamur.ai/free/en/papers/mitchell-2023-detectgpt-zero-shot-machine-generated/)

Other baselines use zlib compressibility, the score of a lower-cased version of the passage, or the perplexity assigned by a smaller reference system. Compressibility gives a way to compare the target’s confidence with the ease of representing the text through ordinary compression. The lower-case comparison examines the relationship between the original and a simple change in surface form. The reference comparison asks whether the target’s confidence is distinctive relative to a smaller system pretrained on the same data. These comparisons come from earlier work on extraction. [Extracting Training Data from Large Language Models](https://md.research.elamur.ai/free/en/papers/carlini-2020-extracting-training-data-large-language/)

For the reference baseline, LLaMA-7B accompanies LLaMA-65B and LLaMA-30B. GPT-Neo-125M serves as the reference for GPT-NeoX-20B. The authors pair OPT-350M with OPT-66B and Pythia-70M with Pythia-2.8B. These pairings are part of the experiment’s comparison, distinct from the expensive hypothetical setup in which the auditor would train a closely matched shadow system. In this comparison, the smaller reference systems were already available for the corresponding target families.

Min-k% Prob reaches an average WikiMIA AUC of 0.72. The paper reports this as a 7.4% improvement over PPL, the strongest baseline. The reported comparison favors Min-k% Prob across diverse targets in the original and paraphrase settings. The appendix reports a similar pattern for TPR@5%FPR. Among the baselines themselves, perplexity does better than the methods that add compression, altered wording, neighborhood comparisons, or a smaller reference. That ordering is important to interpreting the experiment. The strongest alternative is the full-passage score, so the improvement provides a direct comparison between using all positions and concentrating on the most surprising ones.

#### An audit of passages from copyrighted books

The Books3 study separates calibration from application. To calibrate the score, the authors use 50 books that earlier work identified as memorized by ChatGPT. These are proxy positives. The negative books are 50 titles with first editions in 2023, chosen because the authors regard them as too recent to have entered the relevant training data. They draw 100 random snippets of 512 words from each book, producing a balanced validation set of 10,000 examples. On that validation set, Min-k% Prob achieves an AUC of 0.88 and outperforms the baselines. The authors set the membership cutoff at the score that maximizes classification accuracy on the same validation set.

For the separate test, the authors draw 100 copyrighted books from Books3, a subset of The Pile. They sample 100 excerpts of 512 words per book, for a test collection of 10,000 excerpts. GPT-3, specifically text-davinci-003, supplies the scores. Applying the validation cutoff yields an estimated contamination rate for each book, defined as the percentage of sampled passages flagged as members. The authors report that almost 90% of the sampled books have a predicted contamination rate above 50%. They also present the top 20 books ranked by their predicted rates. [The Pile](https://md.research.elamur.ai/free/en/papers/gao-2021-pile-800gb-dataset-diverse-text/)

The validation AUC and the test rates answer different questions. The AUC measures separation between the validation groups as the cutoff varies. The rates measure how often excerpts from a particular test book pass the chosen cutoff. The study treats the prevalence and concentration of positive scores as strong evidence that GPT-3 was exposed to the text of copyrighted books represented in Books3. A score obtained on the same passage wherever it is reproduced cannot identify which copy, collection, or source delivered it to training.

#### Benchmark leakage with known insertions

The downstream contamination experiment gives the investigators direct control over the added data. They take background text from RedPajama and insert formatted examples from BoolQ, IMDB, TruthfulQA, and CommonsenseQA. The insertions occur in contiguous segments placed at random points in the background text. From each benchmark, 200 examples enter the constructed corpus and 200 are held aside. AUC is evaluated for each task on the resulting 400 candidate examples. [BoolQ](https://md.research.elamur.ai/free/en/papers/clark-2019-boolq-exploring-surprising-difficulty-natural/), [IMDB](https://md.research.elamur.ai/free/en/papers/maas-2011-learning-word-vectors-sentiment-analysis/), [TruthfulQA](https://md.research.elamur.ai/free/en/papers/lin-2022-truthfulqa-measuring-how-models-mimic/), and [CommonsenseQA](https://md.research.elamur.ai/free/en/papers/talmor-2019-commonsenseqa-question-answering-challenge-targeting/)

The constructed corpus for the main comparison contains 27 million tokens. The paper reports that 0.1% of them come from the downstream tasks. The authors continue training LLaMA 7B for one epoch on this corpus at a constant learning rate of 1e-4. An epoch is a pass through the training collection, and the learning rate sets the scale of the parameter updates. The starting point is an already pretrained system. The resulting labels describe insertion or exclusion during the controlled continuation, which is the part of training the researchers can inspect.

Min-k% Prob outperforms the baselines on the main downstream AUC comparison. In the appendix comparison using TPR@5%FPR, the authors report a 12.2% improvement over the best baseline. This result concerns finding deliberately inserted items at a low false positive rate in the controlled experiment. The labels let the investigators assess the detector’s capacity to recover examples from a known intervention. They also let the authors vary how that intervention is done, which makes the experiment a basis for the ablations.

#### What remains after unlearning Harry Potter

Machine unlearning is an attempt to remove the influence or accessibility of selected training material after a system has learned from it. The intervention audited in this paper uses further fine-tuning with alternative labels for certain tokens and produces LLaMA2-7B-WhoIsHarryPotter from LLaMA2-7B-chat. The authors compare the original and modified systems to find inputs whose Min-k% Prob scores remain close under a ratio criterion. A similar score nominates an input for further inspection. The subsequent tests ask whether the modified system still produces material associated with the books.

For story completion, the authors divide books 1 to 4 into chunks of 512 words, yielding approximately 1000 chunks. They compute Min-k% Prob for each chunk with the original and modified systems. The interval they use to screen the score ratios is shown below.

```
r ∈ (1 ÷ 1.15, 1.15)
```

Here, r is the ratio of the two Min-k% Prob scores on the same input, one from each system. The symbol ∈ means that r falls in the specified interval. Its lower endpoint is 1 divided by 1.15 and its upper endpoint is 1.15. The parentheses make the interval open. The endpoints are reciprocal, so reversing which score goes in the numerator preserves the selection criterion whenever the ratio is defined.

The rule selects 188 chunks. Perplexity alone identifies no chunks under the comparison reported by the authors. For each selected chunk, they supply the opening 200 words as the prompt and draw 20 continuations with multinomial sampling, which allows tokens to be sampled according to their predicted probabilities. They compare what the modified system generates with the original continuation. SimCSE supplies a text similarity score on a scale from 0 to 1. GPT-4 evaluates similarity on a scale from 1 to 5 and gives a reason for its rating. [SimCSE](https://md.research.elamur.ai/free/en/papers/gao-2021-simcse-simple-contrastive-learning-sentence/)

Of the generated continuations from selected chunks, 5.3% reach a similarity rating of at least 4 under the GPT-4 evaluation. The paper separately reports 10 chunks with a rating of at least 4. Those figures use different units. A chunk is a source passage for prompting, while a generated continuation is one sampled response. The authors show examples in which the continuations follow the original story closely, with SimCSE scores above 0.7 for the examples they present. The evidence concerns similarity to the storyline and the wording under the stated comparison procedures.

In the [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/) experiment, GPT-4 generates 1000 questions about Harry Potter with reference answers. Screening the questions by the same score-ratio interval selects 103. The authors sample 20 answers per question from the modified system. They then compare its answers with the GPT-4 references using ROUGE-L recall. In the paper’s explanation, recall expresses how much of the reference answer is covered by the overlap with a candidate. [ROUGE](https://md.research.elamur.ai/free/en/papers/lin-2004-rouge-package-automatic-evaluation-summaries/)

```
R = O ÷ W
```

Here, R is the reported recall measure, O is the number of overlapping words counted by the measure between the generated answer and the reference, and W is the number of words in the reference. The division uses reference length as the denominator. Greater overlap therefore increases recall on that reference. The paper also checks selected correct answers against the books, adding a factual check to the comparison with generated references.

The selected questions have an average ROUGE-L recall of 0.23. Questions that fall outside the selection have an average of 0.10. The comparison tests whether the screening step enriches for questions likely to elicit an answer resembling the reference from the same modified system.

Mean ROUGE-L recall on Harry Potter questions by Min-k% Prob screening outcome Questions retained by the score-ratio screen elicit answers with higher reference overlap.

**The numbers**

| System or setting | ROUGE-L recall |
| --- | --- |
| Questions outside the screening interval | 0.10 |
| Questions selected by Min-k% Prob (this paper) | 0.23 |

The paper also presents selected questions for which the generated answers achieve ROUGE-L recall of 1 and are verified against the series. Together with the story completions, they show that related knowledge can still be elicited after the unlearning intervention. The score’s contribution is to help locate inputs on which that residual behavior becomes observable.

### What the ablations show

#### Text length and target size change the strength of the signal

On WikiMIA, the authors hold the passage length setting at 128 and compare reference-free methods across LLaMA variants of 7, 13, 30, and 65B. The AUC curves rise with target size. One interpretation offered by the authors is that larger systems can memorize more training material and therefore leave a stronger difference between the predictions made on member and nonmember text. The comparison establishes the trend within this family and benchmark setup. Memorization is an explanation for the trend, inferred from the scores and from the expected effect of capacity.

The length analysis keeps the original wording and changes how much of a passage is provided. AUC increases at longer lengths for the methods plotted. A longer passage can contain more distinctive information and more contexts in which the training history has a chance to affect predictions. For Min-k% Prob, retaining a fraction also means that a longer passage supplies a larger pool of positions for the tail average. The paper attributes the trend to longer texts carrying more information that the target may have memorized. The comparison varies length as a property of the input to the detector. It does not involve further training of the target on the longer passages.

These are comparisons about how much information a detector receives at test time and about the particular target used to assess it. The isolation differs between them. In the length analysis, the new input is a different truncation of benchmark material. In the size analysis, the target itself changes, while the input length is held fixed. Read together, they show why performance on a passage of one length under one target is a poor description of what a detector will achieve in every condition. The bucketed WikiMIA design keeps length visible in the evaluation.

#### More background data can have opposite effects

The downstream experiments vary the corpus used in continued training. In the size ablation, the authors keep 200 inserted examples per downstream task and mix them with different amounts of RedPajama text. The resulting corpora contain 0.17M, 0.27M, 2.6M, and 26M tokens. The reported AUC increases with corpus size in this experiment. As the amount of background text grows, the fixed set of formatted benchmark items accounts for less of the training material. The authors argue that this makes them more distinctive relative to the corpus and may lead to stronger memorization of those outliers.

That interpretation matters because dataset size changes both scale and composition in the RedPajama experiment. The target receives more ordinary corpus text, and the fixed contaminant set becomes a smaller share of it. If the inserted examples have a different format or content distribution from the background, their relative unusualness is part of what changed. The higher AUC is an observation about that mixture. The outlier explanation is a hypothesis about why it occurs.

To probe the hypothesis, the authors construct corpora in which the marked examples come from the same source as the surrounding text. They use Real Time Data News August 2023, which the study treats as unavailable in the original LLaMA pretraining period. The simulated training collections concatenate 1000, 5000, and 10,000 news examples, corresponding to 0.77M, 3.9M, and 7.6M tokens. In each setting, 100 of the included items are designated positives, and another 100 examples from the same news collection are reserved as negatives. AUC decreases as the news corpus grows.

The news comparison brings the direction of the result into line with the stability intuition. When the positive articles resemble the articles around them, more background data makes it harder to pick out the ones included in the controlled training. The RedPajama comparison shows why corpus size alone is insufficient to predict the direction. Formatted benchmark items embedded in a different kind of text can become more readily identifiable as their share falls. The authors interpret the combined evidence in terms of whether a contaminant is an outlier relative to the training distribution. The experiments establish the opposing trends for these particular mixtures and give a reason to examine distributional fit when interpreting a detection result.

#### Repetition strengthens evidence of exposure

The frequency ablation changes the number of copies of each inserted benchmark example. The authors generate occurrences according to a Poisson distribution, a distribution for counts, and examine detection performance in relation to those counts. AUC rises for examples that occur more frequently. The result makes sense in terms of the information available to membership inference. Repeated exposure gives training more opportunities to alter the predictions on that example, making it easier to distinguish from a held-out item.

This comparison separates repetition from the question of membership in the abstract. Two examples can both be members of the same constructed training corpus and still present very different detection problems. A single exposure and repeated exposures carry the same membership label, while leaving signals of different strength. The result helps explain why performance on a group of strongly memorized examples may tell an investigator little about examples encountered less often.

The experiment also keeps two uses of the word frequency apart. Corpus composition concerns the share of training text drawn from the inserted data source. Example multiplicity concerns how many times an individual candidate was included. Changing the amount of background RedPajama text changes the former while the set of inserted examples is fixed. Inserting multiple copies directly varies the latter. The two experiments can therefore produce different trends without describing the same training change.

#### The learning rate changes detection and task performance

The learning rate ablation compares continued-training settings of 10⁻⁵ and 10⁻⁴. Across the downstream tasks, raising the rate increases the AUC of contaminant detection. Under the tested procedure, larger update steps produce a stronger distinction in the scores assigned to inserted and held-out examples. The authors interpret this as stronger memorization of the inserted material.

The appendix provides a separate way to examine that interpretation. It reports the gap in average classification accuracy in favor of contaminant examples over noncontaminant examples. The gap is 0.04 at a learning rate of 10⁻⁵ and 0.11 at 10⁻⁴. The measurement here is downstream classification accuracy, distinct from the AUC used to compare membership scores. The greater advantage for inserted items at the higher rate is consistent with the changes benefiting seen items more than general performance on the task. The authors use that comparison to support their reading of the AUC result.

The held-out sweep over k answers a narrower question. It favors a particular tail fraction among the values tried for a validation target, and that fraction is reused throughout the experiments. The paper’s principal evidence for the tail statistic comes from comparison with PPL and the other baselines. The controlled contamination ablations concern how the training process affects detectability once that statistic has been fixed. They explain when membership leaves stronger evidence under the scoring rule, without tracing each prediction difference to a particular training update.

### Limitations

#### Limits the authors state

The authors define black-box access in terms of obtaining probabilities for the tokens in a candidate passage. This is more access than an interface that returns generated text alone provides. The detector needs scores for the supplied text, including its least probable tokens. Its reference-free design removes the requirement to obtain same-distribution shadow data and train a reference. Access to the target’s probabilities remains a prerequisite for the method the paper evaluates.

WikiMIA is intended for systems that use Wikipedia in training, and the recent event examples need to follow the relevant training period. The authors explicitly motivate using events instead of all newly created pages because publication timing by itself is weak evidence about a text’s novelty. They also distinguish original text from paraphrases and separate passage lengths. These design decisions bound the interpretation of a benchmark result. A score reported on verbatim event prose of a given length concerns the particular kinds of passages available in that setting.

In the unlearning audit, the authors state that their story-completion study covers books 1 to 4 of a series of 7 books. They suggest that broader coverage could expose more passages for which the intervention was unsuccessful. Both the choice of source material and the decision to investigate screened chunks affect the scope of what they observe. The study provides examples of retained behavior after the specific intervention, with counts tied to the books, prompts, and samples used.

The paper also recognizes distributional fit as a condition on the corpus-size finding. The controlled news and downstream examples have opposite trends. The finding about lower learning rates and less frequent exposures comes from the corresponding controlled training settings. Together these qualifications give the relationship between pretraining design and detection difficulty a conditional form. A single summary claim about larger corpora would lose the distinction the experiments expose.

#### Limits that follow from the setup

The timing logic behind WikiMIA works more directly for negative labels than for positive ones. An event occurring after training creates a historical basis for excluding a contemporaneous account of it. An older entry can be available before training and still be missing from a particular corpus, or the corpus can contain a different revision. Knowledge that a system uses Wikipedia supports the positive labeling rule without revealing exactly which snapshot and passage it encountered. The observed AUC is therefore measured against the benchmark labels. The benchmark does not audit an item-by-item training record.

The old and recent groups can also differ in features associated with their time periods. A difference in scores can reflect familiarity with names or descriptions common in the older material, as well as memory for specific WikiMIA passages. This possibility follows from the way the labels and dates are connected. Restricting both classes to event prose reduces some obvious sources of variation, such as comparing old encyclopedic prose with arbitrary newly published text. The experimental design still ties age and membership together. The controlled downstream study can directly assign inclusion in the new corpus and supplies a complementary test with a different labeling mechanism.

The paraphrase setting extends the same issue to alternate wording. The positive label is inherited from the original Wikipedia example. Success indicates that the detector can recover a distinction associated with the source even after rewriting. There are multiple routes to that result. A score can be influenced by recognition of the facts, related wording elsewhere in the training corpus, or the predictability of the paraphrase as text. The test cannot establish membership of the particular rewritten string. This difference between familiarity with content and exposure to exact wording also matters when interpreting the book and unlearning studies.

The strongest statements from the book study concern evidence of exposure in the sampled material. The positive calibration books come from a prior observation of memorization by ChatGPT, while the target under audit is text-davinci-003. The negative calibration books are selected by publication date. These proxies are informative without furnishing a verified training manifest for either class. The choice to optimize accuracy on a balanced validation set also has consequences when applying the cutoff elsewhere. The share of flagged passages in a new collection depends on how the new collection’s scores compare with the validation scores, and the test has no verified membership labels with which to check that transfer.

The unit of the book statistic is another constraint. A high rate for a book describes flags among its sampled snippets. Repeated samples from a book can share vocabulary, setting, and style, and the statistic is not a direct measurement of what share of the book entered training. It is still less a measure of how much of the full pretraining corpus was copyrighted. Nor does the detector identify the route by which the text reached the target or supply the conditions required for a legal judgment. A training data inventory would answer different questions from aggregate evidence that the text looks familiar.

In the contamination experiments, the authors know which examples entered the added corpus. They begin with LLaMA 7B and continue training it on a designed mixture. That gives much stronger control over the membership labels for the intervention than WikiMIA or Books3 can offer. It does not provide a complete history of the base system. The held-out label means the item was excluded from the constructed phase. Conclusions about the size of the effect are also tied to the training duration, formatted benchmark examples, background corpus, and rates used in that phase. A full pretraining run can differ along all of those dimensions.

Finally, the unlearning study observes what the modified system produces when prompted and sampled. The closeness of scores nominates candidates, and the continuations and answers determine what can be recovered on those candidates. A similar continuation can reflect retained story knowledge without proving that an exact passage remains memorized. ROUGE-L recall measures overlap with a reference and can vary with how a correct answer is phrased or how much detail the reference contains. Human verification of the reported correct answers helps establish that those examples convey information from the series. The selected-question averages describe the effectiveness of the screening rule on this pool of prompts, and the completion results describe the behavior observed under this sampling procedure. Neither provides a series-wide rate of retained content or a determination about compliance with a deletion obligation.

### What came after

#### Membership inference and benchmark leakage

The paper brings training membership and benchmark design together. Later citing work takes up both questions. Some of it keeps the individual example as the object of inquiry, asking whether behavior supports a membership decision. Other work treats possible exposure as a condition that an evaluation must account for when it chooses examples or interprets scores. These directions correspond to different roles in the original paper. Min-k% Prob tries to infer provenance from behavior, while WikiMIA constructs a test whose labels can be supported by information outside the target.

[Do Membership Inference Attacks Work on Large Language Models?](https://md.research.elamur.ai/free/en/papers/duan-2024-membership-inference-attacks-work-large/) returns to the reliability question directly. Its subject is the broader class of membership inference methods to which Min-k% Prob belongs. The connection is to the paper’s claim that a score can separate held-out and seen examples under a defined evaluation setup, and to the question of how far that separation extends when the setting changes. This line of inquiry takes the detector itself as the object of evaluation.

[Investigating Data Contamination in Modern Benchmarks for Large Language Models](https://md.research.elamur.ai/free/en/papers/deng-2024-investigating-data-contamination-modern-benchmarks/) takes up the downstream problem. Here the focus is contamination in benchmarks used to assess language systems. The original paper’s controlled insertions establish an experimental link between exposure and subsequent detectability. Investigation of modern benchmarks is concerned with the corresponding problem in the evaluations researchers actually use, where knowledge of the training corpus can be incomplete and item-level evidence matters to interpreting outcomes.

[Rethinking Benchmark and Contamination for Language Models with Rephrased Samples](https://md.research.elamur.ai/free/en/papers/yang-2023-rethinking-benchmark-contamination-language-models/) brings rephrasing into the benchmark contamination question. That focus connects closely to the paraphrase split of WikiMIA. A changed surface form can keep the underlying content recognizable, which complicates the assumption that freshness can be determined by comparing exact strings. WikiMIA uses the original and rephrased forms to test membership signals under changed wording. The later work’s stated focus puts rephrased samples into the question of how a benchmark itself should be understood when judging contamination.

[LiveCodeBench](https://md.research.elamur.ai/free/en/papers/jain-2024-livecodebench-holistic-contamination-free-evaluation/) takes up contamination avoidance in the evaluation of code capability. Its stated objective is a contamination-free evaluation for code. The link to WikiMIA is a shared concern with how the test set is built. A contamination audit asks how confidently exposure can be inferred once a candidate item is chosen. A benchmark designed around avoiding contamination addresses the conditions under which those candidates enter evaluation. The title identifies the domain and the objective, without establishing that its method is inherited from WikiMIA.

[Benchmark Data Contamination of Large Language Models: A Survey](https://md.research.elamur.ai/free/en/papers/xu-2024-benchmark-data-contamination-large/) places the question in a broader account of benchmark contamination. A survey has a different analytical task from a controlled detector experiment. The original paper supplies an example of a behavior-based membership score and a test built around plausible members and temporally excluded nonmembers. The survey’s stated subject is the larger contamination problem in which corpus checks, behavioral evidence, and evaluation design all have roles. [Benchmarking Benchmark Leakage in Large Language Models](https://md.research.elamur.ai/free/en/papers/xu-2024-benchmarking-benchmark-leakage-large-language/) moves the focus to benchmarking leakage itself, the problem of making evaluations of leakage a reproducible object of study.

#### Unlearning as a measurement problem

[TOFU](https://md.research.elamur.ai/free/en/papers/maini-2024-tofu-task-fictitious-unlearning-llms/) frames unlearning through a fictitious task. That framing changes the kind of material on which unlearning can be evaluated. The Harry Potter audit asks what can still be recovered after an intervention on an existing book series. A fictitious task puts the evaluation setting itself at the center of the study. The link is the question the original audit raises about verification. A claim of forgetting needs observable tests that can probe what happens when the modified system is asked for the targeted information.

MUSE puts evaluation at the center of unlearning through a six-way assessment. This is related to the original paper’s use of several observations in its audit. Similarity of input scores, resemblance of generated story continuations, and recovery of answers each concern different observable behavior. A multidimensional evaluation takes up the broader problem of how to judge the effects of an unlearning intervention across several kinds of measurement. The citation connects these projects through the evaluation problem, without settling which tests or scores they share.

## Cite

Cite as Weijia Shi, Anirudh Ajith, Mengzhou Xia, Yangsibo Huang, Daogao Liu, Terra Blevins, Danqi Chen and Luke Zettlemoyer. 2023. Detecting Pretraining Data from Large Language Models. arXiv:2310.16789.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2310.16789](https://doi.org/10.48550/arxiv.2310.16789) · [arXiv 2310.16789](https://arxiv.org/abs/2310.16789)

```bibtex
@misc{shi2023detecting,
  title = {{Detecting Pretraining Data from Large Language Models}},
  author = {Weijia Shi, Anirudh Ajith, Mengzhou Xia, Yangsibo Huang, Daogao Liu, Terra Blevins, Danqi Chen and Luke Zettlemoyer},
  year = {2023},
  doi = {10.48550/arxiv.2310.16789},
  eprint = {2310.16789},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2310.16789}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
