NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On the Potential of Lexico-logical Alignments for Semantic Parsing to SQL Queries

Tianze Shi, Chen Zhao, Jordan L. Boyd-Graber, Hal Daumé Iii, Lillian Lee

Introduction

Semantic parsing—the task of translating natural language into machine-readable code like SQL—is a cornerstone of modern data interaction. Traditionally, models are trained on pairs of questions and logical forms, leaving the internal mapping between specific words and SQL tokens as a latent variable. This "guesswork" becomes particularly challenging when there is minimal textual overlap between the question and the database schema, such as mapping the word "who" to a column named athlete.

Example of manual word-level alignments between a natural language question and its SQL query in the SQUALL dataset.

The SQUALL Dataset

To address this limitation, the authors introduce SQUALL (SQL+QUestion pairs ALigned Lexically), the first large-scale dataset providing manual lexical-to-logical alignments. Derived from the WikiTableQuestions (WTQ) training set, SQUALL consists of 11,276 table-question-answer triplets. Notably, 49.8% of question tokens are explicitly aligned to SQL fragments, providing a "finer-grained" level of supervision that was previously missing in benchmarks like WikiSQL or Spider.

Methodology

The research explores two primary strategies to utilize these manual alignments:

  1. Supervised Attention: Instead of allowing the model to learn attention weights autonomously, a loss term is added to penalize deviations from human-annotated alignments.
  2. Column Prediction: An auxiliary task requires the model to explicitly predict which table column a specific question fragment refers to, reinforcing the link between natural language and database headers.

These techniques were integrated into a Seq2seq model with attention and copying mechanisms, further enhanced by BERT feature extractors.

Key Insights and Results

The inclusion of alignment data yields several critical insights:

  • Efficiency of Annotation: Manual alignment annotation takes less than half the time required to write the SQL query itself, making it a cost-effective supervision method.
  • The 5% Rule: Providing alignments for just 5% of the training data captured over half of the total accuracy improvement seen with full alignment data.
  • Bridging the Lexical Gap: Alignments are most effective when questions use synonyms or vague terms. As shown in Figure 6, the ALIGN model correctly identifies that "show" refers to a specific column, whereas standard models might struggle.
Comparison of model predictions: the ALIGN model correctly identifies the 'show' column (c1) while the baseline SEQ2SEQ+ model fails.
  • Performance Boost: The "ALIGN" model achieved a 4.4% boost in execution accuracy over strong baselines. When combined with BERT, the model reached 54.1% execution accuracy, surpassing the previous weakly-supervised state-of-the-art of 48.8%.
  • Robust Generalization: Models trained with alignments demonstrated significantly better performance on SQL templates unseen during training, suggesting a deeper understanding of the underlying logic.

Conclusion and Future Work

SQUALL represents a major advancement in semantic parsing supervision. While currently limited to the subset of WikiTableQuestions translatable to SQL (~81%), future work could extend these alignments to more complex datasets like Spider. The authors suggest exploring syntax-based methods or automatically converting SQUALL alignments into other logical formalisms to further unlock the potential of fine-grained supervision.

Summary updated

BibTeX
@inproceedings{shi2020potential,
  author = {Tianze Shi and Chen Zhao and Jordan L. Boyd-Graber and Hal Daumé III and Lillian Lee},
  title = {{On the Potential of Lexico-logical Alignments for Semantic Parsing to SQL Queries}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.findings-emnlp.167},
}
Figure