2025-02-18 · 进阶 · 计算机视觉 · 自然语言处理 · 机器学习

SAFE-SQL: Self-Augmented In-Context Learning with Fine-grained Example Selection for Text-to-SQL

SAFE-SQL通过自增强的上下文学习和细粒度示例选择,显著提高了文本到SQL的转换准确性。

更新于 2025-02-18。作者:Jimin Lee、Ingeol Baek、Byeongjeong Kim、Hwanhee Lee。

中文摘要

文本到SQL旨在将自然语言问题转换为可执行的SQL查询。虽然像骨架掩码选择这样的先前方法通过检索与训练示例相似的例子来指导大型语言模型(LLMs)展示了强大的性能,但在现实场景中,由于这些例子不可用,它们遇到了困难。为了克服这一限制,我们提出了用于文本到SQL的自增强上下文学习与细粒度示例选择(SAFE-SQL),这是一个新颖的框架,通过生成和过滤自增强示例来改进SQL生成。SAFE-SQL首先提示LLM生成与测试输入相关的多个文本到SQL示例。然后SAFE-SQL通过三个相关性评估过滤这些示例,构建高质量的上下文学习示例。使用自生成的示例,SAFE-SQL超越了先前的零样本和少样本文本到SQL框架,实现了更高的执行准确率。值得注意的是,我们的方法在额外困难和未见过的场景中提供了额外的性能提升,在这些场景中,传统方法往往失败。

英文摘要

Text-to-SQL aims to convert natural language questions into executable SQL queries. While previous approaches, such as skeleton-masked selection, have demonstrated strong performance by retrieving similar training examples to guide large language models (LLMs), they struggle in real-world scenarios where such examples are unavailable. To overcome this limitation, we propose Self-Augmentation in-context learning with Fine-grained Example selection for Text-to-SQL (SAFE-SQL), a novel framework that improves SQL generation by generating and filtering self-augmented examples. SAFE-SQL first prompts an LLM to generate multiple Text-to-SQL examples relevant to the test input. Then SAFE-SQL filters these examples through three relevance assessments, constructing high-quality in-context learning examples. Using self-generated examples, SAFE-SQL surpasses the previous zero-shot, and few-shot Text-to-SQL frameworks, achieving higher execution accuracy. Notably, our approach provides additional performance gains in extra hard and unseen scenarios, where conventional methods often fail.

解读

一句话总结

SAFE-SQL通过自增强的上下文学习和细粒度示例选择,显著提高了文本到SQL的转换准确性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt