IGSQL: Database Schema Interaction Graph Based Neural Model for Context-Dependent Text-to-SQL Generation

Yitao Cai, Xiaojun Wan

Introduction

Translating natural language into SQL (Text-to-SQL) is essential for democratizing data access. However, real-world interactions are rarely isolated; users engage in multi-turn dialogues where context is paramount. IGSQL addresses the limitations of existing models by introducing a novel graph-based encoder that tracks database schema interactions across conversational turns.

The Challenge of Context-Dependency

In a dialogue, user queries are often elliptical or ambiguous. For instance, a follow-up question like "What is the age of Kacey?" relies on the context that "Kacey" refers to an entity in a previously mentioned table (e.g., Dogs). Previous state-of-the-art models primarily focused on "utterance history"—the sequence of words spoken—often neglecting the historical state of the database schema itself. This oversight makes it difficult to maintain thematic consistency across turns.

The IGSQL Architecture

The core innovation of IGSQL is the Database Schema Interaction Graph Encoder. Unlike static schema representations, IGSQL models schema items (tables and columns) as nodes in a graph, with edges representing structural relationships like primary-foreign key pairs.

The IGSQL architecture featuring the schema interaction graph and gated decoder.

The architecture consists of:

  1. Cross-turn layers: These update schema item representations by attending to related items from the previous turn, effectively creating a "memory" of the active schema neighborhood.
  2. Intra-turn layers: These aggregate local structural information within the current turn.
  3. Gated Decoder: A specialized mechanism that dynamically selects tokens from three sources: standard SQL keywords, schema items, or previously generated SQL tokens. This prevents confusion across different vocabularies.
  4. BERT Integration: Pre-trained BERT embeddings provide a robust semantic foundation for both natural language inputs and schema items.

Experimental Evaluation

IGSQL was evaluated on two challenging benchmarks:

  • SParC: A multi-turn version of the Spider dataset with over 4,000 interactions.
  • CoSQL: A conversational dataset including complex dialogue acts like user clarifications, with over 3,000 interactions.

Both datasets are cross-domain, requiring models to generalize to unseen database structures.

Results and Discussion

IGSQL achieved state-of-the-art performance, notably outperforming the previous leading model, EditSQL.

Performance comparison of IGSQL against baseline models on SParC and CoSQL datasets.

Key findings include:

  • Significant Gains: On SParC, IGSQL improved question match accuracy by 3.3% on the test set and interaction match accuracy by 4.2%.
  • Robustness to Complexity: Ablation studies indicated that the schema interaction graph is particularly beneficial for "Hard" and "Extra Hard" queries, where context tracking is most difficult.
  • Thematic Consistency: By modeling graph distance as a proxy for context, the authors demonstrated that users tend to query related schema items in succession, a pattern IGSQL is uniquely designed to capture.

Conclusion

IGSQL represents a significant advancement in context-dependent Text-to-SQL generation. By shifting the focus from simple utterance history to a structured memory of database schema interactions, the model achieves higher accuracy and better thematic consistency. While "Extra Hard" queries remain a challenge, IGSQL provides a strong framework for future research in conversational data interfaces.

Summary updated

BibTeX
@inproceedings{cai2020igsql,
  author = {Yitao Cai and Xiaojun Wan},
  title = {{IGSQL: Database Schema Interaction Graph Based Neural Model for Context-Dependent Text-to-SQL Generation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2020},
  doi = {10.18653/v1/2020.emnlp-main.560},
}
Figure