Work

CoinMath: Harnessing the Power of Coding Instruction for Math LLM

Year: 2025
Type: conference-paper
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
Language: English
Open Access status: gold
OpenAlex ID: W4412888949
FWCI:
Cites:
Cited by:
Related to: 10