SafeMath: Safe Solutions for Unsafe Math Word Problems
On the map: LLM safety and security → Safety alignment, refusal and guardrails
Abstract (arXiv)
Recent research points toward LLMs being manipulated through adversarial and seemingly benign inputs, resulting in harmful, biased, or policy-violating outputs. In this paper, we study an underexplored issue concerning harmful and toxic mathematical word problems. We show that math questions, particularly those framed as natural language narratives, can serve as a subtle medium for propagating biased, unethical, or psychologically harmful content, with heightened risks in educational settings involving children. To support a systematic study of this phenomenon, we introduce ToxicGSM, a dataset of 1.9k arithmetic problems in which harmful or sensitive context is embedded while preserving mathematically well-defined reasoning tasks. Using this dataset, we audit the behaviour of existing LLMs and analyse the trade-offs between safety enforcement and mathematical correctness. We further propose SafeMath -- a safety alignment technique that reduces harmful outputs while maintaining, and in some cases improving, mathematical reasoning performance. Our results highlight the importance of disentangling linguistic harm from math reasoning and demonstrate that effective safety alignment need not come at the cost of accuracy.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in Safety alignment, refusal and guardrails, one of 12 directions in LLM safety and security. Builds on 18 of its 41 references that are in the map. First posted on arXiv 26 Mar 2026.
Builds on
18 of 41 references.
Closest ancestors · 1
Same direction, newest first
Other references · 17
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2023Let's Verify Step by Stepcited by 3,598
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2021Are NLP Models really able to Solve Simple Math Word Problems?cited by 861
- 2021A Diverse Corpus for Evaluating and Developing English Math Word Problem Solverscited by 314
- 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 240
- 2024OpenMathInstruct-2: Accelerating AI for Math with Massive Open-Source Instruction Datacited by 194
- 2023Solving Math Word Problems by Combining Language Models With Symbolic Solverscited by 124
5 more
- 2024MATHSENSEI: A Tool-Augmented Large Language Model for Mathematical Reasoningcited by 34
- 2024Enhancing Mathematical Reasoning in LLMs by Stepwise Correctioncited by 15
- 2021Towards Tractable Mathematical Reasoning: Challenges, Strategies, and Opportunities for Solving Math Word Problemscited by 12
- 2023From Good to Great: Improving Math Reasoning with Tool-Augmented Interleaf Promptingcited by 10
- 2025Improving Rule-based Reasoning in LLMs using Neurosymbolic Representationscited by 3
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2024GSM-Plus: A Comprehensive Benchmark for Evaluating the Robustness of LLMs as Mathematical Problem Solvers
- 2025MathRobust-LV: Evaluation of Large Language Models' Robustness to Linguistic Variations in Mathematical Reasoning
- 2024Exposing the Achilles' Heel: Evaluating LLMs Ability to Handle Mistakes in Mathematical Reasoning
- 2024Give me a hint: Can LLMs take a hint to solve math problems?
- 2024From Blind Solvers to Logical Thinkers: Benchmarking LLMs' Logical Integrity on Faulty Mathematical Problems
- 2025MSCR: Exploring the Vulnerability of LLMs' Mathematical Reasoning Abilities Using Multi-Source Candidate Replacement
- 2024Can Language Models Rival Mathematics Students? Evaluating Mathematical Reasoning through Textual Manipulation and Human Experiments
- 2024Mathfish: Evaluating Language Model Math Reasoning via Grounding in Educational Curricula