Targeted Training Data Extraction—Neighborhood Comparison-Based Membership Inference Attacks in Large Language Models

Huan Xu, Zhanhao Zhang, Xiaodong Yu, Yingbo Wu, Zhiyong Zha, Bo Xu, Wenfeng Xu, Menglan Hu, Kai PengApplied Sciences 2024

TL;DR

This paper introduces a novel method for targeted training data extraction from large language models (LLMs) by combining neighborhood comparison-based membership inference attacks with advanced suffix generation strategies. The research significantly improves extraction precision, reaching up to 52.5%, and highlights the serious privacy risks associated with LLMs.

What Problem Does This Paper Address?

Large language models (LLMs) are increasingly deployed across various applications, but their "memory effect" means they can inadvertently memorize and potentially leak sensitive training data. While previous research focused on non-targeted data extraction, this paper tackles the more precise challenge of targeted training data extraction. The goal is to extract specific pieces of training data by providing a known prefix and recovering the corresponding suffix. Existing targeted extraction methods suffer from low precision, and there's a need to improve both the extraction process and the evaluation of privacy risks in LLMs.

Methods

The core of this work lies in a two-stage process:

  1. Suffix Generation: The paper explores and analyzes various suffix generation strategies (e.g., beam search, top-k, top-p, typical-p) to create a comprehensive set of potential training data samples from a given prefix. They also investigate the impact of parameters like temperature and repetition penalty on generation quality and diversity.
  2. Suffix Sorting (Membership Inference Attack): This stage uses a modified neighborhood comparison-based membership inference attack (MIA) to rank the generated suffixes and identify those most likely to be part of the original training data. The neighborhood comparison approach, inspired by Mattern et al., involves generating similar "neighbor" samples by masking tokens in the generated text and comparing their loss values against the original generated text. A smaller difference suggests the text is more likely to be from the training set.

The authors also introduce a metric called "Emia" to evaluate the precision of MIA methods in this context.

Datasets

The experiments utilize a dataset of 1000 samples selected from The Pile dataset by Carlini et al. The initial 50 tokens of each sample were used as prefixes for training data extraction, and the full 100 tokens served as the validation set for precision extraction. The attack model used was GPT-Neo 1.3B, and BERT was employed as the neighborhood generation model.

Key Insights and Ideas

  • Targeted Extraction is Crucial: The paper emphasizes that targeted extraction, by providing a prefix, is a more efficient and concerning privacy threat than indiscriminate extraction.
  • Balancing Quality and Diversity: There's a trade-off between generating high-quality, low-loss text (favored by beam search) and diverse text (favored by top-k/top-p). The optimal approach for extraction often requires a balance, as excessive diversity can degrade quality, and overly conservative generation might miss subtle training data patterns.
  • Neighborhood Comparison MIA is Promising but Slow: The adapted neighborhood comparison MIA shows high precision but is computationally expensive due to the generation of neighbor samples.
  • Zlib Entropy (×Zlib) is Surprisingly Effective: The Zlib entropy-based MIA (specifically the ×Zlib variant) demonstrated superior extraction rate and speed in this study, potentially because the chosen training data samples contained more information.
  • Model Size Matters: Larger models exhibit higher extraction accuracy, indicating that privacy leakage becomes a more significant issue as LLMs scale.

Key Results

  • The proposed method, combining neighborhood comparison MIA with optimized suffix generation, achieved a precision of 52.5%, a significant improvement over previous work.
  • The study found that beam search generally produces higher quality text, while top-k offers greater diversity.
  • The Zlib entropy-based (×Zlib) MIA achieved the highest extraction rate (Emia) and a shorter runtime compared to other MIA methods.
  • For GPT-j-6B, an even larger model, the extraction precision reached 72.2%.
  • The runtime of the proposed neighborhood comparison method was significantly longer than other strategies, highlighting a drawback.

Limitations and Future Work

  • Computational Cost: The neighborhood comparison MIA, while effective, is computationally intensive, leading to longer extraction times.
  • Dataset Specificity: The study used a selectively chosen subset of The Pile dataset. The authors acknowledge that this might not fully represent the typical training data distribution and could influence the effectiveness of MIA methods.
  • Suboptimal MIA Performance: Generally, the effectiveness of various membership inference attacks in this context was found to be suboptimal, with only marginal differences between them.
  • Future Work: The authors suggest further research into suffix ranking methodologies to improve MIA performance. They also highlight the need for more robust defenses beyond just targeting MIAs, potentially involving modifications to LLM architectures to prevent data leakage. Investigating the privacy implications of non-member samples that closely resemble training data is also an open area.

Summary updated

BibTeX
@inproceedings{xu2024targeted,
  author = {Huan Xu and Zhanhao Zhang and Xiaodong Yu and Yingbo Wu and Zhiyong Zha and Bo Xu and Wenfeng Xu and Menglan Hu and Kai Peng},
  title = {{Targeted Training Data Extraction—Neighborhood Comparison-Based Membership Inference Attacks in Large Language Models}},
  booktitle = {Applied Sciences},
  year = {2024},
  doi = {10.3390/app14167118},
}
Figure