Reasoning Robustness of LLMs to Adversarial Typographical Errors

Esther Gan, Yiran Zhao, Liying Cheng, Yancan Mao, Anirudh Goyal, Kenji Kawaguchi, Min-Yen Kan, Michael Shieh

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in complex reasoning, often facilitated by Chain-of-Thought (CoT) prompting. However, these models exhibit a surprising fragility: minor typographical errors in a user's query can cause their reasoning processes to collapse. This paper introduces the Adversarial Typo Attack (ATA), an algorithm designed to strategically insert "innocuous" typos that significantly degrade model performance. To evaluate this vulnerability, the authors developed the $R^2ATA$ benchmark, revealing how common human errors can trigger a "cascade of errors" in multi-step logic.

The Adversarial Typo Attack (ATA)

The core of this research is the ATA, a white-box attack method that identifies and exploits character-level vulnerabilities. Unlike random noise, ATA is strategic, following a three-step iterative process to maximize the probability of model failure.

The Adversarial Typo Attack (ATA) process: identifying critical tokens via gradients, sampling human-like typos, and optimizing for model failure.
  1. Identify Important Tokens: The algorithm uses gradients to determine which words in a prompt most heavily influence the model's output.
  2. Sample Typos: It generates candidate typos based on four common human error patterns: proximity (adjacent keys), double-typing (repeated characters), omission (missing letters), and extra whitespace.
  3. Optimize for Failure: The attack selects the specific typo that most effectively increases the likelihood of a "refusal" response or a logical breakdown.

While developed using white-box access to models like Mistral-7B, these adversarial prompts are remarkably transferable to black-box, closed-source models like GPT-4.

The $R^2ATA$ Benchmark

To quantify reasoning robustness, the researchers established the $R^2ATA$ benchmark. This collection of adversarial questions is derived from three iconic reasoning datasets:

  • GSM8K: Grade school math word problems requiring multi-step arithmetic.
  • BBH (Big-Bench Hard): Complex tasks designed to challenge LLM capabilities.
  • MMLU (Massive Multitask Language Understanding): A broad evaluation covering STEM, humanities, and social sciences.

By applying ATA to these datasets, the authors created a rigorous testing ground for measuring how well models maintain logical consistency in the presence of low-level noise.

Key Insights: Why Reasoning Fails

The study provides several critical insights into why typos disrupt high-level reasoning:

  • The Attention Shift: Analysis of attention maps reveals that typos cause models to "lose focus." In a clean prompt, the model attends to critical keywords; once a typo is introduced, attention shifts to irrelevant tokens, leading to a breakdown in logic.
  • Nouns as the Achilles' Heel: The attack's effectiveness is highly dependent on the part of speech targeted.
Distribution of parts of speech targeted by ATA; nouns are the primary targets, accounting for nearly 50% of successful adversarial edits.

As shown in the data, nearly 50% of the most effective edits targeted nouns. Because nouns often represent the primary subjects or variables in a reasoning task, modifying them carries the highest "semantic weight," making them the most vulnerable points in a prompt.

  • Reasoning Cascades: CoT prompting, while powerful, acts as a double-edged sword. A typo-induced error in an early step—such as misidentifying a variable—propagates through subsequent steps. The resulting output may be internally logical but is factually incorrect due to the initial misinterpretation.

Results and Model Resilience

The impact of ATA is most dramatic on smaller and open-source models. For instance, Mistral-7B-Instruct saw its accuracy on GSM8K plummet from 43.7% to 19.2% with just eight character edits. Similarly, Vicuna-33B experienced a drop from 38.2% to 26.4%.

The transferability of these attacks is also significant. Attacks optimized for Mistral-7B reduced the performance of ChatGPT and Mixtral-8x7B by approximately 6.5% to 6.7%. In contrast, GPT-4 demonstrated the highest resilience, with only a minor 3.5% drop on GSM8K. This suggests that as models reach higher levels of linguistic comprehension, they develop a "human-like" ability to ignore minor typographical noise.

Conclusion

This research serves as a sobering reminder of the underlying fragility of current LLM reasoning. While these models can solve complex problems, their foundation remains sensitive to the simplest human mistakes. Future work must focus on developing robust defense mechanisms, such as automated spell-check layers or more resilient training objectives, to ensure that the next generation of AI can handle the inherent "noise" of human communication.

Summary updated

BibTeX
@inproceedings{gan2024reasoning,
  author = {Esther Gan and Yiran Zhao and Liying Cheng and Yancan Mao and Anirudh Goyal and Kenji Kawaguchi and Min-Yen Kan and Michael Shieh},
  title = {{Reasoning Robustness of LLMs to Adversarial Typographical Errors}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.584},
}
Figure