Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLs

Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, Xuanhe Zhou, Chenhao Ma, Guoliang Li, Kevin Chen-Chuan Chang, Fei Huang, Reynold Cheng, Yongbin Li

TL;DR

The BIRD benchmark (BIg bench for laRge-scale Database grounded text-to-SQL) reveals a massive performance gap between Large Language Models (LLMs) and humans when querying massive, messy, real-world databases. While models like GPT-4 lead the pack, their ~55% execution accuracy is still a far cry from the 93% achieved by humans. This proves that serving as a reliable, production-ready database interface is a challenge LLMs have not yet mastered.

What Problem Does This Paper Address?

For years, the "Text-to-SQL" community—which aims to let users query databases using natural language—has relied on benchmarks like Spider and WikiSQL. While foundational, these datasets suffer from a "clean room" problem: the databases are tiny (often just a few rows), the schemas are perfectly labeled, and the questions rarely require outside knowledge.

Core challenges introduced in BIRD: handling dirty database values, applying external knowledge, and optimizing SQL execution efficiency.

In the real world, databases are huge (gigabytes or terabytes), values are "dirty" (e.g., "US$57,500.00" stored as a string instead of a number), and column names are cryptic abbreviations. Furthermore, academic benchmarks traditionally ignore efficiency. In a production environment, a query that takes 22 seconds is a failure compared to an optimized one that takes 4 seconds. This paper introduces BIRD to bridge the gap between academic research and industrial reality by testing models on these exact pain points.

Methods

To ensure high-quality, realistic data, the authors developed a rigorous four-step annotation pipeline:

  1. Database Curation: They collected 95 large-scale databases from platforms like Kaggle and the CTU Prague Relational Learning Repository, spanning 37 distinct domains.
  2. External Knowledge Grounding: Recognizing that SQL often requires domain-specific logic (e.g., knowing that a "winning rate" is calculated as wins / (wins + losses)), they provided "external knowledge evidence" alongside complex questions.
  3. Double-Blind Annotation: To minimize errors, two independent annotators generated SQL for each question. If their results mismatched, experts stepped in to resolve the conflict.
  4. New Metrics: Beyond standard Execution Accuracy (EX), the authors introduced the Valid Efficiency Score (VES). VES rewards models that generate SQL that is not only correct but also computationally efficient, directly accounting for execution time.

The BIRD Dataset

The primary contribution of this paper is the BIRD dataset itself, which dwarfs previous benchmarks in both scale and complexity.

Comparison of BIRD against previous Text-to-SQL benchmarks, highlighting its massive scale, domain diversity, and inclusion of efficiency metrics.
  • Scale & Size: BIRD contains 12,751 text-to-SQL pairs across 95 databases totaling 33.4 GB (compared to Spider's ~1 GB).
  • Complexity: It includes noisy data types and massive row counts (up to 549K per table).
  • Relational Depth: Unlike WikiSQL (which uses 1 table per database), BIRD averages 7.3 tables per database, requiring complex JOIN operations and multi-step reasoning.

Key Insights and Ideas

  • The "Value" Problem: Most previous models focused purely on the schema (table and column names). BIRD forces models to look at the values. If a user asks for "worst performing managers," the model must understand how "performance" is represented in the actual data rows.
  • Knowledge is Power: Providing "external knowledge" (like formulas or synonyms) significantly boosted performance across all models. This suggests that LLMs aren't just failing at SQL syntax; they are failing at domain-specific reasoning.
  • Efficiency Matters: The paper highlights that "normal" semantic parsers often produce "naive" SQL. By using more efficient JOINs or subqueries, execution time can be reduced by over 75%. BIRD is the first benchmark to bake this industrial requirement into its evaluation.
  • Context Compression: In massive databases, you cannot simply stuff every row into an LLM's prompt. Models must learn to reason about the database structure without seeing all the data.

Key Results

The experimental results serve as a humbling reality check for the current LLM era:

  • The Human-AI Gap: While humans achieved 92.96% execution accuracy, the best-performing model setup (GPT-4 + DIN-SQL) only reached 55.90% on the test set.
  • Model Rankings: GPT-4 significantly outperformed Claude-2, ChatGPT, and fine-tuned models like T5.
  • The Knowledge Boost: For GPT-4, adding external knowledge increased accuracy from 34.88% to 54.89%—a massive 20-point jump.
  • Efficiency Shortfalls: Even when models got the answer right, their SQL was often slow. The VES scores were generally lower than EX scores, indicating that LLMs struggle to write "production-ready," optimized code.

Limitations and Future Work

The authors acknowledge several areas for future growth:

  • SQL Dialect: Currently, BIRD is limited to SQLite. Future versions should include PostgreSQL and MySQL to better reflect enterprise environments.
  • Annotation Cost: The double-blind expert process is expensive and hard to scale. They suggest exploring "Human-Computer Interaction" (HCI) pipelines where LLMs like GPT-4 assist in the annotation process.
  • Reasoning Disparity: There is still a notable weakness in "Ranking" and "Numerical Computing" (math) across all models, suggesting that deep data science tasks remain a frontier for LLMs to conquer.

Summary updated

BibTeX
@inproceedings{li2023can,
  author = {Jinyang Li and Binyuan Hui and Ge Qu and Jiaxi Yang and Binhua Li and Bowen Li and Bailin Wang and Bowen Qin and Ruiying Geng and Nan Huo and Xuanhe Zhou and Chenhao Ma and Guoliang Li and Kevin Chen-Chuan Chang and Fei Huang and Reynold Cheng and Yongbin Li},
  title = {{Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Au2mpOeZJc},
}
Figure