TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP
John X. Morris, Eli Lifland, Jin Yong Yoo, Jake Grigsby, Di Jin and, Yanjun Qi

TL;DR
TextAttack is a flexible Python framework that simplifies creating, applying, and combining adversarial attacks, data augmentation, and adversarial training to improve NLP model robustness and performance across various datasets and models.
Contribution
It introduces a modular, extensible framework for NLP adversarial attacks, enabling easy construction and application of attacks, data augmentation, and training techniques.
Findings
Includes 16 implemented adversarial attacks from literature.
Supports models like BERT and all GLUE tasks.
Facilitates easy experimentation with adversarial methods.
Abstract
While there has been substantial research using adversarial attacks to analyze NLP models, each attack is implemented in its own code repository. It remains challenging to develop NLP attacks and utilize them to improve model performance. This paper introduces TextAttack, a Python framework for adversarial attacks, data augmentation, and adversarial training in NLP. TextAttack builds attacks from four components: a goal function, a set of constraints, a transformation, and a search method. TextAttack's modular design enables researchers to easily construct attacks from combinations of novel and existing components. TextAttack provides implementations of 16 adversarial attacks from the literature and supports a variety of models and datasets, including BERT and other transformers, and all GLUE tasks. TextAttack also includes data augmentation and adversarial training modules for using…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
TextAttack with Jack Morris· youtube
Taxonomy
TopicsAdversarial Robustness in Machine Learning · Topic Modeling · Software Engineering Research
MethodsLinear Layer · Layer Normalization · Attention Is All You Need · Dense Connections · Residual Connection · Adam · Multi-Head Attention · Attention Dropout · Dropout · WordPiece
