arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2407.01183cs.DB
收藏

TCSR-SQL:面向表格内容感知的文本到SQL与自检索方法

TCSR-SQL: Towards Table Content-aware Text-to-SQL with Self-retrieval

Harbin Institute of Technology (Shenzhen)(哈尔滨工业大学(深圳));Inspur Cloud Information Technology Co. Ltd(浪潮云信息技术有限公司);Peng Cheng Laboratory(鹏城实验室);Guangdong Power Grid Co. Ltd(广东电网有限责任公司);University of Macau(澳门大学)

Wenbo Xu, Liang Yan, Chuanyi Liu, Peiyi Han, Haifeng Zhu, Yong Xu, Yingwei Liang, Bob Zhang

AI总结:

TCSR-SQL通过LLM上下文学习提取问题中的数据内容关键词,推断相关数据库模式并生成种子SQL进行模糊搜索,结合编码知识表和多轮生成-执行-修订过程生成精确SQL,在包含2115个问题-SQL对的表格内容感知基准上执行准确率至少提升27.8%。

摘要:

基于大语言模型(LLM)的文本到SQL方法在面向实际应用生成SQL查询方面已取得重要进展。然而,在实际场景中面对表格内容感知的问题时,问题中模糊的数据内容关键词以及不存在的数据库模式列名会导致现有方法性能不佳。为解决这一问题,我们提出了一种新颖的面向表格内容感知的文本到SQL与自检索方法(TCSR-SQL)。该方法利用LLM的上下文学习能力,提取问题中的数据内容关键词,并推断可能相关的数据库模式,进而用于生成种子SQL以对数据库进行模糊搜索。搜索结果进一步结合设计的编码知识表来确认编码知识,包括SQL中使用的列名和精确存储的内容值。编码知识被送入多轮生成-执行-修订过程,以获得最终的精确SQL。为验证我们的方法,我们引入了一个表格内容感知的、与问题相关的基准数据集,包含2115个问题-SQL对。在该基准上进行的综合实验表明,TCSR-SQL具有显著性能,与其他最先进方法相比,执行准确率至少提高了27.8%。

英文摘要:

Large Language Model-based (LLM-based) Text-to-SQL methods have achieved important progress in generating SQL queries for real-world applications. When confronted with table content-aware questions in real-world scenarios, ambiguous data content keywords and nonexistent database schema column names within the question lead to the poor performance of existing methods. To solve this problem, we propose a novel approach towards Table Content-aware Text-to-SQL with Self-Retrieval (TCSR-SQL). It leverages LLM's in-context learning capability to extract data content keywords within the question and infer possible related database schema, which is used to generate Seed SQL to fuzz search databases. The search results are further used to confirm the encoding knowledge with the designed encoding knowledge table, including column names and exact stored content values used in the SQL. The encoding knowledge is sent to obtain the final Precise SQL following multi-rounds of generation-execution-revision process. To validate our approach, we introduce a table-content-aware, question-related benchmark dataset, containing 2115 question-SQL pairs. Comprehensive experiments conducted on this benchmark demonstrate the remarkable performance of TCSR-SQL, achieving an improvement of at least 27.8% in execution accuracy compared to other state-of-the-art methods.

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

↑