{"id":13545468,"url":"https://github.com/QData/TextAttack","last_synced_at":"2025-04-02T15:31:09.143Z","repository":{"id":37025795,"uuid":"215173055","full_name":"QData/TextAttack","owner":"QData","description":"TextAttack 🐙  is a Python framework for adversarial attacks, data augmentation, and model training in NLP https://textattack.readthedocs.io/en/master/","archived":false,"fork":false,"pushed_at":"2024-07-25T18:53:58.000Z","size":26543,"stargazers_count":3113,"open_issues_count":72,"forks_count":414,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-02T01:09:48.516Z","etag":null,"topics":["adversarial-attacks","adversarial-examples","adversarial-machine-learning","data-augmentation","machine-learning","natural-language-processing","nlp","security"],"latest_commit_sha":null,"homepage":"https://textattack.readthedocs.io/en/master/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-15T00:51:44.000Z","updated_at":"2025-04-01T05:06:17.000Z","dependencies_parsed_at":"2023-02-09T11:01:47.228Z","dependency_job_id":"53b24fb6-9dfb-4866-9092-db736ed80549","html_url":"https://github.com/QData/TextAttack","commit_stats":{"total_commits":1936,"total_committers":64,"mean_commits":30.25,"dds":0.7004132231404958,"last_synced_commit":"edbcb83654a86db8a7b3079b5c113bad0396a2e1"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QData","download_url":"https://codeload.github.com/QData/TextAttack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246841657,"owners_count":20842629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adversarial-attacks","adversarial-examples","adversarial-machine-learning","data-augmentation","machine-learning","natural-language-processing","nlp","security"],"created_at":"2024-08-01T11:01:03.349Z","updated_at":"2025-04-02T15:31:09.120Z","avatar_url":"https://github.com/QData.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eTextAttack 🐙\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003eGenerating adversarial examples for NLP models\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://textattack.readthedocs.io/\"\u003e[TextAttack Documentation on ReadTheDocs]\u003c/a\u003e\n  \u003cbr\u003e \u003cbr\u003e\n  \u003ca href=\"#about\"\u003eAbout\u003c/a\u003e •\n  \u003ca href=\"#setup\"\u003eSetup\u003c/a\u003e •\n  \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n  \u003ca href=\"#design\"\u003eDesign\u003c/a\u003e\n  \u003cbr\u003e \u003cbr\u003e\n  \u003ca target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/QData/TextAttack/workflows/Github%20PyTest/badge.svg\" alt=\"Github Runner Covergae Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/py/textattack\"\u003e\n    \u003cimg src=\"https://badge.fury.io/py/textattack.svg\" alt=\"PyPI version\" height=\"18\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cimg src=\"https://jxmo.io/files/textattack.gif\" alt=\"TextAttack Demo GIF\" style=\"display: block; margin: 0 auto;\" /\u003e\n\n## About\n\nTextAttack is a Python framework for adversarial attacks, data augmentation, and model training in NLP.\n\n\u003e If you're looking for information about TextAttack's menagerie of pre-trained models, you might want the [TextAttack Model Zoo](https://textattack.readthedocs.io/en/latest/3recipes/models.html) page.\n\n## Slack Channel\n\nFor help and realtime updates related to TextAttack, please [join the TextAttack Slack](https://join.slack.com/t/textattack/shared_invite/zt-huomtd9z-KqdHBPPu2rOP~Z8q3~urgg)!\n\n### *Why TextAttack?*\n\nThere are lots of reasons to use TextAttack:\n\n1. **Understand NLP models better** by running different adversarial attacks on them and examining the output\n2. **Research and develop different NLP adversarial attacks** using the TextAttack framework and library of components\n3. **Augment your dataset** to increase model generalization and robustness downstream\n3. **Train NLP models** using just a single command (all downloads included!)\n\n## Setup\n\n### Installation\n\nYou should be running Python 3.6+ to use this package. A CUDA-compatible GPU is optional but will greatly improve code speed. TextAttack is available through pip:\n\n```bash\npip install textattack\n```\n\nOnce TextAttack is installed, you can run it via command-line (`textattack ...`)\nor via python module (`python -m textattack ...`).\n\n\u003e **Tip**: TextAttack downloads files to `~/.cache/textattack/` by default. This includes pretrained models,\n\u003e dataset samples, and the configuration file `config.yaml`. To change the cache path, set the\n\u003e environment variable `TA_CACHE_DIR`. (for example: `TA_CACHE_DIR=/tmp/ textattack attack ...`).\n\n## Usage\n\n### Help: `textattack --help`\n\nTextAttack's main features can all be accessed via the `textattack` command. Two very\ncommon commands are `textattack attack \u003cargs\u003e`, and `textattack augment \u003cargs\u003e`. You can see more\ninformation about all commands using\n```bash\ntextattack --help\n```\nor a specific command using, for example,\n```bash\ntextattack attack --help\n```\n\nThe [`examples/`](examples/) folder includes scripts showing common TextAttack usage for training models, running attacks, and augmenting a CSV file.\n\n\nThe [documentation website](https://textattack.readthedocs.io/en/latest) contains walkthroughs explaining basic usage of TextAttack, including building a custom transformation and a custom constraint..\n\n\n\n### Running Attacks: `textattack attack --help`\n\nThe easiest way to try out an attack is via the command-line interface, `textattack attack`.\n\n\u003e **Tip:** If your machine has multiple GPUs, you can distribute the attack across them using the `--parallel` option. For some attacks, this can really help performance. (If you want to attack Keras models in parallel, please check out `examples/attack/attack_keras_parallel.py` instead)\n\nHere are some concrete examples:\n\n*TextFooler on BERT trained on the MR sentiment classification dataset*:\n```bash\ntextattack attack --recipe textfooler --model bert-base-uncased-mr --num-examples 100\n```\n\n*DeepWordBug on DistilBERT trained on the Quora Question Pairs paraphrase identification dataset*:\n```bash\ntextattack attack --model distilbert-base-uncased-cola --recipe deepwordbug --num-examples 100\n```\n\n*Beam search with beam width 4 and word embedding transformation and untargeted goal function on an LSTM*:\n```bash\ntextattack attack --model lstm-mr --num-examples 20 \\\n --search-method beam-search^beam_width=4 --transformation word-swap-embedding \\\n --constraints repeat stopword max-words-perturbed^max_num_words=2 embedding^min_cos_sim=0.8 part-of-speech \\\n --goal-function untargeted-classification\n```\n\n\u003e **Tip:** Instead of specifying a dataset and number of examples, you can pass `--interactive` to attack samples inputted by the user.\n\n### Attacks and Papers Implemented (\"Attack Recipes\"): `textattack attack --recipe [recipe_name]`\n\nWe include attack recipes which implement attacks from the literature. You can list attack recipes using `textattack list attack-recipes`.\n\nTo run an attack recipe: `textattack attack --recipe [recipe_name]`\n\n\u003cimg src=\"docs/_static/imgs/overview.png\" alt=\"TextAttack Overview\" style=\"display: block; margin: 0 auto;\" /\u003e\n\n\u003ctable  style=\"width:100%\" border=\"1\"\u003e\n\u003cthead\u003e\n\u003ctr class=\"header\"\u003e\n\u003cth\u003e\u003cstrong\u003eAttack Recipe Name\u003c/strong\u003e\u003c/th\u003e\n\u003cth\u003e\u003cstrong\u003eGoal Function\u003c/strong\u003e\u003c/th\u003e\n\u003cth\u003e\u003cstrong\u003eConstraintsEnforced\u003c/strong\u003e\u003c/th\u003e\n\u003cth\u003e\u003cstrong\u003eTransformation\u003c/strong\u003e\u003c/th\u003e\n\u003cth\u003e\u003cstrong\u003eSearch Method\u003c/strong\u003e\u003c/th\u003e\n\u003cth\u003e\u003cstrong\u003eMain Idea\u003c/strong\u003e\u003c/th\u003e\n\u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n  \u003ctr\u003e\u003ctd style=\"text-align: center;\" colspan=\"6\"\u003e\u003cstrong\u003e\u003cbr\u003eAttacks on classification tasks, like sentiment classification and entailment:\u003cbr\u003e\u003c/strong\u003e\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ea2t\u003c/code\u003e\n\u003cspan class=\"citation\" data-cites=\"yoo2021a2t\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003ePercentage of words perturbed, Word embedding distance, DistilBERT sentence encoding cosine similarity, part-of-speech consistency\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap (or) BERT Masked Token Prediction\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR (gradient)\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003efrom ([\"Towards Improving Adversarial Training of NLP Models\" (Yoo et al., 2021)](https://arxiv.org/abs/2109.00544))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ealzantot\u003c/code\u003e  \u003cspan class=\"citation\" data-cites=\"Alzantot2018GeneratingNL Jia2019CertifiedRT\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003ePercentage of words perturbed, Language Model perplexity, Word embedding distance\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGenetic Algorithm\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003efrom ([\"Generating Natural Language Adversarial Examples\" (Alzantot et al., 2018)](https://arxiv.org/abs/1804.07998))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ebae\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"garg2020bae\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUSE sentence encoding cosine similarity\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eBERT Masked Token Prediction\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eBERT masked language model transformation attack from ([\"BAE: BERT-based Adversarial Examples for Text Classification\" (Garg \u0026 Ramakrishnan, 2019)](https://arxiv.org/abs/2004.01970)). \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ebert-attack\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"li2020bertattack\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUSE sentence encoding cosine similarity, Maximum number of words perturbed\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eBERT Masked Token Prediction (with subword expansion)\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e ([\"BERT-ATTACK: Adversarial Attack Against BERT Using BERT\" (Li et al., 2020)](https://arxiv.org/abs/2004.09984))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003echecklist\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Gao2018BlackBoxGO\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003e{Untargeted, Targeted} Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003echecklist distance\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003econtract, extend, and substitutes name entities\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eInvariance testing implemented in CheckList . ([\"Beyond Accuracy: Behavioral Testing of NLP models with CheckList\" (Ribeiro et al., 2020)](https://arxiv.org/abs/2005.04118))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e \u003ccode\u003eclare\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Alzantot2018GeneratingNL Jia2019CertifiedRT\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUSE sentence encoding cosine similarity\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eRoBERTa Masked Prediction for token swap, insert and merge\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e[\"Contextualized Perturbation for Textual Adversarial Attack\" (Li et al., 2020)](https://arxiv.org/abs/2009.07502))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003edeepwordbug\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Gao2018BlackBoxGO\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003e{Untargeted, Targeted} Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eLevenshtein edit distance\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003e{Character Insertion, Character Deletion, Neighboring Character Swap, Character Substitution}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy replace-1 scoring and multi-transformation character-swap attack ([\"Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers\" (Gao et al., 2018)](https://arxiv.org/abs/1801.04354)\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e \u003ccode\u003efaster-alzantot\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Alzantot2018GeneratingNL Jia2019CertifiedRT\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003ePercentage of words perturbed, Language Model perplexity, Word embedding distance\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGenetic Algorithm\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eModified, faster version of the Alzantot et al. genetic algorithm, from ([\"Certified Robustness to Adversarial Word Substitutions\" (Jia et al., 2019)](https://arxiv.org/abs/1909.00986))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ehotflip\u003c/code\u003e (word swap) \u003cspan class=\"citation\" data-cites=\"Ebrahimi2017HotFlipWA\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eWord Embedding Cosine Similarity, Part-of-speech match, Number of words perturbed\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGradient-Based Word Swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eBeam search\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e ([\"HotFlip: White-Box Adversarial Examples for Text Classification\" (Ebrahimi et al., 2017)](https://arxiv.org/abs/1712.06751))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eiga\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"iga-wang2019natural\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003ePercentage of words perturbed, Word embedding distance\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGenetic Algorithm\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eImproved genetic algorithm -based word substitution from ([\"Natural Language Adversarial Attacks and Defenses in Word Level (Wang et al., 2019)\"](https://arxiv.org/abs/1909.06723)\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003einput-reduction\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"feng2018pathologies\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eInput Reduction\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eWord deletion\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy attack with word importance ranking , Reducing the input while maintaining the prediction through word importance ranking ([\"Pathologies of Neural Models Make Interpretation Difficult\" (Feng et al., 2018)](https://arxiv.org/pdf/1804.07781.pdf))\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003ekuleshov\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Kuleshov2018AdversarialEF\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eThought vector encoding cosine similarity, Language model similarity probability\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy word swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e([\"Adversarial Examples for Natural Language Classification Problems\" (Kuleshov et al., 2018)](https://openreview.net/pdf?id=r1QZ3zbAZ)) \u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003epruthi\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"pruthi2019combating\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eMinimum word length, Maximum number of words perturbed\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003e{Neighboring Character Swap, Character Deletion, Character Insertion, Keyboard-Based Character Swap}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy search\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003esimulates common typos ([\"Combating Adversarial Misspellings with Robust Word Recognition\" (Pruthi et al., 2019)](https://arxiv.org/abs/1905.11268) \u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003epso\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"pso-zang-etal-2020-word\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eHowNet Word Swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eParticle Swarm Optimization\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e([\"Word-level Textual Adversarial Attacking as Combinatorial Optimization\" (Zang et al., 2020)](https://www.aclweb.org/anthology/2020.acl-main.540/)) \u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003epwws\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"pwws-ren-etal-2019-generating\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eWordNet-based synonym swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR (saliency)\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy attack with word importance ranking based on word saliency and synonym swap scores ([\"Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency\" (Ren et al., 2019)](https://www.aclweb.org/anthology/P19-1103/))\u003c/sub\u003e \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etextbugger\u003c/code\u003e : (black-box) \u003cspan class=\"citation\" data-cites=\"Li2019TextBuggerGA\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted Classification\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUSE sentence encoding cosine similarity\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003e{Character Insertion, Character Deletion, Neighboring Character Swap, Character Substitution}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003e([([\"TextBugger: Generating Adversarial Text Against Real-world Applications\" (Li et al., 2018)](https://arxiv.org/abs/1812.05271)).\u003c/sub\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003etextfooler\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"Jin2019TextFooler\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eUntargeted {Classification, Entailment}\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eWord Embedding Distance, Part-of-speech match, USE sentence encoding cosine similarity\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy attack with word importance ranking  ([\"Is Bert Really Robust?\" (Jin et al., 2019)](https://arxiv.org/abs/1907.11932))\u003c/sub\u003e \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\u003ctd style=\"text-align: center;\" colspan=\"6\"\u003e\u003cstrong\u003e\u003cbr\u003eAttacks on sequence-to-sequence models: \u003cbr\u003e\u003c/strong\u003e\u003c/td\u003e\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003emorpheus\u003c/code\u003e \u003cspan class=\"citation\" data-cites=\"morpheus-tan-etal-2020-morphin\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eMinimum BLEU Score\u003c/sub\u003e \u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eInflection Word Swap\u003c/sub\u003e \u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy search\u003c/sub\u003e \u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy to replace words with their inflections with the goal of minimizing BLEU score ([\"It’s Morphin’ Time! Combating Linguistic Discrimination with Inflectional Perturbations\"](https://www.aclweb.org/anthology/2020.acl-main.263.pdf)\u003c/sub\u003e \u003c/td\u003e\n\u003c/tr\u003e\n\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eseq2sick\u003c/code\u003e :(black-box) \u003cspan class=\"citation\" data-cites=\"cheng2018seq2sick\"\u003e\u003c/span\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eNon-overlapping output\u003c/sub\u003e \u003c/td\u003e\n\u003ctd\u003e\u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eCounter-fitted word embedding swap\u003c/sub\u003e \u003c/td\u003e\n\u003ctd\u003e\u003csub\u003eGreedy-WIR\u003c/sub\u003e\u003c/td\u003e\n\u003ctd \u003e\u003csub\u003eGreedy attack with goal of changing every word in the output translation. Currently implemented as black-box with plans to change to white-box as done in paper ([\"Seq2Sick: Evaluating the Robustness of Sequence-to-Sequence Models with Adversarial Examples\" (Cheng et al., 2018)](https://arxiv.org/abs/1803.01128)) \u003c/sub\u003e  \u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003c/tbody\u003e\n\u003c/font\u003e\n\u003c/table\u003e\n\n\n\n#### Recipe Usage Examples\n\nHere are some examples of testing attacks from the literature from the command-line:\n\n*TextFooler against BERT fine-tuned on SST-2:*\n```bash\ntextattack attack --model bert-base-uncased-sst2 --recipe textfooler --num-examples 10\n```\n\n*seq2sick (black-box) against T5 fine-tuned for English-German translation:*\n```bash\n textattack attack --model t5-en-de --recipe seq2sick --num-examples 100\n```\n\n### Augmenting Text: `textattack augment`\n\nMany of the components of TextAttack are useful for data augmentation. The `textattack.Augmenter` class\nuses a transformation and a list of constraints to augment data. We also offer  built-in recipes\nfor data augmentation:\n- `wordnet` augments text by replacing words with WordNet synonyms\n- `embedding` augments text by replacing words with neighbors in the counter-fitted embedding space, with a constraint to ensure their cosine similarity is at least 0.8\n- `charswap` augments text by substituting, deleting, inserting, and swapping adjacent characters\n- `eda` augments text with a combination of word insertions, substitutions and deletions.\n- `checklist` augments text by contraction/extension and by substituting names, locations, numbers.\n- `clare` augments text by replacing, inserting, and merging with a pre-trained masked language model.\n- `back_trans` augments text by backtranslation approach.\n- `back_transcription` augments text by back transcription approach.\n\n\n#### Augmentation Command-Line Interface\nThe easiest way to use our data augmentation tools is with `textattack augment \u003cargs\u003e`. `textattack augment`\ntakes an input CSV file and text column to augment, along with the number of words to change per augmentation\nand the number of augmentations per input example. It outputs a CSV in the same format with all the augmentation\nexamples corresponding to the proper columns.\n\nFor example, given the following as `examples.csv`:\n\n```csv\n\"text\",label\n\"the rock is destined to be the 21st century's new conan and that he's going to make a splash even greater than arnold schwarzenegger , jean- claud van damme or steven segal.\", 1\n\"the gorgeously elaborate continuation of 'the lord of the rings' trilogy is so huge that a column of words cannot adequately describe co-writer/director peter jackson's expanded vision of j . r . r . tolkien's middle-earth .\", 1\n\"take care of my cat offers a refreshingly different slice of asian cinema .\", 1\n\"a technically well-made suspenser . . . but its abrupt drop in iq points as it races to the finish line proves simply too discouraging to let slide .\", 0\n\"it's a mystery how the movie could be released in this condition .\", 0\n```\n\nThe command\n```bash\ntextattack augment --input-csv examples.csv --output-csv output.csv  --input-column text --recipe embedding --pct-words-to-swap .1 --transformations-per-example 2 --exclude-original\n```\nwill augment the `text` column by altering 10% of each example's words, generating twice as many augmentations as original inputs, and exclude the original inputs from the\noutput CSV. (All of this will be saved to `augment.csv` by default.)\n\n\u003e **Tip:** Just as running attacks interactively, you can also pass `--interactive` to augment samples inputted by the user to quickly try out different augmentation recipes!\n\n\nAfter augmentation, here are the contents of `augment.csv`:\n```csv\ntext,label\n\"the rock is destined to be the 21st century's newest conan and that he's gonna to make a splashing even stronger than arnold schwarzenegger , jean- claud van damme or steven segal.\",1\n\"the rock is destined to be the 21tk century's novel conan and that he's going to make a splat even greater than arnold schwarzenegger , jean- claud van damme or stevens segal.\",1\nthe gorgeously elaborate continuation of 'the lord of the rings' trilogy is so huge that a column of expression significant adequately describe co-writer/director pedro jackson's expanded vision of j . rs . r . tolkien's middle-earth .,1\nthe gorgeously elaborate continuation of 'the lordy of the piercings' trilogy is so huge that a column of mots cannot adequately describe co-novelist/director peter jackson's expanded vision of j . r . r . tolkien's middle-earth .,1\ntake care of my cat offerings a pleasantly several slice of asia cinema .,1\ntaking care of my cat offers a pleasantly different slice of asiatic kino .,1\na technically good-made suspenser . . . but its abrupt drop in iq points as it races to the finish bloodline proves straightforward too disheartening to let slide .,0\na technically well-made suspenser . . . but its abrupt drop in iq dot as it races to the finish line demonstrates simply too disheartening to leave slide .,0\nit's a enigma how the film wo be releases in this condition .,0\nit's a enigma how the filmmaking wo be publicized in this condition .,0\n```\n\nThe 'embedding' augmentation recipe uses counterfitted embedding nearest-neighbors to augment data.\n\n#### Augmentation Python Interface\nIn addition to the command-line interface, you can augment text dynamically by importing the\n`Augmenter` in your own code. All `Augmenter` objects implement `augment` and `augment_many` to generate augmentations\nof a string or a list of strings. Here's an example of how to use the `EmbeddingAugmenter` in a python script:\n\n```python\n\u003e\u003e\u003e from textattack.augmentation import EmbeddingAugmenter\n\u003e\u003e\u003e augmenter = EmbeddingAugmenter()\n\u003e\u003e\u003e s = 'What I cannot create, I do not understand.'\n\u003e\u003e\u003e augmenter.augment(s)\n['What I notable create, I do not understand.', 'What I significant create, I do not understand.', 'What I cannot engender, I do not understand.', 'What I cannot creating, I do not understand.', 'What I cannot creations, I do not understand.', 'What I cannot create, I do not comprehend.', 'What I cannot create, I do not fathom.', 'What I cannot create, I do not understanding.', 'What I cannot create, I do not understands.', 'What I cannot create, I do not understood.', 'What I cannot create, I do not realise.']\n```\nYou can also create your own augmenter from scratch by importing transformations/constraints from `textattack.transformations` and `textattack.constraints`. Here's an example that generates augmentations of a string using `WordSwapRandomCharacterDeletion`:\n\n```python\n\u003e\u003e\u003e from textattack.transformations import WordSwapRandomCharacterDeletion\n\u003e\u003e\u003e from textattack.transformations import CompositeTransformation\n\u003e\u003e\u003e from textattack.augmentation import Augmenter\n\u003e\u003e\u003e transformation = CompositeTransformation([WordSwapRandomCharacterDeletion()])\n\u003e\u003e\u003e augmenter = Augmenter(transformation=transformation, transformations_per_example=5)\n\u003e\u003e\u003e s = 'What I cannot create, I do not understand.'\n\u003e\u003e\u003e augmenter.augment(s)\n['What I cannot creae, I do not understand.', 'What I cannot creat, I do not understand.', 'What I cannot create, I do not nderstand.', 'What I cannot create, I do nt understand.', 'Wht I cannot create, I do not understand.']\n```\n\n#### Prompt Augmentation\nIn additional to augmentation of regular text, you can augment prompts and then generate responses to \nthe augmented prompts using a large language model (LLMs). The augmentation is performed using the same\n`Augmenter` as above. To generate responses, you can use your own LLM, a HuggingFace LLM, or an OpenAI LLM.\nHere's an example using a pretrained HuggingFace LLM: \n\n```python\n\u003e\u003e\u003e from textattack.augmentation import EmbeddingAugmenter\n\u003e\u003e\u003e from transformers import AutoModelForSeq2SeqLM, AutoTokenizer\n\u003e\u003e\u003e from textattack.llms import HuggingFaceLLMWrapper\n\u003e\u003e\u003e from textattack.prompt_augmentation import PromptAugmentationPipeline\n\u003e\u003e\u003e augmenter = EmbeddingAugmenter(transformations_per_example=3)\n\u003e\u003e\u003e model = AutoModelForSeq2SeqLM.from_pretrained(\"google/flan-t5-small\")\n\u003e\u003e\u003e tokenizer = AutoTokenizer.from_pretrained(\"google/flan-t5-small\")\n\u003e\u003e\u003e model_wrapper = HuggingFaceLLMWrapper(model, tokenizer)\n\u003e\u003e\u003e pipeline = PromptAugmentationPipeline(augmenter, model_wrapper)\n\u003e\u003e\u003e pipeline(\"Classify the following piece of text as `positive` or `negative`: This movie is great!\")\n[('Classify the following piece of text as `positive` or `negative`: This film is great!', ['positive']), ('Classify the following piece of text as `positive` or `negative`: This movie is fabulous!', ['positive']), ('Classify the following piece of text as `positive` or `negative`: This movie is wonderful!', ['positive'])]\n```\n\n\n### Training Models:  `textattack train`\n\nOur model training code is available via `textattack train` to help you train LSTMs,\nCNNs, and `transformers` models using TextAttack out-of-the-box. Datasets are\nautomatically loaded using the `datasets` package.\n\n#### Training Examples\n*Train our default LSTM for 50 epochs on the Yelp Polarity dataset:*\n```bash\ntextattack train --model-name-or-path lstm --dataset yelp_polarity  --epochs 50 --learning-rate 1e-5\n```\n\n\n*Fine-Tune `bert-base` on the `CoLA` dataset for 5 epochs**:\n```bash\ntextattack train --model-name-or-path bert-base-uncased --dataset glue^cola --per-device-train-batch-size 8 --epochs 5\n```\n\n\n### To check datasets: `textattack peek-dataset`\n\nTo take a closer look at a dataset, use `textattack peek-dataset`. TextAttack will print some cursory statistics about the inputs and outputs from the dataset. For example,\n```bash\ntextattack peek-dataset --dataset-from-huggingface snli\n```\nwill show information about the SNLI dataset from the NLP package.\n\n\n### To list functional components: `textattack list`\n\nThere are lots of pieces in TextAttack, and it can be difficult to keep track of all of them. You can use `textattack list` to list components, for example, pretrained models (`textattack list models`) or available search methods (`textattack list search-methods`).\n\n\n## Design\n\n\n### Models\n\nTextAttack is model-agnostic!  You can use `TextAttack` to analyze any model that outputs IDs, tensors, or strings. To help users, TextAttack includes pre-trained models for different common NLP tasks. This makes it easier for\nusers to get started with TextAttack. It also enables a more fair comparison of attacks from\nthe literature.\n\n\n\n#### Built-in Models and Datasets\n\nTextAttack also comes built-in with models and datasets. Our command-line interface will automatically match the correct\ndataset to the correct model. We include 82 different (Oct 2020) pre-trained models for each of the nine [GLUE](https://gluebenchmark.com/)\ntasks, as well as some common datasets for classification, translation, and summarization.\n\nA list of available pretrained models and their validation accuracies is available at\n[textattack/models/README.md](textattack/models/README.md). You can also view a full list of provided models\n\u0026 datasets via `textattack attack --help`.\n\nHere's an example of using one of the built-in models (the SST-2 dataset is automatically loaded):\n\n```bash\ntextattack attack --model roberta-base-sst2 --recipe textfooler --num-examples 10\n```\n\n#### HuggingFace support: `transformers` models and `datasets` datasets\n\nWe also provide built-in support for [`transformers` pretrained models](https://huggingface.co/models)\nand datasets from the [`datasets` package](https://github.com/huggingface/datasets)! Here's an example of loading\nand attacking a pre-trained model and dataset:\n\n```bash\ntextattack attack --model-from-huggingface distilbert-base-uncased-finetuned-sst-2-english --dataset-from-huggingface glue^sst2 --recipe deepwordbug --num-examples 10\n```\n\nYou can explore other pre-trained models using the `--model-from-huggingface` argument, or other datasets by changing\n`--dataset-from-huggingface`.\n\n\n#### Loading a model or dataset from a file\n\nYou can easily try out an attack on a local model or dataset sample. To attack a pre-trained model,\ncreate a short file that loads them as variables `model` and `tokenizer`.  The `tokenizer` must\nbe able to transform string inputs to lists or tensors of IDs using a method called `encode()`. The\nmodel must take inputs via the `__call__` method.\n\n##### Custom Model from a file\nTo experiment with a model you've trained, you could create the following file\nand name it `my_model.py`:\n\n```python\nmodel = load_your_model_with_custom_code() # replace this line with your model loading code\ntokenizer = load_your_tokenizer_with_custom_code() # replace this line with your tokenizer loading code\n```\n\nThen, run an attack with the argument `--model-from-file my_model.py`. The model and tokenizer will be loaded automatically.\n\n\n\n### Custom Datasets\n\n\n#### Dataset from a file\n\nLoading a dataset from a file is very similar to loading a model from a file. A 'dataset' is any iterable of `(input, output)` pairs.\nThe following example would load a sentiment classification dataset from file `my_dataset.py`:\n\n```python\ndataset = [('Today was....', 1), ('This movie is...', 0), ...]\n```\n\nYou can then run attacks on samples from this dataset by adding the argument `--dataset-from-file my_dataset.py`.\n\n\n\n#### Dataset loading via other mechanism, see: [more details at here](https://textattack.readthedocs.io/en/latest/api/datasets.html)\n\n```python\nimport textattack\nmy_dataset = [(\"text\",label),....]\nnew_dataset = textattack.datasets.Dataset(my_dataset)\n```\n\n\n\n#### Dataset via AttackedText class\n\nTo allow for word replacement after a sequence has been tokenized, we include an `AttackedText` object\nwhich maintains both a list of tokens and the original text, with punctuation. We use this object in favor of a list of words or just raw text.\n\n\n### Attacks and how to design a new attack\n\n\nWe formulate an attack as consisting of four components: a **goal function** which determines if the attack has succeeded, **constraints** defining which perturbations are valid, a **transformation** that generates potential modifications given an input, and a **search method** which traverses through the search space of possible perturbations. The attack attempts to perturb an input text such that the model output fulfills the goal function (i.e., indicating whether the attack is successful) and the perturbation adheres to the set of constraints (e.g., grammar constraint, semantic similarity constraint). A search method is used to find a sequence of transformations that produce a successful adversarial example.\n\n\nThis modular design unifies adversarial attack methods into one system, enables us to easily assemble attacks from the literature while re-using components that are shared across attacks. We provides clean, readable implementations of 16 adversarial attack recipes from the literature (see above table). For the first time, these attacks can be benchmarked, compared, and analyzed in a standardized setting.\n\n\nTextAttack is model-agnostic - meaning it can run attacks on models implemented in any deep learning framework. Model objects must be able to take a string (or list of strings) and return an output that can be processed by the goal function. For example, machine translation models take a list of strings as input and produce a list of strings as output. Classification and entailment models return an array of scores. As long as the user's model meets this specification, the model is fit to use with TextAttack.\n\n\n\n#### Goal Functions\n\nA `GoalFunction` takes as input an `AttackedText` object, scores it, and determines whether the attack has succeeded, returning a `GoalFunctionResult`.\n\n#### Constraints\n\nA `Constraint` takes as input a current `AttackedText`, and a list of transformed `AttackedText`s. For each transformed option, it returns a boolean representing whether the constraint is met.\n\n#### Transformations\n\nA `Transformation` takes as input an `AttackedText` and returns a list of possible transformed `AttackedText`s. For example, a transformation might return all possible synonym replacements.\n\n#### Search Methods\n\nA `SearchMethod` takes as input an initial `GoalFunctionResult` and returns a final `GoalFunctionResult` The search is given access to the `get_transformations` function, which takes as input an `AttackedText` object and outputs a list of possible transformations filtered by meeting all of the attack’s constraints. A search consists of successive calls to `get_transformations` until the search succeeds (determined using `get_goal_results`) or is exhausted.\n\n\n## On Benchmarking Attacks\n\n- See our analysis paper: Searching for a Search Method: Benchmarking Search Algorithms for Generating NLP Adversarial Examples at [EMNLP BlackBoxNLP](https://arxiv.org/abs/2009.06368).\n\n- As we emphasized in the above paper, we don't recommend to directly compare Attack Recipes out of the box.\n\n- This comment is due to that attack recipes in the recent literature used different ways or thresholds in setting up their constraints. Without the constraint space held constant, an increase in attack success rate could come from an improved search or transformation method or a less restrictive search space.\n\n- Our Github on benchmarking scripts and results:  [TextAttack-Search-Benchmark Github](https://github.com/QData/TextAttack-Search-Benchmark)\n\n\n## On Quality of Generated Adversarial Examples in Natural Language\n\n- Our analysis Paper in [EMNLP Findings](https://arxiv.org/abs/2004.14174)\n- We analyze the generated adversarial examples of two state-of-the-art synonym substitution attacks. We find that their perturbations often do not preserve semantics, and 38% introduce grammatical errors. Human surveys reveal that to successfully preserve semantics, we need to significantly increase the minimum cosine similarities between the embeddings of swapped words and between the sentence encodings of original and perturbed sentences.With constraints adjusted to better preserve semantics and grammaticality, the attack success rate drops by over 70 percentage points.\n- Our Github on Reevaluation results: [Reevaluating-NLP-Adversarial-Examples Github](https://github.com/QData/Reevaluating-NLP-Adversarial-Examples)\n- As we have emphasized in this analysis paper, we recommend researchers and users to be EXTREMELY mindful on the quality of generated adversarial examples in natural language\n- We recommend the field to use human-evaluation derived thresholds for setting up constraints\n\n\n\n## Multi-lingual Support\n\n\n- see example code: [https://github.com/QData/TextAttack/blob/master/examples/attack/attack_camembert.py](https://github.com/QData/TextAttack/blob/master/examples/attack/attack_camembert.py) for using our framework to attack French-BERT.\n\n- see tutorial notebook: [https://textattack.readthedocs.io/en/latest/2notebook/Example_4_CamemBERT.html](https://textattack.readthedocs.io/en/latest/2notebook/Example_4_CamemBERT.html) for using our framework to attack French-BERT.\n\n- See [README_ZH.md](https://github.com/QData/TextAttack/blob/master/README_ZH.md) for our README in Chinese\n\n\n\n## Contributing to TextAttack\n\nWe welcome suggestions and contributions! Submit an issue or pull request and we will do our best to respond in a timely manner. TextAttack is currently in an \"alpha\" stage in which we are working to improve its capabilities and design.\n\nSee [CONTRIBUTING.md](https://github.com/QData/TextAttack/blob/master/CONTRIBUTING.md) for detailed information on contributing.\n\n## Citing TextAttack\n\nIf you use TextAttack for your research, please cite [TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP](https://arxiv.org/abs/2005.05909).\n\n```bibtex\n@inproceedings{morris2020textattack,\n  title={TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP},\n  author={Morris, John and Lifland, Eli and Yoo, Jin Yong and Grigsby, Jake and Jin, Di and Qi, Yanjun},\n  booktitle={Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations},\n  pages={119--126},\n  year={2020}\n}\n```\n","funding_links":[],"categories":["Uncategorized","🛡️ Adversarial Testing","Python","Open Source Security Tools","Adversarial Attacks","Natural Language Processing","对抗学习与鲁棒性","Industry-strength AD","📖 Natural Language Processing (NLP)","[↑](#table-of-contents)Tools \u003ca name=\"tools\"\u003e\u003c/a\u003e","🏹️ Adversarial Attack","Tools","Tools and Libraries","Safety and Security Testing","LLM SECURITY / AI SECURITY","2. Business Cases and Implementations","The List of AI Testing Tools","2. Adversarial Machine Learning","Attack Techniques \u0026 Red Teaming"],"sub_categories":["Uncategorized","Others","Tools","Red-Teaming Harnesses \u0026 Automated Security Testing","Red Teaming","Adversarial Testing","AI Red Teaming \u0026 Adversarial Testing","2.2. NLP","7. TextAttack","2.1 Toolkits \u0026 Libraries","Adversarial ML \u0026 Classical Models"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQData%2FTextAttack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQData%2FTextAttack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQData%2FTextAttack/lists"}