arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.13284cs.DBcs.AIcs.CL
收藏

用于 SQL 生成的结构引导大型语言模型

Structure Guided Large Language Model for SQL Generation

Department of Computing, The Hong Kong Polytechnic University, Hung Hom, Hong Kong SAR, China(香港理工大学计算机系);City University of Macau, Macau SAR, China(澳门城市大学);College of Information Science and Technology, Jinan University, GZ, China(广州jinan大学信息科学与技术学院)

Qinggang Zhang, Hao Chen, Junnan Dong, Shengyuan Chen, Feiran Huang, Xiao Huang

AI总结:

针对 LLMs 难以理解复杂数据库结构和准确解读用户意图的问题,提出结构引导的 text-to-SQL 框架 SGU-SQL,通过建立结构感知链接和基于语法的提示分解任务,显著提升了 SQL 生成的准确性。

摘要:

大型语言模型(LLMs)的最新进展显示出在弥合自然语言查询与数据库管理系统之间差距方面的潜力,使用户无需 SQL 背景即可与数据库交互。然而,LLMs 通常难以理解复杂的数据库结构并准确解读用户意图。已有基于分解的方法被提出以提升 LLMs 在复杂任务上的表现,但由于 SQL 语法的声明式结构以及查询概念与数据库元素之间错综复杂的联系,将 SQL 生成分解为子任务并非易事。本文提出了一种新颖的结构引导文本到 SQL 框架(Structure GUided text-to-SQL framework,SGU-SQL),该框架结合基于语法的提示来增强 LLMs 的 SQL 生成能力。具体而言,SGU-SQL 在用户查询与数据库模式之间建立结构感知链接,并利用基于语法的提示分解复杂生成任务,从而实现更准确的基于 LLM 的 SQL 生成。在两个基准数据集上的大量实验表明,SGU-SQL 持续优于最先进的 text-to-SQL 模型。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑