通过填空式推理步骤扩展,提升大模型数学解题能力。
MathFimer: Enhancing Mathematical Reasoning by Expanding Reasoning Steps through Fill-in-the-Middle Task
- 用填空任务重构缺失的解题中间步骤,自动补全逻辑链。
- 在GSM8K、MATH等数据集上,新训练模型性能显著提升。
- 无需强大外部模型,低成本可扩展,适合模型优化者使用。
数学推理是推进大语言模型的重要前沿。尽管逐步求解已成为主流方法,但训练数据中推理步骤的质量从根本上限制了模型表现。已有研究显示更详细的中间步骤能提升性能,但现有扩展方法或需更强外部模型,或计算成本高。本文提出MathFimer框架,受代码推理中“填空中间”任务启发,将解题链分解为前缀-后缀对,训练模型重建缺失的中间步骤。我们在精心构建的NuminaMath-FIM数据集上训练出MathFimer-7B模型,并将其用于向现有数学推理数据集插入详细中间步骤,生成扩展版本。在MathInstruct、MetaMathQA等多个数据集上的实验表明,基于扩展数据训练的模型在GSM8K、MATH等基准上持续优于原始数据训练的模型。该方法无需依赖强外部模型或昂贵推理,提供了一种实用且可扩展的增强路径。
原文摘要 · Abstract (English)
Mathematical reasoning represents a critical frontier in advancing large language models (LLMs). While step-by-step approaches have emerged as the dominant paradigm for mathematical problem-solving in LLMs, the quality of reasoning steps in training data fundamentally constrains the performance of the models. Recent studies have demonstrated that more detailed intermediate steps can enhance model performance, yet existing methods for step expansion either require more powerful external models or incur substantial computational costs. In this paper, we introduce MathFimer, a novel framework for mathematical reasoning step expansion inspired by the ''Fill-in-the-middle'' task from code reasoning. By decomposing solution chains into prefix-suffix pairs and training models to reconstruct missing intermediate steps, we develop a specialized model, MathFimer-7B, on our carefully curated NuminaMath-FIM dataset. We then apply these models to enhance existing mathematical reasoning datasets by inserting detailed intermediate steps into their solution chains, creating MathFimer-expanded versions. Through comprehensive experiments on multiple mathematical reasoning datasets, including MathInstruct, MetaMathQA and etc., we demonstrate that models trained on MathFimer-expanded data consistently outperform their counterparts trained on original data across various benchmarks such as GSM8K and MATH. Our approach offers a practical, scalable solution for enhancing mathematical reasoning capabilities in LLMs without relying on powerful external models or expensive inference procedures.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。