[Paper Review] Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
The paper benchmarks prompt engineering for LLM-based Text-to-SQL, introduces DAIL-SQL, and shows state-of-the-art Spider execution accuracy with token-efficient prompts and open-source LLM analysis via supervised fine-tuning.
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. 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.
Motivation & Objective
- Systematically study prompt engineering for LLM-based Text-to-SQL across question representations, example selection, and example organization.
- Evaluate the effectiveness of open-source LLMs in in-context learning and supervised fine-tuning for Text-to-SQL.
- Propose an integrated, efficient solution (DAIL-SQL) that balances performance and token cost.
- Compare prompts under token-efficiency criteria to guide practical Text-to-SQL deployments.
Proposed method
- Survey five question representations and identify their pros/cons for zero-shot Text-to-SQL.
- Analyze in-context learning with various example selection and organization strategies.
- Introduce DAIL-SQL with DAIL Selection (joint question-and-query-aware selection) and DAIL Organization (preserves Q-S mapping while reducing token cost).
- Adopt Code Representation Prompt (CRP) as the question representation for its rich schema/keys information.
- Explore supervised fine-tuning of open-source LLMs for Text-to-SQL and compare with in-context learning.
- Evaluate token efficiency across prompt design choices to inform cost-effective deployments.
Experimental results
Research questions
- RQ1What question representations and prompt engineering choices maximize Text-to-SQL accuracy and efficiency across LLMs?
- RQ2How do open-source LLMs perform in in-context learning versus supervised fine-tuning for Text-to-SQL?
- RQ3What is the trade-off between prompt information content and token cost in achieving high execution accuracy?
- RQ4How does the proposed DAIL-SQL approach compare to existing state-of-the-art on Spider and related benchmarks?
Key findings
- DAIL-SQL achieves 86.2% execution accuracy on Spider, surpassing the prior state-of-the-art (85.3%).
- With self-consistency, execution accuracy reaches 86.6% at additional computational cost.
- Open-source LLMs show substantial potential for Text-to-SQL, especially when combined with supervised fine-tuning.
- Question representations and organization strategies critically impact performance and token efficiency.
- Token-efficient prompt designs can achieve strong performance with fewer tokens, guiding practical deployments.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.