[论文解读] Divide and Prompt: Chain of Thought Prompting for Text-to-SQL
本文提出 Divide-and-Prompt(DnP)提示,将文本到SQL任务分解为子任务,并对每个子任务应用链式推理(CoT),显著提升在 GPT-3.5-Turbo 上的执行准确性,尤其是在 Spider 数据集的更难任务上。
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.
研究动机与目标
- 将文本到 SQL 作为大模型的推理任务进行动机阐释,并探索通过 CoT 提示来利用大模型在 SQL 生成中的推理能力。
- 提出并评估三种 DnP 提示策略,以引导大模型从自然语言查询生成正确的 SQL。
- 在 Spider 数据集上评估 DnP 提示的有效性,并与现有基线与提示进行比较。
提出的方法
- 将任务划分为子任务,并对每个子任务应用链式推理提示。
- 三种 DnP 方法:逐条 DnP(CC-DnP)、模式链接 DnP(SL-DnP)、生成与精 Refin e DnP(GR-DnP)。
- 展示仅使用自然语言的提示,适用于非专业用户。
实验结果
研究问题
- RQ1Divide-and-Prompt 提示是否能提升文本到 SQL 的准确性,相比标准提示?
- RQ2哪种 DnP 实例化(CC-DnP、SL-DnP、GR-DnP)在何种条件下表现最佳?
- RQ3DnP 提示在 Spider 的易级、难级、超难级文本到 SQL 任务上的表现如何?
- RQ4少样本提示对 DnP 的有效性是否必需,零样本表现如何?
主要发现
| Method | VA (Valid SQL %) | EX (Execution Accuracy %) | TS (Test-Suite Accuracy %) |
|---|---|---|---|
| Finetuned T5-3B + PICARD | 98.4 | 79.3 | 69.4 |
| GRAPHIX + PICARD | 98.8 | 80.5 | 70.3 |
| RESDSQL + NatSQL | 99.1 | 84.1 | 73.5 |
| Rajkumar 等人(2022) | 91.6 | 67.0 | 55.1 |
| Liu 等人(2023) | 97.7 | 70.1 | 60.1 |
| GPT-3.5(零-shot) | 97.9 | 70.8 | 62.3 |
| GPT-3.5(少-shot) | 98.2 | 72.9 | 62.6 |
| GPT-3.5 + 普通 CoT | 92.6 | 60.3 | 49.5 |
| GPT-3.5 + CC-DnP | 97.8 | 74.3 | 63.0 |
| GPT-3.5 + RL-DnP | 99.1 | 74.7 | 65.1 |
| GPT-3.5 + GR-DnP | 98.6 | 75.1 | 65.4 |
- DnP 提示在执行准确性方面相较于标准零-shot 提示提升了 4.3%。
- 在硬等级文本到 SQL 任务上,GR-DnP 相较于标准提示将执行准确性提升最多约 10.8%;在超难任务上提升约 3%。
- 仅使用普通 CoT 提示在 SQL 生成方面表现不足,原因在于 SQL 的严格语法和结构。
- 在阶段-1 使用 SL-DnP,阶段-2 进行精炼的 GR-DnP 在少样本设置下与 GPT-3.5 取得了强劲效果。
- 零样本提示在推理步骤的遵循性方面存在局限,降低了基于 CoT 提示的有效性。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。