Reboost Large Language Model-based Text-to-SQL, Text-to-Python, and Text-to-Function -- with Real Applications in Traffic Domain

📄 arXiv: 2310.18752v2 📥 PDF

作者: Guanghu Sui, Zhishuai Li, Ziyue Li, Sun Yang, Jingqing Ruan, Hangyu Mao, Rui Zhao

分类: cs.AI

发布日期: 2023-10-28 (更新: 2023-10-31)


💡 一句话要点

提出一种新型提示方法以提升文本到SQL的执行准确性

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 文本到SQL 查询重写 SQL增强 执行反馈 商业数据集 适应性方法 大语言模型

📋 核心要点

  1. 现有的文本到SQL方法在特定数据集上表现优异,但在商业数据集上性能显著下降,存在适应性不足的问题。
  2. 本文提出了一种新型的提示方法,通过查询重写和SQL增强来提高模型对模糊信息的处理能力,增强SQL的执行效果。
  3. 实验结果表明,本文方法在商业数据集上的执行准确率达到65.79,相较于现有方法的21.05有了显著提升。

📝 摘要(中文)

现有的最先进方法在Spider数据集上取得了显著的执行准确率,但在商业数据集的复现中表现不佳。本文分析了数据集复杂性和问题意图的清晰度对提示方法性能的影响,提出了一种更具适应性和通用性的提示方法,主要包括查询重写和SQL增强。通过将执行反馈和数据库内容的查询结果融入SQL中,显著提高了商业数据集的执行准确率,实验结果显示,本文方法的准确率达到65.79,较现有方法提升了44.74。

🔬 方法详解

问题定义:本文旨在解决现有文本到SQL方法在商业数据集上性能下降的问题,特别是由于数据集复杂性和问题意图不清晰导致的准确率低下。

核心思路:提出了一种更具适应性和通用性的提示方法,主要通过查询重写将模糊信息转化为精确的信息,并通过SQL增强结合执行反馈来提升SQL的质量。

技术框架:整体框架包括数据预处理、查询重写模块、SQL增强模块和执行反馈整合,确保信息的完整性和准确性。

关键创新:最重要的创新在于将数据库描述中的列注释、值类型和示例纳入提示中,从而减少信息缺口,提升模型的理解能力。

关键设计:在参数设置上,优化了提示的结构和内容,确保模型能够有效利用数据库的元信息,采用了适应性损失函数以提高模型的训练效果。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

实验结果显示,本文方法在商业数据集上的执行准确率达到65.79,相较于现有最先进方法的21.05提升了44.74,证明了该方法在实际应用中的显著优势。

🎯 应用场景

该研究在交通领域具有广泛的应用潜力,能够帮助开发更智能的查询系统,提升数据分析和决策支持的效率。通过改进文本到SQL的转换,能够在实际业务中实现更高效的数据检索和处理,推动智能交通系统的发展。

📄 摘要(原文)

The previous state-of-the-art (SOTA) method achieved a remarkable execution accuracy on the Spider dataset, which is one of the largest and most diverse datasets in the Text-to-SQL domain. However, during our reproduction of the business dataset, we observed a significant drop in performance. We examined the differences in dataset complexity, as well as the clarity of questions' intentions, and assessed how those differences could impact the performance of prompting methods. Subsequently, We develop a more adaptable and more general prompting method, involving mainly query rewriting and SQL boosting, which respectively transform vague information into exact and precise information and enhance the SQL itself by incorporating execution feedback and the query results from the database content. In order to prevent information gaps, we include the comments, value types, and value samples for columns as part of the database description in the prompt. Our experiments with Large Language Models (LLMs) illustrate the significant performance improvement on the business dataset and prove the substantial potential of our method. In terms of execution accuracy on the business dataset, the SOTA method scored 21.05, while our approach scored 65.79. As a result, our approach achieved a notable performance improvement even when using a less capable pre-trained language model. Last but not least, we also explore the Text-to-Python and Text-to-Function options, and we deeply analyze the pros and cons among them, offering valuable insights to the community.