Skip to main content
QUICK REVIEW

[Paper Review] Text-to-SQL in the Wild: A Naturally-Occurring Dataset Based on Stack Exchange Data

Moshe Hazoom, Vibhor Malik|arXiv (Cornell University)|Jun 9, 2021
Natural Language Processing TechniquesComputer Science25 references6 citations
TL;DR

This paper introduces SEDE, a large-scale, real-world Text-to-SQL dataset of 12,023 naturally occurring SQL queries and their corresponding natural language questions from Stack Exchange. The authors propose a novel evaluation metric, PCM-F1, to better assess model performance on complex, under-specified, and diverse real-world queries, showing a significant performance gap—only 50.6% PCM-F1—on SEDE compared to state-of-the-art models trained on standard benchmarks like Spider.

ABSTRACT

Most available semantic parsing datasets, comprising of pairs of natural utterances and logical forms, were collected solely for the purpose of training and evaluation of natural language understanding systems. As a result, they do not contain any of the richness and variety of natural-occurring utterances, where humans ask about data they need or are curious about. In this work, we release SEDE, a dataset with 12,023 pairs of utterances and SQL queries collected from real usage on the Stack Exchange website. We show that these pairs contain a variety of real-world challenges which were rarely reflected so far in any other semantic parsing dataset, propose an evaluation metric based on comparison of partial query clauses that is more suitable for real-world queries, and conduct experiments with strong baselines, showing a large gap between the performance on SEDE compared to other common datasets.

Motivation & Objective

  • To address the lack of realistic, naturally occurring Text-to-SQL data in existing benchmarks, which are typically curated for training and evaluation.
  • To identify and characterize real-world challenges in natural language questions and their corresponding SQL queries, such as under-specification, parameterization, and complex subqueries.
  • To propose a more suitable evaluation metric, PCM-F1, that accounts for partial correctness in complex and ambiguous queries where exact match or denotation accuracy fails.
  • To demonstrate that state-of-the-art models perform significantly worse on real-world data than on standard academic datasets, highlighting a critical generalization gap.

Proposed method

  • Collect 12,023 real SQL queries and their natural language titles/descriptions from the Stack Exchange Data Explorer (SEDE), a public query interface.
  • Apply query canonization and anonymization to identify unique SQL templates, revealing SEDE contains at least 10× more unique templates than other datasets.
  • Propose PCM-F1, a soft exact-match metric based on partially extracted query components (SELECT, WHERE, GROUP BY, ORDER BY), to better evaluate models on complex and under-specified queries.
  • Use T5-based sequence-to-sequence models fine-tuned on SEDE, with beam search inference and schema encoding, to evaluate generalization performance.
  • Introduce PCM-EM and PCM-F1- NoValues variants to validate metric calibration against standard EM on Spider, ensuring consistency with established benchmarks.
  • Conduct error analysis on model predictions to identify failure modes related to under-specification, incorrect date logic, and parameter handling.

Experimental results

Research questions

  • RQ1How do real-world, naturally occurring Text-to-SQL queries differ from those in academic datasets in terms of complexity, diversity, and linguistic challenges?
  • RQ2To what extent do state-of-the-art Text-to-SQL models generalize to real-world queries that include under-specification, parameters, and complex subqueries?
  • RQ3Can a new evaluation metric like PCM-F1 better reflect model performance on real-world queries than traditional exact-match or denotation accuracy?
  • RQ4Why do strong models achieve high performance on benchmarks like Spider but fail significantly on real-world data like SEDE?
  • RQ5What are the key failure modes of current models when generating SQL from ambiguous or incomplete natural language questions?

Key findings

  • SEDE contains 12,023 real-world query-utterance pairs with significantly higher diversity in both utterances (3-gram coverage) and SQL templates (10× more than other single-domain datasets).
  • State-of-the-art models achieve only 50.6% PCM-F1 on SEDE, despite reaching 86.3% PCM-F1 on Spider, indicating a substantial generalization gap in real-world settings.
  • The proposed PCM-F1 metric yields a more accurate and informative performance assessment than exact match or denotation accuracy, especially for under-specified or complex queries.
  • Model failures are frequently due to incorrect handling of implicit assumptions (e.g., filtering for open questions with NULL ClosedDate), incorrect date logic, or misreading parameterized conditions.
  • Even with schema encoding, performance gains are minimal, suggesting that current models struggle with semantic reasoning and implicit context in natural language.
  • The PCM-EM metric is close to 0 across all models, confirming that exact match is too strict for real-world queries, validating the need for softer evaluation metrics like PCM-F1.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.