AI red teaming & LLM evaluation

TextAttack: open-source NLP adversarial attack framework

TextAttack is an open-source NLP adversarial attack framework from QData. It is released under the MIT license and is offered as: CLI, Library.

  • Last reviewed

Best for

  • 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.

Security page
Not documented in the sources we checked
Attestations or disclosure
Not documented in the sources we checked

Capabilities

As documented by the vendor or project. The tag is our label from a controlled vocabulary.

Integrations

Where TextAttack fits in our AI security layers

Our analysis

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
LayerRoleHow it appliesBased on
L4 Testing Testing and red teaming Primary 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.

Alternatives and related tools

More in AI red teaming & LLM evaluation, ranked within the category by Coverage Score.

garak

NVIDIA

Open sourceApache-2.0
  • CLI
  • Library
  • Self-hosted

Probes language models and LLM apps for prompt injection, jailbreaks, data leakage and more.

Best for: Teams that want a free command-line scanner they can point at any model or LLM endpoint before release

Coverage Score 82 out of 100
  • LLM01 Prompt Injection
  • LLM02 Sensitive Information Disclosure
  • LLM09 Misinformation

Reviewed

Giskard

Giskard AI

Open sourceApache-2.0 Freemium
  • Library
  • Self-hosted
  • SaaS
  • On-prem

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

Coverage Score 81 out of 100
  • LLM01 Prompt Injection
  • LLM02 Sensitive Information Disclosure
  • LLM09 Misinformation

Reviewed

Promptfoo

OpenAI (Promptfoo)

Open sourceMIT Freemium
  • CLI
  • Library
  • Self-hosted
  • SaaS
  • On-prem

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

Coverage 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.

Key facts you can cite

We have no commercial relationship with QData.

Sources & last reviewed

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.