arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2409.03733cs.LGcs.AIcs.CL
收藏

以自然语言进行规划可提升大语言模型在代码生成中的搜索效果

Planning In Natural Language Improves LLM Search For Code Generation

Scale AI;California Institute of Technology(加州理工学院);Northeastern University(东北大学);Anysphere

Evan Wang, Federico Cassano, Catherine Wu, Yunfeng Bai, Will Song, Vaskar Nath, Ziwen Han, Sean Hendryx, Summer Yue, Hugh Zhang

AI总结:

本文提出PlanSearch算法,通过在自然语言中搜索多样化的问题解决计划而非直接搜索代码,显著提升LLM代码生成的推理搜索效果,并在LiveCodeBench上取得77.0%的pass@200最优成绩。

摘要:

尽管扩展训练计算已使大语言模型(LLMs)取得显著进步,但扩展推理计算尚未带来类似收益。我们假设缺失的核心因素是LLM输出缺乏多样性,导致搜索效率低下,因为模型会反复采样高度相似但不正确的生成结果。我们通过实验证明,在自然语言中搜索解决问题的候选计划可以缓解这种多样性不足。基于这一见解,我们提出了PlanSearch,这是一种新颖的搜索算法,在HumanEval+、MBPP+和LiveCodeBench(一个无污染的竞赛编程基准)上均展现出强劲结果。PlanSearch首先生成关于问题的一组多样化观察,然后利用这些观察构建解决问题的计划。通过在自然语言中搜索计划而非直接搜索代码解决方案,PlanSearch相比基线搜索方法探索了显著更多样化的潜在解决方案范围。在Claude 3.5 Sonnet之上使用PlanSearch,在LiveCodeBench上实现了77.0%的state-of-the-art pass@200,优于未使用搜索的最佳得分(pass@1 = 41.4%)以及使用标准重复采样的得分(pass@200 = 60.6%)。最后,我们表明,在所有分析的模型、搜索算法和基准测试中,我们都能准确预测搜索带来的性能提升,将其作为生成想法多样性的直接函数。代码可在https://github.com/scaleapi/plansearch找到。

英文摘要:

While scaling training compute has led to remarkable improvements in large language models (LLMs), scaling inference compute has not yet yielded analogous gains. We hypothesize that a core missing component is a lack of diverse LLM outputs, leading to inefficient search due to models repeatedly sampling highly similar, yet incorrect generations. We empirically demonstrate that this lack of diversity can be mitigated by searching over candidate plans for solving a problem in natural language. Based on this insight, we propose PlanSearch, a novel search algorithm which shows strong results across HumanEval+, MBPP+, and LiveCodeBench (a contamination-free benchmark for competitive coding). PlanSearch generates a diverse set of observations about the problem and then uses these observations to construct plans for solving the problem. By searching over plans in natural language rather than directly over code solutions, PlanSearch explores a significantly more diverse range of potential solutions compared to baseline search methods. Using PlanSearch on top of Claude 3.5 Sonnet achieves a state-of-the-art pass@200 of 77.0% on LiveCodeBench, outperforming both the best score achieved without search (pass@1 = 41.4%) and using standard repeated sampling (pass@200 = 60.6%). Finally, we show that, across all models, search algorithms, and benchmarks analyzed, we can accurately predict performance gains due to search as a direct function of the diversity over generated ideas. Code can be found at https://github.com/scaleapi/plansearch.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑