TL;DR
This paper introduces DILMA, a novel method for generating adversarial attacks on categorical sequence classifiers. By fine-tuning a language model and using a differentiable loss function that balances adversarial strength with sequence similarity, DILMA creates more effective and semantically coherent adversarial examples than previous methods, even resisting adversarial training.
What Problem Does This Paper Address?
Deep learning models are known to be vulnerable to adversarial attacks, where small, often imperceptible changes to input data can cause misclassification. While this has been extensively studied for image data, attacking categorical sequence models (like those used for text or transaction data) is significantly harder. The core challenge lies in the discrete nature of the input tokens, which makes standard gradient-based optimization techniques (common in image attacks) inapplicable. Existing methods often struggle with computational complexity or produce adversarial examples that lose their original meaning.
Methods
The authors propose DILMA (DIfferentiable Language Model Attack), which leverages a pre-trained Transformer-based Masked Language Model (MLM) as a generator of adversarial sequences. The key innovation is a differentiable loss function that guides the MLM's fine-tuning. This loss function has two main components:
- Surrogate Classifier Score: This term encourages the generated sequence to be misclassified by a substitute classifier.
- Deep Levenshtein Distance: This term, approximated by a separate deep learning model, ensures that the generated adversarial sequence remains semantically similar to the original input.
By optimizing this combined loss, DILMA can generate adversarial examples that are both effective at fooling classifiers and maintain a high degree of similarity to the original data. They also introduce "SamplingFool," a simpler baseline that relies solely on sampling from a pre-trained MLM without fine-tuning.
Datasets
The paper evaluates DILMA on a variety of datasets, including:
- NLP Datasets: AG News Corpus (AG), TREC (TREC-6), Stanford Sentiment Treebank (SST-2), and Movie Review Data (MR).
- Non-NLP Datasets: Electronic Health Records (EHR), and two bank transaction datasets (Tr.Age, Tr.Gender).
Key Insights and Ideas
- Differentiability is Key: The core problem in attacking discrete sequences is the lack of differentiability. DILMA circumvents this by using a differentiable loss function and a differentiable approximation of edit distance, enabling gradient-based optimization of the language model.
- Language Models as Attack Generators: Fine-tuning powerful pre-trained language models like BERT offers a robust and flexible way to generate diverse and meaningful adversarial sequences.
- Balancing Adversarial Strength and Similarity: The proposed loss function effectively balances the need to fool a classifier with the requirement that the adversarial example remains close to the original. This leads to more semantically coherent attacks.
- Resistance to Defenses: DILMA-generated adversarial examples show remarkable resilience against adversarial training and detection methods, outperforming existing approaches in these scenarios.
Key Results
- DILMA consistently achieves strong adversarial attack performance across diverse NLP and non-NLP datasets, as measured by the Normalized Accuracy Drop (NAD) metric.
- In experiments, DILMA with sampling (DILMA w/ sampling) generally outperforms the original DILMA and other baseline methods like HotFlip and FGSM, especially after adversarial training.
- The paper demonstrates that DILMA is resistant to adversarial training, with performance degradation being significantly less pronounced compared to other methods. For instance, on the Tr.Age dataset, DILMA's NAD remains high even after the target classifier is retrained with adversarial samples.
- DILMA-generated attacks are also harder to detect by discriminator-based defense mechanisms, showing only a slight increase in ROC AUC compared to a random classifier.
Limitations and Future Work
- Hyperparameter Sensitivity: While DILMA offers good performance, the authors note that its effectiveness can depend on hyperparameter selection, though they provide a grid search procedure for finding suitable values.
- Computational Cost: While more efficient than some token-level approaches, fine-tuning a language model for adversarial generation still requires computational resources.
- Broader Impact: The authors raise an important societal question about delegating sequential data processing to AI, highlighting the potential for malicious use of such powerful adversarial attack generation capabilities, for example, in detecting fake news. They hope their work, with its open-source code, will foster further research in robust AI.
Summary updated