MathCoder: 大規模言語モデルにおけるシームレスなコード統合による数学的推論の強化
MathCoder: Seamless Code Integration in LLMs for Enhanced Mathematical Reasoning
October 5, 2023
著者: Ke Wang, Houxing Ren, Aojun Zhou, Zimu Lu, Sichun Luo, Weikang Shi, Renrui Zhang, Linqi Song, Mingjie Zhan, Hongsheng Li
cs.AI
要旨
最近リリースされたGPT-4 Code Interpreterは、自然言語での推論、コード生成、コード実行、そして実行結果に基づいた継続的な推論をシームレスに行う能力により、難解な数学問題を解決する際に顕著な能力を発揮しています。本論文では、オープンソースの言語モデルを微調整し、数学方程式のモデリングと導出にコードを使用できるようにすることで、数学的推論能力を向上させる手法を提案します。我々は、数学問題とそのコードベースの解決策を含む新規で高品質なデータセットを生成する方法を考案し、これをMathCodeInstructと名付けました。各解決策は、自然言語、コード、実行結果を交互に織り交ぜた形式を取ります。また、カスタマイズされた教師あり微調整と推論手法を導入しました。この手法により、難解な数学問題を解決するためのコードベースの解決策を生成できるMathCoderモデル群が得られました。驚くべきことに、MathCoderモデルは、MATH(45.2%)とGSM8K(83.9%)データセットにおいて、オープンソースのLLMの中で最先端のスコアを達成し、他のオープンソースの代替モデルを大幅に上回りました。特に、MathCoderモデルは、GSM8KとMATHにおいてChatGPT-3.5とPaLM-2を凌駕するだけでなく、競技レベルのMATHデータセットにおいてGPT-4をも上回る性能を示しました。データセットとモデルは、https://github.com/mathllm/MathCoder で公開されます。
English
The recently released GPT-4 Code Interpreter has demonstrated remarkable
proficiency in solving challenging math problems, primarily attributed to its
ability to seamlessly reason with natural language, generate code, execute
code, and continue reasoning based on the execution output. In this paper, we
present a method to fine-tune open-source language models, enabling them to use
code for modeling and deriving math equations and, consequently, enhancing
their mathematical reasoning abilities. We propose a method of generating novel
and high-quality datasets with math problems and their code-based solutions,
referred to as MathCodeInstruct. Each solution interleaves natural language,
code, and execution results. We also introduce a customized supervised
fine-tuning and inference approach. This approach yields the MathCoder models,
a family of models capable of generating code-based solutions for solving
challenging math problems. Impressively, the MathCoder models achieve
state-of-the-art scores among open-source LLMs on the MATH (45.2%) and GSM8K
(83.9%) datasets, substantially outperforming other open-source alternatives.
Notably, the MathCoder model not only surpasses ChatGPT-3.5 and PaLM-2 on GSM8K
and MATH but also outperforms GPT-4 on the competition-level MATH dataset. The
dataset and models will be released at https://github.com/mathllm/MathCoder.