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

Execution-Based Evaluation for Open-Domain Code Generation

Zhiruo Wang, Shuyan Zhou, Daniel Fried, Graham Neubig

Abstract

Current benchmarks for natural language to code generation often focus on "closed-domain" tasks—algorithmic problems solvable using only built-in language features. This paper introduces ODEX, a new execution-based benchmark designed to evaluate "open-domain" code generation, which requires the use of diverse third-party libraries. ODEX spans 79 libraries and four languages (English, Spanish, Japanese, and Russian), providing a more realistic assessment of how Large Language Models (LLMs) perform in real-world software development contexts.

Introduction

The advancement of Large Language Models (LLMs) has revolutionized automated code generation. However, standard evaluation datasets like HumanEval and MBPP primarily test a model's ability to solve isolated algorithmic puzzles. In contrast, professional software engineering is characterized by its reliance on a vast ecosystem of external libraries. Writing code that correctly interfaces with libraries like pandas for data manipulation or requests for network operations is a distinct and often more difficult challenge than implementing a sorting algorithm.

To address this, we present ODEX, the first benchmark that combines multi-language support with execution-based evaluation for open-domain tasks. By requiring generated code to pass functional test cases involving external dependencies, ODEX reveals the "open-domain tax"—the performance gap models face when moving beyond standard language built-ins.

The ODEX Dataset

ODEX consists of 945 natural language (NL) to code pairs. It is uniquely multilingual, capturing developer intents in English, Spanish, Japanese, and Russian. This diversity reflects the global nature of programming and ensures that models are tested against a wide range of linguistic expressions of technical requirements.

Examples of open-domain, multilingual code generation tasks in ODEX, featuring libraries like requests, datetime, csv, and sympy.

The dataset focuses on practical, "natural" queries harvested from StackOverflow. This approach ensures that the benchmark reflects the actual problems developers seek to solve, rather than artificial exercises.

Methodology: Ensuring Functional Correctness

A key contribution of ODEX is its execution-based evaluation framework. Unlike lexical metrics (e.g., BLEU), which only measure textual similarity, execution-based evaluation confirms that the generated code actually works. The creation of ODEX followed a rigorous four-step pipeline:

  1. Resource Collection: NL-code pairs were sourced from StackOverflow to ensure real-world relevance.
  2. Function Wrapping: Snippets were transformed into standalone, testable functions.
  3. Library Prerequisites: The specific libraries and versions required for each snippet were manually identified and documented.
  4. Test Case Annotation: Experts authored 1,707 test cases, employing techniques like mocking for network calls to ensure reliable execution.
The four-step pipeline for creating execution-based test cases: wrapping code into functions, importing libraries, writing test cases, and executing for verification.

Key Insights and Results

Evaluations using the pass@k metric on models like OpenAI’s CODEX and Salesforce’s CODEGEN provided several significant findings:

The Open-Domain Tax

Models perform substantially worse on open-domain tasks. For CODEX Davinci-002, the pass@1 accuracy dropped by nearly 20 percentage points when moving from closed-domain to open-domain English tasks. This highlights a critical area for improvement in LLM training: the need for better "library awareness."

Lexical Metrics are Unreliable

The study found that BLEU and ROUGE scores correlate poorly with functional correctness. Code that is syntactically similar to a reference solution may still fail due to a single incorrect API call, while functionally perfect code might be penalized for using different variable names.

The Benefit of Execution Hints

Including a single example test case in the model's prompt (within the docstring) significantly improved performance. This "hint" helps the model understand the expected input/output types and the specific behavior required, effectively guiding the generation process.

Conclusion

ODEX provides a vital new lens for evaluating code generation models. By shifting the focus from "closed-domain" algorithms to "open-domain" library usage, it exposes the practical challenges LLMs face in real-world programming. As we move toward more sophisticated AI coding assistants, benchmarks like ODEX will be essential for measuring progress in functional, library-aware code generation.

Summary updated

BibTeX
@inproceedings{wang2023execution,
  author = {Zhiruo Wang and Shuyan Zhou and Daniel Fried and Graham Neubig},
  title = {{Execution-Based Evaluation for Open-Domain Code Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.89},
}
Figure