Abstract
Large Language Models (LLMs) have demonstrated significant proficiency in code generation, yet their application to complex, stateful data science tasks remains under-evaluated. This paper introduces DSEval, a comprehensive framework designed to benchmark LLM-powered data science agents across their operational lifecycle. By incorporating a novel bootstrapped annotation method and specialized validators for data integrity and execution state, DSEval provides a rigorous assessment of current agent capabilities. Our findings reveal critical weaknesses in state management and error recovery, particularly in realistic scenarios like Kaggle competitions.
1. Introduction
While Large Language Models (LLMs) have become remarkably adept at writing isolated Python snippets, the practice of data science involves a stateful, iterative process. Tasks such as data cleaning, exploratory analysis, and feature engineering are interdependent; a single error in an early stage can propagate through the entire pipeline, leading to catastrophic failures or silent data corruption.
Existing benchmarks, such as HumanEval or MBPP, focus primarily on stateless code completion. They fail to capture the nuances of real-world data science, including interaction with a runtime session, context retrieval from previous steps, and the handling of execution errors. To address these gaps, we present DSEval, a framework that monitors the entire agent lifecycle from query to execution.
2. The DSEval Evaluation Framework
The DSEval framework is designed to evaluate agents within a realistic runtime environment. It utilizes a modular architecture to track how agents interact with in-memory data, external files, and execution history.
To scale the creation of high-quality benchmarks, we developed DSEAL (DSEval Annotation Language), a domain-specific language that extends Python with YAML-based configurations for queries and validators. Furthermore, we employed an LLM-bootstrapping approach, using GPT-4 to generate problem sets from "idea seeds" (e.g., Kaggle datasets), refined through a human-in-the-loop process. This method reduced human labor by approximately 3x compared to manual curation.
3. Benchmarking Datasets
DSEval comprises four distinct benchmarks, totaling 825 problems, to test various aspects of data science proficiency:
- DSEval-Exercise: 187 tutorial-style Pandas exercises.
- DSEval-SO: 202 problems derived from real-world StackOverflow questions.
- DSEval-LeetCode: 40 algorithmic problems focused on Pandas operations.
- DSEval-Kaggle: 396 problems based on 31 real-world Kaggle datasets, representing the highest level of complexity.
4. Analysis of Agent Performance and Failure Modes
Our evaluation revealed several critical failure modes that are often overlooked in standard code-generation benchmarks.
4.1 The "Intactness" Violation
A significant issue identified is the "intactness violation," where an agent inadvertently modifies or deletes original data during a processing step. Because data science is stateful, such in-place modifications can lead to "hallucinated" results in subsequent analysis steps, as the underlying data no longer matches the expected state.
4.2 Error Propagation and Context
In multi-step conversational settings, error propagation is a major hurdle. A minor mistake in an initial step causes a significant drop in the "Pass Rate" for subsequent tasks. We found that providing the agent with "Code History" is often more critical for success than providing detailed variable descriptions, as it allows the model to better understand the current state of the runtime session.
5. Experimental Results
We evaluated six popular frameworks, including Chapyter and the Code Interpreter API, using models ranging from GPT-3.5 to CodeLlama.
- Model Dominance: GPT-4 remains the state-of-the-art engine, significantly outperforming all other tested models across every benchmark category.
- Complexity Scaling: While agents performed well on simpler exercises (~80% pass rate), performance dropped sharply on the DSEval-Kaggle benchmark, with the best configurations failing to exceed a 65% success rate.
- Self-Correction: Implementing a "self-debug" loop—where the agent reviews its own execution errors and attempts a fix—markedly improves performance. This mechanism allows weaker models like GPT-3.5 to approach the first-shot accuracy of more powerful models.
6. Conclusion and Future Directions
DSEval highlights that current data science agents struggle with long-term state management and realistic, multi-step problem solving. While self-correction and better context representation help, significant gaps remain in handling complex datasets like those found on Kaggle. Future research will focus on long-horizon planning (20+ interdependent steps), visual validators for generated charts, and more robust interactive recovery mechanisms for when an agent detects it has corrupted the runtime state.
Summary updated