arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.12317cs.CLcs.AI
收藏

EVOR:为代码生成演化检索

EVOR: Evolving Retrieval for Code Generation

The University of Hong Kong(香港大学);Fudan University(复旦大学);Sea AI Lab(Sea AI实验室)

Hongjin Su, Shuyang Jiang, Yuhang Lai, Haoyuan Wu, Boao Shi, Che Liu, Qian Liu, Tao Yu

AI总结:

针对静态单一知识库限制代码生成适应能力的问题,本文提出 EVOR,通过查询与多样化知识库同步演化提升检索增强代码生成,并构建 EVOR-BENCH,执行准确率达现有方法两到四倍。

摘要:

近来,检索增强生成(RAG)已成功应用于代码生成。然而,现有的检索增强代码生成(RACG)流程采用单一来源的静态知识库,限制了大型语言模型(LLM)对其知识不足领域的适应能力。在本工作中,我们开发了一个新颖流程 EVOR,它利用查询与多样化知识库的同步演化。在两个需要外部知识来解决代码生成任务的现实设置中,我们构建了四个与频繁更新的库和长尾编程语言相关的新数据集,命名为 EVOR-BENCH。大量实验表明,与 Reflexion(Shinn 等,2024)、DocPrompting(Zhou 等,2023)等其他方法相比,EVOR 的执行准确率达到其两到四倍。我们证明 EVOR 具有灵活性,可轻松与这些方法结合以获得进一步提升。进一步分析表明,EVOR 受益于查询与文档的同步演化以及知识库中的多样化信息来源。我们希望本研究能为未来设计先进 RACG 流程带来更多启发。我们的模型、代码和数据可在 https://arks-codegen.github.io 获取。

英文摘要:

Recently the retrieval-augmented generation (RAG) has been successfully applied in code generation. However, existing pipelines for retrieval-augmented code generation (RACG) employ static knowledge bases with a single source, limiting the adaptation capabilities of Large Language Models (LLMs) to domains they have insufficient knowledge of. In this work, we develop a novel pipeline, EVOR, that employs the synchronous evolution of both queries and diverse knowledge bases. On two realistic settings where the external knowledge is required to solve code generation tasks, we compile four new datasets associated with frequently updated libraries and long-tail programming languages, named EVOR-BENCH. Extensive experiments demonstrate that EVOR achieves two to four times of execution accuracy compared to other methods such as Reflexion (Shinn et al., 2024), DocPrompting (Zhou et al., 2023), etc. We demonstrate that EVOR is flexible and can be easily combined with them to achieve further improvement. Further analysis reveals that EVOR benefits from the synchronous evolution of queries and documents and the diverse information sources in the knowledge base. We hope that our studies will inspire more insights into the design of advanced RACG pipelines in future research. Our model, code, and data are available at https://arks-codegen.github.io.

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

↑