Introduction
Large Language Models (LLMs) have demonstrated significant potential in mathematical reasoning, yet a substantial performance gap remains between proprietary models like GPT-4 and their open-source counterparts. The primary bottleneck is the availability of high-quality, diverse mathematical training data. Traditional "Direct Question Augmentation"—where a model rewrites existing problems—often produces logically inconsistent or "broken" questions. For instance, a model might modify a problem such that the total cost specified is less than the sum of the individual items listed. MathGenie addresses this by introducing a novel pipeline that prioritizes logical consistency through question back-translation.
The MathGenie Pipeline
The MathGenie framework scales up mathematical reasoning data by focusing on the constraints inherent in solutions before generating questions. The process consists of three main stages:
- Iterative Solution Augmentation: Instead of altering questions, the system uses a Llama-2 70B model ($M_{text}$) to modify existing solutions from seed datasets (GSM8K and MATH). By iteratively changing numerical values, adding complexity, or swapping entities, the model ensures that the mathematical "ground truth" serves as the foundation for data generation.
- Question Back-translation: A dedicated model ($M_{backtrans}$) is trained to perform the inverse task: generating a question based on a provided mathematical solution. Since the solution already contains the necessary logical flow and constraints, the resulting questions are significantly more coherent and solvable than those generated from scratch.
- Verification-Based Solution Filtering: To maintain high data quality, a solution generator ($M_{code}$) produces code-integrated solutions (combining natural language with Python) for the newly back-translated questions. The model then generates "verification rationales" to double-check its work via code execution. Only samples that pass this rigorous verification are included in the final 170K-sample MathGenieData set.
Key Insights: Solutions as Anchors
The core innovation of MathGenie lies in the realization that solutions are more logically constrained than questions. While a model might easily hallucinate a nonsensical question, it is much harder to generate a coherent mathematical solution that does not follow a logical roadmap. By starting with the solution, the back-translation model is guided by a pre-defined logical structure. Furthermore, the use of code-integrated solutions allows the model to offload arithmetic to a Python interpreter, while self-verification acts as a powerful filter against synthetic noise.
Experimental Results
The resulting models, dubbed MathGenieLM, set new benchmarks for open-source mathematical reasoning.
As shown in the results, MathGenieLM-InternLM2-20B achieved state-of-the-art performance, reaching 87.7% on GSM8K and 55.7% on MATH. These results surpass previous open-source leaders such as ToRA and MathCoder. Notably, the models demonstrated strong generalization capabilities on out-of-domain benchmarks like SVAMP and Simuleq. For example, the Llama-2 7B variant improved from a ~30% baseline to 61.4% on Simuleq. When employing a 10-path majority voting strategy, the Llama-2 70B variant reached 91.7% on GSM8K, significantly narrowing the gap with GPT-4.
Conclusion and Future Work
MathGenie demonstrates that high-quality synthetic data, generated through a logic-first back-translation approach, can significantly enhance the reasoning capabilities of open-source LLMs. While the pipeline is currently compute-intensive and limited to text/code modalities, it provides a scalable blueprint for data augmentation in complex reasoning domains. Future research may extend this methodology to formal logic, scientific discovery, and multimodal mathematical problems involving diagrams.
Summary updated