Skip to main content
QUICK REVIEW

[Paper Review] Divide and Prompt: Chain of Thought Prompting for Text-to-SQL

Xiping Liu, Zhao Tan|arXiv (Cornell University)|Apr 23, 2023
Topic ModelingComputer Science7 citations
TL;DR

The paper introduces Divide-and-Prompt (DnP) prompts that decompose Text-to-SQL tasks into subtasks and apply chain-of-thought reasoning to each, significantly boosting execution accuracy on GPT-3.5-Turbo, especially on harder Spider tasks.

ABSTRACT

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.

Motivation & Objective

  • Motivate Text-to-SQL as a reasoning task for LLMs and explore CoT prompting to leverage LLM reasoning in SQL generation.
  • Propose and evaluate three DnP prompting strategies to guide LLMs in generating correct SQL from natural language queries.
  • Assess the effectiveness of DnP prompts on the Spider dataset and compare against existing baselines and prompts.

Proposed method

  • Divide the task into subtasks and apply chain-of-thought prompting to each subtask.
  • Three DnP methods: Clause-by-Clause DnP (CC-DnP), Schema Linking DnP (SL-DnP), Generate and Refine DnP (GR-DnP).
  • Demonstrate prompts using natural language only, suitable for non-expert users.

Experimental results

Research questions

  • RQ1Can Divide-and-Prompt prompting improve Text-to-SQL accuracy over standard prompting?
  • RQ2Which DnP instantiation (CC-DnP, SL-DnP, GR-DnP) yields the best performance and under what conditions?
  • RQ3How do DnP prompts perform on easy vs. hard vs. extra-hard Text-to-SQL tasks on Spider?
  • RQ4Is few-shot prompting essential for DnP effectiveness, and how does zero-shot fare?

Key findings

  • DnP prompts improve execution accuracy by 4.3% over standard zero-shot prompting.
  • On hard-level Text-to-SQL tasks, GR-DnP improves EX by up to 10.8% compared to standard prompting; on extra-level tasks, improvement is about 3%.
  • Normal CoT prompting alone underperforms for SQL generation due to SQL’s strict syntax and structure.
  • GR-DnP with SL-DnP in stage-1 and refinement in stage-2 achieves strong results with GPT-3.5 in few-shot settings.
  • Zero-shot prompting shows limited adherence to reasoning steps, reducing the effectiveness of CoT-based prompts.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.