Leveraging Table Content for Zero-shot Text-to-SQL with Meta-Learning

Yongrui Chen, Xinnan Guo, Chaojie Wang, Jian Qiu, Guilin Qi, Meng Wang, Huiying Li

Introduction

Converting natural language questions into executable SQL queries—a task known as text-to-SQL—is a cornerstone of making databases accessible to non-technical users. While significant progress has been made, existing models often struggle with the "zero-shot" challenge: generating queries for tables and schemas that were never seen during training. Traditional approaches often rely on memorizing specific headers, leading to poor generalization when encountering novel domains.

This paper introduces MC-SQL (Meta-Content text-to-SQL), a framework designed to overcome these limitations. MC-SQL employs two primary innovations: explicitly leveraging actual table cell values to bridge the gap between questions and headers, and utilizing a meta-learning training strategy to force the model to learn how to adapt to unseen schemas.

The MC-SQL Framework

Table Content-Enhanced Modeling

A key insight of this work is that while headers can be ambiguous or abstract, the data contained within the table cells is concrete and provides vital semantic context. For example, a model might not inherently know that the word "son" in a question refers to the column "Relationship to Monarch." However, if it identifies the word "son" within the table's cells, it can establish a direct link between the user's intent and the relevant column.

Figure 1: An illustration of how table content acts as a bridge between natural language questions and database headers.

To implement this, MC-SQL uses a literal similarity score (based on Longest Consecutive Common Subsequence) to filter and select the most relevant cell for each header. This selected content is then encoded alongside the question and headers using BERT. To handle numbers and out-of-vocabulary (OOV) terms effectively, the model also incorporates character-level embeddings for table cells.

Zero-shot Meta-Learning Strategy

To prevent the model from overfitting to specific training schemas, the authors adopt a meta-learning training process. Instead of standard batch training, the data is partitioned into a Support Set and a Query Set containing disjoint sets of tables.

Figure 4: The overall architecture of MC-SQL, combining the content-enhanced model with a zero-shot meta-learning training loop.

As shown in the framework overview, the model performs a two-step gradient update. It first learns from the support set and then optimizes its parameters based on its performance on the unseen tables in the query set. This "learning to learn" approach encourages the model to develop generalizable mapping capabilities rather than memorizing fixed schema patterns.

Experimental Evaluation

The authors evaluated MC-SQL on two major benchmarks:

  • WikiSQL: A large-scale English open-domain dataset. MC-SQL achieved 84.1% Logical Form (LF) accuracy, outperforming the state-of-the-art TaBERT model. Notably, MC-SQL achieved these results using a standard BERT-base encoder, whereas many competitors require larger, more computationally expensive models.
  • ESQL: A Chinese domain-specific dataset for the electricity industry. On zero-shot subsets of ESQL, the meta-learning strategy alone provided a nearly 2% boost in accuracy, demonstrating its effectiveness in specialized domains.

Key Insights and Future Work

The research highlights that table content is a powerful semantic bridge, particularly useful for resolving WHERE clause constraints (identifying specific values and columns). Meta-learning further serves as a functional regularizer, ensuring that model updates remain valid across diverse, unseen table structures.

While highly effective for single-table queries, future work will focus on extending the MC-SQL framework to handle complex multi-table joins and advanced SQL operations like GROUP BY and nested queries. Additionally, the authors aim to explore more sophisticated cell-filtering mechanisms that go beyond literal similarity to handle synonyms and paraphrasing.

Summary updated

BibTeX
@inproceedings{chen2021leveraging,
  author = {Yongrui Chen and Xinnan Guo and Chaojie Wang and Jian Qiu and Guilin Qi and Meng Wang and Huiying Li},
  title = {{Leveraging Table Content for Zero-shot Text-to-SQL with Meta-Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i5.16519},
}
Figure