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 Li, Bin Gu, Mengfei Yang

Introduction

While Large Language Models (LLMs) have shown remarkable proficiency in solving isolated coding puzzles, their performance in real-world software development environments remains less understood. Traditional benchmarks like HumanEval or MBPP focus on "standalone" functions—self-contained logic that resembles competitive programming rather than professional engineering. DevEval is a new, manually-annotated benchmark designed to bridge this gap by evaluating repository-level code generation.

The DevEval Benchmark

DevEval consists of 1,825 testing samples derived from 115 real-world PyPI repositories across 10 popular domains, such as Database, Internet, and Frameworks. Unlike previous datasets, DevEval reflects the actual distribution of code in the wild: approximately 73% of the samples are "non-standalone," meaning they rely on a complex web of internal dependencies, including classes and functions located in the same or different files.

Overview of the DevEval benchmark components, including requirements, repository context, and reference dependencies.

Each sample in DevEval is meticulously annotated with:

  • Signature and Requirement: The target function's definition and natural language description.
  • Repository Context: The surrounding codebase to simulate a real IDE environment.
  • Reference Dependencies: Explicit labels for intra-class, intra-file, and cross-file dependencies.
  • Test Cases: Unit tests to verify functional correctness.

Evaluation Methodology

To capture the nuances of repository-level tasks, the researchers introduced two key metrics:

  1. Pass@k: Measures functional correctness by checking if the generated code passes the provided unit tests.
  2. Recall@k: A novel metric that measures how accurately the model identifies and invokes the specific internal dependencies used by human developers in the reference code.

Key Results and Insights

Experiments involving state-of-the-art models like GPT-4, GPT-3.5, and DeepSeek Coder revealed a significant "context gap." LLMs that excel at standalone puzzles often struggle when dropped into a sprawling repository. For instance, GPT-4’s performance drops from an 80% Pass@1 on HumanEval to 53.04% on DevEval.

Performance comparison between standalone and non-standalone code across different context settings, highlighting the impact of local file context.

As illustrated in the results, context is the primary driver of performance. Providing "Local File" context (the code surrounding the target function) improved GPT-4’s performance by over 200% compared to a zero-context setting. However, even with full context, models frequently fail to "see" relevant functions in different files, leading to the hallucination of logic that already exists elsewhere in the project.

Conclusion

DevEval sets a new, more rigorous standard for evaluating AI coding assistants. By moving beyond isolated functions and requiring models to navigate real-world repository dependencies, it highlights the critical need for better context-retrieval mechanisms and improved cross-file understanding in the next generation of LLMs.

Summary updated

BibTeX
@inproceedings{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 and Bin Gu and Mengfei Yang},
  title = {{DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositories}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.214},
}
Figure