NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

ExecRepoBench: Multi-level Executable Code Completion Evaluation

Jian Yang, Jiajun Zhang, Jiaxi Yang, Ke Jin, Lei Zhang, Qiyao Peng, Ken Deng, Yibo Miao, Tianyu Liu, Zeyu Cui, Binyuan Hui, Junyang LinarXiv 2024 · DOI

Introduction

Traditional code completion benchmarks often rely on static metrics like Exact Match or Edit Similarity. While these metrics provide a baseline for text generation, they fail to capture the functional correctness of code in real-world software engineering contexts. Modern development occurs at the repository level, where inter-file dependencies and complex logic are the norm. To address these limitations, we introduce ExecRepoBench, a benchmark designed to evaluate code completion through actual execution within a multi-file environment. Alongside this, we present Repo-Instruct, a large-scale instruction dataset, and a multi-level masking strategy that leverages Abstract Syntax Trees (AST) to improve model understanding of hierarchical code structures.

Methodology: Multi-level Grammar-based Completion

A core innovation of this work is the shift from random text masking to logical, grammar-based masking. By parsing code into an AST, we can identify and mask specific logical units such as expressions, statements, functions, and classes. This approach forces the model to learn the structural and logical flow of programming languages rather than just predicting character sequences.

The three-step process for multi-level grammar-based completion using AST parsing.

Furthermore, we employ Hybrid Instruction Tuning, combining prefix-suffix-middle completion data with standard Question-Answering (QA) instruction data. This dual training ensures that the resulting model, Qwen2.5-Coder-Instruct-C, can both complete code snippets and follow complex natural language instructions.

Datasets and Evaluation

The research introduces two significant data resources:

  1. Repo-Instruct: A training corpus of nearly 3 million completion samples derived from 1.5 million GitHub repositories, covering major languages like Python, C++, Java, and JavaScript.
  2. ExecRepoBench: A high-quality evaluation set of 1.2K samples from 50 active Python repositories. Unlike static benchmarks, ExecRepoBench requires models to pass unit tests in an isolated Docker environment to be considered successful.
Overview of the ExecRepoBench evaluation environment, featuring repository structure and Docker-based unit testing.

Key Insights and Results

Our evaluation revealed a significant "Execution Mismatch": models that score well on text similarity often fail functional tests, and vice versa. This highlights the necessity of execution-based benchmarks.

The 7B parameter Qwen2.5-Coder-Instruct-C model demonstrated exceptional performance:

  • ExecRepoBench: Achieved a Pass@1 score of 44.2%, significantly outperforming larger models such as CodeLlama-70B (24.9%) and StarCoder2-15B (22.8%).
  • MultiPL-E: Reached an average Pass@1 of 76.4% across 8 languages, rivaling proprietary models.

These results suggest that specialized training on repository-level dependencies and logical structures allows smaller models to punch significantly above their weight class in functional code generation.

Conclusion and Future Work

ExecRepoBench sets a new standard for code completion evaluation by prioritizing functional correctness over text matching. While currently focused on Python for its executable component, future work will expand this to other languages. Additionally, exploring Reinforcement Learning from Human Feedback (RLHF) could further align model outputs with developer preferences and coding styles.

Summary updated

BibTeX
@misc{yang2024execrepobench,
  author = {Jian Yang and Jiajun Zhang and Jiaxi Yang and Ke Jin and Lei Zhang and Qiyao Peng and Ken Deng and Yibo Miao and Tianyu Liu and Zeyu Cui and Binyuan Hui and Junyang Lin},
  title = {{ExecRepoBench: Multi-level Executable Code Completion Evaluation}},
  year = {2024},
  eprint = {2412.11990},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.11990},
}
Figure