Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation

Dawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun, Yichen Qian +2 more
8/29/2023
879 citations
cs.DBcs.CLcs.LG
benchmark-dataset

Official code: BeachWang/DAIL-SQL (642 stars, Python, Apache-2.0, last commit 2025-03-07).

Abstract

Large language models (LLMs) have emerged as a new paradigm for Text-to-SQL task. However, the absence of a systematical benchmark inhibits the development of designing effective, efficient and economic LLM-based Text-to-SQL solutions.

Show full abstract

To address this challenge, in this paper, we first conduct a systematical and extensive comparison over existing prompt engineering methods, including question representation, example selection and example organization, and with these experimental results, we elaborate their pros and cons. Based on these findings, we propose a new integrated solution, named DAIL-SQL, which refreshes the Spider leaderboard with 86.6% execution accuracy and sets a new bar. To explore the potential of open-source LLM, we investigate them in various scenarios, and further enhance their performance with supervised fine-tuning. Our explorations highlight open-source LLMs' potential in Text-to-SQL, as well as the advantages and disadvantages of the supervised fine-tuning. Additionally, towards an efficient and economic LLM-based Text-to-SQL solution, we emphasize the token efficiency in prompt engineering and compare the prior studies under this metric. We hope that our work provides a deeper understanding of Text-to-SQL with LLMs, and inspires further investigations and broad applications.

View on arXivView PDF

Code Implementations(1)

BeachWang/DAIL-SQLOfficial100%
Apache-2.0

A efficient and effective few-shot NL2SQL method on GPT-4.

64297Python, ShellAug 29, 20231 years agoApache-2.0

Similar Papers

Cite this paper

@article{gao2023texttosql,
  title  = {Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation},
  author = {Dawei Gao and Haibin Wang and Yaliang Li and Xiuyu Sun and Yichen Qian and Bolin Ding and Jingren Zhou},
  year   = {2023},
  eprint = {2308.15363},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2308.15363v4}
}

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/2308.15363.svg)](https://codeofpaper.com/paper/2308.15363)

Discussion