arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2305.12586cs.CL
收藏

增强大型语言模型的少样本文本到SQL能力:提示设计策略研究

Enhancing Few-shot Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design Strategies

Yale University(耶鲁大学);Columbia University(哥伦比亚大学);Allen Institute for AI(艾伦人工智能研究所)

Linyong Nan, Yilun Zhao, Weijin Zou, Narutatsu Ri, Jaesung Tae, Ellen Zhang, Arman Cohan, Dragomir Radev

AI总结:

本文研究通过上下文学习改进大型语言模型的Text-to-SQL能力,提出利用SQL语法结构检索示例并兼顾多样性与相似性的提示策略,结合数据库知识增强,在Spider数据集上取得优于现有系统的执行准确率。

摘要:

上下文学习(ICL)已成为处理各种自然语言处理任务的新方法,它利用大型语言模型(LLMs)基于补充了少量示例或特定任务指令的上下文进行预测。本文旨在将该方法扩展到利用结构化知识源的问答任务,并通过探索使用LLMs的各种提示设计策略来改进Text-to-SQL系统。我们系统地研究了在Text-to-SQL任务中提示LLMs的不同示例选择方法和最佳指令格式。我们的方法涉及利用示例SQL查询的语法结构来检索示例,并且我们证明在示例选择中追求多样性和相似性能够提升性能。此外,我们展示了LLMs能从数据库相关的知识增强中获益。我们最有效的策略在Spider数据集上比最先进的系统高出2.5个百分点(执行准确率),比最佳微调系统高出5.1个百分点。这些结果突显了我们的方法在使LLMs适应Text-to-SQL任务方面的有效性,并且我们对促成该策略成功的因素进行了分析。

英文摘要:

In-context learning (ICL) has emerged as a new approach to various natural language processing tasks, utilizing large language models (LLMs) to make predictions based on context that has been supplemented with a few examples or task-specific instructions. In this paper, we aim to extend this method to question answering tasks that utilize structured knowledge sources, and improve Text-to-SQL systems by exploring various prompt design strategies for employing LLMs. We conduct a systematic investigation into different demonstration selection methods and optimal instruction formats for prompting LLMs in the Text-to-SQL task. Our approach involves leveraging the syntactic structure of an example's SQL query to retrieve demonstrations, and we demonstrate that pursuing both diversity and similarity in demonstration selection leads to enhanced performance. Furthermore, we show that LLMs benefit from database-related knowledge augmentations. Our most effective strategy outperforms the state-of-the-art system by 2.5 points (Execution Accuracy) and the best fine-tuned system by 5.1 points on the Spider dataset. These results highlight the effectiveness of our approach in adapting LLMs to the Text-to-SQL task, and we present an analysis of the factors contributing to the success of our strategy.

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

↑