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

REPOEXEC: Evaluate Code Generation with a Repository-Level Executable Benchmark

Nam Le Hai, Dung Manh Nguyen, Nghi D. Q. Bui · OpenReview

Abstract

CodeLLMs have gained widespread adoption for code generation tasks, yet their capacity to handle repository-level code generation with complex contextual dependencies remains underexplored. Our work underscores the critical importance of leveraging repository-level contexts to generate executable and functionally correct code. We present REPOEXEC, a novel benchmark designed to evaluate repository-level code generation, with a focus on three key aspects: executability, functional correctness through comprehensive test case generation, and accurate utilization of cross-file contexts. Our study examines a controlled scenario where developers specify essential code dependencies (contexts), challenging models to integrate them effectively. Additionally, we introduce an instruction-tuned dataset that enhances CodeLLMs' ability to leverage dependencies, along with a new metric, Dependency Invocation Rate (DIR), to quantify context utilization. Experimental results reveal that while pretrained LLMs demonstrate superior performance in terms of correctness, instruction-tuned models excel in context utilization and debugging capabilities. REPOEXEC offers a comprehensive evaluation framework for assessing code functionality and alignment with developer intent, thereby advancing the development of more reliable CodeLLMs for real-world applications. The dataset and source code are available at https://github.com/FSoft-AI4Code/RepoExec.

Introduction

Most code generation benchmarks, such as HumanEval, treat coding as an isolated task where a model produces a standalone function from a prompt. However, real-world software engineering occurs within the context of a repository. Developers rarely write everything from scratch; instead, they rely on internal APIs, project-specific constants, and existing class hierarchies.

Existing repository-level benchmarks often suffer from three major flaws: a lack of executability (relying on match-based metrics like BLEU), poor test quality, and a failure to penalize "code smells"—such as when a model reimplements a function that already exists elsewhere in the repository. REPOEXEC addresses these issues by providing a fully executable environment and a novel metric to measure context utilization.

Methodology: Building an Executable Benchmark

The creation of REPOEXEC involved a comprehensive pipeline designed to ensure high-quality, executable code samples. The process began with automated extraction using a tool called pydepcall to map function dependencies across entire repositories. To ensure functional correctness, the authors utilized LLMs for unit test generation, followed by an "Assertion Fixer" and "Coverage Enhancement" phase. This rigorous approach resulted in an average line coverage of 96.25%.

The REPOEXEC pipeline for benchmark creation and evaluation.

Contextual Dependency and the DIR Metric

A core innovation of this work is the Dependency Invocation Rate (DIR). This metric measures the ratio of provided dependencies that the model actually utilized versus what it was expected to use. This distinguishes between a model that "cheats" by reimplementing logic and one that effectively navigates the repository structure.

Models were tested against varying levels of context: Small (signatures only), Medium (signatures and docstrings), and Full (signatures, docstrings, and implementation content). This allows for a granular analysis of how different types of information influence model performance and dependency utilization.

Illustration of cross-file context extraction and the construction of prompts with varying context levels.

Key Insights and Results

Experimental results yielded several critical findings for the development of CodeLLMs:

  • The "Reinventing the Wheel" Trap: Pretrained models (e.g., base CodeLlama) often produce functionally correct code but have low DIR scores. They tend to ignore existing repository tools, leading to redundant codebases.
  • The Medium Context Paradox: Surprisingly, providing Medium context (signatures + docstrings) often performed worse than Small context (signatures only). Docstrings can sometimes confuse models, leading them to treat the dependency as a few-shot example to be copied rather than a tool to be invoked.
  • Instruction Tuning is Vital: Models fine-tuned on the authors' dependency-enhanced dataset (comprising over 150,000 functions) showed a significant improvement in DIR (over 10%) and better overall correctness.
  • Self-Correction Capabilities: Multi-round debugging, where models receive execution error logs to fix their own code, significantly boosted performance. For instance, GPT-3.5's pass@1 score jumped from 27.04% to 41.97% after three rounds of automated debugging.

Conclusion

REPOEXEC shifts the evaluation of AI code generation toward more realistic, repository-level tasks. By emphasizing executability and the Dependency Invocation Rate, it highlights the current gap between functional correctness and architectural cleanliness in AI-generated code. Future work will aim to incorporate multi-level transitive dependencies and broader non-code contexts to further simulate the complexities of professional software development.

Summary updated

BibTeX
@inproceedings{hai2025repoexec,
  author = {Nam Le Hai and Dung Manh Nguyen and Nghi D. Q. Bui},
  title = {{REPOEXEC: Evaluate Code Generation with a Repository-Level Executable Benchmark}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  url = {https://openreview.net/forum?id=dEJZOim3i3},
}
Figure