arXiv:2503.23803cs.SEcs.AI2025-03被引 26

用推理时间计算替代模型大小,让小模型也能高效写代码

Thinking Longer, Not Larger: Enhancing Software Engineering Agents via Scaling Test-Time Compute

  • 用真实代码库生成多阶段推理路径,提升思考质量
  • 32B模型在SWE-bench上解决46%问题,超越更大模型
  • 适合想低成本部署代码助手的开发者和研究者

近期软件工程智能体在自动化程序优化方面展现出良好能力。然而,其对闭源或资源密集型模型的依赖,给私有环境部署带来挑战。为此,我们提出统一的测试时计算扩展框架,通过增加推理时计算而非扩大模型规模来提升性能。该框架包含内部与外部两种策略:内部采用基于真实软件仓库的开发上下文轨迹生成方法,支持故障定位、补丁生成等多阶段推理,并通过拒绝采样严格评估轨迹的准确性和复杂度;外部则提出基于开发流程的搜索策略,由奖励模型与执行验证引导,在关键决策点精准分配计算资源,克服现有仅在终点验证的局限性。在SWE-bench Verified上的评估显示,我们的32B模型实现46%的问题解决率,显著优于DeepSeek R1 671B和OpenAI o1等更大模型。同时,实证验证了测试时缩放现象——模型会动态为更难问题分配更多令牌,从而增强推理能力。所有训练数据、模型与代码已公开,便于后续研究。

原文摘要 · Abstract (English)

Recent advancements in software engineering agents have demonstrated promising capabilities in automating program improvements. However, their reliance on closed-source or resource-intensive models introduces significant deployment challenges in private environments, prompting a critical question: \textit{How can personally deployable open-source LLMs achieve comparable code reasoning performance?} To this end, we propose a unified Test-Time Compute scaling framework that leverages increased inference-time computation instead of larger models. Our framework incorporates two complementary strategies: internal TTC and external TTC. Internally, we introduce a \textit{development-contextualized trajectory synthesis} method leveraging real-world software repositories to bootstrap multi-stage reasoning processes, such as fault localization and patch generation. We further enhance trajectory quality through rejection sampling, rigorously evaluating trajectories along accuracy and complexity. Externally, we propose a novel \textit{development-process-based search} strategy guided by reward models and execution verification. This approach enables targeted computational allocation at critical development decision points, overcoming limitations of existing "end-point only" verification methods. Evaluations on SWE-bench Verified demonstrate our \textbf{32B model achieves a 46\% issue resolution rate}, surpassing significantly larger models such as DeepSeek R1 671B and OpenAI o1. Additionally, we provide the empirical validation of the test-time scaling phenomenon within SWE agents, revealing that \textbf{models dynamically allocate more tokens to increasingly challenging problems}, effectively enhancing reasoning capabilities. We publicly release all training data, models, and code to facilitate future research. https://github.com/yingweima2022/SWE-Reasoner

代码生成推理增强开源模型测试时扩展

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