Introduction
Large Language Models (LLMs) have achieved impressive benchmarks in solving Math Word Problems (MWPs). However, a critical question remains: are these models performing true logical reasoning, or are they simply exploiting statistical patterns in the training data? To probe this, researchers developed MathAttack, a framework designed to stress-test LLMs by altering the linguistic context of a math problem without changing its mathematical structure.
The MathAttack Methodology
Traditional adversarial attacks often fail in the mathematical domain because they inadvertently change the problem's logic (e.g., changing a price from $140 to $100), rendering the original ground-truth answer incorrect. MathAttack solves this through a three-stage "logic preservation" pipeline:
- Logical Entity Recognition: The system uses Named Entity Recognition (NER) to identify "Logical Entities"—the backbone of the math problem. This includes roles (names), numbers (quantities), and scenarios (time/location).
- Freezing: These identified entities are "frozen," preventing the attacker from modifying them. This ensures the mathematical logic remains 100% intact.
- Word-Level Attack: The system targets the remaining "modifiable" words. Using a BertAttack-based approach, it identifies words critical to the model's confidence and replaces them with semantically similar synonyms.
Experimental Evaluation
The framework was tested on two standard benchmarks, GSM8K and MultiArith, as well as a new human-verified dataset called RobustMath. RobustMath contains 300 high-quality adversarial samples where the logic is guaranteed to be identical to the original.
Key Results
The findings reveal a significant "robustness gap" in current LLMs:
- High Success Rates: On GPT-3.5 (ChatGPT), MathAttack achieved an Attack Success Rate (ASR) of approximately 40%. This means that in 4 out of 10 cases, a model that correctly solved a problem failed it after simple synonym swaps.
- Model Fragility: Smaller models like Flan-T5-large were almost entirely compromised, with ASRs reaching up to 100%.
- Semantic Integrity: Despite the drop in model performance, the adversarial problems maintained over 90% semantic similarity to the originals, meaning they remained perfectly clear to human readers.
Insights into LLM "Reasoning"
The study highlights that LLMs are surprisingly fragile. A trivial change, such as replacing the word "class" with "group," can cause a model to ignore entire constraints in a simple subtraction problem. Furthermore, the research suggests that complexity breeds vulnerability: problems with more reasoning steps or longer descriptions are easier to attack, as the "linguistic noise" distracts the model from the core logic.
Conclusion and Defense
To mitigate these vulnerabilities, the authors found that adversarial defense—specifically including adversarial examples in few-shot prompts—can significantly improve robustness. Future work will likely focus on instruction tuning and reinforcement learning to help models prioritize underlying logic over linguistic "window dressing."
Summary updated