Source-linked AI summary

Bag of Tricks for Training Data Extraction from Language Models

Weichen Yu, Tianyu Pang, Qian Liu, Chao Du, Bingyi Kang, Yan Huang, Min Lin, Shuicheng Yan

arXiv:2302.04460v2cs.CLcs.AIcs.CRcs.LG

TL;DR

Training data extraction can help assess privacy leakage, but existing approaches are often proof-of-concept and not effective enough. This paper benchmarks generation and ranking tricks on GPT-Neo 1.3B and reports that selected tricks improve results over the baseline in most cases, while combinations can be incompatible or less precise.

  • Problem

    Existing training data extraction methods are often proof-of-concept and not effective enough, despite the task’s importance for assessing privacy leakage.

    Source: §1 · pp. 1–2
  • Method

    The paper benchmarks techniques for generating candidate suffixes and ranking them, including sampling and token-level criteria.

    Source: §7 · p. 9
  • Results

    Several tricks improve GPT-Neo 1.3B extraction over the baseline in most cases, but combining tricks does not always help and can reduce precision.

    Source: §1 · p. 2
  • Takeaways & Limitations

    The findings support careful selection and combination of extraction tricks rather than assuming general-purpose text-generation methods will work for extraction.

    Source: §1 · p. 2, §7 · p. 9

    The evaluation focuses on targeted extraction of 1-eidetic data with GPT-Neo 1.3B and 100-token sentences.

    Source: §1 · p. 2, §3.2 · p. 3

Abstract

from arXiv · show

With the advance of language models, privacy protection is receiving more attention. Training data extraction is therefore of great importance, as it can serve as a potential tool to assess privacy leakage. However, due to the difficulty of this task, most of the existing methods are proof-of-concept and still not effective enough. In this paper, we investigate and benchmark tricks for improving training data extraction using a publicly available dataset. Because most existing extraction methods use a pipeline of generating-then-ranking, i.e., generating text candidates as potential training data and then ranking them based on specific criteria, our research focuses on the tricks for both text generation (e.g., sampling strategy) and text ranking (e.g., token-level criteria). The experimental results show that several previously overlooked tricks can be crucial to the success of training data extraction. Based on the GPT-Neo 1.3B evaluation results, our proposed tricks outperform the baseline by a large margin in most cases, providing a much stronger baseline for future research. The code is available at https://github.com/weichen-yu/LM-Extraction.

1. Introduction

Training data extraction can assess privacy leakage, but existing methods are often ineffective and may require generating and ranking many candidates. This work evaluates generation and ranking techniques for targeted extraction and finds that selected tricks improve GPT-Neo 1.3B results over the baseline in most cases.

1. Introduction

  • Training data may expose sensitive information, including names, email addresses, phone numbers, and physical addresses, raising privacy concerns.The introduction frames extraction as a tool for evaluating privacy leakage.Source: §1 · p. 1
  • Figure 1 groups evaluated precision results by suffix generation and suffix ranking, with dashed bars marking each category’s best method.The figure distinguishes generation methods in pink from ranking methods in orange.Source: Figure 1 · p. 1
  • Existing extraction methods can underperform popular-entity selection and require generating and ranking many candidates to find one successful instance.The authors describe the task as relatively new, with substantial room for improvement.Source: §1 · p. 1
  • The study targets 1-eidetic memorized data extraction from a 1.3B parameter GPT-Neo model, providing a data prefix and attempting to recover the suffix that follows it.This targeted 1-eidetic extraction poses greater risk and is more challenging than non-targeted and κ-eidetic settings with κ > 1.Source: §1 · p. 2
  • Several previously overlooked tricks improve GPT-Neo 1.3B training data extraction over the baseline in most cases, but combining tricks can also hurt precision.The authors emphasize that experimental setup and judicious selection matter.Source: §1 · p. 2

2. Related Work

Related work places training data extraction among attacks exploiting model memorization and connects it to membership inference. It distinguishes exact recovery of training sentences from attacks that infer attributes, properties, or model functionality.

2. Related Work

  • The paper introduces training data extraction, membership inference, and other memorization-based attacks as the related-work themes.Source: §2 · p. 2, §2.3 · p. 2

2.1. Training Data Extraction

  • Training data extraction recovers examples used to train a model, while early work defined model knowledge extraction and κ-eidetic memorization and subsequent research studied memorization and sensitive applications.Later work discussed duplication, forgetting, memorization factors, and leakage from clinical notes.Source: §2.1 · p. 2

2.2. Membership Inference Attacks

  • Membership inference asks whether a record appeared in training data and uses classifier-based or metric-based methods, alongside proposed defenses such as differential privacy and data pruning.Prior demonstrations include classification and generation tasks.Source: §2.2 · p. 2

2.3. Other Memorization-Based Attacks

  • Other memorization-based attacks include model extraction, which seeks a functionally similar model, and attribute or property inference, which need not recover an exact training sentence.Training data extraction instead requires sentence-level identity and is described as more difficult and dangerous.Source: §2.3 · pp. 2–3

3. Preliminary

The study evaluates targeted extraction of training examples with a GPT-Neo model and metrics designed to measure recovery rather than language quality. Its setup uses unique 100-token examples and a threat model focused on 1-eidetic memorization.

3. Preliminary

  • The preliminary section recaps the study setup, threat model, and evaluation metrics.Source: §3 · p. 3

3.1. Basic Setups

  • The study uses 20,000 Pile examples with 50-token prefixes and suffixes; all 100-token examples appear once in training, and 19,000/1,000 examples form the train/test split.The model is GPT-Neo 1.3B, an autoregressive model trained on the Pile.Source: §3.1 · p. 3

3.2. Threat Model

  • Targeted extraction assumes a supplied training prefix and seeks its most-likely suffix, with κ fixed at 1 for 1-eidetic data.Generated sentences are 100 tokens long; shorter outputs are padded to the specified length.Source: §3.2 · p. 3

3.3. Evaluation Metrics

  • The evaluation uses precision, recall, and average Hamming distance to measure exact suffix recovery and token-level similarity.Recall uses e_j with j=100 for the 1,000-prefix test set.Source: §3.3 · p. 3
  • The proposed extraction metrics target recovered-data success, unlike common repetition or language-quality metrics that may not align with extraction goals.Source: §3.3 · pp. 3–4

4. Pipeline Overview

The extraction pipeline first generates candidate suffixes from a prefix, then ranks them by estimated likelihood. The paper explores changes to both stages.

4. Pipeline Overview

  • Suffix generation samples next tokens from the language model’s probability distribution; the basic strategy limits sampling to the top 10 tokens.Source: §4 · p. 4
  • Suffix ranking estimates candidate likelihood and retains suffixes with high probability, typically using membership inference based on perplexity.The paper explores tricks for both generation and ranking.Source: §4 · p. 4
  • Perplexity is calculated over the generated sentence’s tokens, excluding padding tokens.Source: §4 · p. 4

5. Improved Suffix Generation

This section studies suffix-generation improvements, beginning from a difference between ground-truth and generated-token logit distributions. It evaluates sampling, probability adjustment, context handling, look-ahead, and hyperparameter tuning.

5.1. Sampling Strategy

  • At nucleus-η ≈0.6, extraction precision improves 31% over baseline; larger or smaller values reduce performance.Larger top-k may increase sentence diversity while decreasing precision and Hamming distance; beam-search gains diminish quickly above width two despite increasing memory use.Source: §5.1 · pp. 4–5

5.2. Probability Distribution Adjustment

  • Temperature increases diversity but also the number of suffixes needed to include the ground truth, while repetition penalty has mostly negative effects on extraction.The section frames temperature selection as a balance between diversity and efficiency.Source: §5.2 · p. 5

5.3. Exposure Bias Reduction

  • The authors adjust context-window size and position shifting to better match training prefixes, which may be incomplete sentences.They motivate these changes by noting that training examples may be truncated or prefixed with other text.Source: §5.3 · p. 5

5.3.1. DYNAMIC CONTEXT WINDOW

  • Ensembling probabilities from different context lengths improves extraction accuracy, while generation accuracy declines as the prefix becomes shorter.The weighted-average and voting implementations use multiple context-window lengths.Source: §5.3.1 · pp. 5–6
  • Combining context-window lengths improves extraction accuracy by 143% with weighted averaging and 139% with voting over baseline.Weighted averaging performs slightly better; the ensemble can also reduce cascades of errors after a wrong generated token.Source: §5.3.1 · p. 6

5.3.2. DYNAMIC POSITION SHIFTING

  • Position shifting improves the MH metric but may reduce precision and recall.The method evaluates shifted positions and selects the one with the lowest prefix perplexity.Source: §5.3.2 · pp. 6–7

5.4. Look-Ahead

  • Look-ahead improves precision, and increasing λ improves performance but raises computational cost to O(λ · N).It uses posterior probabilities of subsequent tokens to inform the current token’s generation probability.Source: §5.4 · p. 7

5.5. Hyperparameter Optimization

  • Auto-tuning improves precision by 37% over baseline, while the stated manual settings yield 48.8%.The search uses CMA-ES over top-k, nucleus-η, typical-ϕ, temperature, and repetition penalty.Source: §5.5 · pp. 7–8

6. Improved Suffix Ranking

The section tests sentence- and token-level suffix-ranking criteria, then examines how the tricks interact. Although some individual criteria improve results, combining multiple techniques does not necessarily improve performance.

6. Improved Suffix Ranking

  • Ground-truth sentences do not consistently have the lowest perplexity, motivating ranking metrics beyond perplexity.The section identifies this discrepancy in its statistical analysis as the reason for proposing additional ranking metrics.Source: §6 · p. 8

6.1. Sentence-Level Criteria

  • Perplexity and Zlib entropy, including their product, yield only marginal improvement in the overall membership-inference task.The metrics are considered as sentence-level criteria; both tend to decrease when the model is highly confident in its predictions.Source: §6.1 · p. 8
  • Tandem probability has a marginal effect on precision and a negative effect on MR.The section evaluates cumulative token probability as an alternative ranking metric.Source: §6.1 · p. 8

6.2. Token-Level Criteria

  • Rewarding high-confidence tokens by subtracting 0.1 from a suffix’s perplexity score when a token probability exceeds 0.9 noticeably improves results.The proposed ranking rule targets generated suffixes containing confident tokens.Source: §6.2 · p. 8
  • Computing perplexity from majority tokens encourages inclusion of high-perplexity “surprised” tokens without harming overall sentence perplexity, but the improvement is relatively marginal.The method uses the batch mean and standard deviation to identify the majority-token range.Source: §6.2 · p. 8

6.3. Compatibility Analysis

  • Combining multiple techniques yields no significant performance improvement, even with beam width 2; a larger GPT-Neo model yields better results.The compatibility results are reported for precision, recall, and Hamming distance on a single trial.Source: Table 10 · p. 8, §6.3 · p. 9

7. Conclusion and Future Work

The paper evaluates a dozen generation- and ranking-strategy techniques for training-data extraction. Several improve results, but their interactions are subtle, and commonly used general text-generation methods are not always effective for extraction.

  • The study investigates a dozen techniques that make minor changes to language-model generation and ranking strategies.Source: §7 · p. 9
  • Several techniques improve extraction, but interactions between different tricks are more subtle than expected, and versatile general text-generation methods are not always effective for extraction.Source: §7 · p. 9
  • Future work should explore compatible techniques, combine suffix generation and ranking end to end, and investigate the mechanisms behind stronger performance.Source: §7 · p. 9

A.1. Guidelines

The guidelines frame practical training-data extraction methods around usability, effectiveness, efficiency, and perniciousness. The authors clarify that their aim is to improve leakage evaluation, not to pose attack methods.

  • Usable methods should be easy to adopt, require no additional datasets, avoid complex modules, and adapt readily to different applications.Source: §A.1 · p. 12
  • Methods should demonstrate good performance on the datasets being evaluated.Source: §A.1 · p. 12
  • Methods should limit computation cost and favor small effective modules; extra language models improve performance, but the authors seek alternatives without noticeable trade-offs.Source: §A.1 · p. 12
  • The guidelines expect strong extraction attacks to better evaluate information-leakage risk, while emphasizing that their aim is evaluation rather than posing attacks.Source: §A.1 · p. 12

A.2. Typical Failure Cases of Training Data Extraction

The paper distinguishes two extraction failure patterns: an early incorrect suffix token can derail later generation, while a mostly correct suffix can contain only a few mismatches. It links the latter pattern to look-ahead and notes that prefixes and suffixes may be incomplete text fragments.

  • One failure type begins with incorrect middle suffix tokens, after which subsequent tokens are generated inaccurately.Source: §A.2 · p. 12
  • Another failure type has only a few suffix tokens that differ from ground truth, while later tokens are correct.Source: §A.2 · p. 12
  • Look-ahead is motivated by the second failure type; incomplete prefixes and suffixes, including fragments caused by truncation and padding, motivate dynamic context windows and position shifting.Source: §A.2 · p. 12
  • Table 11 provides successful extraction examples as a contrast to the failure cases.Source: §A.2 · p. 12

A.3. Histogram without Interploration

The appendix examines perplexity and logit distributions, summarizes extraction techniques’ effects, and discusses the scope and societal risks of targeted training-data extraction.

A.3.1. SENTENCE PERPLEXITY HISTOGRAM

  • Ground-truth suffix perplexity is ranked against generated suffixes to visualize their distributional discrepancy.The histogram’s x-axis is based on the ground-truth perplexity rank among generated suffixes.Source: §A.3.1 · p. 12

A.3.2. TOKEN LOGITS HISTOGRAM

A.4. Takeaways

  • Suffix generation influences extraction precision more than suffix ranking, and dynamic context windows are more useful than the other examined tricks.Source: §A.4 · p. 13
  • Sampling strategies are highly sensitive to hyperparameters.Source: §A.4 · p. 13
  • The authors recommend using no more than two beams because additional beams increase memory requirements while yielding diminishing precision improvements.Source: §A.4 · p. 13
  • Look-ahead mechanisms improve the precision of the currently generated token, with the degree of improvement depending on how many future tokens are considered.Source: §A.4 · p. 13

A.5. Negative Societal Impacts

  • The study focuses on targeted extraction from GPT-Neo trained on the public Pile, and matching training-data suffixes may be recovered when attackers have training data or can replicate similar sentences.Table 11 is captioned as showing successful cases whose generated suffixes match ground truth in both length and tokens.Source: §A.5 · p. 14, Table 11 · p. 14
  • Institutions and organizations are the intended users, but malicious attackers may also use extraction methods; the authors call for more resistant language models.Source: §A.5 · p. 14
Loading 2302.04460v2…