Structure Guided Large Language Model for SQL Generation

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhang, Qinggang, Chen, Hao, Dong, Junnan, Chen, Shengyuan, Huang, Feiran, Huang, Xiao
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866908443486453760
author Zhang, Qinggang
Chen, Hao
Dong, Junnan
Chen, Shengyuan
Huang, Feiran
Huang, Xiao
author_facet Zhang, Qinggang
Chen, Hao
Dong, Junnan
Chen, Shengyuan
Huang, Feiran
Huang, Xiao
contents 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 comprehend complex database structures and accurately interpret user intentions. 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 decomposes the complex generation task using syntax-based prompting to enable more accurate LLM-based SQL generation. Extensive experiments on two benchmark datasets demonstrate that SGU-SQL consistently outperforms state-of-the-art text-to-SQL models.
format Preprint
id arxiv_https___arxiv_org_abs_2402_13284
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Structure Guided Large Language Model for SQL Generation
Zhang, Qinggang
Chen, Hao
Dong, Junnan
Chen, Shengyuan
Huang, Feiran
Huang, Xiao
Databases
Artificial Intelligence
Computation and Language
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 comprehend complex database structures and accurately interpret user intentions. 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 decomposes the complex generation task using syntax-based prompting to enable more accurate LLM-based SQL generation. Extensive experiments on two benchmark datasets demonstrate that SGU-SQL consistently outperforms state-of-the-art text-to-SQL models.
title Structure Guided Large Language Model for SQL Generation
topic Databases
Artificial Intelligence
Computation and Language
url https://arxiv.org/abs/2402.13284