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

Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows

Fangyu Lei, Jixuan Chen, Yuxiao Ye, Ruisheng Cao, Dongchan Shin, Hongjin Su, Zhaoqing Suo, Hongcheng Gao, Wenjing Hu, Pengcheng Yin, Victor Zhong, Caiming Xiong, Ruoxi Sun, Qian Liu, Sida Wang, Tao Yu

TL;DR

Language models that appear to be SQL wizards on standard benchmarks are failing the "real-world" test. The new Spider 2.0 benchmark introduces 632 complex, enterprise-level text-to-SQL tasks featuring massive schemas, diverse cloud dialects (like BigQuery and Snowflake), and multi-step data engineering workflows. Even the state-of-the-art o1-preview model, equipped with a specialized agentic framework, only solves 21.3% of these tasks—a stark contrast to its >90% performance on previous benchmarks.

The Enterprise SQL Problem

For years, the "text-to-SQL" field has relied on benchmarks like Spider 1.0 and BIRD. While foundational, they represent a simplified version of data science. In these datasets, databases are small, schemas are straightforward (a few tables and columns), and the required SQL is often just a few lines of standard SQLite code.

In contrast, real-world enterprise environments are messy. A data analyst at a large company doesn't just query a single table; they navigate cloud warehouses with thousands of columns, use specialized dialects, and manage complex pipelines using tools like dbt (data build tool). The authors argue that current LLMs are over-optimized for simple benchmarks and lack the "agentic" reasoning required to handle the scale, documentation-heavy nature, and intricate logic of actual enterprise workflows.

The Spider 2.0 Framework

The authors move beyond the traditional "Natural Language in, SQL out" paradigm, framing Spider 2.0 as an agentic task.

Overview of the Spider 2.0 text-to-SQL workflow environment.
  1. Spider-Agent Framework: Instead of single-shot generation, they developed a framework where an LLM acts as an autonomous agent. It can interact with a database interface, read local files (like dbt project codebases), consult external documentation for specific SQL dialects, and iteratively debug its code based on execution feedback.
  2. Task Construction: They curated 632 problems from real-world applications (e.g., Google Analytics, Salesforce). These aren't just "questions"; they are "workflows" that might require generating 100+ lines of SQL or orchestrating multiple data transformations.
  3. Evaluation Variants: To accommodate different research needs, they introduced Spider 2.0-lite (focused on direct text-to-SQL in cloud environments) and Spider 2.0-snow (specifically for Snowflake), alongside the full agentic version.

Dataset Scale

The Spider 2.0 suite represents a massive leap in complexity:

  • Spider 2.0 (Full): 632 tasks requiring interaction with project codebases, documentation, and live databases.
  • Comparison Benchmarks: Evaluated against Spider 1.0 (2018) and BIRD (2024), Spider 2.0 databases average 812 columns—nearly 15x the scale of BIRD.

Key Insights and Error Analysis

Evaluating state-of-the-art models on this new benchmark revealed several critical failure points for modern LLMs.

Distribution of error categories for models evaluated on Spider 2.0.
  • The "Schema Haystack": In enterprise DBs, finding the right column is a "needle in a haystack" problem. Models frequently fail at schema linking (accounting for 27.6% of errors) because they cannot comprehend the relationships in a 1,000-column environment.
  • Dialect Matters: Standard SQL isn't enough. Real workflows use advanced, dialect-specific functions (e.g., ST_DISTANCE for geography or DATE_TRUNC for time-series). Models often hallucinate standard functions that don't exist in the target cloud environment.
  • Planning vs. Generation: Solving these tasks requires complex "query planning." The gold-standard solutions often involve multiple Common Table Expressions (CTEs). Models struggle to maintain the logic across these long, nested structures.
  • The dbt Integration: This is the first major benchmark to incorporate dbt projects. This forces the model to understand not just a database, but a project-level codebase of existing SQL transformations and YAML configurations.

Key Results

The performance gap is massive, revealing that we are far from "solving" text-to-SQL for the enterprise:

  • o1-preview (Agentic): Achieved a 21.3% success rate on Spider 2.0. While this was the best-performing model, it still failed nearly 80% of the time.
  • GPT-4o: Managed only 12.3% in the same agentic setting.
  • Traditional Methods: State-of-the-art text-to-SQL parsers (like DAIL-SQL) that score >80% on Spider 1.0 dropped to a dismal 5.68% on Spider 2.0-lite.
  • Open Source Gap: The best open-source model tested (DeepSeek-V3) reached only 8.78% on the lite version, showing a significant lead for closed-source "reasoning" models.

Limitations and Future Work

The authors identify several hurdles for the next generation of data agents:

  1. Cost: Running these agentic loops is expensive. The average cost for an o1-preview attempt was $0.75 per instance.
  2. Value Linking: At terabyte scale, models can't simply "scan" all data to find specific values (like a specific user ID), making filter conditions hard to generate without better indexing or retrieval tools.
  3. Long-Context Reasoning: Even with 128k context windows, the combination of massive schemas, dbt codebases, and dialect documentation pushes models to their limits.

Future work will likely focus on more efficient schema retrieval, better "self-debugging" loops, and training models specifically on the "planning" phase of complex SQL engineering.

Summary updated

BibTeX
@inproceedings{lei2025spider,
  author = {Fangyu Lei and Jixuan Chen and Yuxiao Ye and Ruisheng Cao and Dongchan Shin and Hongjin SU and ZHAOQING SUO and Hongcheng Gao and Wenjing Hu and Pengcheng Yin and Victor Zhong and Caiming Xiong and Ruoxi Sun and Qian Liu and Sida Wang and Tao Yu},
  title = {{Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=XmProj9cPs},
}
Figure