Lune

NeurIPS2023Top-tier venue

DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction

Mohammadreza Pourreza, Davood Rafiei

Abstract

There is currently a significant gap between the performance of fine-tuned models and prompting approaches using Large Language Models (LLMs) on the challenging task of text-to-SQL, as evaluated on datasets such as Spider. To improve the performance of LLMs in the reasoning process, we study how decomposing the task into smaller sub-tasks can be effective. In particular, we show that breaking down the generation problem into sub-problems and feeding the solutions of those sub-problems into LLMs can be an effective approach for significantly improving their performance. Our experiments with three LLMs show that this approach consistently improves their simple few-shot performance by roughly 10%, pushing the accuracy of LLMs towards SOTA or surpassing it. On the holdout test set of Spider, the SOTA, in terms of execution accuracy, was 79.9 and the new SOTA at the time of this writing using our approach is 85.3. Our approach with in-context learning beats many heavily fine-tuned models by at least 5%. Additionally, when evaluated on the BIRD benchmark, our approach achieved an execution accuracy of 55.9%, setting a new SOTA on its holdout test set.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

126 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • DSPy: Compiling Declarative Language Model Calls into State-of-the-Art Pipelines cites Automatic Chain of Thought Prompting in Large Language Models
  • DSPy: Compiling Declarative Language Model Calls into State-of-the-Art Pipelines cites Large Language Models are Zero-Shot Reasoners
  • DSPy: Compiling Declarative Language Model Calls into State-of-the-Art Pipelines cites Language Models are Few-Shot Learners
  • DSPy: Compiling Declarative Language Model Calls into State-of-the-Art Pipelines cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Automatic Chain of Thought Prompting in Large Language Models cites Large Language Models are Zero-Shot Reasoners
  • Automatic Chain of Thought Prompting in Large Language Models cites Language Models are Few-Shot Learners
  • Automatic Chain of Thought Prompting in Large Language Models cites Finetuned Language Models are Zero-Shot Learners
  • Automatic Chain of Thought Prompting in Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Large Language Models are Zero-Shot Reasoners cites Language Models are Few-Shot Learners
  • Large Language Models are Zero-Shot Reasoners cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation cites Large Language Models are Zero-Shot Reasoners
  • The Dawn of Natural Language to SQL: Are We Fully Ready? [Experiment, Analysis & Benchmark ] cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • The Dawn of Natural Language to SQL: Are We Fully Ready? [Experiment, Analysis & Benchmark ] cites CodeS: Towards Building Open-source Language Models for Text-to-SQL
  • The Dawn of Natural Language to SQL: Are We Fully Ready? [Experiment, Analysis & Benchmark ] cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • AgentBench: Evaluating LLMs as Agents cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • AgentBench: Evaluating LLMs as Agents cites Language Models are Few-Shot Learners
  • AgentBench: Evaluating LLMs as Agents cites Finetuned Language Models are Zero-Shot Learners
  • AgentBench: Evaluating LLMs as Agents cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • CodeS: Towards Building Open-source Language Models for Text-to-SQL cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • CodeS: Towards Building Open-source Language Models for Text-to-SQL cites Language Models are Few-Shot Learners
  • CodeS: Towards Building Open-source Language Models for Text-to-SQL cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Finetuned Language Models are Zero-Shot Learners cites Language Models are Few-Shot Learners
  • Finetuned Language Models are Zero-Shot Learners cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers126

  1. AgentBench: Evaluating LLMs as AgentsXiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu et al.ICLR 2024 · 748 citations
  2. Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun et al.VLDB 2024 · 609 citations
  3. DSPy: Compiling Declarative Language Model Calls into State-of-the-Art PipelinesOmar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang et al.ICLR 2024 · 170 citations
  4. The Dawn of Natural Language to SQL: Are We Fully Ready? [Experiment, Analysis & Benchmark ]Boyan Li, Yuyu Luo, Chengliang Chai, Guoliang Li et al.VLDB 2024 · 137 citations
  5. CodeS: Towards Building Open-source Language Models for Text-to-SQLHaoyang Li, Jing Zhang, Hanbing Liu, Ju Fan et al.SIGMOD 2024 · 124 citations

Builds on16

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  3. Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
  4. Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations
  5. Automatic Chain of Thought Prompting in Large Language ModelsZhuosheng Zhang, Aston Zhang, Mu Li, Alex SmolaICLR 2023 · 234 citations

Related papers

  1. ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-ThoughtHanchong Zhang, Ruisheng Cao, Lu Chen, Hongshen Xu et al.EMNLP Findings 2023 · 54 citations
  2. Enhancing Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design StrategiesLinyong Nan, Yilun Zhao, Weijin Zou, Narutatsu Ri et al.EMNLP Findings 2023 · 49 citations
  3. STaR-SQL: Self-Taught Reasoner for Text-to-SQLMingqian He, Yongliang Shen, Wenqi Zhang, Qiuying Peng et al.ACL 2025
  4. Decomposition for Enhancing Attention: Improving LLM-based Text-to-SQL through Workflow ParadigmYuanzhen Xie, Xinzhou Jin, Tao Xie, Mingxiong Lin et al.ACL Findings 2024 · 34 citations
  5. Optimizing Reasoning for Text-to-SQL with Execution FeedbackBohan Zhai, Canwen Xu, Yuxiong He, Zhewei YaoACL Findings 2025 · 8 citations
Dusk over the sea between two cliffs drawn in fine vertical lines