CoinMath: Harnessing the Power of Coding Instruction for Math LLMs

Chengwei Wei, Bin Wang, Jung-jae Kim, Guimei Liu, Nancy F. Chen
12/16/2024
cs.CL

No official code found. Best implementation: amao0o0/CoinMath (2 stars, last commit 2025-12-29).

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 general-domain 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.

View on arXivView PDF

Code Implementations(1)

amao0o0/CoinMathCommunity100%

CoinMath: Harnessing the Power of Coding Instruction for Math LLMs

20Shell, PythonDec 16, 20249 months ago

Cite this paper

@article{wei2024coinmath,
  title  = {CoinMath: Harnessing the Power of Coding Instruction for Math LLMs},
  author = {Chengwei Wei and Bin Wang and Jung-jae Kim and Guimei Liu and Nancy F. Chen},
  year   = {2024},
  eprint = {2412.11699},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2412.11699v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2412.11699.svg)](https://codeofpaper.com/paper/2412.11699)

Discussion