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

Codev-Bench:LLM 如何理解以开发者为中心的代码补全?

Codev-Bench: How Do LLMs Understand Developer-Centric Code Completion?

Northwestern University(西北大学);Alibaba Group(阿里巴巴集团);Tongyi Lab(通义实验室)

Zhenyu Pan, Rongyu Cao, Yongchang Cao, Yingwei Ma, Binhua Li, Fei Huang, Han Liu, Yongbin Li

AI总结:

该研究通过分析工业代码补全数据并构建自动化 Codev-Agent,提出仓库级、以开发者为中心的 Codev-Bench,以更真实地评估 LLM 的即时意图理解与补全能力。

摘要:

代码补全是代码生成中的一项关键下游任务,也是软件开发中提升开发者生产力最频繁且最具影响力的方法之一。随着智能补全工具的发展,我们需要一个稳健的评估基准,以实现产品之间有意义的比较,并指导未来进展。然而,现有基准更多关注粗粒度任务,缺乏贴近开发者真实场景的工业级分析,更像通用代码生成。此外,这些基准通常依赖昂贵且耗时的人工标注,而且独立测试用例未能利用最小测试来实现最大程度的仓库级理解和代码覆盖率。为解决这些局限,我们首先分析来自工业级代码补全工具的业务数据,并重新定义评估标准,使其在整个编码过程中更贴合开发者意图和期望的补全行为。基于这些洞察,我们提出 Codev-Agent,这是一个基于智能体的系统,可自动化仓库爬取、构建执行环境、从现有单元测试中提取动态调用链,并生成新的测试样本以避免数据泄漏,从而确保公平有效的比较。借助 Codev-Agent,我们提出 Code-Development Benchmark(Codev-Bench),这是一个细粒度、真实世界、仓库级且以开发者为中心的评估框架。Codev-Bench 评估代码补全工具能否捕捉开发者的即时意图,并在多种上下文中建议合适代码,为现代软件开发中的代码补全提供更现实的基准。

英文摘要:

Code completion, a key downstream task in code generation, is one of the most frequent and impactful methods for enhancing developer productivity in software development. As intelligent completion tools evolve, we need a robust evaluation benchmark that enables meaningful comparisons between products and guides future advancements. However, existing benchmarks focus more on coarse-grained tasks without industrial analysis resembling general code generation rather than the real-world scenarios developers encounter. Moreover, these benchmarks often rely on costly and time-consuming human annotation, and the standalone test cases fail to leverage minimal tests for maximum repository-level understanding and code coverage. To address these limitations, we first analyze business data from an industrial code completion tool and redefine the evaluation criteria to better align with the developer's intent and desired completion behavior throughout the coding process. Based on these insights, we introduce Codev-Agent, an agent-based system that automates repository crawling, constructs execution environments, extracts dynamic calling chains from existing unit tests, and generates new test samples to avoid data leakage, ensuring fair and effective comparisons. Using Codev-Agent, we present the Code-Development Benchmark (Codev-Bench), a fine-grained, real-world, repository-level, and developer-centric evaluation framework. Codev-Bench assesses whether a code completion tool can capture a developer's immediate intent and suggest appropriate code across diverse contexts, providing a more realistic benchmark for code completion in modern software development.

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

↑