AdvExpander: Generating Natural Language Adversarial Examples by Expanding Text

Zhihong Shao, Zitao Liu, Jiyong Zhang, Zhongqin Wu, Minlie Huang

TL;DR

AdvExpander introduces a novel way to evaluate NLP model robustness by expanding text with adversarial modifiers rather than substituting words. By searching the latent space of a pre-trained conditional variational autoencoder (CVAE) using linguistic constraints, it successfully fools state-of-the-art models—including those explicitly hardened against word substitution—while remaining perfectly readable and semantically valid to humans.

What Problem Does This Paper Address?

Most adversarial attacks on NLP models rely on substitution—swapping words for synonyms, introducing typos, or changing characters. While effective, this approach restricts the search space to a tiny neighborhood around the original text. It fails to capture how models handle broader linguistic variations, such as syntactic changes or the addition of contextual details.

AdvExpander addresses this gap by shifting the paradigm from substitution to insertion. This allows researchers to uncover hidden structural vulnerabilities that traditional substitution-based methods completely miss.

Methods

AdvExpander operates in two distinct stages:

  1. Determining Insertion Instructions: The system uses a constituency parser and handcrafted templates to identify "safe" targets for expansion (e.g., noun phrases or verb phrases) without ruining the sentence structure. It considers four modifier types: adverb phrases (ADVP), prepositional phrases (PP), appositives (Appos), and clauses (CL.). Crucially, for text-matching tasks like paraphrase detection, it enforces a heuristic rule: it only expands shared constituents in both sentences with the exact same modifiers to ensure the ground-truth label is preserved.
  2. Searching Adversarial Modifiers: To generate fluent modifiers, the authors pre-train a CVAE on a massive corpus. Instead of fine-tuning the CVAE directly (which can degrade text quality), they freeze its parameters and train a lightweight feed-forward network (an adversarial prior network) using REINFORCE. This network searches the latent space for codes that maximize the target model's error. Finally, a beam search generates candidate sentences, and GPT-2 selects the most natural-sounding successful adversarial example based on perplexity.
The two-stage workflow of AdvExpander, showing insertion instruction determination and latent space beam search.

Datasets

  • SNLI (Stanford Natural Language Inference): For evaluating natural language inference (entailment, contradiction, neutral).
  • QQP (Quora Question Pairs): For paraphrase identification.
  • IMDB: For document-level sentiment classification.
  • Billion Word Benchmark: Used exclusively for pre-training the CVAE generative model to ensure smooth, fluent text generation.

Key Insights and Ideas

  • Substitution Robustness $\neq$ Insertion Robustness: Models like RBOW and RCNN, which are mathematically certified or robustly trained against word substitutions, fall surprisingly easily to text expansion. This proves that current defense mechanisms are over-specialized and blind to structural additions.
  • Complementary Attack Vectors: Because insertion and substitution operate in entirely different search spaces, they can be combined. Merging AdvExpander with substitution methods (like TextFooler) creates a significantly more potent attack than combining two different substitution methods.
  • Conditioning on Constituents: Instead of generating a whole sentence or conditioning on the entire text, the CVAE generates modifiers conditioned strictly on the target constituent. This keeps the latent space dense and smooth, making it highly transferable across different datasets.

Key Results

  • Massive Accuracy Drops: AdvExpander drastically degrades state-of-the-art models. For instance, BERT's accuracy plummeted from 90.7% to 27.2% on SNLI, and from 92.0% to 16.4% on IMDB.
  • Defeating Certified Defenses: On the IMDB dataset, the robust RCNN model maintained a solid 10.0% accuracy against TextFooler but dropped to 1.8% when facing a combined AdvExpander + TextFooler attack.
  • High Human Fidelity: Human evaluators maintained high accuracy (80.0% on QQP, 84.5% on IMDB) when classifying AdvExpander's adversarial examples, confirming that the insertions preserve the original semantic labels and maintain natural readability.
Performance comparison showing model accuracies under various individual and combined adversarial attacks.

Limitations and Future Work

  • Rigid Linguistic Rules: The method relies heavily on handcrafted parsing templates and the accuracy of off-the-shelf constituency parsers. If a sentence structure doesn't fit the templates, AdvExpander safely skips it rather than risking an ungrammatical insertion.
  • Search Efficiency: While parallelizable, running a reinforcement learning-based latent space search combined with beam search and GPT-2 scoring is computationally expensive compared to simple synonym swapping.
  • Future Directions: The authors suggest that future work could explore automated rule discovery or end-to-end structural insertion models that don't rely on rigid parsing templates.

Summary updated

BibTeX
@article{shao2020advexpander,
  author = {Zhihong Shao and Zitao Liu and Jiyong Zhang and Zhongqin Wu and Minlie Huang},
  title = {{AdvExpander: Generating Natural Language Adversarial Examples by Expanding Text}},
  journal = {IEEE ACM Trans. Audio Speech Lang. Process.},
  year = {2020},
  doi = {10.1109/taslp.2021.3129339},
}
Figure