NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MuMath-Code: Combining Tool-Use Large Language Models with Multi-perspective Data Augmentation for Mathematical Reasoning

Shuo Yin, Weihao You, Zhilong Ji, Guoqiang Zhong, Jinfeng Bai

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities across various domains, yet complex multi-step mathematical reasoning remains a significant challenge. Current research typically diverges into two paths: tool-free methods focusing on extensive data augmentation of natural language Chain-of-Thought (CoT) solutions, and tool-use methods that offload computation to external interpreters like Python.

MuMath-Code bridges this gap by integrating sophisticated data augmentation with a structured tool-interaction framework. By prioritizing the model's intrinsic reasoning before introducing code execution, the framework achieves superior performance on rigorous benchmarks, setting new standards for open-source models.

Methodology: A Two-Stage Approach

The core of MuMath-Code is a novel two-stage training strategy designed to build a robust foundation in mathematical logic before teaching tool interaction. This approach ensures the model understands the underlying logic before attempting implementation.

The two-stage training framework of MuMath-Code, transitioning from natural language reasoning to code-integrated tool use.

Multi-perspective Data Augmentation

To increase data diversity and robustness, the authors employ several augmentation techniques beyond simple rephrasing:

  • Alteration: Changing numbers or conditions within existing problems.
  • FOBAR/BF-Trans: Generating "backward" problems where the model must deduce missing initial conditions given a final answer.
  • Majority Voting: Using multiple generations and picking the most common answer to create high-quality "pseudo-answers" for augmented questions.

Training Stages

  1. Stage 1 (Natural Language Reasoning): The model is first fine-tuned on MuMath-Data ($D_\mu$), a 750K sample dataset of pure natural language solutions. This stage develops the model's "math intuition."
  2. Stage 2 (Code-Nested Interaction): The model is then trained on MuMath-Code-Data ($D_{\mu-code}$), which features 600K samples of interleaved natural language and Python code.

A critical component of Stage 2 is Prefix CoT, where the model performs a natural language analysis before writing code. Additionally, the training includes "buggy" code samples followed by mistake analysis and corrections, teaching the model to self-debug during inference.

Key Results

MuMath-Code sets a new bar for open-source mathematical reasoning. The 70B parameter variant achieved state-of-the-art results, reaching 90.7% on GSM8K and 55.1% on the MATH benchmark, outperforming previous leaders like ToRA and MathCoder.

Comprehensive performance comparison of MuMath-Code against state-of-the-art closed-source and open-source models across multiple mathematical benchmarks.

The results demonstrate that the two-stage training is highly efficient. For instance, the MuMath-Code 7B model (83.8% on GSM8K) outperforms several 70B models from other lineages. The model also exhibits strong generalization across diverse benchmarks like GSM-Hard, SVAMP, and TabMWP, proving its ability to handle varied problem formats and complexities.

Conclusion and Future Work

The success of MuMath-Code highlights the importance of a "thinking-first" foundation. By mastering underlying logic in natural language before adopting computational tools, LLMs can achieve significantly higher accuracy and robustness.

While the current model is limited by the capabilities of its "teacher" (GPT-4) and is not yet optimized for formal mathematical proofs, it represents a major step forward for open-source reasoning. Future work will focus on expanding into symbolic logic and more complex mathematical domains.

Summary updated

BibTeX
@inproceedings{yin2024mumath,
  author = {Shuo Yin and Weihao You and Zhilong Ji and Guoqiang Zhong and Jinfeng Bai},
  title = {{MuMath-Code: Combining Tool-Use Large Language Models with Multi-perspective Data Augmentation for Mathematical Reasoning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.274},
}
Figure