TL;DR
This paper introduces TAG, a novel gradient attack method specifically designed for Transformer-based language models. It demonstrates that private training data can be effectively reconstructed from shared gradients, posing a significant privacy risk in distributed NLP training, and shows TAG outperforms prior methods in data recovery.
What Problem Does This Paper Address?
Distributed learning is a popular paradigm for training large-scale deep learning models, allowing multiple devices to collaborate without sharing their raw data. A key assumption is that sharing only gradients during training is privacy-preserving. However, recent research has shown that in computer vision, gradients can be used to reconstruct private training data (gradient leakage). This paper addresses the critical gap of understanding and quantifying this privacy risk in the context of modern Transformer-based language models, which are increasingly used in distributed settings. The authors highlight the lack of systematic studies and formal evaluation methods for gradient attacks in NLP, particularly for complex architectures like Transformers.
Methods
The core contribution is the TAG (Transformer Attack from Gradient) algorithm. TAG aims to reconstruct private training data (input tokens and labels) by leveraging the gradients shared by a participating device. The process involves:
- Dummy Data Initialization: The adversary starts with randomly initialized dummy input tokens (X') and labels (Y').
- Dummy Gradient Calculation: Using the current global model weights, the adversary computes gradients (∇W') for this dummy data.
- Gradient Matching: The crucial step is to minimize the difference between the adversary's dummy gradients (∇W') and the actual shared gradients from the victim (∇W). This is achieved by defining a differentiable distance function.
- Optimized Distance Function: Unlike previous methods that solely relied on Euclidean distance, TAG proposes a combined distance metric using both L2 (Euclidean) and L1 (Manhattan) norms. This is particularly important because Transformer gradients can have many near-zero values, making Euclidean distance less effective in certain initialization scenarios. The combined metric also weights earlier layers more heavily, as they are closer to the input data.
- Iterative Refinement: The dummy data (X', Y') is iteratively updated to minimize this distance function, gradually converging towards the original private training data.
Datasets
The experiments were conducted using datasets from the General Language Understanding Evaluation (GLUE) benchmark:
- CoLA (Corpus of Linguistic Acceptability): English acceptability judgments of sentences.
- SST-2 (Stanford Sentiment Treebank): Sentiment analysis of movie reviews.
- RTE (Recognizing Textual Entailment): Determining textual entailment between sentence pairs.
These datasets were chosen for their varying sentence lengths, which are relevant to the attack's effectiveness.
Key Insights and Ideas
- Transformers are Vulnerable: The paper definitively shows that Transformer-based language models, widely used in NLP, are susceptible to gradient leakage attacks.
- Beyond Image Classification: TAG extends gradient attack research from image classification to the more complex domain of NLP, demonstrating its applicability to text data.
- Importance of Distance Metric: The novel combined L1/L2 distance function is key to TAG's success, especially when dealing with the specific gradient distributions found in Transformers, outperforming simpler Euclidean distance measures.
- Larger Models Leak More: A significant finding is that larger Transformer models tend to leak more private information than smaller ones, suggesting a trade-off between model performance and privacy.
- Vocabulary Size Matters: Smaller vocabulary sizes appear to increase the risk of data leakage, making models trained on more specialized or limited vocabularies more vulnerable.
Key Results
- High Recovery Rates: TAG can recover up to 88.9% of tokens and achieve a cosine similarity of 0.93 in token embeddings on the CoLA dataset.
- Performance Improvement: Compared to prior methods like DLG, TAG achieves a 1.5x higher Recover Rate and 2.5x higher ROUGE-2 score.
- Model Generalizability: TAG demonstrates effectiveness across various Transformer architectures, including Transformer, TinyBERT (4 and 6 layers), BERT (BASE and LARGE), and works with both pre-trained and randomly initialized models.
- Larger Models, More Leakage: BERTLARGE showed significantly higher leakage (e.g., 30% more Recover Rate than TinyBERT4) compared to smaller models.
- Runtime: While effective, the attack's runtime increases with model size, with BERTLARGE taking approximately 3x longer than TinyBERT4 for 1,000 iterations.
Limitations and Future Work
- Runtime for Large Models: The paper acknowledges that larger models require more time for the attack to complete.
- Data Agnosticism: While the algorithm is presented as data-agnostic, the experiments focus on specific NLP tasks and datasets.
- Future Work: The authors hope their work will "shed some light on the privacy leakage problem in Transformer-based NLP models," implying a need for further research into more robust defenses and a deeper understanding of the attack's nuances across different model configurations and datasets. The paper also suggests that smaller NLP models are more resilient, hinting at future research directions in model compression for privacy.
Summary updated