3 个月前

MathCoder:在LLM中实现无缝代码集成以增强数学推理能力

MathCoder:在LLM中实现无缝代码集成以增强数学推理能力

摘要

最近发布的 GPT-4 代码解释器在解决复杂数学问题方面展现出卓越的能力,这主要归功于其能够无缝结合自然语言推理、代码生成、代码执行以及基于执行结果持续进行推理的能力。在本文中,我们提出了一种微调开源语言模型的方法,使其能够利用代码进行数学建模与方程推导,从而显著提升其数学推理能力。为此,我们构建了一种新颖且高质量的数据集生成方法,该方法涵盖数学问题及其基于代码的解决方案,命名为 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。

代码仓库

mathllm/mathcoder
官方
GitHub 中提及

基准测试

基准方法指标
arithmetic-reasoning-on-gsm8kMathCoder-CL-13B
Accuracy: 74.1
Parameters (Billion): 7
arithmetic-reasoning-on-gsm8kMathCoder-CL-7B
Accuracy: 67.8
Parameters (Billion): 7
arithmetic-reasoning-on-gsm8kMathCoder-L-13B
Accuracy: 72.6
Parameters (Billion): 13
arithmetic-reasoning-on-gsm8kMathCoder-L-70B
Accuracy: 83.9
Parameters (Billion): 70
arithmetic-reasoning-on-gsm8kMathCoder-CL-34B
Accuracy: 81.7
Parameters (Billion): 34
arithmetic-reasoning-on-gsm8kMathCoder-L-7B
Accuracy: 64.2
Parameters (Billion): 7
math-word-problem-solving-on-mathMathCoder-CL-7B
Accuracy: 30.2
Parameters (Billions): 7
math-word-problem-solving-on-mathMathCoder-CL-34B
Accuracy: 45.2
Parameters (Billions): 34
math-word-problem-solving-on-mathMathCoder-CL-13B
Accuracy: 35.9
Parameters (Billions): 13
math-word-problem-solving-on-mathMathCoder-L-34B
Accuracy: 45.1
Parameters (Billions): 34
math-word-problem-solving-on-mathMathCoder-L-7B
Accuracy: 23.3
Parameters (Billions): 7
math-word-problem-solving-on-mathMathCoder-L-13B
Accuracy: 29.9
Parameters (Billions): 13
math-word-problem-solving-on-svampMathCoder-L-70B
Execution Accuracy: 84.9

用 AI 构建 AI

从想法到上线——通过免费 AI 协同编程、开箱即用的环境和市场最优价格的 GPU 加速您的 AI 开发

AI 协同编程
即用型 GPU
最优价格
立即开始

Hyper Newsletters

订阅我们的最新资讯
我们会在北京时间 每周一的上午九点 向您的邮箱投递本周内的最新更新
邮件发送服务由 MailChimp 提供
MathCoder:在LLM中实现无缝代码集成以增强数学推理能力 | 论文 | HyperAI超神经