Weakly Supervised Text-to-SQL Parsing through Question Decomposition

Tomer Wolfson, Daniel Deutch, Jonathan Berant

Abstract

Traditional Text-to-SQL systems rely heavily on large-scale, expert-annotated datasets, which are costly and difficult to scale. This paper presents a novel framework for training text-to-SQL parsers using weak supervision. By leveraging Question Decomposition Meaning Representation (QDMR) as an intermediate step, the proposed pipeline automatically synthesizes high-quality SQL training data from question-answer pairs. Experimental results across five benchmarks demonstrate that this approach achieves up to 97% of the performance of fully supervised models without requiring manually written SQL queries.

Introduction

The development of natural language interfaces for databases (Text-to-SQL) is often hindered by the "expertise bottleneck." Creating high-quality training data requires annotators proficient in both natural language and SQL, making data collection expensive and slow. Furthermore, models trained on specific schemas often fail to generalize to new, unseen databases.

To address these challenges, we explore "weak supervision"—using signals that are easier for non-experts to provide. Instead of full SQL queries, we utilize simple answers and step-by-step natural language breakdowns of questions. This paper introduces a method to bridge the gap between natural language and SQL using an intermediate representation called QDMR.

Methodology

The core of the proposed approach is a multi-stage pipeline that transforms a natural language question into a functional SQL query through decomposition.

Overview of the weakly supervised Text-to-SQL pipeline, from question decomposition to model training.

1. SQL Synthesis

The synthesis process begins with Phrase DB Linking, which matches natural language phrases in QDMR steps to database schema elements using string matching and word embeddings. Next, Join Path Inference identifies the necessary table connections using shortest-path heuristics. Finally, a SQL Mapper converts the structured QDMR steps into a candidate SQL query using predefined mapping rules.

Because initial mappings may be ambiguous (e.g., selecting an ID instead of a name), the system generates multiple candidate queries. These candidates are executed against the database, and only those that return the correct "gold" answer provided in the weak supervision signal are retained.

3. Model Training

The resulting pairs of questions and synthesized SQL queries form a high-quality training set. A standard sequence-to-sequence model, such as T5-large, is then trained on this data. This allows the model to learn the mapping from natural language to SQL as if it were trained on human-annotated data.

Example of QDMR steps being mapped to SQL queries through phrase-DB linking and logical operations.

Experimental Evaluation

The framework was evaluated on five diverse benchmarks, including the large-scale cross-domain SPIDER dataset and domain-specific sets like GEO880, ACADEMIC, IMDB, and YELP. The BREAK dataset provided the source for QDMR structures.

Key Results

  • High Coverage: The system successfully synthesized valid SQL for 77.8% of the questions across all datasets.
  • Competitive Accuracy: On SPIDER and GEO880, the weakly supervised models achieved 91% to 97% of the accuracy of fully supervised counterparts.
  • Zero In-Domain Annotation: By using a pre-trained QDMR parser to generate decompositions for new databases, the system maintained 86% to 93% of supervised performance, demonstrating strong zero-shot capabilities.

Discussion and Insights

A significant finding is that QDMR acts as an effective bridge for weak supervision. Unlike SQL, QDMR can be crowdsourced from non-experts because it follows natural language logic rather than database schema knowledge. Interestingly, models trained on synthesized SQL occasionally outperformed supervised models in cross-database tasks, suggesting that the synthesis process may produce more consistent logical structures than human annotators.

However, limitations remain. The system currently assumes literal value matching between questions and database entries, struggling with domain-specific jargon (e.g., "women" vs gender = 'F'). Additionally, structural mismatches between human logic and database schemas can lead to synthesis failures.

Conclusion

This work demonstrates that high-performing Text-to-SQL models can be built without expensive SQL annotations. By using question decomposition and execution-guided synthesis, we can leverage easier-to-obtain weak supervision signals to scale natural language interfaces to a wider variety of databases. Future research will focus on improving robustness to domain jargon and enhancing the flexibility of the SQL mapping rules.

Summary updated

BibTeX
@inproceedings{wolfson2022weakly,
  author = {Tomer Wolfson and Daniel Deutch and Jonathan Berant},
  title = {{Weakly Supervised Text-to-SQL Parsing through Question Decomposition}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=yAcGaimlXbW},
}
Figure