arXiv:2606.15589cs.LGcs.AI2026-06

用可执行代码替代自然语言推理,性能提升31.6个百分点

Is Code Better Than Language for Algorithmic Reasoning

  • 模型先输出可执行代码,再由语言模型模拟执行
  • 代码执行比自然语言推理高31.6个百分点
  • 证明工具使用优势来自可靠外部执行而非表示形式

对于工具增强的语言模型,比较自然语言推理与代码执行流程困难,因两者同时改变了中间表示和执行机制。本文通过中间干预分离这两个因素:模型将推理表达为可执行代码,语言模型在上下文中模拟该代码以生成答案。在40个可验证的算法任务基准上,确定性代码执行相比自然语言推理提升31.6个百分点。我们发现,中间干预与自然语言推理差异仅0.15个百分点。结果表明,在本评估设置下,仅改变中间表示无法解释工具使用的性能优势,支持性能提升依赖可靠的外部执行。我们构建了一个简单的统计决策论模型,刻画在解耦的轨迹生成/执行范式中,执行如何优于端到端风险。通过重构干预,利用代理语言模型从代码表示推断自然语言推理轨迹,恢复了与原始自然语言推理流程相当的性能。所有实验见 https://github.com/TerryTong-Git/ToolProj。

原文摘要 · Abstract (English)

For tool-augmented language models, comparing natural-language reasoning with code-execution pipelines is difficult because the comparison changes both the intermediate representation and the execution mechanism. We separate these factors with an intermediate intervention: the model expresses its reasoning as executable code, and the language model simulates that code in context to produce an answer. On a 40-task verifiable algorithmic benchmark, deterministic code execution outperforms natural-language reasoning by +31.6pp. We observe that the intermediate intervention is not meaningfully different from natural-language reasoning (+0.15pp). These results suggest that, in our evaluated setting, changing the intermediate representation alone does not explain the tool-use advantage, providing evidence for the performance gains requiring reliable external execution. We formalize this intuition with a simple statistical decision-theoretic model that characterizes when execution dominates end-to-end risk in our disentangled trace-generation/execution regime. We validate our theory using a reconstruction intervention that leverages a proxy language model to infer natural-language reasoning traces from code representations, recovering performance comparable to the original natural-language reasoning pipeline. All experiments are at https://github.com/TerryTong-Git/ToolProj.

算法推理代码执行语言模型工具使用

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