Improving Few-Shot Text-to-SQL with Meta Self-Training via Column Specificity

Xinnan Guo, Yongrui Chen, Guilin Qi, Tianxing Wu, Hao Xu

Abstract

Generating SQL queries from natural language questions (NLQ) typically requires vast amounts of labeled data, which is often unavailable in specialized domains. We present MST-SQL, a framework that leverages unlabeled data through iterative self-training and a novel meta-learning strategy called Column Specificity Meta-Learning (CSML). By prioritizing common database columns during training, MST-SQL learns generalizable SQL logic that adapts effectively to new schemas with minimal supervision. Our approach achieves state-of-the-art performance in few-shot settings on the WikiSQL and ESQL benchmarks.

Introduction

The ability to query databases using natural language is a key step toward democratizing data access. However, the high cost of producing hand-labeled NLQ-SQL pairs creates a significant barrier, particularly in privacy-sensitive sectors like finance or healthcare. While "few-shot" learning aims to address this by training on limited examples, existing methods often fail to utilize available unlabeled queries or overfit to specific table structures.

MST-SQL addresses these challenges by combining self-training with meta-learning. It treats the diversity of database columns not as a hurdle, but as a signal: by focusing on "common" columns (like dates or names) during meta-updates, the model captures the underlying structural logic of SQL that transfers across different tables.

The MST-SQL Framework

The MST-SQL architecture is built upon a RoBERTa-based encoding module that processes column types, headers, and table content alongside the natural language question. It decomposes the SQL generation task into several sub-tasks, such as selecting columns and operators.

The MST-SQL architecture (a) and the iterative adaptation pipeline (b) which integrates labeled and unlabeled data.

Iterative Self-Training

To exploit unlabeled data, the model generates "pseudo-labels" for raw user queries. To mitigate the risk of the model learning from its own incorrect predictions, a confidence filtering (CF) mechanism is employed. Only predictions exceeding a specific confidence threshold are used to update the model, ensuring that the self-training process remains stable and accurate.

Column Specificity Meta-Learning (CSML)

The core innovation is the CSML module. During the meta-learning phase, the model calculates a specificity score for each column based on its frequency across the dataset. The training objective is weighted to prioritize "generic knowledge" derived from common columns. This prevents the model from becoming overly specialized to niche columns in the training set, facilitating faster and more accurate adaptation to entirely new database schemas in few-shot scenarios.

Experimental Evaluation

We evaluated MST-SQL on two primary benchmarks: WikiSQL (open-domain) and ESQL (Chinese domain-specific).

In the 1-shot setting on WikiSQL, MST-SQL achieved a remarkable 78.4% Logical Form (LF) accuracy. This significantly outperforms the base HydraNet model (64.2%) and even exceeds the performance of large-scale pre-trained models like GRAPPA (72.8%), which are trained on hundreds of thousands of examples. On the ESQL dataset, the model demonstrated strong domain adaptation, outperforming the baseline by 10% in 5-shot tests.

Key Insights

The Role of Confidence Filtering

A critical component of the self-training success is the confidence filtering mechanism. As shown in our ablation studies, removing this filter leads to a significant performance drop, as the model begins to incorporate noise from incorrect pseudo-labels into its weights.

Impact of confidence filtering (CF) and varying thresholds (λ) on Logical Form (LF) accuracy over training epochs.

Generic Knowledge as a Regularizer

Our results suggest that focusing on common columns acts as a powerful regularizer. By mastering the "generic" patterns of how language maps to SQL structure, the model becomes more robust when encountering the unique quirks of specialized tables. This "generic knowledge" hypothesis explains why MST-SQL generalizes so well to unseen domains compared to standard supervised approaches.

Conclusion

MST-SQL demonstrates that combining self-training with meta-learning is a highly effective strategy for few-shot text-to-SQL tasks. By intelligently filtering unlabeled data and prioritizing transferable column logic, the framework achieves state-of-the-art results with minimal human intervention. Future work will focus on extending this approach to multi-table queries involving complex JOIN operations, which remain a significant challenge in the field.

Summary updated

BibTeX
@inproceedings{guo2022improving,
  author = {Xinnan Guo and Yongrui Chen and Guilin Qi and Tianxing Wu and Hao Xu},
  title = {{Improving Few-Shot Text-to-SQL with Meta Self-Training via Column Specificity}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2022},
  doi = {10.24963/ijcai.2022/576},
}
Figure