Skip to main content
QUICK REVIEW

[Paper Review] Representing Schema Structure with Graph Neural Networks for Text-to-SQL Parsing

Ben Bogin, Matt Gardner|arXiv (Cornell University)|May 15, 2019
Natural Language Processing TechniquesComputer Science19 references40 citations
TL;DR

The paper introduces a graph neural network (GNN) based schema representation integrated into an encoder-decoder text-to-SQL parser, achieving substantial accuracy gains on the Spider benchmark by conditioning both encoding and decoding on schema structure.

ABSTRACT

Research on parsing language to SQL has largely ignored the structure of the database (DB) schema, either because the DB was very simple, or because it was observed at both training and test time. In Spider, a recently-released text-to-SQL dataset, new and complex DBs are given at test time, and so the structure of the DB schema can inform the predicted SQL query. In this paper, we present an encoder-decoder semantic parser, where the structure of the DB schema is encoded with a graph neural network, and this representation is later used at both encoding and decoding time. Evaluation shows that encoding the schema structure improves our parser accuracy from 33.8% to 39.4%, dramatically above the current state of the art, which is at 19.7%.

Motivation & Objective

  • Motivate the importance of database schema structure in zero-shot text-to-SQL parsing on complex, unseen schemas (Spider).
  • Propose a GNN-based schema representation to provide global, schema-aware signals to both encoder and decoder.
  • Demonstrate that incorporating schema structure significantly improves SQL query accuracy, especially for multi-table queries.

Proposed method

  • Convert each DB schema into a multi-type graph with tables and columns as nodes and foreign-key relations as edges.
  • Compute a question-conditioned relevance score for schema items to softly prune schema influence per question.
  • Use a gated Graph Neural Network to compute node representations that incorporate global schema structure and question relevance.
  • Augment the encoder inputs with graph-informed schema representations and modify the decoder to attend to and utilize graph-aware schema signals.
  • In decoding, include a self-attention mechanism over previously decoded schema items to bias future schema-item choices.

Experimental results

Research questions

  • RQ1Does encoding schema structure with a graph neural network improve Text-to-SQL parsing on unseen schemas (Spider)?
  • RQ2How does a schema-aware representation affect encoding-time and decoding-time decisions, especially for queries involving multiple tables?

Key findings

  • The full GNN-based model achieves 39.4% accuracy on the Spider test set, substantially higher than prior state-of-the-art (19.7%).
  • Removing the GNN reduces accuracy to 33.8%, showing the importance of schema structure.
  • Schema-aware modeling particularly boosts multi-table queries from 14.6% to 26.8% accuracy.
  • Ablations show that self-attention and relevance signals both contribute to performance; Oracle-like relevance further boosts potential gains to 54.3%.
  • The model reduces “bad” joins (e.g., joining unrelated tables) compared to No GNN (15.6% vs 83.4% incidence).

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.