arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.03731cs.CLcs.AIcs.CVcs.LG
收藏

MathCoder:面向增强数学推理能力的大语言模型无缝代码集成方法

MathCoder: Seamless Code Integration in LLMs for Enhanced Mathematical Reasoning

The Chinese University of Hong Kong(香港中文大学);City University of Hong Kong(香港城市大学);Shanghai Artificial Intelligence Laboratory(上海人工智能实验室)

Ke Wang, Houxing Ren, Aojun Zhou, Zimu Lu, Sichun Luo, Weikang Shi, Renrui Zhang, Linqi Song, Mingjie Zhan, Hongsheng Li

AI总结:

本研究提出MathCoder方法,通过构建穿插自然语言、代码与执行结果的MathCodeInstruct数据集,结合定制监督微调与推理策略训练开源大模型,显著提升其数学推理能力,在多个基准上超越现有开源及部分闭源模型。

摘要:

近期发布的GPT-4 Code Interpreter在解决高难度数学问题方面展现出卓越能力,这主要得益于其能够结合自然语言无缝推理、生成代码、执行代码,并基于执行输出继续推理的特性。本文提出了一种对开源语言模型进行微调的方法,使其能够利用代码建模和推导数学方程,从而增强其数学推理能力。我们提出了一种生成包含数学问题及其基于代码的解决方案的新型高质量数据集的方法,该数据集名为MathCodeInstruct。每份解决方案都穿插了自然语言、代码和执行结果。我们还引入了一种定制化的监督微调和推理方法。通过该方法得到了MathCoder模型系列,这类模型能够生成基于代码的解决方案来解决高难度数学问题。令人瞩目的是,MathCoder模型在MATH(45.2%)和GSM8K(83.9%)数据集上取得了开源大语言模型中的最优成绩,大幅优于其他开源同类模型。值得注意的是,MathCoder模型不仅在GSM8K和MATH数据集上超越了ChatGPT-3.5和PaLM-2,在竞赛难度的MATH数据集上甚至优于GPT-4。该数据集和模型将在https://github.com/mathllm/MathCoder 发布。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑