TL;DR
This paper introduces "N-Gram Coverage Attack," a novel membership inference attack that works solely on a language model's text outputs, making it applicable to black-box APIs like GPT-4. This method surprisingly matches or even surpasses the performance of traditional attacks that require internal model access, and it scales effectively with increased computational resources.
What Problem Does This Paper Address?
Large language models (LLMs) are increasingly trained on vast datasets, and there's a growing concern about whether these models might inadvertently memorize and reproduce sensitive or copyrighted information from their training data. Membership inference attacks (MIAs) are crucial for auditing this "memorization" and ensuring fair use, but most existing state-of-the-art MIAs require access to the model's internal states (like logits or hidden layers). This limitation prevents their use on widely deployed, API-accessible models like OpenAI's GPT series, where only text outputs are available. The paper aims to bridge this gap by developing an effective MIA that works purely on these black-box outputs.
Methods
The core of the proposed "N-Gram Coverage Attack" lies in a simple yet effective intuition: models are more likely to "memorize" and thus regenerate text patterns that were prevalent in their training data. The attack works as follows:
- Prefixing and Generation: Given a candidate text document, the attack takes a short prefix of it. This prefix is then used to prompt the target LLM, generating multiple diverse continuations (outputs).
- N-Gram Similarity: The generated continuations are then compared to the suffix of the original candidate document using n-gram overlap metrics. The idea is that if the model was trained on the document, its generated continuations should more closely resemble the original suffix than if the document was not in the training set.
- Aggregation: The similarity scores from multiple generated outputs are aggregated (e.g., using the maximum score) to produce a final score. If this aggregated score exceeds a certain threshold, the document is predicted to be a "member" of the training data.
The paper explores different n-gram similarity metrics (Coverage, Creativity Index, Longest Common Substring) and aggregation functions, finding that "Coverage" and "Creativity Index" generally perform best.
Datasets
The authors evaluate their method on several existing and newly constructed datasets:
- BookMIA: Snippets from books, including those likely in older LLM training sets and newer ones.
- WikiMIA: Wikipedia articles from before and after 2017.
- WikiMIA2024 Hard: A new dataset constructed to minimize temporal distribution shifts by using different versions of the same Wikipedia articles from before and after 2016.
- WikiMIA-24: Similar to WikiMIA but with a more recent cutoff for non-members.
- TÜLU Mix: A new dataset designed to assess fine-tuning membership attack effectiveness, using examples from the TÜLU Mix and other instruction-tuning datasets.
They also test on models trained on Dolma (a large corpus) and The Pile (another large pretraining corpus).
Key Insights and Ideas
- Output-Only Attacks are Powerful: The most significant insight is that simple n-gram overlap on model outputs is surprisingly effective for membership inference, even against sophisticated models and without access to internal states. This opens up MIA to a much wider range of deployed LLMs.
- Memorization as a Signal: The core assumption that memorized training data leads to more "faithful" or similar generations is validated. The attack leverages this by looking for how closely generated text "regenerates" the original text.
- Scalability is Key: The attack's performance improves as more generated sequences are used. This suggests that while computationally more expensive, increasing the "compute budget" for the attack can yield better results, offering a trade-off between cost and accuracy.
- Evolving Privacy in Newer Models: More recent models, like GPT-4o, show increased robustness to these attacks, indicating a potential trend towards better privacy protections in newer LLM architectures.
Key Results
- Outperforms Black-Box Baselines: N-Gram Coverage Attack consistently outperforms existing black-box MIAs like DE-COP across various datasets and models, often by a significant margin.
- Competitive with White-Box Attacks: Remarkably, the proposed method achieves performance comparable to, and sometimes even better than, state-of-the-art white-box attacks (which have access to model internals) on many benchmarks. For example, on the Pile dataset, it performs on average 95% as well as white-box baselines on LLaMA models.
- Efficiency: The method is computationally more efficient than DE-COP, taking significantly less time for comparable or better results.
- Robustness of Newer Models: On datasets like WikiMIA-24 Hard, newer models like GPT-4o and GPT-4 show increased robustness, with attack performance scores often lower than older models.
Limitations and Future Work
- Compute Budget Trade-off: While performance scales with the number of generated sequences, there's a computational cost associated with generating more outputs. The paper explores this trade-off, suggesting that a 50% prefix and around 50-100 generations strike a good balance.
- Temperature Sensitivity: The paper notes that a temperature near 1.0 is generally best for performance, but higher temperatures (encouraging diversity) might be beneficial in some cases, hinting at a complex interplay between diversity and accurate representation.
- Model Robustness: The study observes that newer models like GPT-4o are more robust to these attacks. This suggests future work could focus on understanding why these models are more robust and developing even stronger privacy-preserving techniques.
- New Benchmarks: The creation of WikiMIA2024 Hard and TÜLU Mix datasets contributes to the evaluation landscape for MIAs, particularly for newer models and fine-tuning scenarios.
Summary updated