Repository navigation
Description
Part of #511.
Is your feature request related to a problem? Please describe.
Does a refusal still hold if one or two characters in a harmful request are changed in a way a human can't see? garak's badchars.BadCharacters probe tests exactly that, based on Boucher et al., "Bad Characters: Imperceptible NLP Attacks" (IEEE S&P 2022, https://arxiv.org/abs/2106.09898). It applies a small budget of perturbations (default: 1 per prompt) across four categories:
- Invisible characters: ZWSP / ZWNJ / ZWJ inserted at selected positions
- Homoglyphs: one character swapped for a look-alike from Unicode's
intentional.txt - Reordering: two adjacent characters visually swapped using nested bidi controls
- Deletions: an ASCII character followed by a backspace (U+0008)
PyRIT has related converters, but I couldn't find a scenario covering this combination of budgeted perturbations:
| Category | Existing converter | Gap |
|---|---|---|
| Invisible | ZeroWidthConverter |
Inserts ZWSP between every character; no budget, no ZWNJ/ZWJ |
| Homoglyph | UnicodeConfusableConverter |
Replaces every confusable character; no budget |
| Reordering | BidiConverter |
Wraps the whole prompt rather than swapping two adjacent characters |
| Deletion | — | Not covered |
This is also distinct from Best-of-N/CharNoiseConverter (#2277) and char_split (#3381), which apply visible noise. BadCharacters perturbations render identically to the original text.
Describe the solution you'd like
A BadCharacters scenario in pyrit/scenario/scenarios/garak/, structured like the Encoding scenario (one technique per category), using a capped, deterministic sample from an existing harmful-behavior dataset and the scenario's default objective scorer, as FigStep does.
My recommendation: add an optional budget parameter to ZeroWidthConverter and UnicodeConfusableConverter (current behavior stays the default), and add new converters for the adjacent-character bidi swap and the backspace deletion. Happy to adjust if you'd prefer a different split.
I would like to take this.
Activity
richlundeen commentedon Nov 25, 2026
Mohammad Aatif Shaikh (@aatif101), thanks for the clear gap analysis, and sorry for the slow reply. This fits the parity work in #511, so I assigned it to you. Your split works: add an optional budget to
ZeroWidthConverterandUnicodeConfusableConverterwith today's behavior as the default, and add new converters for the adjacent-character bidi swap and the backspace deletion, since those are new transformations.