MathCoder: 향상된 수학적 추론을 위한 LLM 내 원활한 코드 통합
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 코드 인터프리터는 자연어를 활용한 추론, 코드 생성, 코드 실행, 그리고 실행 결과를 기반으로 한 추가 추론 능력 덕분에 어려운 수학 문제를 해결하는 데 있어 뛰어난 성능을 보여주었습니다. 본 논문에서는 오픈소스 언어 모델을 미세 조정하여 코드를 활용해 수학 방정식을 모델링하고 도출함으로써 수학적 추론 능력을 향상시키는 방법을 제시합니다. 우리는 수학 문제와 코드 기반 해결책을 포함한 새로운 고품질 데이터셋을 생성하는 방법을 제안하며, 이를 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.