Abstract
Text-to-SQL aims to map natural language questions to SQL queries. The sketch-based method combined with execution-guided (EG) decoding strategy has shown a strong performance on the WikiSQL benchmark. However, execution-guided decoding relies on database execution, which significantly slows down the inference process and is hence unsatisfactory for many real-world applications. In this paper, we present the Schema Dependency guided multi-task Text-to-SQL model (SDSQL) to guide the network to effectively capture the interactions between questions and schemas. The proposed model outperforms all existing methods in both the settings with or without EG. We show the schema dependency learning partially covers the benefit from EG and alleviates the need for it. SDSQL without EG significantly reduces time consumption during inference, sacrificing only a small amount of performance and providing more flexibility for downstream applications.
Introduction
Translating natural language questions into structured SQL queries—a task known as Text-to-SQL—is essential for making databases accessible to non-technical users. A critical challenge in this domain is schema linking, the process of identifying how specific words in a question correspond to database components like columns, tables, or operators.
Currently, the most accurate models rely on Execution-Guided (EG) decoding, which generates multiple SQL candidates and runs them against a live database to filter out errors. While effective, EG is slow, requires a live database connection during inference, and is computationally expensive. This paper introduces SDSQL, a model designed to achieve state-of-the-art accuracy by improving the model's internal logic through explicit schema dependency learning, thereby reducing the necessity for trial-and-error database execution.
Methodology
The core innovation of the SDSQL model is the explicit learning of "dependencies" between question tokens and the database schema. Instead of relying on implicit attention mechanisms, the authors treat schema linking as a supervised multi-task problem.
Model Architecture
- Input Representation: The model utilizes BERT to encode the question and table headers into a joint representation, which is then refined by a Bi-LSTM layer.
- Schema Dependency Module: The model employs a deep biaffine attention mechanism to predict specific dependency labels between words and columns. These labels include
S-Col(Select Column),S-Agg(Select Aggregator),W-Col(Where Column), andW-Op(Where Operator). - Adaptive Multi-task Loss: SDSQL is trained to simultaneously optimize the SQL structure and the schema dependencies. An adaptive loss function automatically weighs these tasks during training to ensure balanced learning without manual tuning.
Evaluation and Results
The model was evaluated on the WikiSQL benchmark, the standard large-scale dataset for single-table Text-to-SQL tasks, consisting of over 80,000 question-SQL pairs.
Key Findings
- State-of-the-Art Performance: SDSQL achieved 85.6% Logical Form (LF) accuracy and 91.4% Execution (EX) accuracy on the test set without using EG decoding, outperforming all previous models in its category.
- Efficiency Gains: By capturing the logic typically provided by EG decoding within the model itself, SDSQL significantly reduces inference time. It is nearly twice as fast as EG-based models because it does not need to verify queries against a database.
- Closing the EG Gap: Even when EG is added, SDSQL sets a new record (86.6% LF / 92.4% EX), though the improvement is marginal. This suggests the model has already learned most of the necessary schema logic independently.
- Ablation Success: Removing the Schema Dependency module caused EX accuracy to drop from 91.4% to 86.2%, confirming that explicit dependency learning is the primary driver of the model's success.
Conclusion
SDSQL demonstrates that explicitly modeling the dependencies between natural language and database schemas can significantly improve Text-to-SQL performance while maintaining high inference efficiency. While this research focuses on single-table queries, the authors plan to extend this dependency-guided approach to more complex multi-table datasets like Spider in future work.
Summary updated