2025-01-28 · 进阶 · 机器学习 · 计算机视觉 · 数据科学

CodeMonkeys: Scaling Test-Time Compute for Software Engineering

CodeMonkeys通过扩展测试时计算来提高解决GitHub软件工程问题的能力,通过并行和串行计算扩展,实现了更高的覆盖率和解决率。

更新于 2025-01-28。作者:Ryan Ehrlich、Bradley Brown、Jordan Juravsky、Ronald Clark、Christopher Ré、Azalia Mirhoseini。

中文摘要

测试时计算能力的扩展是提升大型语言模型能力的一个有前景的方向。然而,测试时计算能力的扩展可以采用多种方式,而有效地结合不同的方法仍然是一个活跃的研究领域。在这里,我们以解决来自SWE-bench数据集的真实GitHub问题为背景,探讨这个问题。我们的系统名为CodeMonkeys,它允许模型通过联合生成和运行测试脚本与他们的草案编辑来迭代地编辑代码库。对于每个问题,我们采样许多这些多轮轨迹来生成一系列候选编辑。这种方法使我们能够通过增加每个轨迹的迭代次数来扩展“串行”测试时计算能力,通过增加每个问题中的轨迹数量来扩展“并行”测试时计算能力。在并行扩展的情况下,我们可以将前期成本分摊到多个下游样本中,使我们能够通过简单地让大型语言模型阅读每个文件的方法来识别相关的代码库上下文。为了在候选编辑之间进行选择,我们结合使用模型生成的测试投票和最终的多轮轨迹进行选择。总的来说,CodeMonkeys使用大约2300美元的预算解决了SWE-bench验证中的57.4%的问题。我们的选择方法还可以用于结合来自不同来源的候选者。在现有顶级SWE-bench验证提交的编辑集成中选择,获得了66.2%的分数,并且优于集成中最好的成员。我们在https://scalingintelligence.stanford.edu/pubs/codemonkeys上完全发布了我们的代码和数据。

英文摘要

Scaling test-time compute is a promising axis for improving LLM capabilities. However, test-time compute can be scaled in a variety of ways, and effectively combining different approaches remains an active area of research. Here, we explore this problem in the context of solving real-world GitHub issues from the SWE-bench dataset. Our system, named CodeMonkeys, allows models to iteratively edit a codebase by jointly generating and running a testing script alongside their draft edit. We sample many of these multi-turn trajectories for every issue to generate a collection of candidate edits. This approach lets us scale "serial" test-time compute by increasing the number of iterations per trajectory and "parallel" test-time compute by increasing the number of trajectories per problem. With parallel scaling, we can amortize up-front costs across multiple downstream samples, allowing us to identify relevant codebase context using the simple method of letting an LLM read every file. In order to select between candidate edits, we combine voting using model-generated tests with a final multi-turn trajectory dedicated to selection. Overall, CodeMonkeys resolves 57.4% of issues from SWE-bench Verified using a budget of approximately 2300 USD. Our selection method can also be used to combine candidates from different sources. Selecting over an ensemble of edits from existing top SWE-bench Verified submissions obtains a score of 66.2% and outperforms the best member of the ensemble on its own. We fully release our code and data at https://scalingintelligence.stanford.edu/pubs/codemonkeys.

解读

一句话总结

CodeMonkeys通过扩展测试时计算来提高解决GitHub软件工程问题的能力,通过并行和串行计算扩展,实现了更高的覆盖率和解决率。

问题1:这篇论文想要解决什么具体问题?

• 问题背景:随着大型语言模型(LLM)在解决编程任务方面的能力不断提高,如何进一步提高LLM的测试时计算能力成为研究热点。 • 现有方案不足:现有的方法在扩展测试时计算方面存在局限性,如需要大量计算资源、难以有效选择最佳解决方案等。 • 研究目标:设计一个系统,通过扩展测试时计算来提高解决GitHub软件工程问题的能力,并实现高效的解决方案选择。

问题2:论文的核心创新点是什么?

• 技术创新:提出了CodeMonkeys系统,通过并行和串行计算扩展,提高了测试时计算能力。 • 方法改进:将问题解决过程分为三个步骤:识别相关代码库上下文、生成候选代码库编辑以及选择最佳编辑。 • 优势:实现了更高的覆盖率和解决率,同时降低了计算成本。

问题3:实验结果如何验证了方法的有效性?

• 关键实验:在SWE-bench Verified数据集上进行了实验,验证了CodeMonkeys系统的有效性。 • 性能提升:CodeMonkeys在SWE-bench Verified数据集上实现了57.4%的解决率,并花费约2300美元的LLM推理成本。 • 对比结果:与基线方法相比,CodeMonkeys实现了更高的解决率。

问题4:这个研究的实际应用价值是什么?

• 应用场景:CodeMonkeys系统可以应用于解决GitHub软件工程问题,提高开发效率和代码质量。 • 实施建议:结合实际情况,选择合适的并行和串行计算扩展策略,以提高解决率。 • 局限与展望:未来可以进一步优化选择方法,提高解决率,并探索更多应用场景。

来源