ProgramGym:为长时程程序复现智能体扩展训练环境

·

研究论文 · 2026/10/12

编程智能体越来越多地被用于像软件工程师一样从零开始构建程序,而非解决仓库内的问题或根据给定需求文档生成仓库。然而,可扩展且可验证的训练环境仍然稀缺,这些环境应迫使智能体发现所需内容并决定系统应如何设计。此外,现有智能体工作流也无法支持长期开发,即智能体在实现前探索参考程序。为应对这些挑战,我们提出了 ProgramGym,一个由 Program-Env 和 Program-Agent 组成的框架,用于长期程序复现智能体的可扩展训练环境。具体而言,Program-Env 通过反馈驱动的循环从仓库构建可验证的训练环境,该循环修复运行时沙箱构建和黑盒测试的质量。使用这一新流程,我们获得了涵盖 C、C++、Go 和 Rust 的 1,648 个训练环境。Program-Agent 将分析、实现和审查的角色隔离工作流与用于编译检查和故障恢复的修订管理相结合。在 ProgramBench 上的实验表明,Program-Env 和 Program-Agent 均提升了程序复现的性能。在这些构建环境的轨迹上进行微调,将 Qwen3.8-27B 的性能从 34.87% 提升至 42.84%。Program-Agent 进一步将基础模型和 SFT 模型提升至 55.71% 和 56.25%,均超过一些旗舰模型。我们将发布 ProgramGym 以支持对从零开始构建程序的编程智能体的进一步研究。

该工作针对编程智能体从零构建程序时缺乏可扩展可验证训练环境的问题,提出了包含环境构建与智能体工作流的完整框架,并在多个语言和基准上验证了性能提升,对推动从零构建程序的智能体研究具有实用价值。

Coding agents are increasingly used to build programs from scratch as software engineers do rather than to resolve issues within a repository or to generate a repository from a given requirements document. However, scalable verifiable training environments that force agents to discover what is required and to decide how the system should be designed remain scarce. Moreover, existing agent workflows also cannot sustain long-horizon development in which the agent explores the reference program before implementation. To address these challenges, we introduce ProgramGym, a framework consisting of Program-Env and Program-Agent for scalable training environments of long-horizon program reproduction agents. Specifically, Program-Env constructs verifiable training environments from repositories through a feedback-driven loop that repairs runtime sandbox builds and the quality of black-box tests. Using this novel pipeline, we obtain 1,648 training environments spanning C, C++, Go, and Rust. Program-Agent combines a role-isolated workflow of analysis, implementation, and review with revision management for compilation checks and failure recovery. Experiments on ProgramBench show that both Program-Env and Program-Agent improve performance on program reproduction. Fine-tuning on trajectories with these constructed environments raises the performance of Qwen3.8-27B from 34.87% to 42.84%. Program-Agent further raises the base and SFT models to 55.71% and 56.25%, both exceeding some flagship models. We will release the ProgramGym to support further research on coding agents that build programs from scratch.

阅读原文

参与讨论