Abstract
Standard text-to-SQL parsers often fail on new databases because they make "local" decisions, picking columns or tables one by one without considering the overall database structure. This paper introduces a global reasoning framework using Graph Neural Networks (GNNs) to holistically select database constants and re-rank candidate queries, resulting in a significant accuracy jump from 39.4% to 47.4% on the challenging SPIDER benchmark.
The Problem: Local Ambiguity in Zero-Shot Parsing
The goal of zero-shot semantic parsing is to build systems that translate natural language questions into SQL queries for databases they have never seen before. The primary challenge in this setting is ambiguity.
Most existing parsers rely on "local" decoding: they attempt to match a word like "name" in a question to a specific column in the database. However, complex schemas often contain multiple similar columns. For instance, a database might have both singer.name and song.name. If a parser only evaluates the word "name" in isolation, it faces a high probability of error.
Humans resolve this by looking at the "global" context—if the question also mentions "nationality," we can infer that the query likely pertains to the singer table. Current parsers struggle with this holistic view of the database schema.
Methods: Injecting Global Reasoning
The authors propose two technical contributions to move beyond local decisions by utilizing Graph Neural Networks (GNNs) to model the relational structure of the database schema.
1. Global Gating
Before the parser begins generating SQL, a Gating GCN processes the entire database schema (represented as a graph of tables and columns) alongside the full question. This GNN predicts a "relevance score" for every schema element. This acts as a soft selection filter, informing the parser which parts of the database are relevant based on the global context of the query.
2. Discriminative Re-ranking
Rather than outputting a single greedy prediction, the system generates a "beam" of top-K candidate queries. A second GNN then evaluates these candidates. This re-ranker examines the specific set of database constants used in each candidate and verifies how well they align with the question words globally. It essentially "double-checks" the parser's work to ensure the chosen columns make sense as a cohesive group.
To facilitate this, the authors added a special "global node" to their GNN that connects to every other node, allowing information to flow across the entire schema rapidly.
Evaluation on the SPIDER Benchmark
The model was evaluated on SPIDER, a large-scale, cross-domain dataset containing ~10,000 examples across 200 databases. SPIDER is particularly difficult because it requires joining multiple tables and handling complex SQL clauses like ORDER BY and GROUP BY in a zero-shot setting.
Key Results
- State-of-the-Art Performance: The "Global-GNN" model achieved 47.4% accuracy on the SPIDER hidden test set, a substantial improvement over the previous baseline of 39.4%.
- Complexity Handling: The gains were most significant on "Multi-table" queries, where global reasoning about joins is most critical.
- Ablation Impact: Removing either the Global Gating or the Re-ranking led to a roughly 4% drop in performance, demonstrating that both pre-filtering and post-checking are vital components.
Conclusion and Future Work
While this work represents a major step forward, an "oracle" analysis suggests significant remaining headroom. If global gating and re-ranking were perfect, accuracy could potentially reach 73.5%. Current limitations include SQL logic errors (e.g., confusing MIN with MAX) and the computational overhead of re-ranking large beams. Future work may involve models that jointly select both database constants and SQL operators within a unified global reasoning framework.
Summary updated