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

M. Pourreza, Davood Rafiei
2/12/2026

No official code found. Best implementation: MohammadrezaPourreza/Few-shot-NL2SQL-with-prompting (418 stars, MIT, last commit 2024-03-30).

Abstract

We study the problem of decomposing a complex text-to-sql task into smaller sub-tasks and how such a decomposition can significantly improve the performance of Large Language Models (LLMs) in the reasoning process. There is currently a significant gap between the performance of fine-tuned models and prompting approaches using LLMs on challenging text-to-sql datasets such as Spider. We show that SQL queries, despite their declarative structure, can be broken down into sub-problems and the solutions of those sub-problems can be fed into LLMs to significantly improve their performance. Our experiments with three LLMs show that this approach consistently improves their performance by roughly 10%, pushing the accuracy of LLMs towards state-of-the-art, and even beating large fine-tuned models on the holdout Spider dataset.

View on arXivView PDF

Code Implementations(1)

MIT
41885PythonMar 16, 20232 years agoMIT

Similar Papers

Cite this paper

@article{pourreza2026dinsql,
  title  = {DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction},
  author = {M. Pourreza and Davood Rafiei},
  year   = {2026},
  eprint = {2304.11015},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2304.11015},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2304.11015.svg)](https://codeofpaper.com/paper/2304.11015)

Discussion