arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.04919cs.DB
收藏

SEA-SQL:具有自适应精炼的语义增强型 Text-to-SQL

SEA-SQL: Semantic-Enhanced Text-to-SQL with Adaptive Refinement

Chaofan Li, Yingxia Shao, Yawen Li, Zheng Liu

AI总结:

本文提出 SEA-SQL 框架,通过语义增强模式、微调自适应偏差消除器和动态执行调整,在零样本设置下低成本提升 Text-to-SQL 准确性,并在 Spider、BIRD 上以极低生成成本达到先进或媲美 GPT-4 的效果。

摘要:

大语言模型(LLM)的最新进展显著推动了 Text-to-SQL 任务的发展。这些工作中的一个常见需求是对 SQL 查询进行事后纠正。然而,这一过程大多需要分析错误案例,并制定带有规则的提示词以消除模型偏差,而且缺乏对 SQL 查询的执行验证。此外,主流技术主要依赖 GPT-4 和少样本提示词,导致成本高昂。为了以具有成本效益的方式研究有效的 SQL 精炼方法,我们提出了具有自适应精炼的语义增强型 Text-to-SQL(Semantic-Enhanced Text-to-SQL with Adaptive Refinement,SEA-SQL),该方法包括自适应偏差消除和动态执行调整,旨在通过零样本提示词在最小化资源支出的同时提升性能。具体而言,SEA-SQL 采用语义增强模式来扩充数据库信息并优化 SQL 查询。在 SQL 查询生成过程中,使用经过微调的自适应偏差消除器来缓解 LLM 造成的固有偏差。动态执行调整用于保证经过偏差消除的 SQL 查询的可执行性。我们在 Spider 和 BIRD 数据集上进行实验,以证明该框架的有效性。结果表明,SEA-SQL 在 GPT3.5 场景下以 9%-58% 的生成成本实现了最先进的性能。此外,SEA-SQL 仅以 0.9%-5.3% 的生成成本即可达到与 GPT-4 相当的水平。

英文摘要:

Recent advancements in large language models (LLMs) have significantly contributed to the progress of the Text-to-SQL task. A common requirement in many of these works is the post-correction of SQL queries. However, the majority of this process entails analyzing error cases to develop prompts with rules that eliminate model bias. And there is an absence of execution verification for SQL queries. In addition, the prevalent techniques primarily depend on GPT-4 and few-shot prompts, resulting in expensive costs. To investigate the effective methods for SQL refinement in a cost-efficient manner, we introduce Semantic-Enhanced Text-to-SQL with Adaptive Refinement (SEA-SQL), which includes Adaptive Bias Elimination and Dynamic Execution Adjustment, aims to improve performance while minimizing resource expenditure with zero-shot prompts. Specifically, SEA-SQL employs a semantic-enhanced schema to augment database information and optimize SQL queries. During the SQL query generation, a fine-tuned adaptive bias eliminator is applied to mitigate inherent biases caused by the LLM. The dynamic execution adjustment is utilized to guarantee the executability of the bias eliminated SQL query. We conduct experiments on the Spider and BIRD datasets to demonstrate the effectiveness of this framework. The results demonstrate that SEA-SQL achieves state-of-the-art performance in the GPT3.5 scenario with 9%-58% of the generation cost. Furthermore, SEA-SQL is comparable to GPT-4 with only 0.9%-5.3% of the generation cost.

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

↑