Attacking Neural Text Detectors

Max WolffarXiv 2020

Abstract

Neural text detectors are designed to identify AI-generated content, but they are surprisingly fragile. This paper demonstrates that simple black-box attacks—such as replacing characters with visually identical Unicode homoglyphs or introducing common typos—can cause a top detector's recall to plummet from 97.44% to nearly 0%. These findings suggest that current detection methods rely on fragile token-level statistics rather than a deep understanding of human writing, making them vulnerable to adversarial manipulation.

Introduction

As large language models (LLMs) like GPT-2 and its successors become increasingly capable of generating coherent, human-like prose, the risk of automated misinformation campaigns grows. To counter this, researchers have developed "neural text detectors" (such as RoBERTa-based classifiers and GROVER) that identify the predictable statistical patterns inherent in machine-generated text.

However, machine learning models are notoriously susceptible to adversarial attacks. This study investigates whether these detectors can be bypassed using "black-box" methods—attacks that require no knowledge of the model's internal weights—while keeping the text perfectly legible to human readers.

Methodology

The researchers proposed two distinct classes of black-box attacks:

  1. Homoglyph Attacks (Non-human-like): This method exploits Unicode by replacing standard Latin characters with visually similar characters from other alphabets (e.g., replacing an English "a" with a Cyrillic "а"). While humans see no difference, the model's tokenizer sees entirely different characters, breaking the statistical patterns the detector relies on.
  2. Misspelling Attacks (Human-like): This method simulates human error by randomly replacing correctly spelled words with common misspellings sourced from Wikipedia. The goal is to shift the text's distribution toward the "messier" nature of human writing.

The study utilized a dataset of 5,000 text samples generated by the GPT-2 1.5B model (using top-k 40 sampling), with human-written baselines drawn from the WebText dataset.

Experimental Results

The impact of these simple perturbations was devastating. On unaltered neural text, the RoBERTa detector achieved a recall of 97.44%. However, as shown in Figure 1, accuracy drops precipitously as even a small percentage of characters are replaced.

Detector accuracy vs. percentage of characters replaced.

Specifically, after replacing all English "e"s and "a"s with Cyrillic homoglyphs, RoBERTa's recall plummeted to 0.26%. The researchers identified a "vowel vulnerability": because vowels appear in almost every word, swapping them causes a massive shift in the token distribution with very few character changes. Even the more "human-like" misspelling attack was highly effective; a 5% misspelling rate (1 in 20 words) dropped recall to 22.68%.

Statistical Shift and Transferability

The attacks work by disrupting the specific statistical signatures of the language model, causing the detector to default to a "human" classification by process of elimination. This shift is clearly visible in tools like GLTR, which helps humans spot AI text by highlighting word predictability.

Visualizing the statistical shift in AI-generated text before (a) and after (b) a homoglyph attack.

As illustrated in Figure 2, the homoglyph attack (bottom) causes a massive shift in the word rank distribution. The average "rank" of words shifted from 14.05 for neural text to 371.41 for attacked text—far higher than even natural human writing (128.26). Furthermore, these attacks proved transferable: an attack designed to fool RoBERTa also successfully deceived GROVER, suggesting a fundamental shared reliance on fragile token-level statistics.

Discussion and Conclusion

While homoglyph attacks are devastating, they can be mitigated through "sanitization" pre-processing (e.g., Unicode normalization). However, human-like attacks involving misspellings or grammatical shifts present a much greater challenge, as they are harder to programmatically correct without altering the text's meaning.

The findings highlight a critical vulnerability: current detectors identify what isn't machine writing rather than understanding what is human writing. Future research must focus on making detectors robust against stylistic perturbations, forcing them to move beyond simple token-level statistics toward a deeper understanding of linguistic nuance.

Summary updated

BibTeX
@misc{wolff2020attacking,
  author = {Max Wolff},
  title = {{Attacking Neural Text Detectors}},
  year = {2020},
  eprint = {2002.11768},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.11768},
}
Figure