Tag&Tab: Pretraining Data Detection in Large Language Models Using Keyword-Based Membership Inference Attack

Sagiv Antebi, Edan Habler, Asaf Shabtai, Yuval EloviciarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) are often trained on massive, uncurated datasets that may contain copyrighted or sensitive information. Detecting whether a specific text was used during pretraining is crucial for auditing privacy and copyright compliance. We present Tag&Tab, a novel, reference-free Membership Inference Attack (MIA) that identifies training data by focusing on the memorization of rare, low-entropy keywords and named entities. Unlike traditional methods that analyze entire documents uniformly, Tag&Tab isolates highly informative tokens, significantly improving detection accuracy across various model architectures and datasets.

Introduction

As LLMs scale, they increasingly memorize specific strings from their training corpora. Researchers use Membership Inference Attacks (MIAs) to determine if a target text was part of this training set. Existing "reference-free" MIAs typically rely on overall perplexity or loss; however, these metrics are often noisy because they treat common linguistic structures (e.g., "the", "and") the same as unique identifiers.

The core insight of this work is that true memorization is most evident in how a model predicts rare, context-specific words. By shifting the focus from token-level statistical averages to a semantic-aware, keyword-focused approach, Tag&Tab provides a more precise "fingerprint" for data membership without requiring access to model weights or expensive shadow model training.

The Tag&Tab Framework

Tag&Tab operates as a black-box attack through a three-stage pipeline: Preprocessing/Tagging, Tabbing, and Inference.

The Tag&Tab pipeline: from input text to membership inference.
  1. Preprocessing & Tagging: The system identifies the most unique details of a text. It calculates the entropy contribution of words and selects the $K$ rarest tokens (typically $K=4$). This list is further augmented by extracting Named Entities (e.g., specific people or organizations) using standard NLP libraries. These selected tokens are designated as "Tags."
  2. Tabbing: The full text is processed by the target LLM. Rather than calculating the loss for the entire sequence, the method specifically extracts the log-likelihoods of the tagged keywords, conditioned on their preceding context.
  3. Inference: The log-likelihoods of these tags are averaged. If this average exceeds a domain-calibrated threshold, the text is classified as a "Member" of the training set.

Experimental Evaluation

We evaluated Tag&Tab against several state-of-the-art baselines, including DC-PDD, Min-K%++, and ReCaLL, across diverse benchmarks such as The Pile, BookMIA (for copyright auditing), and PatentMIA (for cross-lingual testing).

Performance comparison of Tag&Tab against baseline MIA methods across various LLMs.

As shown in the results, Tag&Tab consistently outperforms existing methods. On the BookMIA dataset, it achieved an AUC of 0.91 on LLaMA-30B and 0.97 on GPT-3.5 Turbo. The attack demonstrates a clear scaling property: as the parameter count of the target LLM increases, the detection accuracy of Tag&Tab also improves, reflecting the higher memorization capacity of larger models.

Key Findings

  • Optimal Keyword Selection: Experiments revealed that selecting a small number of high-information keywords (e.g., $K=4$) is more effective than using larger sets (e.g., $K=10$). This filtering removes the "noise" of common words that the model predicts well regardless of training exposure.
  • Semantic Synergy: Combining low-entropy words with Named Entities provides a stronger signal than using either category in isolation, outperforming traditional frequency-based rankings like TF-IDF.
  • Robustness: The method is resilient to minor text perturbations. Swapping keywords for synonyms resulted in only a negligible (1-2%) drop in AUC, suggesting that the model's memorization is tied to the broader semantic context of the rare tokens.
  • Domain Sensitivity: Decision thresholds must be calibrated per domain. A threshold optimized for mathematical papers will not generalize to literature, necessitating the use of domain-specific non-member data for calibration.

Conclusion

Tag&Tab represents a significant advancement in LLM auditing. By focusing on the "unique details" of a text rather than its global statistics, it provides a compute-efficient and highly accurate tool for detecting unauthorized data use. Future work will focus on improving performance for non-Latin languages and developing more automated methods for domain-specific threshold calibration.

Summary updated

BibTeX
@misc{antebi2025tag,
  author = {Sagiv Antebi and Edan Habler and Asaf Shabtai and Yuval Elovici},
  title = {{Tag\&Tab: Pretraining Data Detection in Large Language Models Using Keyword-Based Membership Inference Attack}},
  year = {2025},
  eprint = {2501.08454},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.08454},
}
Figure