Abstract
Current Large Language Model (LLM) evaluations are increasingly compromised by data contamination. We present MATHEMAGIC, a framework that generates dynamic, counterfactual mathematics problems to test genuine reasoning. Our results show that while top models excel at following explicit new rules (deduction), they struggle to infer these rules from examples (induction) and often revert to standard arithmetic patterns ingrained during pre-training.
Introduction
The rapid advancement of LLMs has led to high scores on benchmarks like GSM8K. However, the static nature of these datasets raises concerns about rote memorization. MATHEMAGIC addresses this by redefining mathematical operations at test time, forcing models to reason from first principles rather than relying on memorized strings.
Methodology
MATHEMAGIC transforms standard arithmetic problems from GSM8K using nine counterfactual strategies, such as symbol swapping, digit reversal, and base changes. We evaluate models in two settings:
- Inductive: Models must infer the transformation rule from few-shot examples.
- Deductive: Models are explicitly provided with the rule in natural language.
Results
The Induction-Deduction Gap
Our evaluation reveals a significant performance disparity. Models consistently perform better when rules are explicitly stated.
As illustrated in the figure, GPT-5 achieves 87.2% accuracy in the inductive setting, which improves to 96.4% under deduction. Smaller models show a much steeper drop-off, with Qwen2.5-0.5B failing to reach 6% accuracy in either setting.
Scaling with Context
Performance generally scales with the number of few-shot examples provided, though many models plateau.
While GPT-5 continues to improve up to 512 shots, Llama3 8B exhibits a notable performance collapse after 128 shots, suggesting that excessive novel context can degrade reasoning in certain architectures.
The Reversion Trap
A key finding is the "reversion error," where models default to standard math despite clear counter-evidence. This suggests that pre-trained knowledge acts as a strong prior that is difficult to override. Furthermore, fine-tuning on these tasks led to overfitting rather than the acquisition of general inductive reasoning skills.
Conclusion
MATHEMAGIC demonstrates that LLMs are currently better at pattern matching than flexible logical induction. Future work should focus on developing architectures capable of overriding ingrained priors to achieve true reasoning.
Summary updated