Recently Large Language Models (LLMs) have been proven to have strong abilities in various domains and tasks. We study the problem of prompt designing in the text-to-SQL task and attempt to improve the LLMs' reasoning ability when generating SQL queries. Besides the trivial few-shot in-context learning setting, we design our chain-of-thought (CoT) prompt with a similar method to schema linking. We provide a method named ACT-SQL to automatically generate auto-CoT exemplars and thus the whole process doesn't need manual labeling. Our approach is cost-saving since we only use the LLMs' API call once when generating one SQL query. Furthermore, we extend our in-context learning method to the multi-turn text-to-SQL task. The experiment results show that the LLMs' performance can benefit from our ACT-SQL approach. Our approach achieves SOTA performance on the Spider dev set among existing in-context learning approaches.
翻译:近期,大型语言模型(LLMs)已被证明在多个领域和任务中具有强大能力。我们研究文本到SQL任务中提示设计的问题,并尝试提升LLMs生成SQL查询时的推理能力。除了简单的少样本上下文学习设置外,我们采用与模式链接类似的方法设计了思维链提示。我们提出名为ACT-SQL的方法自动生成自动思维链示例,从而使整个过程无需人工标注。由于每次生成SQL查询时仅调用一次LLMs的API,我们的方法具有成本效益。此外,我们将上下文学习方法扩展到多轮文本到SQL任务中。实验结果表明,LLMs的性能可从我们的ACT-SQL方法中受益。该方法在Spider开发集上达到了现有上下文学习方法中的最佳性能。