DeepPrep: An LLM-Powered Agentic System for Autonomous Data Preparation

Meihao Fan, Ju Fan, Yuxin Zhang, Shaolei Zhang, Xiaoyong Du, Jie Song, Peng Li, Fuxin Jiang, Tieying Zhang, Jianjun ChenarXiv 2026

TL;DR

DeepPrep is an LLM-powered agentic system that automates data preparation by treating pipeline generation as a tree-based search over materialized execution states. By combining execution-grounded feedback with a progressive agentic training framework, it achieves data preparation accuracy on par with closed-source giants like GPT-5 while slashing inference costs by 15x.

What Problem Does This Paper Address?

Data preparation—cleaning, joining, and aggregating messy, heterogeneous raw tables into analysis-ready data—is notoriously tedious, often consuming 60% to 80% of a data scientist's time.

While recent approaches try to leverage Large Language Models (LLMs) to automate this via natural language instructions, they suffer from two major flaws:

  1. Lack of grounding: One-shot code generation methods write data pipelines blindly without checking intermediate execution results.
  2. Linearity traps: ReAct-style agents interact with the environment linearly. If they make a mistake early on (e.g., forgetting to deduplicate or explode a column), the error propagates downstream. By the time the execution error surfaces, a linear agent cannot backtrack to fix the root cause without restarting the entire process.
Figure 2: An illustrative example highlighting the core idea of DeepPRep. (a) Code generation makes decisions without ground- ing in intermediate execution results. (b) ReAct-style approaches follow linear reasoning with limited ability to revise earlier decisions. (c) DeepPRep applies a tree-based structured exploration, which enables backtracking to resolve non-local errors.

Methods

DeepPrep introduces an agentic framework driven by Tree-Based Agentic Reasoning and optimized via a Progressive Agentic Training pipeline.

1. Tree-Based Agentic Reasoning

Instead of a linear chain of thoughts, DeepPrep maintains an explicit search tree where each node represents a fully materialized intermediate table state, and each edge represents a data preparation operator (DeepPrep supports 31 distinct operators covering cleaning, reshaping, and combination).

The LLM navigates this tree using four explicit action tags:

  • <plan>: Analyzes the current state and proposes a high-level strategy.
  • <expand>: Generates a candidate operator pipeline from a selected parent node.
  • <execute>: Runs the pipeline in a Python environment, materializing new nodes or logging error traces.
  • <answer>: Terminates the search once the target schema is satisfied.

This structure allows the agent to seamlessly backtrack to any historical state if a downstream execution fails.

DeepPrep's tree-based agentic inference procedure

2. Progressive Agentic Training

Training an open-source LLM to perform complex tree search and handle sparse rewards is difficult. DeepPrep solves this with a multi-stage curriculum:

  • Cold-Start Curriculum: First, the model learns individual operator syntax. Second, it learns tree-based reasoning by distilling high-quality trajectories from a strong teacher model (like DeepSeek-R1).
  • Multi-turn RL with Hybrid Rewards: The model is fine-tuned using Group Relative Policy Optimization (GRPO). The reward function is a hybrid mix of strict outcome correctness, partial progress (measuring schema and content similarity), and an LLM-adjudicated process reward to prevent "reward hacking" (e.g., superficially renaming columns without transforming the underlying data).

3. Reversible Noise Injection

To generate training data, the authors took clean databases from Text-to-SQL benchmarks and applied inverse data preparation operators (e.g., converting a clean ISO date into multiple messy formats). This guarantees that the injected errors are mathematically reversible, providing perfect ground-truth pipelines for training.

Datasets

The authors evaluated DeepPrep across three datasets:

  • Synth-Spider: Synthesized from the Spider NL2SQL benchmark (6,788 training, 2,008 test cases). Pipelines range up to 28 operators long. Used for training and in-domain testing.
  • Synth-Bird: Synthesized from the BIRD benchmark (1,150 test cases). Features larger databases and longer transformation chains to test out-of-domain generalization.
  • Parrot: An augmented public benchmark for text-to-pipeline translation (13,965 training, 1,365 test cases) featuring shorter pipelines.

Key Insights and Ideas

  • Execution is the ultimate supervisor: You cannot reliably prepare data without looking at the data. Materializing intermediate tables at every node gives the LLM concrete feedback, turning abstract code generation into a tangible search problem.
  • Backtracking beats restarting: In data prep, an error in step 2 might only trigger a runtime exception in step 7. DeepPrep’s tree structure allows it to surgically replace step 2 while preserving the valid operator prefixes, mimicking how human data scientists debug.
  • Synthesizing "dirty" data via inversion: High-quality data preparation datasets are rare. By treating data corruption as the literal inverse of data cleaning, the authors unlocked an automated way to generate infinite, realistic training tasks.

Key Results

  • State-of-the-Art Open-Source Performance: On the Synth-Spider benchmark, DeepPrep (built on Qwen3-14B) achieved 67.18% exact match accuracy, outperforming the strongest prompting baseline (CodeGen) by 21.71 points and standard Imitation Learning by 5.48 points.
  • Closing the Closed-Source Gap: DeepPrep powered by an open-source 14B model performs comparably to commercial giants, matching GPT-5's standard ReAct performance (67.03%).
  • Massive Cost Reductions: DeepPrep dramatically extends the cost-accuracy Pareto frontier. It achieves its high accuracy while being 15x cheaper than GPT-5 and 57x cheaper than Claude-4 ReAct setups.
Cost-Accuracy trade-off Pareto frontiers across datasets

Limitations and Future Work

  • Operator Dependency: While DeepPrep includes an ExeCode operator for arbitrary Python execution, it relies heavily on its 31 predefined native operators. Expanding this native library or improving arbitrary code synthesis within the tree search remains an open challenge.
  • Scalability Constraints: Materializing and storing entire table states at every node in a deep search tree can become computationally heavy and memory-intensive for extremely massive, multi-gigabyte datasets.
  • Human-in-the-Loop: The current system is fully autonomous. Integrating human feedback loops—allowing a user to guide the tree search or correct a plan mid-flight—is a promising direction for real-world deployment.

Summary updated

BibTeX
@misc{fan2026deepprep,
  author = {Meihao Fan and Ju Fan and Yuxin Zhang and Shaolei Zhang and Xiaoyong Du and Jie Song and Peng Li and Fuxin Jiang and Tieying Zhang and Jianjun Chen},
  title = {{DeepPrep: An LLM-Powered Agentic System for Autonomous Data Preparation}},
  year = {2026},
  eprint = {2602.07371},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.07371},
}
Figure