ACL Findings2025
CoinMath: Harnessing the Power of Coding Instruction for Math LLM
Chengwei Wei, Bin Wang, Jung-Jae Kim, Guimei Liu, Nancy F. Chen
Abstract
Large Language Models (LLMs) have shown strong performance in solving mathematical problems, with code-based solutions proving particularly effective.However, the best practice to leverage coding instruction data to enhance mathematical reasoning remains underexplored.This study investigates three key questions: (1) How do different coding styles of mathematical code-based rationales impact LLMs' learning performance?(2) Can generaldomain coding instructions improve performance?(3) How does integrating textual rationales with code-based ones during training enhance mathematical reasoning abilities?Our findings reveal that code-based rationales with concise comments, descriptive naming, and hardcoded solutions are beneficial, while improvements from general-domain coding instructions and textual rationales are relatively minor.Based on these insights, we propose CoinMath, a learning strategy designed to enhance mathematical reasoning by diversifying the coding styles of code-based rationales.CoinMath generates a variety of code-based rationales incorporating concise comments, descriptive naming conventions, and hardcoded solutions.Experimental results demonstrate that CoinMath significantly outperforms its baseline model, MAmmoTH, one of the SOTA math LLMs. 1 Model Comment A. S. G. M. Avg.Llama-3.1-8BNo 61.7 30.4 32.4 11.5 34.0 Concise 83.3 80.3 73.5 36.4 68.4 Detailed 80.7 83.4 73.6 35.5 68.3 CodeLlama-Python-7B No 82.7 64.4 52.2 27.3 56.7 Concise 83.0 68.7 59.7 28.1 59.9 Detailed 83.3 69.6 55.4 27.2 58.9 Gemma-2-2B No 73.0 65.3 53.6 25.8 54.4 Concise 77.3 67.6 54.7 26.6 56.6 Detailed 79.0 67.2 54.0 24.4 56.2 CodeGemma-2B No 79.0 53.1 40.9 21.4 48.6 Concise 80.0 52.0 41.0 21.7 48.7 Detailed 81.0 55.2 39.7 21.4 49.3
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
Lineage
- Llemma: An Open Language Model for Mathematics cites MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuning
- Llemma: An Open Language Model for Mathematics cites Solving Quantitative Reasoning Problems with Language Models
- Llemma: An Open Language Model for Mathematics cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuning cites Solving Quantitative Reasoning Problems with Language Models
- MAmmoTH: Building Math Generalist Models through Hybrid Instruction Tuning cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Solving Quantitative Reasoning Problems with Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds on12
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- LoRA: Low-Rank Adaptation of Large Language ModelsEdward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu et al.ICLR 2022 · 18,833 citations
- Solving Quantitative Reasoning Problems with Language ModelsAitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer et al.NeurIPS 2022 · 2,039 citations
- MAmmoTH: Building Math Generalist Models through Hybrid Instruction TuningXiang Yue, Xingwei Qu, Ge Zhang, Yao Fu et al.ICLR 2024 · 558 citations
- Llemma: An Open Language Model for MathematicsZhangir Azerbayev, Hailey Schoelkopf, Keiran Paster, Marco Dos Santos et al.ICLR 2024 · 433 citations
Related papers
- Fewer is More: Boosting Math Reasoning with Reinforced Context PruningXijie Huang, Li Lyna Zhang, Kwang-Ting Cheng, Fan Yang et al.EMNLP 2024 · 7 citations
- MuMath-Code: Combining Tool-Use Large Language Models with Multi-perspective Data Augmentation for Mathematical ReasoningShuo Yin, Weihao You, Zhilong Ji, Guoqiang Zhong et al.EMNLP 2024 · 3 citations
- OpenMathInstruct-2: Accelerating AI for Math with Massive Open-Source Instruction DataShubham Toshniwal, Wei Du, Ivan Moshkov, Branislav Kisacanin et al.ICLR 2025
- MARIO: MAth Reasoning with code Interpreter Output - A Reproducible PipelineMinpeng Liao, Chengxi Li, Wei Luo, Jing Wu et al.ACL Findings 2024 · 2 citations
- ClozeMath: Improving Mathematical Reasoning in Language Models by Learning to Fill EquationsQuang Hieu Pham, Thuy Duong Nguyen, Tung Pham, Anh Tuan Luu et al.ACL Findings 2025
