In computer vision, adversarial perturbations are typically modeled as continuous noise restricted within an $L_p$-ball. In natural language processing, however, text is fundamentally discrete and hierarchical. An attacker can manipulate a text input at several distinct layers of granularity:
- Character-level: Introducing typos, misspellings, or character insertions and deletions.
- Word-level: Replacing keywords with semantically similar synonyms.
- Phrase-level: Altering multi-token spans or injecting variable-length text fragments.
- Sentence-level: Paraphrasing entire sentences or introducing distracting structural modifications.
The core challenge in securing NLP models is the cross-granularity generalization gap. Because defenses are typically optimized for a single level of linguistic manipulation, they remain critically vulnerable when an attacker shifts the scope of the perturbation to a different granularity.
The Granularity Silo Problem
Most adversarial defenses are engineered within strict granularity silos. The vast majority of both empirical and certified defense frameworks focus exclusively on word-level synonym substitutions.
For instance, Hong Liu proposed modeling word substitutions as a convex hull in vector space to induce stability against synonym swaps. Similarly, Yibin Wang et al. designed specialized word embeddings to tighten safety bounds, while Siqi Sun and Wenjie Ruan developed TextVerifier to provide certifiable guarantees against word substitutions. Other popular defense strategies—such as label smoothing (Soham Dan et al.), randomized word substitution (Xiaosen Wang et al.), and weight perturbations (Jianhan Xu et al.)—are fundamentally tuned to the statistics of word-for-word replacements.
While these methods successfully harden models against specific synonym-swapping algorithms, they create a narrow perimeter of defense. Because they rely on the specific geometry or vocabulary of word-level changes, they fail to generalize when an attack operates above or below the word level.
Why Word-Level Defenses Fail at Other Scales
To understand why these defenses fail to generalize, we must look at how text representations change under different types of noise.
Consider a defense like the Dirichlet Neighborhood Ensemble proposed by Yi Zhou et al., which smooths a model's predictions over a neighborhood of semantic synonyms. This mechanism relies entirely on the assumption that the perturbed word maps to a known, semantically close vector in a fixed embedding space.
If an attacker drops down to the character level and introduces a subtle typo (e.g., replacing "bad" with "b@d"), the subword tokenizer breaks the token into entirely different, rare, or out-of-vocabulary subwords. The word-level defense is completely bypassed because the underlying embedding lookup is disrupted before the synonym-smoothing logic can even be applied. As noted by Yibin Wang et al., this leaves certified word-level models entirely exposed to orthographic manipulations.
Conversely, if an attacker scales up to phrase-level or structural modifications—such as the variable-length span transformations generated by ValCAT (Chuyun Deng et al.) or the phrase-level swaps in PLAT (Yibin Lei et al.)—the perturbation alters the syntactic structure of the sentence. Defenses that rely on isolating and smoothing the influence of individual words, such as TextShield (Lingfeng Shen et al.) or SHAP-based detection (Lukas Huber et al.), struggle because the adversarial effect is distributed across multi-token sequences rather than localized to a single keyword.
The Paradox of One-Sided Hardening
The problem is deeper than a simple lack of coverage: optimizing a model for one granularity can actively degrade its robustness to another.
In Revisiting Character-level Adversarial Attacks for Language Models, the authors demonstrate a striking cross-granularity trade-off: training paradigms designed to protect against word-level attacks can actually increase a model's susceptibility to character-level noise.
When a model is forced during training to become invariant to word substitutions (for instance, by collapsing synonym embeddings together), it often compensates by over-indexing on exact subword structures and character arrangements to maintain classification performance. This makes the model uniquely fragile to minor orthographic shifts.
Conversely, character-level denoising models like CharBERT (Wentao Ma et al.) successfully neutralize typos by reconstructing subword representations, but they remain completely vulnerable to high-level semantic shifts like synonym swaps or sentence paraphrasing because their objective is focused on low-level orthographic restoration rather than semantic invariance.
Moving Toward Unified Robustness
As observed by Moustafa Alzantot et al. and Yotam Gil et al., character-only or word-only substitution models fail to capture the full spectrum of human-readable text modifications. Real-world adversarial vulnerabilities span across multiple granularities simultaneously.
Achieving true robustness requires moving past fixed synonym lists (Hong Liu) or token-specific honeypots (Noseong Park et al.). The field currently lacks a unified mathematical framework capable of simultaneously bounding discrete character mutations, semantic word substitutions, and fluid syntactic paraphrases. Until defenses can bridge this cross-granularity gap, text classifiers will remain vulnerable to attackers who simply change the scale of their perturbations.
Key Foundational Work
Generating Natural Language Adversarial Examples (2018) — contributed 1 concept elements to this direction.
White-to-Black: Efficient Distillation of Black-Box Adversarial Attacks (2019) — contributed 1 concept elements to this direction.