UNJOIN: Enhancing Multi-Table Text-to-SQL Generation via Schema Simplification

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Ganesan, Poojah, Jha, Rajat Aayush, Roth, Dan, Gupta, Vivek
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866910964897546240
author Ganesan, Poojah
Jha, Rajat Aayush
Roth, Dan
Gupta, Vivek
author_facet Ganesan, Poojah
Jha, Rajat Aayush
Roth, Dan
Gupta, Vivek
contents Recent advances in large language models (LLMs) have greatly improved Text-to-SQL performance for single-table queries. But, it remains challenging in multi-table databases due to complex schema and relational operations. Existing methods often struggle with retrieving the right tables and columns, generating accurate JOINs and UNIONs, and generalizing across diverse schemas. To address these issues, we introduce UNJOIN, a two-stage framework that decouples the retrieval of schema elements from SQL logic generation. In the first stage, we merge the column names of all tables in the database into a single-table representation by prefixing each column with its table name. This allows the model to focus purely on accurate retrieval without being distracted by the need to write complex SQL logic. In the second stage, the SQL query is generated on this simplified schema and mapped back to the original schema by reconstructing JOINs, UNIONs, and relational logic. Evaluations on SPIDER and BIRD datasets show that UNJOIN matches or exceeds the state-of-the-art baselines. UNJOIN uses only schema information, which does not require data access or fine-tuning, making it scalable and adaptable across databases.
format Preprint
id arxiv_https___arxiv_org_abs_2505_18122
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle UNJOIN: Enhancing Multi-Table Text-to-SQL Generation via Schema Simplification
Ganesan, Poojah
Jha, Rajat Aayush
Roth, Dan
Gupta, Vivek
Computation and Language
Recent advances in large language models (LLMs) have greatly improved Text-to-SQL performance for single-table queries. But, it remains challenging in multi-table databases due to complex schema and relational operations. Existing methods often struggle with retrieving the right tables and columns, generating accurate JOINs and UNIONs, and generalizing across diverse schemas. To address these issues, we introduce UNJOIN, a two-stage framework that decouples the retrieval of schema elements from SQL logic generation. In the first stage, we merge the column names of all tables in the database into a single-table representation by prefixing each column with its table name. This allows the model to focus purely on accurate retrieval without being distracted by the need to write complex SQL logic. In the second stage, the SQL query is generated on this simplified schema and mapped back to the original schema by reconstructing JOINs, UNIONs, and relational logic. Evaluations on SPIDER and BIRD datasets show that UNJOIN matches or exceeds the state-of-the-art baselines. UNJOIN uses only schema information, which does not require data access or fine-tuning, making it scalable and adaptable across databases.
title UNJOIN: Enhancing Multi-Table Text-to-SQL Generation via Schema Simplification
topic Computation and Language
url https://arxiv.org/abs/2505.18122