[Paper Review] UniSAr: A Unified Structure-Aware Autoregressive Language Model for Text-to-SQL
UniSAr proposes a unified, structure-aware autoregressive language model for text-to-SQL that enhances off-the-shelf models like BART through three non-invasive extensions: structure marks for schema and context encoding, constrained decoding for valid SQL generation, and SQL completion to infer missing JOINs. It achieves state-of-the-art or comparable performance across seven diverse text-to-SQL benchmarks, including multi-domain, multi-table, and multi-turn settings, demonstrating strong generalization and compatibility with multi-task training.
Existing text-to-SQL semantic parsers are typically designed for particular settings such as handling queries that span multiple tables, domains or turns which makes them ineffective when applied to different settings. We present UniSAr (Unified Structure-Aware Autoregressive Language Model), which benefits from directly using an off-the-shelf language model architecture and demonstrates consistently high performance under different settings. Specifically, UniSAr extends existing autoregressive language models to incorporate three non-invasive extensions to make them structure-aware: (1) adding structure mark to encode database schema, conversation context, and their relationships; (2) constrained decoding to decode well structured SQL for a given database schema; and (3) SQL completion to complete potential missing JOIN relationships in SQL based on database schema. On seven well-known text-to-SQL datasets covering multi-domain, multi-table and multi-turn, UniSAr demonstrates highly comparable or better performance to the most advanced specifically-designed text-to-SQL models. Importantly, our UniSAr is non-invasive, such that other core model advances in text-to-SQL can also adopt our extensions to further enhance performance.
Motivation & Objective
- To address the lack of generalization in existing text-to-SQL models that are specifically designed for single settings such as multi-domain, multi-table, or multi-turn tasks.
- To develop a unified framework that maintains high performance across diverse text-to-SQL settings without requiring task-specific architectural modifications.
- To improve the robustness and generalizability of pre-trained language models in text-to-SQL by incorporating structural knowledge in a non-invasive way.
- To enable effective multi-task training across different text-to-SQL benchmarks by leveraging a simple, shared architecture.
Proposed method
- Introduces structure marks—special tokens inserted into the input sequence—to encode database schema, conversation context, and their relationships in a serialized format.
- Applies constrained decoding during generation to restrict output tokens to only those present in the database schema, ensuring syntactic and semantic validity of SQL queries.
- Proposes SQL completion to infer and insert missing JOIN conditions by analyzing the schema structure, improving completeness of generated queries.
- Extends a pre-trained autoregressive model (BART) with these three components without modifying its core architecture, enabling non-invasive integration.
- Employs joint training across multiple datasets (e.g., WikiSQL, Spider, CoSQL) to enhance generalization and model robustness.
- Uses oracle structure marks in ablation studies to estimate the upper bound of performance gains from improved schema-linking.
Experimental results
Research questions
- RQ1Can a unified, non-invasive framework achieve competitive performance across diverse text-to-SQL settings such as multi-domain, multi-table, and multi-turn?
- RQ2How effective are structure marks, constrained decoding, and SQL completion in improving the accuracy and robustness of text-to-SQL generation?
- RQ3To what extent does UniSAr generalize across datasets when trained jointly, especially compared to task-specific models?
- RQ4What is the upper bound of performance improvement achievable through higher-quality structure marks?
Key findings
- UniSAr achieves 86.7% logical form accuracy on the Spider test set in single-table setting, outperforming BART (83.7%) and matching or exceeding RAT-SQL (78.0% single, 77.5% joint).
- On multi-turn datasets (CoSQL, SParC, Chase), UniSAr shows significant gains: +8.7%, +11.7%, and +5.9% respectively over BART in joint training, indicating strong contextual modeling.
- In joint training across single-table (WikiSQL) and multi-table (Spider) datasets, UniSAr maintains high performance (70.0% on Spider test set), showing robustness to data distribution imbalance.
- The oracle structure mark experiment reveals a 1.2% boost on Spider and up to 11.7% on Chase, suggesting that improved schema-linking could further enhance performance.
- UniSAr consistently outperforms BART and matches or exceeds RAT-SQL across all benchmarks, demonstrating that non-invasive extensions can rival task-specific designs.
- The model shows strong generalization in multi-task training, with positive performance gains across settings, unlike task-specific models like RAT-SQL that suffer from overfitting.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.