arXiv:2510.04081cs.CLcs.PL2025-10NeurIPS被引 11

用代码自动生成可验证的推理数据,让AI更可靠地解题。

Scaling Code-Assisted Chain-of-Thoughts and Instructions for Model Reasoning

  • 用代码生成器自动构建带执行验证的推理链,确保逻辑正确。
  • 在130万条数据上训练后,数学推理能力超越现有主流模型。
  • 适合想提升AI推理能力的研究者和开发者,无需人工标注。

推理能力对大语言模型解决复杂任务至关重要,但实现可靠且可扩展的推理仍具挑战。尽管思维链(CoT)提示已成为主流方法,但现有方法常存在生成不可控、质量不足和推理路径单一等问题。近期工作利用代码增强CoT,通过可执行步骤约束推理,但通常局限于预定义的数学问题,限制了可扩展性与泛化能力。本文提出Caco(Code-Assisted Chain-of-Thought),一种通过代码驱动增强的自动化框架,可合成高质量、可验证且多样化的指令-思维链推理数据。Caco首先在统一代码格式的数学与编程解法上微调代码基思维链生成器,再大规模生成多样化推理轨迹。关键在于,通过代码执行与规则过滤实现自动化验证,确保逻辑正确性与结构多样性,随后将筛选后的输出反向重构为自然语言指令与语言思维链,提升任务适应性。该闭环流程实现了无需人工干预的可扩展推理数据合成,保证可执行性。在自建的Caco-1.3M数据集上的实验表明,经Caco训练的模型在数学推理基准上表现优异,超越现有强基线。进一步分析显示,代码锚定的验证机制与指令多样性显著提升模型在未见任务上的泛化能力。本工作建立了一种无需人工干预的自我维持、可信推理系统新范式。

原文摘要 · Abstract (English)

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.

推理增强代码生成自动化数据大模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。