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

IncSQL: Training Incremental Text-to-SQL Parsers with Non-Deterministic Oracles

Tianze Shi, Kedar Tatwawadi, Kaushik Chakrabarti, Yi Mao, Oleksandr Polozov, Weizhu ChenarXiv 2018

Introduction

Translating natural language questions into structured SQL queries (NL2SQL) is a critical step toward making databases accessible to non-technical users. However, traditional sequence-to-sequence models often struggle with the inherent flexibility of SQL syntax. IncSQL addresses these challenges by introducing an incremental parser trained with non-deterministic oracles, achieving state-of-the-art performance on the WikiSQL benchmark.

The NL2SQL Challenge

The primary difficulty in NL2SQL lies in the lack of a one-to-one mapping between questions and queries. Two major hurdles complicate this task:

  1. The "Order-Matters" Issue: SQL WHERE clauses are order-independent. A model might produce a semantically correct query that differs in order from the ground truth, leading to unfair penalties during training.
  2. Implicit Mentions: Users frequently omit column names, requiring the model to infer context (e.g., "Willis Tower" implies the Name column).
Example of the NL2SQL task where a natural language question is translated into a SQL query to retrieve data from a table.

Methodology

IncSQL treats query generation as a sequence of discrete actions to fill a SQL template. This incremental approach allows the model to maintain dependencies between different parts of the query.

Advanced Encoder-Decoder Architecture

The model utilizes a sophisticated neural architecture to bridge the gap between natural language and database schemas.

  • Encoder: Employs bi-LSTMs with self-attention and "cross-serial attention" to link question tokens directly to schema columns.
  • Decoder: A 2-layer LSTM that predicts the next action (e.g., SELECT, AGG, CONDCOL) using a bilinear scoring function.
The IncSQL architecture featuring a bi-LSTM encoder with cross-serial attention and an incremental LSTM decoder.

Key Innovations

  • Non-Deterministic Oracles: Instead of forcing the model to follow a single "gold" path, the oracle identifies all valid next actions that could lead to a correct query. This allows the model to explore multiple semantically equivalent paths during training, significantly improving robustness.
  • ANYCOL Action: To handle implicit column mentions, the ANYCOL action allows the system to perform a broad search across all columns when a specific one isn't identified in the text.
  • Execution-Guided Decoding: During inference, IncSQL can perform "execution-guided decoding." By checking partial queries against the database, the model prunes paths that would result in errors or empty sets, ensuring the final output is logically sound.

Results and Discussion

IncSQL was evaluated primarily on the WikiSQL dataset, consisting of over 80,000 pairs. It was also tested on a reduced ATIS dataset to verify generalizability.

  • Accuracy: The base model achieved 83.7% execution accuracy. With execution-guided decoding, this rose to 87.1%, a new state-of-the-art at the time.
  • Logical Form vs. Execution: Interestingly, while execution accuracy improved, exact string matching (logical form accuracy) decreased. This confirms that the model successfully learned to generate diverse but correct SQL structures that rigid training methods would have suppressed.

Conclusion

IncSQL demonstrates that flexibility in training—specifically through non-deterministic oracles—is key to mastering semantic parsing tasks. By moving away from rigid string matching and toward execution-based correctness, IncSQL provides a more robust framework for natural language database interfaces. Future work will focus on extending this incremental approach to multi-table schemas and more complex SQL operations like joins and subqueries.

Summary updated

BibTeX
@misc{shi2018incsql,
  author = {Tianze Shi and Kedar Tatwawadi and Kaushik Chakrabarti and Yi Mao and Oleksandr Polozov and Weizhu Chen},
  title = {{IncSQL: Training Incremental Text-to-SQL Parsers with Non-Deterministic Oracles}},
  year = {2018},
  eprint = {1809.05054},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1809.05054},
}
Figure