[Paper Review] Towards Improving Adversarial Training of NLP Models
This paper proposes A2T, a computationally efficient adversarial training method for NLP models that uses gradient-based word importance ranking and counter-fitted word embeddings to generate cheap, effective adversarial examples. A2T improves model robustness against diverse attacks, enhances standard accuracy and cross-domain generalization, and boosts interpretability without requiring expensive search or complex architectures.
Adversarial training, a method for learning robust deep neural networks, constructs adversarial examples during training. However, recent methods for generating NLP adversarial examples involve combinatorial search and expensive sentence encoders for constraining the generated instances. As a result, it remains challenging to use vanilla adversarial training to improve NLP models' performance, and the benefits are mainly uninvestigated. This paper proposes a simple and improved vanilla adversarial training process for NLP models, which we name Attacking to Training (A2T). The core part of A2T is a new and cheaper word substitution attack optimized for vanilla adversarial training. We use A2T to train BERT and RoBERTa models on IMDB, Rotten Tomatoes, Yelp, and SNLI datasets. Our results empirically show that it is possible to train robust NLP models using a much cheaper adversary. We demonstrate that vanilla adversarial training with A2T can improve an NLP model's robustness to the attack it was originally trained with and also defend the model against other types of word substitution attacks. Furthermore, we show that A2T can improve NLP models' standard accuracy, cross-domain generalization, and interpretability. Code is available at https://github.com/QData/Textattack-A2T .
Motivation & Objective
- To address the high computational cost of vanilla adversarial training in NLP, which limits its practical adoption.
- To investigate whether a cheaper, gradient-based adversarial attack can still improve model robustness and generalization.
- To evaluate the impact of adversarial training on standard accuracy, cross-domain generalization, and model interpretability.
- To compare the effectiveness of word substitution using counter-fitted embeddings versus masked language models in adversarial training.
- To demonstrate that adversarial training with A2T improves robustness against attacks not used during training.
Proposed method
- A2T generates adversarial examples via iterative word substitution using a gradient-based importance ranking of words.
- It replaces words with synonyms from a counter-fitted word embedding model to maintain fluency and semantic consistency.
- The attack is optimized for speed, avoiding expensive sentence-level encoders or combinatorial search.
- A2T-MLM is a variant that uses masked language models for word replacement instead of synonym lookup.
- Adversarial training is performed by augmenting the training data with both original and A2T-generated adversarial examples.
- The method is evaluated on BERT and RoBERTa across IMDB, Rotten Tomatoes, Yelp, and SNLI datasets using standard accuracy, robustness, and interpretability metrics.
Experimental results
Research questions
- RQ1Can a cheaper, gradient-based adversarial attack achieve comparable robustness gains to expensive search-based attacks in NLP?
- RQ2Does adversarial training with A2T improve model generalization on out-of-domain data?
- RQ3How does A2T affect standard accuracy and model interpretability compared to natural training?
- RQ4Does A2T improve robustness against attacks not used during training?
- RQ5How do different word replacement strategies (counter-fitted embeddings vs. masked language models) affect model performance?
Key findings
- A2T improved adversarial robustness against multiple attacks, including those not used during training, demonstrating generalization of defense.
- Models trained with A2T achieved higher standard accuracy and cross-domain generalization than natural training, particularly on IMDB and Yelp.
- A2T improved model interpretability, as measured by AOPC, with BERT models showing higher AOPC scores than RoBERTa.
- A2T-MLM hurt standard accuracy and cross-domain generalization, likely due to generating false positive adversarial examples with semantic drift.
- The optimal γ value for adversarial training was 0.2, suggesting that higher attack rates do not improve robustness and may even reduce performance.
- Adversarial training with A2T reduced the ℓ₂ distance between [CLS] embeddings of original and adversarial inputs, indicating improved robustness in representation space.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.