Library · published 2022-12-24 · added 2026-08-30 · github.com

TextGrad

What it is

TextGrad is a research implementation for generating adversarial text examples using gradient-driven optimization. It works by treating text as a continuous variable, optimizing it to fool transformer-based language models (like BERT) while maintaining semantic validity, and supports both attacking and robust training workflows.

The problem it solves

Existing adversarial attacks on text often rely on discrete search or random perturbations, which are inefficient or fail to find high-quality, semantically valid adversarial examples that effectively fool transformer models.

What you could use it for

adversarial-attacksnlprobustnesstext-optimizationtransformers

Read the source ↗Back to the library →

Summary written by an AI model from the source; check the source before you rely on it.