Enhancing Text-to-SQL Capabilities of Large Language Models: A Study on Prompt Design Strategies
The DOI matches its Crossref record; 29 of the 29 references it cites were found in a registry or an index.
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.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Claims other papers make about this one
Each is checked against this paper’s own text: does it say what the citing paper says it does?
In the citing paper
“ODIS [251] retrieves both in-domain and outof-domain demonstrations, while Nan et al. [252] retrieved both similar and diverse demonstrations.”
From Retrieval-Augmented Generation for AI-Generated Content: A Survey (2024) · cites this paper as [252]
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., & Liu, P. J. (2019) · arXiv · doi:10.48550/arxiv.1910.10683 · Cited by 31,859
Language Models are Few-Shot Learners
Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020) · arXiv · doi:10.48550/arxiv.2005.14165 · Cited by 23,372
Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks
Reimers, N., & Gurevych, I. (2019) · Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP) · doi:10.18653/v1/d19-1410 · Cited by 12,778
LLaMA: Open and Efficient Foundation Language Models
Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., et al. (2023) · arXiv · doi:10.48550/arxiv.2302.13971 · Cited by 4,602
Chain-Of-Thought Prompting Elicits Reasoning in Large Language Models
Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q. V., & Zhou, D. (2022) · Advances in Neural Information Processing Systems 35 · doi:10.52202/068431-1800 · Cited by 4,505
CodeBERT: A Pre-Trained Model for Programming and Natural Languages
Feng, Z., Guo, D., Tang, D., Duan, N., Feng, X., Gong, M., Shou, L., Qin, B., Liu, T., Jiang, D., et al. (2020) · Findings of the Association for Computational Linguistics: EMNLP 2020 · doi:10.18653/v1/2020.findings-emnlp.139 · Cited by 2,824
Large language models are zero-shot reasoners
Kojima, T., Gu, S. (., Reid, M., Matsuo, Y., & Iwasawa, Y. (2022) · Advances in Neural Information Processing Systems 35 · doi:10.52202/068431-1613 · Cited by 2,013 · cited 1×
“For tasks that involve multi-step reasoning and higher complexity, Chain-of-thought prompting has been developed (Wei et al., 2023; Kojima et al., 2023).”
BackgroundLarge Language Models are Zero-Shot Reasoners
Kojima, T., Gu, S. S., Reid, M., Matsuo, Y., & Iwasawa, Y. (2022) · arXiv · doi:10.48550/arxiv.2205.11916 · Cited by 2,013
Wang, Y., Wang, W., Joty, S., & Hoi, S. C. H. (2021) · Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing · doi:10.18653/v1/2021.emnlp-main.685 · Cited by 1,495
Wang, Y., Wang, W., Joty, S., & Hoi, S. C. H. (2021) · arXiv · doi:10.48550/arxiv.2109.00859 · Cited by 1,495
Evaluating Large Language Models Trained on Code
Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. D. O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., et al. (2021) · arXiv · doi:10.48550/arxiv.2107.03374 · Cited by 1,436
Yu, T., Zhang, R., Yang, K., Yasunaga, M., Wang, D., Li, Z., Ma, J., Li, I., Yao, Q., Roman, S., et al. (2018) · Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing · doi:10.18653/v1/d18-1425 · Cited by 1,034 · cited 7×
“In order to determine the problem types that benefit most or least from our proposed methods, we also evaluate the performance of different models across various problem categories within the Spider dataset.”
BackgroundMethodInfluentialSelf-citationFantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
Lu, Y., Bartolo, M., Moore, A., Riedel, S., & Stenetorp, P. (2021) · arXiv · doi:10.48550/arxiv.2104.08786 · Cited by 615 · cited 2×
“Several studies (Sorensen et al., 2022; Gonen et al., 2022; Wu et al., 2022; Hu et al., 2022; Lu et al., 2022) have proposed metrics to measure the suitability of examples with respect to the target objective and to determine the optimal ordering of them.”
BackgroundFantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity
Lu, Y., Bartolo, M., Moore, A., Riedel, S., & Stenetorp, P. (2022) · Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · doi:10.18653/v1/2022.acl-long.556 · Cited by 610 · cited 2×
“Several studies (Sorensen et al., 2022; Gonen et al., 2022; Wu et al., 2022; Hu et al., 2022; Lu et al., 2022) have proposed metrics to measure the suitability of examples with respect to the target objective and to determine the optimal ordering of them.”
BackgroundWhat Makes Good In-Context Examples for GPT-3?
Liu, J., Shen, D., Zhang, Y., Dolan, B., Carin, L., & Chen, W. (2022) · Proceedings of Deep Learning Inside Out (DeeLIO 2022): The 3rd Workshop on Knowledge Extraction and Integration for Deep Learning Architectures · doi:10.18653/v1/2022.deelio-1.10 · Cited by 563
TaBERT: Pretraining for Joint Understanding of Textual and Tabular Data
Yin, P., Neubig, G., Yih, W.-T., & Riedel, S. (2020) · Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics · doi:10.18653/v1/2020.acl-main.745 · Cited by 487
Large Language Models Are Human-Level Prompt Engineers
Zhou, Y., Muresanu, A. I., Han, Z., Paster, K., Pitis, S., Chan, H., & Ba, J. (2022) · arXiv · doi:10.48550/arxiv.2211.01910 · Cited by 330 · cited 1×
“Zhou et al. (2023) proposes an automatic approach to identify the optimal prompt by searching over a pool of model generated instructions, assigning scores to them, and selecting the prompt with the highest score.”
BackgroundMeasuring and Narrowing the Compositionality Gap in Language Models
Press, O., Zhang, M., Min, S., Schmidt, L., Smith, N., & Lewis, M. (2023) · Findings of the Association for Computational Linguistics: EMNLP 2023 · doi:10.18653/v1/2023.findings-emnlp.378 · Cited by 303
Measuring and Narrowing the Compositionality Gap in Language Models
Press, O., Zhang, M., Min, S., Schmidt, L., Smith, N. A., & Lewis, M. (2022) · arXiv · doi:10.48550/arxiv.2210.03350 · Cited by 294 · cited 1×
“Press et al. (2023) suggests that prompting LLMs to ask follow-up questions is an effective way to construct the chain-of-thoughts process.”
BackgroundTRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generation
Yin, P., & Neubig, G. (2018) · Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations · doi:10.18653/v1/d18-2002 · Cited by 203
(2021) · doi:10.18653/v1/2021.naacl-main.105 · Cited by 148
A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capability
Liu, A., Hu, X., Wen, L., & Yu, P. S. (2023) · arXiv · doi:10.48550/arxiv.2303.13547 · Cited by 129 · cited 1×
“Existing research indicates that LLMs using prompt-based semantic parsing underperform their fine-tuned counterparts (Liu et al., 2023), while recent studies also suggest that performance of ICL-trained LLMs is significantly affected by the structure of the prompt (Liu et al., 2022; Rubin et al.,…”
BackgroundChen, W., Ma, X., Wang, X., & Cohen, W. W. (2022) · arXiv · doi:10.48550/arxiv.2211.12588 · Cited by 125
Demystifying Prompts in Language Models via Perplexity Estimation
Gonen, H., Iyer, S., Blevins, T., Smith, N., & Zettlemoyer, L. (2023) · Findings of the Association for Computational Linguistics: EMNLP 2023 · doi:10.18653/v1/2023.findings-emnlp.679 · Cited by 109
Demystifying Prompts in Language Models via Perplexity Estimation
Gonen, H., Iyer, S., Blevins, T., Smith, N. A., & Zettlemoyer, L. (2022) · arXiv · doi:10.48550/arxiv.2212.04037 · Cited by 109
Selective annotation makes language models better few-shot learners
Su, H., Kasai, J., Wu, C. H., Shi, W., Wang, T., Xin, J., Zhang, R., Ostendorf, M., Zettlemoyer, L., Smith, N. A., et al. (2022) · arXiv · doi:10.48550/arxiv.2209.01975 · Cited by 70 · cited 1×
“Su et al. (2023) introduces the Vote-k approach to selectively annotate diverse and representative examples for pool construction, then retrieve based on the similarity.”
MethodEvaluating the Text-to-SQL Capabilities of Large Language Models
Rajkumar, N., Li, R., & Bahdanau, D. (2022) · arXiv · doi:10.48550/arxiv.2204.00498 · Cited by 56
Binding Language Models in Symbolic Languages
Cheng, Z., Xie, T., Shi, P., Li, C., Nadkarni, R., Hu, Y., Xiong, C., Radev, D., Ostendorf, M., Zettlemoyer, L., et al. (2022) · arXiv · doi:10.48550/arxiv.2210.02875 · Cited by 53 · cited 1×
“…in producing transparent reasoning process in formal language sequence (such as Text-to-SQL) for question answering tasks based on databases or knowledge graphs (Berant et al., 2013; Zhong et al., 2017; Yu et al., 2018; Yin and Neubig, 2018; Yu et al., 2019; Ren et al., 2021; Cheng et al., 2023).”
BackgroundSelf-citationLEVER: Learning to Verify Language-to-Code Generation with Execution
Ni, A., Iyer, S., Radev, D., Stoyanov, V., Yih, W.-T., Wang, S. I., & Lin, X. V. (2023) · arXiv · doi:10.48550/arxiv.2302.08468 · Cited by 46 · cited 3×
“…the following four semantic parsing datasets: • Spider (Yu et al., 2018) Model We evaluate different ICL strategies with Codex (Chen et al., 2021), a GPT-3 variant that was finetuned on code data on the web and has demonstrated state-of-the-art performance as the time of writing (Ni et al., 2023).”
BackgroundMethodInfluentialSelf-citation
Cited by
Retrieval-Augmented Generation for AI-Generated Content: A Survey
Zhao, P., Zhang, H., Yu, Q., Wang, Z., Geng, Y., Fu, F., Yang, L., Zhang, W., Jiang, J., & Cui, B. (2024) · arXiv · doi:10.48550/arxiv.2402.19473 · Cited by 240
“Another work [285] retrieves both similar and diverse demonstrations, and then builds prompt for in-context learning to generate SQL. MURRE [286] conducts multi-hop retrieve-rewrite, where relevant tables are retrieved through dense retrieval and then re-writed to generate new tabularized question.”
Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQL
Hong, Z., Yuan, Z., Zhang, Q., Chen, H., Dong, J., Huang, F., & Huang, X. (2024) · arXiv · doi:10.48550/arxiv.2406.08426 · Cited by 100
Reliable Text-to-SQL with Adaptive Abstention
Chen, K., Chen, Y., Koudas, N., & Yu, X. (2025) · Proceedings of the ACM on Management of Data · doi:10.1145/3709719 · Cited by 12
Understanding the Effects of Noise in Text-to-SQL: An Examination of the BIRD-Bench Benchmark
Wretblad, N., Riseby, F. G., Biswas, R., Ahmadi, A., & Holmström, O. (2024) · arXiv · doi:10.48550/arxiv.2402.12243 · Cited by 7
Metadata
- Authors
- Nan, L., Zhao, Y., Zou, W., Ri, N., Tae, J., Zhang, E., Cohan, A., & Radev, D.
- Venue
- Findings of the Association for Computational Linguistics: EMNLP 2023
- Published
- 2023
- Pages
- 14935-14956
- Cited by
- 48
- References
- 29
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.