arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2406.10018cs.SE
收藏

STALL+:利用静态分析提升基于大语言模型的仓库级代码补全

STALL+: Boosting LLM-based Repository-level Code Completion with Static Analysis

Junwei Liu, Yixuan Chen, Mingwei Liu, Xin Peng, Yiling Lou

AI总结:

本文提出框架 STALL+,系统研究静态分析在基于大语言模型的仓库级代码补全不同阶段的集成策略,并在 CrossCodeEval 上验证提示阶段集成文件依赖效果最佳,同时揭示其与 RAG 的互补性及语言差异。

摘要:

仓库级代码补全具有挑战性,因为它涉及来自仓库中多个文件的复杂上下文。迄今为止,研究人员已提出两类技术来增强基于大语言模型的仓库级代码补全,即检索增强生成(RAG)和静态分析集成。本工作首次对基于大语言模型的仓库级代码补全中的静态分析集成进行研究,考察静态分析集成策略在代码补全不同阶段的有效性和效率。我们首先实现了一个框架 STALL+,该框架支持将多种静态分析策略以可扩展和可定制的方式集成到基于大语言模型的仓库级代码补全的完整流水线中;基于 STALL+,我们在最新的仓库级代码补全基准 CrossCodeEval 上纳入了不同代码大语言模型进行了广泛实验。我们的发现表明,在提示阶段集成文件级依赖关系表现最佳,而在后处理阶段集成表现最差。此外,我们观察到静态分析在动态语言和静态语言之间带来的改进不同,即考虑到静态分析动态语言的局限性,Java 的最佳组合是提示阶段与解码阶段集成,而 Python 的最佳组合是提示阶段与后处理阶段集成。此外,我们发现 RAG 与静态分析集成之间存在互补性,以及它们在组合后的成本效益。

英文摘要:

Repository-level code completion is challenging as it involves complicated contexts from multiple files in the repository. To date, researchers have proposed two technical categories to enhance LLM-based repository-level code completion, i.e., retrieval-augmented generation (RAG) and static analysis integration. This work performs the first study on the static analysis integration in LLM-based repository-level code completion by investigating both the effectiveness and efficiency of static analysis integration strategies across different phases of code completion. We first implement a framework STALL+, which supports an extendable and customizable integration of multiple static analysis strategies into the complete pipeline of LLM-based repository-level code completion; and based on STALL+, we perform extensive experiments by including different code LLMs on the latest repository-level code completion benchmark CrossCodeEval. Our findings show that integrating file-level dependencies in prompting phase performs the best while the integration in post-processing phase performs the worse. Additionally, we observe different improvements from static analysis between dynamic languages and static languages, i.e., the best combination is prompting-phase with decoding-phase integration for Java while the best combination is prompting-phase with post-processing-phase integration for Python given the limitations of statically analyzing dynamic languages. Additionally, we find the complementarity between RAG and static analysis integration as well as their cost-effectiveness after combination.

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

↑