TL;DR
As large language models (LLMs) approach Olympiad-level mathematical proficiency, finding novel, high-quality problems to train and evaluate them has become a major bottleneck. This paper introduces Code2Math, a multi-agent framework that leverages code execution to autonomously evolve simple math problems into highly complex, structurally distinct variations. Crucially, the study reveals a "capability asymmetry"—models can successfully generate valid mathematical challenges that surpass their own ability to solve.
What Problem Does This Paper Address?
State-of-the-art reasoning models (like DeepSeek-R1) are achieving incredible performance on standard math benchmarks, nearing International Mathematical Olympiad (IMO) levels. However, this rapid progress has triggered a data scarcity crisis: we are running out of sufficiently challenging, high-quality math problems to continue training and evaluating these models.
Manually curating Olympiad-level math problems requires deep domain expertise and immense human effort. Meanwhile, existing automated generation methods often rely on superficial text paraphrasing or simple rule-based edits (like changing numbers or adding tedious algebra). The authors address this gap by asking: Can code-driven agents autonomously explore mathematical spaces to synthesize genuinely difficult problems that require deep conceptual insights ("Aha!" moments)?
Methods
The authors propose a multi-agent framework that treats problem generation as an iterative, exploratory process backed by a Python execution sandbox. The system operates under a test-time scaling paradigm, running multiple rollouts until a generated problem satisfies two strict verification agents.
The pipeline consists of three specialized agents:
- Evolution Agent: Analyzes the original "seed" problem to identify its cognitive bottleneck. It then enters an exploration phase, writing Python code using specialized libraries (
SymPyfor symbolic math,Z3for constraint satisfaction,NetworkXfor graph theory, anditertoolsfor combinatorics) to search for tighter mathematical bounds, hidden periodicities, or complex combinatorial structures. It outputs a new problem statement and a proposed solution. - Solvability Verification Agent: Acts as a strict firewall against "bad math." It checks the problem text for contradictions and rigorously audits the proposed solution steps to ensure logical consistency, filtering out flawed generations.
- Difficulty Verification Agent: Evaluates the relative difficulty using a 5-point rubric designed to distinguish Cognitive Depth (requiring a non-trivial leap in insight) from Artificial Complexity (merely adding tedious calculations or repetitive steps).
Datasets
The framework was evaluated using a dataset of 100 seed problems collected from diverse, high-level mathematical sources. These include standard mathematics problem books, recent regional exams, the IMO, and mainstream benchmarks like AIME-2024 and AIME-2025. This diverse mix ensures a wide coverage of fields, including algebra, combinatorics, calculus, sequences, and graph theory.
Key Insights and Ideas
- Capability Asymmetry: The most striking insight is that LLMs exhibit an asymmetry in creation versus solution. An evolution agent can synthesize a "Burden of Discovery"—deliberately concealing insights to create a harder problem—that reduces the solve rate of models otherwise stronger than itself.
- Code as an Exploration Engine: Code execution shifts the model's behavior from superficial text editing to grounded structural exploration. By anchoring problems around concrete computational targets (like fixed constants or enumerable configurations), code-enabled evolution produces cleaner, more rigorous, and better-specified mathematical challenges.
- Solvability is the Real Bottleneck: Maintaining mathematical validity while increasing difficulty is incredibly hard. The failure analysis revealed that the vast majority of rejected problem candidates failed at the solvability verification stage rather than the difficulty check.
Key Results
- Substantial Difficulty Escalation: Evolved problems systematically degraded the performance of top-tier solver models. For example, the solve rate of GPT-5.2-High dropped from 70% on the seed problems to 64% on DeepSeek-Reasoner evolutions, and down to 61% on Gemini-3-Pro-Thinking and Seed-2.0-Pro evolutions.
- Longer Reasoning Chains: Solvers required significantly more cognitive effort to tackle the evolved problems. The Average Token Consumption (ATC) shifted heavily to the right, showing a substantial increase in high-token counts and timeout cases.
- High Solvability Precision: Problems that passed the internal multi-agent filters were highly reliable. An external judge (GPT-5.2-High) certified up to 96% of DeepSeek-Reasoner's accepted problems as valid, a finding strongly supported by a blind human expert audit which yielded a 99.2% validity precision rate.
- The Power of Code: In ablation studies comparing code-enabled agents to no-code agents, code-driven evolution consistently produced harder problems, lowering average solver accuracy from 25.7% (no-code) to 23.1% (with code).
Limitations and Future Work
- High Computational Cost: The dual-verification pipeline is computationally expensive. Generating a single qualified problem requires multiple iterations, averaging between 1.56 and 6.55 failures per success, with some difficult cases exceeding 10 iterations.
- Small Scale: Due to these computational constraints, the evaluation was limited to a relatively small sample of 100 seed problems.
- Downstream Training Value Unverified: While the framework successfully generates harder problems, the authors have not yet fine-tuned an LLM on this synthesized data to verify if it directly translates to an increase in a model's baseline mathematical capability. Testing this downstream training value remains a key direction for future work.
Summary updated