Chain-of-thought (CoT) prompting combined with large language models (LLMs) have achieved encouraging results on complex reasoning tasks. Text-to-SQL is a critical semantic parsing task that converts natural language questions into SQL statements, involving a complex reasoning process. However, there is little work about using CoT prompting to activate LLM's reasoning capabilities on Text-to-SQL tasks. In this work, we propose a new paradigm for prompting Text-to-SQL tasks, called Divide-and-Prompt, which first divides the task into subtasks, and then approach each subtask through CoT. We present 3 prompting-based methods to enhance the Text-to-SQL ability of LLMs. Experiments show that these prompts guide LLMs to generate Text-to-SQL with higher execution accuracy.
翻译:链式思维(CoT)提示与大型语言模型(LLMs)相结合,在复杂推理任务上已取得了令人鼓舞的成果。文本到SQL是一种关键语义解析任务,旨在将自然语言问题转换为SQL语句,涉及复杂的推理过程。然而,目前关于利用CoT提示激活LLM在文本到SQL任务中推理能力的研究仍较少。本文提出了一种面向文本到SQL任务的新提示范式,称为分而提示,该方法首先将任务划分为子任务,然后通过CoT逐一处理每个子任务。我们提出了3种基于提示的方法来增强LLM的文本到SQL能力。实验表明,这些提示能够引导LLM生成执行准确率更高的文本到SQL语句。