ALGO:利用 LLM 生成的 Oracle 验证器综合算法程序
ALGO: Synthesizing Algorithmic Programs with LLM-Generated Oracle Verifiers
AI总结:
本文提出 ALGO 框架,通过 LLM 穷举变量组合生成 oracle,引导算法搜索并验证程序正确性,从而以模型无关方式显著提升代码生成模型在算法题上的一次提交通过率。
摘要:
大型语言模型(LLM)擅长根据功能描述实现代码,但在处理不仅需要实现、还需要识别合适算法的算法问题时会遇到困难。此外,LLM 生成的程序缺乏正确性保证,需要人工验证。为应对这些挑战,我们提出 ALGO,这是一个利用 LLM 生成的 Oracle 来综合算法程序的框架,这些 Oracle 用于指导生成并验证程序正确性。ALGO 首先通过提示 LLM 穷举相关变量的所有组合,生成一个参考 oracle。随后,该 oracle 被用于指导任意搜索策略探索算法空间,并验证综合得到的算法。我们的研究表明,LLM 生成的 oracle 在 88% 的情况下是正确的。借助 oracle 作为验证器,ALGO 能够以与模型无关的方式与任何现有代码生成模型集成,以提升其性能。实验表明,配备 ALGO 后,我们的一次提交通过率比 Codex 模型高 8 倍,比 CodeContests 上当前最先进的模型 CodeT 高 2.6 倍。在未见过的问题上,我们的通过率也比 ChatGPT Code Interpreter 高 1.3 倍。我们用于测试的问题集、使用的提示、验证器和解法程序,以及 ALGO 生成的测试用例,均可在 https://github.com/zkx06111/ALGO 获取。
英文摘要:
Large language models (LLMs) excel at implementing code from functionality descriptions but struggle with algorithmic problems that require not only implementation but also identification of the suitable algorithm. Moreover, LLM-generated programs lack guaranteed correctness and require human verification. To address these challenges, we propose ALGO, a framework that synthesizes Algorithmic programs with LLM-Generated Oracles to guide the generation and verify their correctness. ALGO first generates a reference oracle by prompting an LLM to exhaustively enumerate all the combinations of relevant variables. This oracle is then utilized to guide an arbitrary search strategy in exploring the algorithm space and to verify the synthesized algorithms. Our study shows that the LLM-generated oracles are correct for 88% of the cases. With the oracles as verifiers, ALGO can be integrated with any existing code generation model in a model-agnostic manner to enhance its performance. Experiments show that when equipped with ALGO, we achieve an 8x better one-submission pass rate over the Codex model and a 2.6x better one-submission pass rate over CodeT, the current state-of-the-art model on CodeContests. We can also get 1.3x better pass rate over the ChatGPT Code Interpreter on unseen problems. The problem set we used for testing, the prompts we used, the verifier and solution programs, and the test cases generated by ALGO are available at https://github.com/zkx06111/ALGO.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。