Researchers and ML engineers who want a free MIT-licensed Python framework to attack, augment data for and train NLP models
Teams that run text classifiers, such as spam, toxicity or sentiment models, and want to measure how word and character changes flip their output
Consider instead if
You want to probe a chat model or LLM application for prompt injection and jailbreaks rather than a classic NLP model.
See garak.
Your model takes images, audio or tabular data, or you also need poisoning, extraction and inference attacks and defenses.
See ART.
What TextAttack does
TextAttack comes out of 2020 NLP security research: it changes words and characters until a text classifier or translation model gives a different answer, a different threat from prompt injection against a chat model. The QData team's paper split every attack into a goal function, constraints, a transformation and a search method, and shipped 16 published attacks in that form. The docs now list 24 recipes, including two for sequence-to-sequence models and recipes for French, Spanish and Chinese. The same parts drive data augmentation and adversarial training, so one library can attack a model and then retrain it on the results. Pick it for classic NLP models, ART for image or tabular models, and garak for chat LLMs. It is MIT licensed and installs with pip; the repository has no security policy.
This summary is our own wording of the sourced facts on this page.
Key facts
Each value links to the page that states it, with the date we checked it.
Our editorial model, not a standard. The primary layer follows the category, except for tools whose main documented job is detection and response; other layers rest on a capability the sources document.
How the model works.
AI security layers that TextAttack covers, with the role, how each applies and what it rests on
Attack and evaluate models, apps and agents on purpose, before release and after every change, to find what the other layers miss.
Follows its category, AI red teaming & LLM evaluation
OWASP LLM Top 10 mapping
Our analysis
The risk list is OWASP's (Top 10 for LLM Applications, 2025).
The mapping is our analysis, and each row rests on a capability the sources document.
No OWASP LLM risk is mapped to this tool in our analysis.
Not mapped in our analysis: LLM01, LLM02, LLM05, LLM06, LLM07, LLM09.
These are risks we expect tools in this category to cover; the sources we checked do not document a matching capability.
Generates adversarial test suites for LLM agents and RAG apps, runs them and reports failures by threat type.
Best for: Python teams that want a free library to scan an LLM agent or RAG app for prompt injection and harmful output, and to write pass or fail checks for it
Runs evals and red team scans against LLM apps from a CLI or CI pipeline and writes a vulnerability report.
Best for: Developer teams that want one open-source CLI for both prompt evals and red teaming, run locally and in CI
80Coverage Score 80 out of 100
LLM01 Prompt Injection
LLM02 Sensitive Information Disclosure
LLM09 Misinformation
Reviewed
TextAttack FAQ
Is TextAttack open source?
Yes. TextAttack is released under the MIT license, and the code is on GitHub at QData/TextAttack.
What is TextAttack built for?
The README describes a Python framework for adversarial attacks, data augmentation and model training in NLP, with attacks assembled from four components.
Can TextAttack test an LLM application for prompt injection?
The README describes attacks on NLP models and a prompt augmentation pipeline that can send augmented prompts to an LLM. It does not mention prompt injection or jailbreak testing, so see the alternatives listed on this page for that use case.
How many attacks does TextAttack include?
The 2020 paper implements 16 attacks from the literature. The current docs list 24 attack recipes, such as TextFooler, DeepWordBug and BERT-Attack, plus MORPHEUS and Seq2Sick for sequence-to-sequence models and recipes for French, Spanish and Chinese.
Last reviewed . We compile from the vendors' own public
pages and repositories and we do not run the products. Source links open in a new tab. Found a mistake? Report a correction.
We may use analytics and, later, show ads. They stay off until you choose, wherever you are. Declining
never limits what you can read. See our privacy policy and
cookie policy.
Privacy settings
Choose what you allow. Your choice is stored on this device for 13 months. You can change it later from the
"Privacy choices" link in the footer.