PET-SQL:一种面向Text-to-SQL的提示增强两轮优化方法及交叉一致性
PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency
AI总结:
提出两阶段框架PET-SQL,通过参考增强提示和模式链接生成SQL,并利用跨LLM交叉一致性进行优化,在Spider基准上以87.6%执行准确率创SOTA。
摘要:
近期Text-to-SQL(Text2SQL)的进展强调激发大型语言模型(LLM)的上下文学习能力,取得了显著成果。然而,在处理冗长的数据库信息和复杂的用户意图时,它们仍面临挑战。本文提出了一个两阶段框架,以提升当前基于LLM的自然语言到SQL系统的性能。我们首先引入一种新颖的提示表示,称为参考增强表示,它包含模式信息以及从表中随机采样的单元格值,以指导LLM生成SQL查询。然后,在第一阶段,检索问题-SQL对作为少样本示例,提示LLM生成初步SQL(PreSQL)。之后,解析PreSQL中提及的实体以进行模式链接,从而显著压缩有用信息。在第二阶段,利用链接后的模式,我们简化提示的模式信息,并指导LLM生成最终SQL。最后,作为后优化模块,我们提出在不同LLM之间使用交叉一致性,而非特定LLM内部的自一致性。我们的方法在Spider基准上取得了新的SOTA结果,执行准确率为87.6%。
英文摘要:
Recent advancements in Text-to-SQL (Text2SQL) emphasize stimulating the large language models (LLM) on in-context learning, achieving significant results. Nevertheless, they face challenges when dealing with verbose database information and complex user intentions. This paper presents a two-stage framework to enhance the performance of current LLM-based natural language to SQL systems. We first introduce a novel prompt representation, called reference-enhanced representation, which includes schema information and randomly sampled cell values from tables to instruct LLMs in generating SQL queries. Then, in the first stage, question-SQL pairs are retrieved as few-shot demonstrations, prompting the LLM to generate a preliminary SQL (PreSQL). After that, the mentioned entities in PreSQL are parsed to conduct schema linking, which can significantly compact the useful information. In the second stage, with the linked schema, we simplify the prompt's schema information and instruct the LLM to produce the final SQL. Finally, as the post-refinement module, we propose using cross-consistency across different LLMs rather than self-consistency within a particular LLM. Our methods achieve new SOTA results on the Spider benchmark, with an execution accuracy of 87.6%.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。