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

Execution-based Evaluation for Data Science Code Generation Models

Junjie Huang, Chenglong Wang, Jipeng Zhang, Cong Yan, Haotian Cui, Jeevana Priya Inala, Colin B. Clement, Nan Duan, Jianfeng GaoarXiv 2022

Abstract: Code generation models can benefit data scientists' productivity by automatically generating code from context and text descriptions. An important measure of the modeling progress is whether a model can generate code that can correctly execute to solve the task. However, due to the lack of an evaluation dataset that directly supports execution-based model evaluation, existing work relies on code surface form similarity metrics (e.g., BLEU, CodeBLEU) for model selection, which can be inaccurate. To remedy this, we introduce ExeDS, an evaluation dataset for execution evaluation for data science code generation tasks. ExeDS contains a set of 534 problems from Jupyter Notebooks, each consisting of code context, task description, reference program, and the desired execution output. With ExeDS, we evaluate the execution performance of five state-of-the-art code generation models that have achieved high surface-form evaluation scores. Our experiments show that models with high surface-form scores do not necessarily perform well on execution metrics, and execution-based metrics can better capture model code generation errors.

Introduction

In the rapidly evolving field of AI-driven programming, evaluating the quality of generated code is a critical challenge. Traditionally, researchers have relied on "surface-form" metrics such as BLEU or CodeBLEU. These metrics measure the textual overlap between a model's output and a human-written reference. However, code is fundamentally different from natural language; two snippets can be textually distinct yet functionally identical, or nearly identical yet functionally broken due to a single character error.

This discrepancy is particularly acute in Data Science (DS). Data scientists typically work in interactive environments like Jupyter Notebooks, where code execution is stateful and depends heavily on external data dependencies (e.g., CSV files) and previous computational steps. Existing benchmarks often lack these dependencies, making it impossible to verify if the generated code actually works. To bridge this gap, we present ExeDS, the first dataset designed for execution-based evaluation of data science code generation.

The ExeDS Benchmark

The ExeDS dataset consists of 534 high-quality problems derived from real-world Jupyter Notebooks. To create this benchmark, we developed a rigorous pipeline that included crawling original GitHub repositories to retrieve data dependencies, filtering for cells that execute without error, and employing human annotators to write clear natural language "intents" for each task.

Structure of an ExeDS problem instance.

As illustrated in Figure 1, each ExeDS instance provides the model with the preceding code context and a natural language intent. The evaluation then compares the execution output of the generated code against the ground truth output using a metric we call Output Exact Match (OutputEM). This metric normalizes numerical and textual outputs to ensure that functional correctness is captured even when formatting differs.

The "BLEU Mirage" in Data Science

Our findings reveal a significant gap between traditional metrics and actual execution success. We found that models scoring high on BLEU often fail to produce executable code. For instance, a model might correctly predict complex variable names (boosting its BLEU score) but fail to call the necessary print() function, resulting in a 0% execution score.

Conversely, powerful models like OpenAI’s Codex demonstrated a "silent" top-tier performance. In zero-shot settings, Codex achieved a very low BLEU score (3.9) because its coding style differed from the human references in the dataset. However, it achieved a high execution score (27.7%), proving that it understood the underlying logic of the tasks better than surface-form metrics suggested.

Example of intent-output mismatch in generated code.

Figure 2 highlights a common failure mode: the model generates code that is syntactically correct and relevant to the context (using .info()) but fails to satisfy the specific intent of the prompt ("Print the Shape"). Execution-based evaluation is essential to identify these subtle but critical errors.

Key Results and Error Analysis

We evaluated several state-of-the-art models, including JuPyT5, CodeGPT, and the GPT-neo family. JuPyT5, an encoder-decoder model pre-trained specifically on notebook data, achieved the highest execution performance with a 31.6% OutputEM. Notably, its code-level Exact Match (EM) was only 6.2%, further emphasizing that functional correctness does not require textual identity.

Our error analysis identified two primary hurdles for current models:

  1. Context Management: 45% of execution errors were caused by "undefined variables," suggesting that models struggle to maintain a long-term memory of the notebook state.
  2. Schema Sensitivity: 22% of errors involved misusing the data schema, such as referencing non-existent column names. This indicates that future models would benefit from "seeing" the actual data structure (column names and types) rather than just the code context.

Conclusion

ExeDS provides a necessary reality check for data science code generation. By shifting the focus from how code looks to how it runs, we can more accurately track progress in the field. Our results suggest that future research should prioritize multimodal context—incorporating data schemas and execution state—to build more robust and useful tools for data scientists.

Summary updated

BibTeX
@misc{huang2022execution,
  author = {Junjie Huang and Chenglong Wang and Jipeng Zhang and Cong Yan and Haotian Cui and Jeevana Priya Inala and Colin B. Clement and Nan Duan and Jianfeng Gao},
  title = {{Execution-based Evaluation for Data Science Code Generation Models}},
  year = {2022},
  eprint = {2211.09374},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.09374},
}
Figure