Pretraining Data Detection for Large Language Models: A Divergence-based Calibration Method

Weichao Zhang, Ruqing Zhang, Jiafeng Guo, Maarten de Rijke, Yixing Fan, Xueqi Cheng

Introduction

As Large Language Models (LLMs) achieve state-of-the-art performance across various domains, the transparency regarding their training data has diminished. This "black box" approach to model development poses significant challenges for the research community, particularly concerning data contamination in benchmarks, copyright infringement, and the potential exposure of private information. To address these concerns, researchers have turned to Membership Inference Attacks (MIA) to determine whether a specific text was included in a model's pretraining set.

This paper introduces DC-PDD (Divergence-based Calibration for Pretraining Data Detection), a novel method that identifies training data by measuring the divergence between a model's predicted probabilities and the general frequency of words in a reference corpus.

The Challenge: The "Common Word" Trap

Existing detection methods, such as the widely used Min-K% Prob, operate on the hypothesis that LLMs assign higher probabilities to sequences they have encountered during training. However, this approach suffers from a fundamental flaw: common linguistic patterns.

If a non-training text is composed of highly frequent words (e.g., "The children played at the park"), an LLM will naturally assign it high probabilities regardless of whether it was in the training set. This leads to a high rate of false positives, where the detector confuses general linguistic familiarity with specific memorization of training data.

Methodology: DC-PDD

DC-PDD shifts the focus from raw probabilities to calibrated divergence. The method follows a structured pipeline to isolate the signal of pretraining:

  1. Token Probability Distribution: The target LLM is queried to obtain the predicted probability for each token in a given text sequence.
  2. Token Frequency Distribution: A large, public reference corpus (such as C4 for English or ChineseWebText for Chinese) is used to estimate the baseline frequency of those tokens in general language.
  3. Divergence Calculation: The core of the method involves computing the cross-entropy between the model's prediction and the baseline frequency. By applying divergence-from-randomness theory, the authors argue that when a model's prediction for a word significantly exceeds its natural frequency, it indicates the model has likely "memorized" that specific context.

Refinement Strategies

To further improve detection accuracy, the authors implement two key refinements:

  • Limit Upper Bound (LUP): This strategy caps the influence of individual tokens, preventing extreme outliers from disproportionately affecting the overall score.
  • Select First Occurrence (SFO): LLMs are inherently better at predicting a word if it has already appeared in the immediate context. To distinguish between long-term pretraining memory and short-term in-context learning, DC-PDD only considers the score of a word the first time it appears in the text snippet.

Experimental Evaluation

The researchers evaluated DC-PDD across multiple model families, including OPT, Llama, Pythia, Baichuan, and Qwen, using three primary benchmarks:

  • WikiMIA: Based on Wikipedia entries.
  • BookMIA: Based on a corpus of published books.
  • PatentMIA: A new Chinese-language benchmark introduced by the authors. It utilizes patent priority dates to create a strict temporal separation between training data (older patents) and non-training data (patents released after model finalization).

Key Results

DC-PDD consistently outperformed existing state-of-the-art methods across different languages and model architectures:

  • BookMIA (English): DC-PDD achieved an AUC of 0.725, representing a 5.4% improvement over the "Lowercase" baseline and an 8.6% improvement over Min-K% Prob.
  • PatentMIA (Chinese): On this new benchmark, DC-PDD outperformed Min-K% Prob by 5.4% in AUC and demonstrated a significant 13.2% increase in TPR@5%FPR (True Positive Rate at a 5% False Positive Rate).
  • Model Agnosticism: The method proved robust even when the reference corpus did not perfectly align with the model's actual training data, suggesting high practical utility for auditing black-box models.

Discussion and Limitations

While DC-PDD represents a significant advancement in data detection, several limitations remain. The method is currently dependent on the availability of a large, representative reference corpus in the target language. Additionally, the hyperparameter used for the Limit Upper Bound (LUP) requires tuning for different model architectures. Finally, while highly effective for sample-level detection, scaling these techniques to corpus-level detection—identifying if an entire website or dataset was used—remains an open research challenge.

Conclusion

DC-PDD provides a robust, calibration-based framework for auditing LLM training data. By accounting for the background noise of general language frequency, it effectively overcomes the "common word" trap that plagues previous membership inference methods, offering a more reliable tool for ensuring transparency and copyright compliance in the era of large-scale AI.

Summary updated

BibTeX
@inproceedings{zhang2024pretraining,
  author = {Weichao Zhang and Ruqing Zhang and Jiafeng Guo and Maarten de Rijke and Yixing Fan and Xueqi Cheng},
  title = {{Pretraining Data Detection for Large Language Models: A Divergence-based Calibration Method}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.300},
}
Figure