Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task

Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, Zilin Zhang, Dragomir R. Radev

TL;DR

Spider is a massive, human-labeled dataset designed to move text-to-SQL systems away from simple pattern matching toward true semantic parsing. By introducing 200 complex databases across 138 domains, it forces models to generalize to entirely new database schemas and complex query structures that they have never seen during training.

The Problem: Memorization vs. Understanding

For years, the goal of "Text-to-SQL"—allowing users to query databases using natural language—seemed nearly solved. State-of-the-art models were hitting 80%+ accuracy on classic benchmarks like ATIS or GeoQuery. However, these results were often a mirage caused by two main issues:

  1. Domain Specificity: Most datasets used the same database for both training and testing. Models weren't learning how to "understand" SQL; they were just memorizing which specific words mapped to which specific columns in a single, static schema.
  2. Lack of Complexity: Large-scale datasets like WikiSQL were limited to simple "SELECT-WHERE" queries on single tables. They couldn't handle the "real-world" complexity of relational databases, such as joining multiple tables or using subqueries.

The Spider Dataset

Spider was created to bridge this gap by requiring cross-domain generalization on complex queries. It consists of 10,181 questions and 5,693 unique SQL queries across 200 databases covering 138 domains (e.g., airlines, car rentals, sports).

Comparison of Spider against existing datasets, highlighting its superior domain diversity and SQL complexity.

As shown in the comparison above, Spider significantly exceeds previous benchmarks in the number of databases and domains, as well as the inclusion of complex SQL clauses like GROUP BY, ORDER BY, and nested queries.

Methodology and Annotation

The authors spent 1,000 man-hours with computer science students to manually curate the dataset. The methodology focused on ensuring high SQL pattern coverage (including HAVING, UNION, and nested subqueries) and database diversity.

The annotation process: annotators map natural language questions to complex SQL queries based on multi-table schemas.

Annotators were tasked with creating questions that required complex logic. They categorized queries into four levels—Easy, Medium, Hard, and Extra Hard—based on the number of SQL components and the complexity of the logic required. To evaluate models, the researchers used Component Matching and Exact Matching to ensure logical equivalence to the gold standard.

Key Insights and Results

The results were a wake-up call for the NLP community. The most striking insight is the Generalization Gap: the performance drop when moving from an "Example Split" (where the model has seen the database before) to a "Database Split" (where the schema is entirely new).

At the time of publication, even the best models struggled:

  • TypeSQL, a top performer on WikiSQL, achieved 34.3% accuracy when it had seen the database before, but crashed to just 9.7% on the unseen database split.
  • On "Extra Hard" queries in the database split, the best model performance dropped to near zero (0.3%).

This proves that previous models were largely over-fitting to specific schemas. The bottleneck in Text-to-SQL isn't just the language—it's understanding how different tables relate to one another through foreign keys.

Limitations and Future Work

While a major step forward, Spider has limitations. It excludes questions requiring external "common sense" knowledge and focuses on single-turn questions rather than multi-turn dialogues. Additionally, it intentionally excludes "value prediction" to focus on the fundamental challenge of mapping natural language to SQL logic. Spider remains one of the most influential benchmarks in the field, serving as the "ImageNet moment" for semantic parsing.

Summary updated

BibTeX
@inproceedings{yu2018spider,
  author = {Tao Yu and Rui Zhang and Kai Yang and Michihiro Yasunaga and Dongxu Wang and Zifan Li and James Ma and Irene Li and Qingning Yao and Shanelle Roman and Zilin Zhang and Dragomir R. Radev},
  title = {{Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2018},
  doi = {10.18653/v1/d18-1425},
}
Figure