TL;DR
Large Language Models (LLMs) are notoriously shaky at math, often tripping over their own feet as problems get longer or numbers get bigger. This paper demonstrates that if you teach a model to write formal code (like Lean or Python) instead of just "thinking out loud" in English, its accuracy doesn't just improve—it scales far more gracefully as complexity increases. By letting a computer handle the literal "math" part, the model can focus on the logic, making it much more reliable for high-stakes reasoning.
What Problem Does This Paper Address?
We’ve all seen LLMs perform impressive feats of logic, only to fail at adding two six-digit numbers. The core issue is that we usually ask models to perform Chain-of-Thought (CoT) reasoning—basically, showing their work in natural language. But natural language is fuzzy, and doing multi-step arithmetic in a "mental" workspace is hard for a transformer.
The authors identify a gap in how we evaluate these models: we don't usually distinguish between numerical scale (how big the numbers are) and compositional complexity (how many steps are in the problem). Does a model fail because it can't handle 1,234,567, or because it lost track after the fifth addition? To solve this, they created a way to measure how "gracefully" a model's performance degrades as things get tougher.
Methods
The researchers introduced a "dual-slope" framework to measure sensitivity to these two different types of complexity.
Instead of natural language, they trained models to use Executable Symbolic Representations. Specifically, they used Lean, a formal proof language, and Python. The idea is simple: the LLM acts as the architect, writing a precise program that describes the problem. Then, an external "executor" (a Lean compiler or a Python interpreter) does the actual heavy lifting of the calculation.
They fine-tuned three sizes of the Qwen3 model (0.6B, 1.7B, and 8B parameters) using Low-Rank Adaptation (LoRA), comparing the classic English CoT approach against this new "code-first" approach.
Datasets
- GSM-AB (GSM Arithmetic Benchmark): A brand-new, highly controlled benchmark. It consists of 2,000 questions across 20 "complexity cells." It independently varies the number of digits in the operands (from 3 to 6) and the number of operations required (from 2 to 6).
- GSM8K: Used for the initial training pool.
- OOD (Out-of-Distribution) Sets: To see if the skills transferred, they tested on SVAMP, DeepMind Mathematics, and Math401.
Key Insights and Ideas
- The "Calculator" Effect: When using Lean, the model's sensitivity to the size of the numbers (digit length) almost vanished, especially in larger models. Since the model only has to write the number correctly once, it doesn't matter if it's "12" or "12,345,678"—the computer handles the rest.
- Logic is still the Bottleneck: While bigger numbers became easy, more steps (operation count) still caused performance to drop. However, the drop was significantly slower when using executable code compared to English.
- Scaling Matters: Small models (0.6B) actually struggled more with the logic of writing Lean code as the number of operations grew. The "scaling advantage" of using code really starts to shine as the model size increases to 8B parameters.
- Language Agnostic: The benefits weren't unique to Lean. A control test using Python showed nearly identical improvements, suggesting that the "executable" nature of the representation is what matters, not the specific syntax.
Key Results
The results were stark. Using Lean improved average accuracy by 29.5 to 47.8 percentage points over the standard CoT approach across the different model sizes.
As seen in Figure 2, the "slopes" tell the story. In the 8B model (panel c), the Lean accuracy line is nearly horizontal as digits increase—meaning the model is essentially immune to numerical scale. Meanwhile, the CoT line (orange) dives downward. For operation counts (panel f), the Lean slope was -0.033, while the CoT slope was a much steeper -0.114. In plain English: the CoT model's accuracy fell nearly four times faster as the problems got more complex.
Limitations and Future Work
The authors are careful to note that these results are specific to arithmetic. While Lean and Python help with "doing the math," they don't necessarily help the model understand a complex word problem if the linguistic phrasing is tricky.
Furthermore, the very smallest models (0.6B) sometimes produced code that was syntactically correct but logically wrong—they "hallucinated" the wrong math steps even if the computer executed them perfectly. Future work could explore more diverse mathematical structures beyond the "balanced trees" used here, or look at how these executable representations might help in even larger "frontier" models.
Summary updated