Contrasting Human- and Machine-Generated Word-Level Adversarial Examples for Text Classification

Maximilian Mozes, Max Bartolo, Pontus Stenetorp, Bennett Kleinberg, Lewis D. Griffin

TL;DR

While NLP models are famously vulnerable to adversarial attacks, many algorithmic attacks produce "nonsense" text that fails to preserve the original meaning. This paper investigates whether humans can do better: it turns out humans are incredibly efficient—flipping model predictions in just ~11 queries compared to thousands for machines—but they still struggle to maintain the original sentiment and naturalness as well as the best algorithms.

Introduction

In computer vision, an "adversarial example" is often an invisible change to pixels that misleads a model. In Natural Language Processing (NLP), this is significantly more challenging because changing even a single word is immediately apparent to a human reader. Recent research has criticized popular word-level attacks for producing text that is ungrammatical, unnatural, or—most critically—changes the actual meaning of the sentence. If an attack changes the ground-truth label (e.g., turning a positive review negative), it is no longer a successful adversarial attack but a different sentence entirely. This study explores whether valid, natural-sounding, word-level adversarial examples are possible and if humans can find them more effectively than current algorithms.

Methods

The researchers conducted a two-stage experiment involving human crowdworkers and four state-of-the-art algorithms: TEXTFOOLER, GENETIC, BAE, and SEMEMEPSO.

  1. Generation: Human participants performed a "black-box" attack on a high-performing RoBERTa model using a custom web interface. To assist them, the interface provided "word saliency" highlights, indicating which words the model was most sensitive to. Humans were restricted to word substitutions only, matching the constraints placed on the algorithms.
  2. Validation: Independent human judges then rated the resulting adversarial sequences on a 5-point scale for naturalness and sentiment preservation to ensure the attacks were valid and didn't simply change the underlying meaning.
The custom web interface used by human crowdworkers to identify and substitute words to flip model predictions.

Key Insights

The Efficiency Gap

Humans demonstrated remarkable efficiency compared to automated methods. On average, humans required only 10.9 queries to the model to find a successful attack. In contrast, the GENETIC algorithm required over 3,500 queries, and SEMEMEPSO exceeded 140,000. This suggests that humans possess a "semantic intuition" for model vulnerabilities that current heuristic or brute-force algorithms lack.

The Validity Struggle

Despite their efficiency, humans found the task difficult. Only 58% of successful human attacks actually preserved the original sentiment according to independent judges. This indicates that the strict constraints of word-level-only substitutions may be too restrictive to allow for truly "invisible" adversarial attacks in text, even for human attackers.

No "Human Touch" Advantage in Naturalness

Surprisingly, human-generated examples were not significantly more natural than those produced by the best algorithms. While humans and SEMEMEPSO were the "cleanest" in terms of grammar, machines like TEXTFOOLER have become highly proficient at selecting synonyms that fit the context while maintaining the original sentiment better than humans.

Key Results

A comparison of sentiment preservation (Match S) and naturalness (Match U) across human and algorithmic attacks.
  • Attack Success Rate (ASR): Humans successfully flipped the model's prediction 48.8% of the time. While algorithms like SEMEMEPSO and TEXTFOOLER achieved near 100% success, they did so at the cost of massive query counts.
  • Sentiment Preservation: TEXTFOOLER was the top performer, preserving sentiment in 93% of cases, significantly outperforming humans at 58%.
  • Grammar: BAE was the worst offender for grammatical errors, while humans and SEMEMEPSO maintained the highest text quality.

Conclusion

The study highlights that while humans are far more efficient at finding model weaknesses, they struggle to maintain semantic consistency under strict substitution constraints. The authors suggest that human "search strategies" could inspire new, more computationally efficient algorithms. Future work may explore phrase-level attacks to give human creativity more freedom to restructure sentences while maintaining naturalness.

Summary updated

BibTeX
@inproceedings{mozes2021contrasting,
  author = {Maximilian Mozes and Max Bartolo and Pontus Stenetorp and Bennett Kleinberg and Lewis D. Griffin},
  title = {{Contrasting Human- and Machine-Generated Word-Level Adversarial Examples for Text Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.651},
}
Figure