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

**Authors:** Mohammadreza Pourreza, Davood Rafiei  
**arXiv:** [2304.11015](https://arxiv.org/abs/2304.11015)  
**Date:** 2023-04-21  
**Summary page:** https://www.summarizepaper.com/en/paper/2304.11015v1/

## Key points

- Authors focus on decomposing complex text-to-SQL tasks into smaller sub-tasks
- Investigate how this decomposition enhances performance of Large Language Models (LLMs)
- Significant gap between fine-tuned models and prompting approaches using LLMs on challenging text-to-SQL datasets like Spider
- Propose breaking down SQL queries into sub-problems and feeding solutions into LLMs to improve performance
- Experiments show consistent enhancement of LLM performance by approximately 10%
- Outperforms large fine-tuned models on holdout Spider dataset
- SQL queries can be effectively divided into manageable sub-problems, improving reasoning capabilities for LLMs
- Evolution of natural language interfaces to databases discussed in introduction
- Earlier systems were domain-specific or rule-based, recent systems use supervised models or deep neural models
- Latest development involves employing LLMs under zero-shot and few-shot prompting techniques
- LLMs still lag behind existing methods when evaluated on benchmarks like Spider

## Summary

In this study, the authors focus on the problem of decomposing complex text-to-SQL tasks into smaller sub-tasks and investigate how this decomposition can enhance the performance of Large Language Models (LLMs) in the reasoning process. They observe a significant gap between the performance of fine-tuned models and prompting approaches using LLMs on challenging text-to-SQL datasets like Spider. To address this issue, the authors propose breaking down SQL queries into sub-problems and feeding the solutions of these sub-problems into LLMs to improve their performance. The experiments conducted with three LLMs demonstrate that this approach consistently enhances their performance by approximately 10%, pushing the accuracy of LLMs closer to state-of-the-art results. In fact, it even outperforms large fine-tuned models on the holdout Spider dataset. The authors highlight that despite SQL queries' declarative structure, they can be effectively divided into manageable sub-problems, leading to improved reasoning capabilities for LLMs. The introduction provides additional context by discussing the evolution of natural language interfaces to databases over the past two decades. It mentions earlier systems that were domain-specific or relied on rule-based approaches, as well as more recent systems utilizing supervised models trained on diverse domains and datasets or deep neural models trained on large text and code repositories. The latest development in this field involves employing Large Language Models (LLMs) under zero-shot and few-shot prompting techniques. However, while LLMs offer strong baselines with only a few demonstrations and no fine-tuning, they still lag behind existing methods when evaluated on commonly used benchmarks like Spider.
