TextAttack: Python framework for adversarial attacks and data augmentation in NLP
TextAttack is a Python library and also a framework for executing or building adversarial attacks against NLP models. This is highly helpful in the evaluation of the attack methods and the NLP model's robustness.
TextAttack's modular design makes it easily extensible to any NLP models, tasks, attack constraints, attack strategies and attack methods. TextAttack facilitates the easy way for ablation studies because of the segregation it stipulates on the adversarial attacks and standardisation of the constraint.
TextAttack benefits the attacks on NLP models that are specially trained for classification, entailment, and translation.
Let's look into the Features of TextAttack for more Understanding.
The four major features of TextAttack to build the robust attacks are:
Goal Function is to indicate the objective of an attack. It can change all of the words in a transition output or could improve the prediction score of a classification model as well.
Search Methods help find the solvable parts in a problem, the perturbation theory.
Transformations help in transforming text input to words, characters or phrases.
Constraints would evaluate whether the perturbation is a valid one regards the given input.
The additional features of TextAttack are for ease of problem-solving and it includes:
Data Augmentation can be achieved with transformations and constraints
Built-in datasets is used for executing attacks without providing the original data to the model
Pre-trained models are used for testing attacks and constraint evaluation purposes.
Built-in Tokenizers help in tokenizing the input values of the model
Visualisation options are of Weights and Biases along with Visdom
To execute TextAttack in your novel projects, you should have installed Python 3.6+ version. If you have to improve the speed of your code execution, you should be using CUDA-compatible GPU, but it is purely optional. By default, TextAttack downloads pre-trained models, dataset samples during installation and configuration process.
Web Ref: TextAttack_Web
GitHub Ref: TexAttack_GitHub