DPDLLM: A Black-box Framework for Detecting Pre-training Data from Large Language Models

Baohang Zhou, Zezhong Wang, Lingzhi Wang, Hongru Wang, Ying Zhang, Kehui Song, Xuhui Sui, Kam-Fai Wong

Abstract

Large Language Models (LLMs) are often trained on massive datasets containing copyrighted or private information. Detecting such "data contamination" is challenging, especially for commercial black-box models that do not provide internal token probabilities. We present DPDLLM, a novel black-box framework that identifies pre-training data by analyzing generated text. DPDLLM utilizes a small reference model to detect signs of memorization and a Gaussian Naive Bayes classifier to distinguish between seen and unseen data. Our experiments show that DPDLLM consistently outperforms existing membership inference attacks across multiple benchmarks, achieving up to 81.6% AUC on copyright detection tasks.

Introduction

The rapid advancement of LLMs like GPT-4 and Claude has raised significant concerns regarding data privacy and copyright. These models are trained on vast web-scraped datasets that frequently include protected materials. Auditing these models is difficult because researchers typically lack access to the model's internal states, such as logits or loss values. Existing Membership Inference Attacks (MIA) often rely on these "grey-box" features or require expensive shadow models. DPDLLM addresses this gap by providing a purely black-box method for verifying if a model has encountered specific text during pre-training, relying solely on text generation.

Methodology

The DPDLLM framework operates in three distinct stages to detect data memorization:

  1. Memorizing via Reference Model: A target text snippet is used to fine-tune a small, open-source reference model (e.g., GPT-2). This process forces the reference model to "memorize" the specific sequence, making it highly sensitive to that text's structure.
  2. Extracting LLM Memorization: The first half (prefix) of the target text is fed into the black-box LLM. If the LLM was trained on this data, its generated "postscript" is likely to closely match the original second half of the text.
  3. Detection via Classifier: The LLM's output is processed by the fine-tuned reference model to calculate token-level probabilities. A Gaussian Naive Bayes (GNB) classifier then uses these probability distributions to determine if the data was "seen" or "unseen" during the target LLM's pre-training phase.
The DPDLLM architecture illustrating the interaction between the LLM service, the reference model, and the GNB classifier.

Datasets

The framework was evaluated on four benchmark datasets to ensure robustness across domains:

  • WikiMIA2: An updated dataset containing Wikipedia and news content from 2023.
  • BookMIA: Based on the Books3 corpus, specifically designed for detecting copyrighted literary material.
  • Wiki-SPGC & WikiMIA2-SPGC: Multi-domain datasets combining Wikipedia and the Gutenberg corpus to test the classifier's ability to generalize in complex scenarios.

Results

DPDLLM demonstrates superior performance compared to traditional baselines such as Perplexity (PPL), Zlib compression, and Min-K% Prob.

On the WikiMIA2 dataset, DPDLLM achieved an AUC of 71.4% for LLaMA-7B, significantly outperforming baseline methods which typically ranged between 50-57%. In copyright detection tasks using the BookMIA dataset, the framework reached an AUC of 81.6% for LLaMA-13B. The results indicate that DPDLLM becomes more effective as the length of the text increases, as longer sequences provide more features for the GNB classifier.

Performance comparison (AUC) of DPDLLM against baselines on the WikiMIA2 dataset across different text lengths.

Conclusion

DPDLLM provides a practical and efficient solution for auditing black-box LLMs for data contamination and copyright infringement. By leveraging a small reference model as a proxy, it successfully identifies memorized training data from text outputs alone. This method is significantly faster and more cost-effective than training large shadow models. Future work will focus on improving multi-domain generalization and exploring zero-shot detection capabilities to further reduce the reliance on known training samples.

Summary updated

BibTeX
@inproceedings{zhou2024dpdllm,
  author = {Baohang Zhou and Zezhong Wang and Lingzhi Wang and Hongru Wang and Ying Zhang and Kehui Song and Xuhui Sui and Kam-Fai Wong},
  title = {{DPDLLM: A Black-box Framework for Detecting Pre-training Data from Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.35},
}
Figure