ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems

Yi Zhang, Jan Deriu, George Katsogiannis-Meimarakis, Catherine Kosten, Georgia Koutrika, Kurt Stockinger · DOI

Abstract

Natural Language to SQL systems (NL-to-SQL) have recently shown a significant increase in accuracy for natural language to SQL query translation. This improvement is due to the emergence of transformer-based language models, and the popularity of the Spider benchmark - the de-facto standard for evaluating NL-to-SQL systems. The top NL-to-SQL systems reach accuracies of up to 85%. However, Spider mainly contains simple databases with few tables, columns, and entries, which does not reflect a realistic setting. Moreover, complex real-world databases with domain-specific content have little to no training data available in the form of NL/SQL-pairs leading to poor performance of existing NL-to-SQL systems. In this paper, we introduce ScienceBenchmark, a new complex NL-to-SQL benchmark for three real-world, highly domain-specific databases. For this new benchmark, SQL experts and domain experts created high-quality NL/SQL-pairs for each domain. To garner more data, we extended the small amount of human-generated data with synthetic data generated using GPT-3. We show that our benchmark is highly challenging, as the top performing systems on Spider achieve a very low performance on our benchmark. Thus, the challenge is many-fold: creating NL-to-SQL systems for highly complex domains with a small amount of hand-made training data augmented with synthetic data. To our knowledge, ScienceBenchmark is the first NL-to-SQL benchmark designed with complex real-world scientific databases, containing challenging training and test data carefully validated by domain experts.

Introduction

The "holy grail" of data democratization is allowing non-experts to query complex databases using plain English. While current Natural Language to SQL (NL-to-SQL) systems boast over 80% accuracy on standard benchmarks like Spider, they often crumble when faced with the messy, cryptic, and highly specialized schemas of real-world scientific databases.

Industry-standard benchmarks like Spider consist mostly of simple databases created by students, featuring clear, natural language headers and general knowledge (like "pets" or "colleges"). In contrast, real-world scientific databases feature cryptic schemas (e.g., column names like ra for right ascension), complex logic requiring mathematical operations, and a severe scarcity of existing training data. This paper introduces ScienceBenchmark, a rigorous new evaluation set spanning astrophysics, cancer research, and research policy, alongside a novel data augmentation pipeline that uses GPT-3 to bootstrap training data for these "low-resource" scientific domains.

The ScienceBenchmark Dataset

ScienceBenchmark comprises three distinct, highly domain-specific databases:

  • CORDIS (Research Policy): 19 tables and 82 columns regarding EU research projects.
  • SDSS (Astrophysics): A subset of the Sloan Digital Sky Survey featuring 61 columns of astronomical measurements.
  • OncoMX (Cancer Research): 25 tables and 106 columns integrating biomarker and genomic data.

ScienceBenchmark stands out for having significantly more rows per table and higher domain-specific complexity than its predecessors like KaggleDBQA and BIRD.

Methodology: The Data Augmentation Pipeline

To address the data scarcity in these niche fields, the authors developed a two-pronged approach: manual expert curation and an automated four-phase data augmentation pipeline.

Overview of the four-phase data augmentation pipeline: Seeding, SQL Query Generation, SQL-to-NL Translation, and the Discriminative Phase.
  1. Phase 1 (Seeding): Extracting Abstract Syntax Tree (AST) templates from manual expert queries.
  2. Phase 2 (SQL Generation): Filling those templates with data from an "enhanced schema." This ensures the generated SQL is meaningful (e.g., not trying to calculate the "average" of a categorical ID).
  3. Phase 3 (SQL-to-NL): Using a fine-tuned GPT-3 model to "back-translate" the generated SQL into a natural language question.
  4. Phase 4 (Discriminative): Using sentence embeddings to select the most representative and fluent questions from the candidates generated by the LLM.
Detailed view of the AST template extraction and generation process, showing how seed ASTs are transformed into generated SQL queries.

Key Results and Insights

  • The "Spider" Illusion: Systems that achieve ~85% accuracy on Spider drop to as low as 8-16% on ScienceBenchmark in zero-shot settings. This proves that "solving" current benchmarks does not mean we have solved NL-to-SQL for specialized industries.
  • Synthetic Data Success: In domains where human-labeled data is expensive, synthetic data generated via LLMs is surprisingly effective. Adding synthetic data to the training mix improved performance by up to 45% over the baseline. For the OncoMX dataset, training on a combination of manual seed data and synthetic data boosted accuracy from 13% to 49%.
  • Schema Enhancement is Critical: Providing "human-readable aliases" for cryptic columns (e.g., telling the model ra means right ascension) is essential for the model to bridge the gap between natural language and code.
  • LLM Performance: GPT-3.5 (few-shot) reached 60% accuracy on CORDIS but struggled with the heavy numerical and mathematical requirements of the astrophysics data (peaking at 33%).

Conclusion

ScienceBenchmark highlights the significant gap between current NL-to-SQL benchmarks and real-world scientific needs. While synthetic data generation offers a promising path forward for low-resource domains, future work must focus on improving the reasoning capabilities of these systems to handle the sophisticated mathematical operators and complex hierarchies required by scientists.

Summary updated

BibTeX
@misc{zhang2023sciencebenchmark,
  author = {Yi Zhang and Jan Deriu and George Katsogiannis-Meimarakis and Catherine Kosten and Georgia Koutrika and Kurt Stockinger},
  title = {{ScienceBenchmark: A Complex Real-World Benchmark for Evaluating Natural Language to SQL Systems}},
  year = {2023},
  eprint = {2306.04743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2306.04743},
}
Figure