EMNLP Findings2023
Enhancing Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design Strategies
Linyong Nan, Yilun Zhao, Weijin Zou, Narutatsu Ri, Jaesung Tae, Ellen Zhang, Arman Cohan, Dragomir Radev
Abstract
In-context learning (ICL) has emerged as a new approach to various natural language processing tasks, utilizing large language models (LLMs) to make predictions based on context that has been supplemented with a few examples or task-specific instructions. In this paper, we aim to extend this method to question answering tasks that utilize structured knowledge sources, and improve Text-to-SQL systems by exploring various prompt design strategies for employing LLMs. We conduct a systematic investigation into different demonstration selection methods and optimal instruction formats for prompting LLMs in the Text-to-SQL task. Our approach involves leveraging the syntactic structure of an example's SQL query to retrieve demonstrations, and we demonstrate that pursuing both diversity and similarity in demonstration selection leads to enhanced performance. Furthermore, we show that LLMs benefit from database-related knowledge augmentations. Our most effective strategy outperforms the state-of-the-art system by 2.5 points (Execution Accuracy) and the best fine-tuned system by 5.1 points on the Spider dataset. These results highlight the effectiveness of our approach in adapting LLMs to the Text-to-SQL task, and we present an analysis of the factors contributing to the success of our strategy.
Ask Lune
Ask anything. The answer quotes the paper.
Lune reads all of it and the papers around it, then shows you the passages behind every answer.
Lune answers from
the full paper · 9 top-tier papers that cite it · related work
Free to start. No credit card required.
Cited by top-tier papers9
- SQLFixAgent: Towards Semantic-Accurate Text-to-SQL Parsing via Consistency-Enhanced Multi-Agent CollaborationJipeng Cen, Jiaxin Liu, Zhixu Li, Jingjing WangAAAI 2025 · 18 citations
- Reliable Text-to-SQL with Adaptive AbstentionKaiwen Chen, Yueting Chen, Nick Koudas, Xiaohui YuSIGMOD 2025 · 9 citations
- 2D-TPE: Two-Dimensional Positional Encoding Enhances Table Understanding for Large Language ModelsJia-Nan Li, Jian Guan, Wei Wu, Zhengtao Yu et al.WWW 2025 · 4 citations
- Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema PruningZhili Shen, Pavlos Vougiouklis, Chenxin Diao, Kaustubh Vyas et al.EMNLP 2024 · 3 citations
- Skeletons Matter: Dynamic Data Augmentation for Text-to-QueryYuchen Ji, Bo Xu, Jie Shi, Jiaqing Liang et al.EMNLP 2025
Builds on21
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Large Language Models are Zero-Shot ReasonersTakeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo et al.NeurIPS 2022 · 8,168 citations
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order SensitivityYao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel et al.ACL 2022 · 1,494 citations
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
Related papers
- 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
- DCG-SQL: Enhancing In-Context Learning for Text-to-SQL with Deep Contextual Schema Link GraphJihyung Lee, Jin-Seop Lee, Jaehoon Lee, YunSeok Choi et al.ACL 2025
- DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 citations
- SQLPrompt: In-Context Text-to-SQL with Minimal Labeled DataRuoxi Sun, Sercan Ö. Arik, Rajarishi Sinha, Hootan Nakhost et al.EMNLP Findings 2023 · 18 citations
- Selective Demonstrations for Cross-domain Text-to-SQLShuaichen Chang, Eric Fosler-LussierEMNLP Findings 2023 · 19 citations
