arXiv:2411.05010cs.SEcs.AI2024-11中稿 · ICLR被引 9

用优化思想提升代码生成搜索效率,显著减少迭代次数并提高准确率。

Scattered Forest Search: Smarter Code Space Exploration with LLMs

  • 将代码生成视为黑箱优化问题,设计新型森林搜索策略提升多样性。
  • 在HumanEval上达67.1% pass@1,较最先进方法提升8.6%,迭代次数减半。
  • 适合追求高效、高精度代码生成的开发者与研究者使用。

我们将代码生成建模为代码空间内的黑箱优化问题,证明优化方法可增强推理扩展性。基于此视角,提出一种新方法SCATTERED FOREST SEARCH(SFS),通过提升解的多样性并更好利用反馈来改进进化搜索。理论分析表明该方法有助于避免局部最优,实现更高效的探索。在HumanEval、MBPP、APPS、CodeContests和Leetcode上的大量实验显示显著性能提升:例如在HumanEval+上使用GPT-3.5时,pass@1达到67.1%,较当前最优提升8.6%;在HumanEval上达87.2%,提升4.3%,同时迭代次数减少一半。此外,该方法比树搜索、行搜索和重复采样等现有技术更具可扩展性。

原文摘要 · Abstract (English)

We frame code generation as a black-box optimization problem within the code space and demonstrate how optimization-inspired techniques can enhance inference scaling. Based on this perspective, we propose SCATTERED FOREST SEARCH (SFS), a novel approach that improves solution diversity and better exploits feedback during evolutionary search. Our theoretical analysis illustrates how these methods help avoid local optima during optimization, leading to more efficient exploration. Extensive experiments on HumanEval, MBPP, APPS, CodeContests, and Leetcode reveal significant performance gains. For instance, our method achieves a pass@1 rate of 67.1% on HumanEval+ and 87.2% on HumanEval with GPT-3.5, marking improvements of 8.6% and 4.3% over the state-of-the-art, while also halving the iterations needed to find the correct solution. Furthermore, our approach scales more efficiently than existing search techniques, including tree search, line search, and repeated sampling.

代码生成搜索算法LLM优化

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