DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositories

Jia Li, Ge Li, Yunfei Zhao, Yongmin Li, Huanyu Liu, Hao Zhu, Lecheng Wang, Kaibo Liu, Zheng Fang, Lanshen Wang, Jiazheng Ding, Xuanming Zhang, Yuqi Zhu, Yihong Dong, Zhi Jin, Binhua Li, Fei Huang, Yongbin LiarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable proficiency in code generation, often achieving high scores on popular benchmarks like HumanEval and MBPP. However, these benchmarks primarily focus on "standalone" functions—self-contained puzzles that require only standard library knowledge. In contrast, professional software development involves complex, "non-standalone" code that relies on a dense web of project-specific dependencies.

DevEval is a new, manually-annotated benchmark designed to bridge this gap. By evaluating LLMs on repository-level code generation, DevEval reveals a significant performance drop when models are required to handle real-world dependencies, with even top-tier models like GPT-4 struggling to maintain their typical performance levels in realistic settings.

The Standalone vs. Repository-Level Gap

Most existing benchmarks are poorly aligned with actual developer workflows. Real-world code is rarely written in a vacuum; it depends on functions, classes, and variables defined elsewhere in the same file, class, or across different files in a repository. This "knowledge gap" means that high scores on toy problems do not necessarily translate to utility in a production environment. DevEval addresses this by requiring models to generate code within the context of an entire repository, forcing them to navigate internal project logic.

The DevEval Benchmark

To create a benchmark that reflects real-world distributions, the authors analyzed over 1 million functions from 500 repositories. The resulting DevEval benchmark consists of 1,874 testing samples drawn from 117 repositories across 10 diverse domains.

Overview of a DevEval sample, illustrating the multi-faceted components required for repository-level evaluation, including signatures, requirements, and cross-file dependencies.

DevEval is characterized by several key features:

  • Realistic Distribution: 73% of samples are non-standalone, matching the distribution found in large-scale repository analysis.
  • Human Annotation: 13 developers spent over 670 hours writing requirements and labeling dependencies (intra-class, intra-file, and cross-file).
  • Comprehensive Metrics: In addition to the standard Pass@k (functional correctness), the authors introduce Recall@k, which measures how accurately a model invokes specific reference dependencies.

Experimental Findings

The researchers tested eight popular LLMs across three settings: "Without Context," "Local File (Completion)," and "Local File (Infilling)." The results highlight a staggering "context gap."

Performance comparison showing the significant impact of repository context on Pass@1 scores for standalone versus non-standalone tasks.

Key Insights:

  • The Necessity of Context: GPT-4-turbo's performance drops to roughly 17% on DevEval when denied repository context. Providing local file context improves Pass@1 scores by over 200%, confirming that context retrieval is essential for repository-level assistance.
  • Hallucination and Guessing: Models often attempt to "guess" dependencies based on common naming conventions when context is missing. However, when context is provided, they still struggle with "heterogeneous" information, often hallucinating non-existent functions even when the correct one is present in the prompt.
  • Dependency Difficulty: Models struggle most with cross-file dependencies. For these, GPT-4’s Recall@1 was only 38.71% in the completion setting, highlighting a major weakness in navigating complex project structures.

Conclusion

DevEval sets a new standard for evaluating coding proficiency by moving beyond standalone functions. The benchmark demonstrates that while LLMs are powerful, their ability to handle the intricate dependencies of real-world repositories remains a significant hurdle. Future work will look to expand DevEval to other programming languages and explore how models handle broader, repository-wide contexts beyond local files.

Summary updated

BibTeX
@misc{li2024deveval,
  author = {Jia Li and Ge Li and Yunfei Zhao and Yongmin Li and Huanyu Liu and Hao Zhu and Lecheng Wang and Kaibo Liu and Zheng Fang and Lanshen Wang and Jiazheng Ding and Xuanming Zhang and Yuqi Zhu and Yihong Dong and Zhi Jin and Binhua Li and Fei Huang and Yongbin Li},
  title = {{DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositories}},
  year = {2024},
  eprint = {2405.19856},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2405.19856},
}
Figure