ProgAgent:通过程序化训练学习工具编排

·

研究论文 · 2026/10/15

大型语言模型(LLM)日益需要编排多种工具以完成长时程任务。现有智能体通常采用直接工具调用(DTC),即模型顺序调用工具,工具响应累积在模型上下文中,可能导致上下文腐化和编排崩溃。相比之下,程序化工具调用(PTC)通过可执行代码调用工具,并将中间结果存储在运行时变量中,而非追加到上下文。先前工作主要将PTC视为推理时的优化,但其对智能体训练的好处尚不明确,且合适的可验证训练任务稀缺。在本工作中,我们提出了ProgAgent,一个完整的PTC训练栈,包括合成可验证长时程任务的流水线、轻量级PTC运行时和两阶段训练配方。仅使用215个任务在四种环境规模下实例化,ProgAgent在四个基准测试中取得了比评估的同等规模基线更高的通过率。在LOCA-bench上,ProgAgent-14B在64k令牌环境状态下达到30.7%的通过率,而基线得分为零。跨框架实验表明,PTC训练的模型在两种评估接口下均优于DTC训练的模型,表明PTC训练的好处超越了接口本身。

该研究首次系统性地探索了程序化工具调用(PTC)在智能体训练中的价值,提出了完整的训练栈,并在多个基准上验证了其有效性,尤其是在长上下文场景下显著优于基线,为LLM工具编排训练提供了新思路。

Large language models (LLMs) are increasingly expected to orchestrate diverse tools over long-horizon tasks. Existing agents typically use Direct Tool Calling (DTC), where the model invokes tools sequentially, and tool responses accumulate in the model context, which can lead to context rot and orchestration breakdown. In contrast, Programmatic Tool Calling (PTC) invokes tools through executable code and stores intermediate results in runtime variables rather than appending them to the context. Prior work has explored PTC mainly as an inference-time optimization, but its benefits for agentic training remain unclear, and suitable verifiable training tasks are scarce. In this work, we introduce ProgAgent, a full PTC training stack, comprising a pipeline for synthesizing verifiable long-horizon tasks, a lightweight PTC runtime, and a two-stage training recipe. Using only 215 tasks instantiated at four environment scales, ProgAgent yields higher pass rates than the evaluated baselines of comparable size across four benchmarks. On LOCA-bench, ProgAgent-14B achieves a 30.7% pass rate at a 64k-token environment state, where these baselines score zero. Cross-harness experiments show that PTC-trained models outperform DTC-trained models under both evaluation interfaces, suggesting that the benefits of PTC training extend beyond the interface.

阅读原文

参与讨论