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

Sagiv Antebi, Edan Habler, Asaf Shabtai, Yuval Elovici2025

Abstract

Large Language Models (LLMs) are often trained on massive datasets without explicit consent, leading to significant copyright and privacy concerns. Detecting whether specific text was part of a model's pretraining data is a critical task for accountability. This paper introduces Tag&Tab, a reference-free membership inference attack (MIA) that focuses on semantically important keywords—rare words and named entities—rather than the entire token sequence. By isolating high-signal tokens, Tag&Tab achieves a significant performance boost (5.3% to 17.6% increase in AUC) over state-of-the-art methods across various architectures and datasets.

Introduction

The rapid advancement of LLMs relies on trillions of tokens scraped from the web. This practice has sparked legal battles, such as The New York Times vs. OpenAI, and raised alarms about the leakage of personally identifiable information (PII). Membership Inference Attacks (MIAs) aim to determine if a document was included in a training set. However, existing MIAs often suffer from "semantic blindness," treating common filler words like "the" with the same weight as unique technical terms. Furthermore, many high-performing methods require expensive "shadow models" or auxiliary reference models, limiting their practical utility.

Methodology: The Tag&Tab Framework

Tag&Tab addresses these limitations through a two-stage, reference-free process: Tagging and Tabbing.

Overview of the Tag&Tab framework: Tagging selects keywords, Tabbing calculates probabilities, and Infer determines membership.

1. Tagging (Keyword Selection)

Instead of analyzing the full text, the system identifies "high-signal" keywords based on two criteria:

  • Low-Entropy Words: Rare words are identified using a word-frequency map. The hypothesis is that LLMs are more likely to uniquely memorize rare content than common words.
  • Named Entity Recognition (NER): Spans such as people, organizations, and locations are identified using the spaCy library.

2. Tabbing (Probability Calculation)

The target LLM is queried with the full text, but log-likelihoods are extracted only for the selected keywords. The final inference is based on the average log-likelihood of these keywords. If the model predicts these specific rare words with high confidence, it serves as a strong indicator that the model has encountered this exact context during training.

Experimental Results

The researchers evaluated Tag&Tab on benchmarks including BookMIA, MIMIR, and subsets of The Pile (e.g., GitHub, EuroParl).

Performance and Keyword Optimization

A key finding was the "Less is More" principle. The authors discovered that selecting a small number of keywords (e.g., K=4 per sentence) often yielded the best results. Including too many tokens introduces noise from common words that the model predicts well by default, which can dilute the membership signal.

AUC performance across different models as a function of the number of tagged keywords.

Key Findings

  • Superior Accuracy: Tag&Tab outperformed baselines like LOSS, Zlib, and Min-K% by an average of 5.3% to 17.6% in AUC scores.
  • High Confidence: On the BookMIA dataset, it achieved an AUC of 0.91 for LLaMA-30B and 0.97 for GPT-3.5 Turbo.
  • Reference-Free Efficiency: Unlike methods like LiRA, Tag&Tab achieves state-of-the-art results without the need for a second reference model, significantly reducing computational overhead.

Discussion and Future Work

While Tag&Tab is highly effective for pretraining data detection, it shows some limitations. It is less effective on models fine-tuned on entire documents, where memorization becomes more uniform across the text. Additionally, performance varied on non-Latin scripts, such as the Chinese PatentMIA dataset, likely due to different entropy distributions. Future research will explore the impact of keyword placement and more advanced NLP techniques to further refine keyword selection.

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},
  doi = {10.18653/v1/2025.findings-emnlp.283},
}
Figure