面向模型推理的代码辅助思维链与指令的规模化扩展
Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning
AI总结:
针对大语言模型推理中CoT方法生成不可控、泛化性弱等问题,提出Caco框架,通过代码驱动的自动数据合成与验证闭环,规模化生成高质量推理数据,提升模型数学推理与跨任务泛化能力。
摘要:
推理能力对大语言模型(LLM)解决复杂任务至关重要,但实现可靠、可扩展的推理仍具挑战。尽管思维链(Chain-of-Thought, CoT)提示已成为主流方法,现有方法常存在生成不可控、质量不足以及推理路径多样性有限的问题。近期研究利用代码将推理建立在可执行步骤的基础上来增强CoT,但这类方法通常局限于预定义的数学问题,阻碍了可扩展性与泛化性。\n本研究提出Caco(Code-Assisted Chain-of-ThOught,代码辅助思维链)这一新型框架,通过代码驱动的增强方式自动合成高质量、可验证且多样化的指令-CoT推理数据。与现有工作不同,Caco首先基于现有数学与编程解决方案,以统一代码格式微调一个基于代码的CoT生成器,随后将数据生成规模化,产出大量多样化推理轨迹。关键在于,我们引入了通过代码执行和基于规则的过滤实现的自动验证机制,以确保逻辑正确性和结构多样性,随后将过滤后的输出逆向工程为自然语言指令和语言类CoT,以提升任务适配性。这一闭环流程实现了全自动、可扩展的推理数据合成,且保证了可执行性。\n在我们构建的Caco-1.3M数据集上的实验表明,经Caco训练的模型在数学推理基准上表现出强劲的竞争力,优于现有强基线模型。进一步分析显示,Caco的代码锚定验证机制和指令多样性有助于提升在未见过任务上的出色泛化能力。本研究为构建无需人工干预、自维持且可信的推理系统建立了一种范式。
英文摘要:
Reasoning capability is pivotal for Large Language Models (LLMs) to solve complex tasks, yet achieving reliable and scalable reasoning remains challenging. While Chain-of-Thought (CoT) prompting has become a mainstream approach, existing methods often suffer from uncontrolled generation, insufficient quality, and limited diversity in reasoning paths. Recent efforts leverage code to enhance CoT by grounding reasoning in executable steps, but such methods are typically constrained to predefined mathematical problems, hindering scalability and generalizability. In this work, we propose Caco (Code-Assisted Chain-of-ThOught), a novel framework that automates the synthesis of high-quality, verifiable, and diverse instruction-CoT reasoning data through code-driven augmentation. Unlike prior work, Caco first fine-tunes a code-based CoT generator on existing math and programming solutions in a unified code format, then scales the data generation to a large amount of diverse reasoning traces. Crucially, we introduce automated validation via code execution and rule-based filtering to ensure logical correctness and structural diversity, followed by reverse-engineering filtered outputs into natural language instructions and language CoTs to enrich task adaptability. This closed-loop process enables fully automated, scalable synthesis of reasoning data with guaranteed executability. Experiments on our created Caco-1.3M dataset demonstrate that Caco-trained models achieve strong competitive performance on mathematical reasoning benchmarks, outperforming existing strong baselines. Further analysis reveals that Caco's code-anchored verification and instruction diversity contribute to superior generalization across unseen tasks. Our work establishes a paradigm for building self-sustaining, trustworthy reasoning systems without human intervention.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。