Structure-Guided Large Language Models for Text-to-SQL Generation
Abstract
Recent advancements in large language models (LLMs) have shown promise in bridging the gap between natural language queries and database management systems, enabling users to interact with databases without the background of SQL. However, LLMs often struggle to fully exploit and comprehend the user intention and complex structures of databases. Decomposition-based methods have been proposed to enhance the performance of LLMs on complex tasks, but decomposing SQL generation into subtasks is non-trivial due to the declarative structure of SQL syntax and the intricate connections between query concepts and database elements. In this paper, we propose a novel Structure GUided text-to-SQL framework ( SGU-SQL) that incorporates syntax-based prompting to enhance the SQL generation capabilities of LLMs. Specifically, SGU-SQL establishes structure-aware links between user queries and database schema and recursively decomposes the complex generation task using syntax-based prompting to guide LLMs in incrementally constructing target SQLs. Extensive experiments on two benchmark datasets demonstrate that SGU-SQL consistently outperforms state-of-the-art text-to-SQL baselines.
Cite
Text
Zhang et al. "Structure-Guided Large Language Models for Text-to-SQL Generation." Proceedings of the 42nd International Conference on Machine Learning, 2025.Markdown
[Zhang et al. "Structure-Guided Large Language Models for Text-to-SQL Generation." Proceedings of the 42nd International Conference on Machine Learning, 2025.](https://mlanthology.org/icml/2025/zhang2025icml-structureguided/)BibTeX
@inproceedings{zhang2025icml-structureguided,
title = {{Structure-Guided Large Language Models for Text-to-SQL Generation}},
author = {Zhang, Qinggang and Chen, Hao and Dong, Junnan and Chen, Shengyuan and Huang, Feiran and Huang, Xiao},
booktitle = {Proceedings of the 42nd International Conference on Machine Learning},
year = {2025},
pages = {74671-74691},
volume = {267},
url = {https://mlanthology.org/icml/2025/zhang2025icml-structureguided/}
}