Abstract
Data science is an iterative, conversational process typically conducted in computational notebooks like Jupyter. While Large Language Models (LLMs) have become proficient at generating standalone Python functions, they often struggle with the multi-turn, stateful reality of real-world data science. This paper introduces ARCADE, a benchmark of over 1,000 multi-turn code generation problems requiring deep notebook context, and PACHINCO, a 62B parameter model specifically fine-tuned for this domain. Our findings highlight the critical importance of notebook-specific training and "step-by-step" prompting strategies to bridge the gap between static code generation and interactive data exploration.
Introduction
Most existing code generation benchmarks, such as HumanEval, focus on "text-to-function" tasks where a model writes a self-contained function from a docstring. However, real-world data science happens in fragmented cells. To generate the next line of code effectively, an AI must understand the execution history, the current state of dataframes (schema), and the evolving intent of the user across multiple interaction turns. Existing benchmarks often lack this context or suffer from data leakage, where evaluation problems were present in the model's training data.
The ARCADE Benchmark and PACHINCO Model
To address these challenges, the researchers developed a multi-pronged approach:
- ARCADE Benchmark: A dataset of 1,078 problems across 136 notebooks. It includes a "New Tasks" split—problems created from scratch using Kaggle datasets released after February 2022—to ensure models cannot rely on memorization.
- PACHINCO Model: Starting with a 62B parameter PaLM model, the researchers performed two-stage fine-tuning. The first stage used a massive Python source code corpus (64B tokens), followed by a second stage specifically on 3.8 million Jupyter notebooks (9.6B tokens) to capture the unique "rhythm" of interactive data science.
- Step-by-Step (SbS) Prompting: A few-shot strategy that encourages models to decompose complex tasks into smaller steps with natural language explanations. This approach helps the model "think through" the logic before generating code.
Key Insights
- Context and Schema Awareness: Model performance plateaus after 5 to 7 cells of context. Without this history, models frequently encounter
NameErrororKeyError. Providing a text description of the dataframe schema (column names and example values) is essential for grounded understanding. - The Impact of Data Leakage: Models performed significantly better on "Existing Tasks" than on "New Tasks," suggesting that current LLM benchmarks may overstate reasoning capabilities due to memorization.
- Diversity via Decomposition: SbS prompting does more than improve readability; it increases the diversity of solutions. In the 50% of real-world cases where user intent is ambiguous, a model capable of generating multiple distinct, plausible approaches is far more valuable.
Results
PACHINCO (62B) outperformed public models like CodeGen-16B and InCoder-6B. On the challenging "New Tasks" split, PACHINCO achieved a pass@1 of 18.0% and a pass@30 of 47.7%. Fine-tuning on notebooks specifically provided a major boost over general Python scripts, confirming that notebook-based code is a distinct dialect.
Limitations and Future Work
While ARCADE is a significant step forward, it is currently pandas-centric and does not fully cover machine learning model fitting or complex visualization. Furthermore, the evaluation remains static; future work should explore dynamic, session-level evaluations where the AI can respond to user feedback or errors in real-time. Finally, distilling the intelligence of the 62B PACHINCO model into smaller, more efficient architectures remains a key goal for local deployment.
Summary updated