Evaluating the true reasoning capabilities of Large Language Models (LLMs) is a moving target. High performance on popular benchmarks like GSM8k might simply be a result of memorization—data contamination from massive training sets—rather than actual reasoning. Furthermore, existing benchmarks fail to systematically scale the complexity of the logic required. If a model can solve a three-step problem, can it generalize to a ten-step problem?
To address this, researchers introduce MathGAP, a novel data-generation framework that programmatically creates arithmetic word problems based on specific, controllable "proof structures." This ensures the evaluation data is truly out-of-distribution (OOD) and allows for systematic testing of easy-to-hard generalization.
The MathGAP Framework: Building Proof Trees
Instead of writing a story first, MathGAP starts with a logical conclusion and works backward to generate a problem. The core of this method is the Proof Tree, which is constructed in three main steps:
- Logical Sampling: The system samples a "root" logical form (the final answer) and recursively applies inference rules (like addition, subtraction, or comparison) to build a tree of premises. Users can precisely control the depth (number of reasoning steps), width (number of initial facts), and shape (linear vs. nonlinear) of the proof.
- Natural Language Mapping: The leaf nodes (the foundational axioms or facts) are converted into natural language sentences using predefined templates to form the word problem.
- Solution Generation: The internal nodes of the tree are converted into Chain-of-Thought (CoT) reasoning traces, providing a step-by-step solution.
A critical distinction in MathGAP is between linear proofs (where each step uses at most one previously derived fact) and nonlinear proofs (where a model must hold multiple intermediate conclusions in "memory" to derive the next step).
Key Insights: Where LLMs Struggle
Using the MathGAP pipeline, the researchers generated several test sets varying in depth, width, and linearity, and evaluated a suite of models including Mixtral-8x7B, Llama 3, GPT-4o, and newer reasoning models like OpenAI o1-preview and DeepSeek-R1.
Nonlinear Logic is the "Final Boss"
Models find nonlinear problems significantly harder than linear ones, even when the total number of facts is identical. This suggests that maintaining intermediate states in the context window for extended periods is a major bottleneck for current LLM architectures.
Width vs. Depth
Surprisingly, generalizing to a "wider" problem (one with more initial facts to synthesize) is often harder for LLMs than generalizing to a "deeper" one (more sequential, step-by-step deductions).
The "U-Shaped" Ordering Bias
Models are highly sensitive to the order of sentences in a prompt. They are most successful when a crucial fact is placed at the very beginning or the very end of a problem description. If moved to the middle, performance drops significantly—a manifestation of the well-documented "lost in the middle" effect.
Performance Decay and Noisy Generalization
The results clearly show that LLM reasoning is not a binary "can or cannot" trait. Instead, performance degrades steadily as complexity increases, suggesting that reasoning in these models is a noisy, probabilistic process rather than the robust execution of a deterministic algorithm.
All models exhibited a significant drop in accuracy as proof depth and width increased. For instance, on complex nonlinear problems, most standard models' accuracy trended toward zero as the depth reached 6.
While highly capable models like GPT-4o fail on the most complex nonlinear structures, newer reasoning-focused models (o1 and R1) perform much better. However, they are still not perfect; on a particularly tough depth-7 nonlinear set, o1 scored only 5% and R1 scored 11%. Furthermore, providing "in-distribution" examples (In-Context Learning) doesn't always help. For some models, zero-shot performance was actually better than few-shot, indicating that certain complex reasoning patterns are difficult to learn purely from a few prompt examples.
Future Directions
MathGAP provides a robust foundation for stress-testing LLM reasoning, but there is room for expansion. Currently, the framework relies on templates, which limits linguistic diversity, and focuses primarily on addition and subtraction. Future iterations could use LLMs to paraphrase templates for greater natural language variety and expand the arithmetic scope to include multiplication, division, and rates. By combining more inference rules and arbitrary sentence orderings, MathGAP can continue to generate OOD problems that will challenge even the next generation of AI reasoning models.
Summary updated