Abstract
We introduce DA-Code, a code generation benchmark specifically designed to assess LLMs on agent-based data science tasks. This benchmark features three core elements: First, the tasks within DA-Code are inherently challenging, setting them apart from traditional code generation tasks and demanding advanced coding skills in grounding and planning. Second, examples in DA-Code are all based on real and diverse data, covering a wide range of complex data wrangling and analytics tasks. Third, to solve the tasks, the models must utilize complex data science programming languages, including Python and SQL, to perform intricate data processing and derive the answers. We set up the benchmark in a controllable and executable environment that aligns with real-world data analysis scenarios and is scalable. The annotators meticulously designed the evaluation suite to ensure the accuracy and robustness of the evaluation. We developed the DA-Agent baseline. Experiments show that although the baseline performs better than other existing frameworks, using the current best LLMs achieves only 30.5% accuracy, leaving ample room for improvement.
Introduction
While Large Language Models (LLMs) have demonstrated proficiency in generating isolated code snippets, a significant gap remains between simple code generation and autonomous data science. Real-world data science is an iterative, agentic process involving complex file navigation, data cleaning, multi-step planning, and debugging based on execution feedback. Existing benchmarks like DS-1000 or HumanEval often fail to capture this complexity, focusing instead on "instruction-to-code" tasks that lack environmental interaction.
To address this, we present DA-Code, an execution-based benchmark comprising 500 multi-step data science tasks. DA-Code requires models to function as agents within a sandbox environment, interacting with real-world datasets to perform data wrangling, machine learning, and exploratory analysis.
The DA-Code Benchmark
DA-Code is designed to reflect the "messiness" of professional data science. The benchmark includes:
- 500 Diverse Tasks: Sourced from Kaggle and GitHub, covering Data Wrangling (DW), Machine Learning (ML), and Exploratory Data Analysis (EDA).
- Complex Environments: Tasks involve an average of 5.7 files across multiple formats (CSV, SQL, YAML, etc.), requiring agents to navigate directory structures and understand data schemas.
- Long-Horizon Solutions: Unlike traditional benchmarks with short solutions, DA-Code tasks require an average of 85 lines of code, necessitating sustained planning and execution.
Agentic Framework and Methodology
To evaluate LLMs on this benchmark, we developed DA-Agent, a framework that enables models to interact with a live environment. The agent operates in a ReAct-style loop: Thought → Action → Observation.
The action space includes:
- Bash: For file system navigation and environment setup.
- Python: For data processing, visualization, and modeling.
- SQL: For querying structured databases.
- Terminate: To submit the final answer or result.
Evaluation is strictly execution-based. Rather than comparing code similarity, we verify the output—such as the correctness of a transformed database table, the metadata of a generated chart, or the performance metrics of a trained model.
Results and Analysis
Our experiments with leading models, including GPT-4, GPT-4o, and Qwen2.5, reveal that autonomous data science remains a significant challenge for current AI.
Performance Gap
GPT-4 emerged as the leader, achieving a success rate of 30.5%, yet this highlights substantial room for improvement. Open-source models like Qwen2.5-72B trail significantly at 22.6%. As task difficulty increases, performance drops sharply; on "Hard" tasks, GPT-4's success rate falls to 23.4%.
The Planning Bottleneck
A key finding is that planning, rather than coding syntax, is the primary bottleneck. When provided with a "Reference Plan," GPT-4’s performance improved by nearly 8 percentage points. Models often suffer from "environmental hallucination," assuming the existence of files or columns without prior exploration.
Task-Specific Insights
Surprisingly, models performed better on Machine Learning tasks than on Data Wrangling. This suggests that while ML workflows are well-represented in training data, the bespoke nature of data cleaning requires higher-level reasoning and grounding that current models lack. Successful trajectories typically follow an EEEA pattern: Exploration, Execution, Evaluation, and Adjustment.
Conclusion
DA-Code provides a rigorous framework for evaluating the next generation of data science agents. The low success rates of current state-of-the-art models emphasize the need for better planning, grounding, and iterative debugging capabilities. Future work will explore fine-tuning for agentic trajectories and incorporating multimodal evaluation for data visualization.
The benchmark and code are available at: https://github.com/yiyihum/dabench
Summary updated