Table of Contents
Fetching ...

RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL

Haoyang Li, Jing Zhang, Cuiping Li, Hong Chen

TL;DR

This work tackles Text-to-SQL by decoupling schema linking from skeleton parsing. It introduces RESDSQL, combining a ranking-enhanced encoder that selectively injects the most relevant schema items with a skeleton-aware decoder that generates a SQL skeleton before the full query, guiding subsequent parsing. The approach yields state-of-the-art results on Spider and improves robustness across perturbation-based variants, with ablations showing the critical roles of the ranking mechanism, skeleton guidance, and the column-enhanced layer. The method also integrates an execution-guided selector to ensure executable queries, making it practical for real-world use with complex schemas and queries.

Abstract

One of the recent best attempts at Text-to-SQL is the pre-trained language model. Due to the structural property of the SQL queries, the seq2seq model takes the responsibility of parsing both the schema items (i.e., tables and columns) and the skeleton (i.e., SQL keywords). Such coupled targets increase the difficulty of parsing the correct SQL queries especially when they involve many schema items and logic operators. This paper proposes a ranking-enhanced encoding and skeleton-aware decoding framework to decouple the schema linking and the skeleton parsing. Specifically, for a seq2seq encoder-decode model, its encoder is injected by the most relevant schema items instead of the whole unordered ones, which could alleviate the schema linking effort during SQL parsing, and its decoder first generates the skeleton and then the actual SQL query, which could implicitly constrain the SQL parsing. We evaluate our proposed framework on Spider and its three robustness variants: Spider-DK, Spider-Syn, and Spider-Realistic. The experimental results show that our framework delivers promising performance and robustness. Our code is available at https://github.com/RUCKBReasoning/RESDSQL.

RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL

TL;DR

This work tackles Text-to-SQL by decoupling schema linking from skeleton parsing. It introduces RESDSQL, combining a ranking-enhanced encoder that selectively injects the most relevant schema items with a skeleton-aware decoder that generates a SQL skeleton before the full query, guiding subsequent parsing. The approach yields state-of-the-art results on Spider and improves robustness across perturbation-based variants, with ablations showing the critical roles of the ranking mechanism, skeleton guidance, and the column-enhanced layer. The method also integrates an execution-guided selector to ensure executable queries, making it practical for real-world use with complex schemas and queries.

Abstract

One of the recent best attempts at Text-to-SQL is the pre-trained language model. Due to the structural property of the SQL queries, the seq2seq model takes the responsibility of parsing both the schema items (i.e., tables and columns) and the skeleton (i.e., SQL keywords). Such coupled targets increase the difficulty of parsing the correct SQL queries especially when they involve many schema items and logic operators. This paper proposes a ranking-enhanced encoding and skeleton-aware decoding framework to decouple the schema linking and the skeleton parsing. Specifically, for a seq2seq encoder-decode model, its encoder is injected by the most relevant schema items instead of the whole unordered ones, which could alleviate the schema linking effort during SQL parsing, and its decoder first generates the skeleton and then the actual SQL query, which could implicitly constrain the SQL parsing. We evaluate our proposed framework on Spider and its three robustness variants: Spider-DK, Spider-Syn, and Spider-Realistic. The experimental results show that our framework delivers promising performance and robustness. Our code is available at https://github.com/RUCKBReasoning/RESDSQL.
Paper Structure (39 sections, 4 equations, 2 figures, 5 tables)

This paper contains 39 sections, 4 equations, 2 figures, 5 tables.

Figures (2)

  • Figure 1: Illustration of a Text-to-SQL instance solved by a seq2seq PLM. In the database schema, each schema item is denoted by its "original name (semantic name)".
  • Figure 2: An overview of the ranking-enhanced encoding and skeleton-aware decoding framework. We train a cross-encoder for classifying the schema items. Then we take the question, the ranked schema sequence, and optional foreign keys as the input of the ranking-enhanced encoder. The skeleton-aware decoder first decodes the SQL skeleton and then the actual SQL query.