Fine-tuning can Help Detect Pretraining Data from Large Language Models

Hengxiang Zhang, Songxin Zhang, Bingyi Jing, Hongxin Wei

TL;DR

Researchers have developed a novel method called Fine-tuned Score Deviation (FSD) that significantly improves our ability to detect if a specific piece of text was used to train a Large Language Model (LLM). By fine-tuning a model on a tiny sliver of data it definitely hasn't seen before, the authors found they could create a massive, measurable gap between "member" data (pretraining data) and "non-member" data, making detection much more accurate.

What Problem Does This Paper Address?

LLMs are trained on massive swaths of the internet, but developers rarely disclose exactly what’s in those datasets. This lack of transparency creates three major headaches:

  1. Data Contamination: If a model was trained on the questions and answers of a benchmark test, its high scores on that test are "cheating," not a sign of true intelligence.
  2. Copyright Infringement: Models often memorize and regurgitate copyrighted books or articles without permission.
  3. Privacy Risks: Sensitive personal information (like private emails) can inadvertently end up in the training corpus.

Existing detection methods usually look at "scoring functions" like Perplexity (how "surprised" a model is by a text). The logic is simple: models should be less surprised by text they've seen before. However, this is noisy. A very simple, repetitive sentence might have low perplexity even if the model never saw it, while a complex, rare sentence from the training set might still have high perplexity.

Methods: Introducing Fine-tuned Score Deviation (FSD)

The authors introduce FSD to cut through the noise of standard scoring functions. Instead of just looking at the model's scores once, they look at how those scores change after a quick round of extra training.

Conceptual overview of the Fine-tuned Score Deviation (FSD) method.

The process works like this:

  1. Collect "Unseen" Data: Find a small amount of data (as few as 100 examples) from the same domain (e.g., recent Wikipedia entries or new research papers) that was published after the model's knowledge cutoff.
  2. Targeted Fine-tuning: Fine-tune the LLM on this small "unseen" set using LoRA (Low-Rank Adaptation), a computationally efficient way to update model weights.
  3. Measure the Deviation: Compare the scoring function (like Perplexity or Min-k%) of a target text before and after this fine-tuning.

The "Aha!" moment is that fine-tuning on new domain data causes the model's scores for all unseen data in that domain to drop significantly. However, the scores for data the model already saw during its original pretraining stay relatively stable. By measuring this deviation distance, the researchers can clearly separate members from non-members.

Key Insights and Ideas

  • The Differential Shift: The core insight is that LLMs have a "diminishing returns" relationship with data they've already seen. Fine-tuning on a specific domain helps the model "learn" the general patterns of that domain, which helps it predict new data much better, but doesn't significantly change its prediction of data it has already memorized.
Perplexity shifts differently for member vs. non-member data after fine-tuning.
  • Extreme Data Efficiency: You don't need a massive dataset to make this work. Leveraging just 100 non-member examples was enough to boost detection accuracy dramatically.
  • Domain Sensitivity: For the best results, the auxiliary "unseen" data used for fine-tuning should match the domain of the text you are trying to check.

Datasets and Key Results

The study evaluated FSD across several diverse benchmarks, including WikiMIA (recent Wikipedia events), ArXivTection (recent research papers), BookMIA & BookTection (copyrighted books), and The Pile. They tested these against popular open-source models like LLaMA (7B, 13B, 30B), GPT-J, OPT, and Pythia.

The improvements were substantial across the board:

  • AUC Boost: On the WikiMIA dataset using the OPT-6.7B model, the best baseline (Min-k%) had an AUC of 0.62. Adding FSD boosted that to an impressive 0.91.
  • Catching Copyright: In detecting copyrighted books (BookMIA), the method reached an accuracy of 98.6% when combined with the Zlib scoring function—a 71.8% improvement over the baseline.
  • Low False Positives: On ArXivTection with LLaMA-7B, the True Positive Rate at a strict 5% False Positive Rate (a key metric for real-world use) jumped from a dismal 0.10 to a robust 0.81.

Limitations and Future Work

While highly effective, FSD does have limitations. Domain Knowledge is required; to use FSD effectively, you need to know the general domain of the text you're testing to find appropriate "unseen" data for fine-tuning. Additionally, there is a Computational Overhead. While LoRA is efficient, FSD still requires a fine-tuning step, making it more "expensive" than the single-pass scoring used by previous methods. Finally, the effectiveness of the score deviation depends heavily on the Data Quality of the small non-member dataset used.

The authors suggest that future work could explore how to make the method more robust when the domain of the target text is unknown or highly diverse.

Summary updated

BibTeX
@inproceedings{zhang2025fine,
  author = {Hengxiang Zhang and Songxin Zhang and Bingyi Jing and Hongxin Wei},
  title = {{Fine-tuning can Help Detect Pretraining Data from Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=X8dzvdkQwO},
}
Figure