Retrieval-augmented GPT-3.5-based Text-to-SQL Framework with Sample-aware Prompting and Dynamic Revision Chain
On the map: Retrieval-augmented generation → RAG robustness and adaptive retrieval
Abstract (arXiv)
Text-to-SQL aims at generating SQL queries for the given natural language questions and thus helping users to query databases. Prompt learning with large language models (LLMs) has emerged as a recent approach, which designs prompts to lead LLMs to understand the input question and generate the corresponding SQL. However, it faces challenges with strict SQL syntax requirements. Existing work prompts the LLMs with a list of demonstration examples (i.e. question-SQL pairs) to generate SQL, but the fixed prompts can hardly handle the scenario where the semantic gap between the retrieved demonstration and the input question is large. In this paper, we propose a retrieval-augmented prompting method for a LLM-based Text-to-SQL framework, involving sample-aware prompting and a dynamic revision chain. Our approach incorporates sample-aware demonstrations, which include the composition of SQL operators and fine-grained information related to the given question. To retrieve questions sharing similar intents with input questions, we propose two strategies for assisting retrieval. Firstly, we leverage LLMs to simplify the original questions, unifying the syntax and thereby clarifying the users' intentions. To generate executable and accurate SQLs without human intervention, we design a dynamic revision chain which iteratively adapts fine-grained feedback from the previously generated SQL. Experimental results on three Text-to-SQL benchmarks demonstrate the superiority of our method over strong baseline models.
Key facts. Cited by 12 papers in the map (data through 7 Oct 2026). Placed in RAG robustness and adaptive retrieval, one of 15 directions in Retrieval-augmented generation. Builds on 36 of its 42 references that are in the map. First posted on arXiv 11 Jul 2023.
Builds on
36 of 42 references.
References · 36
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023A Survey of Large Language Modelscited by 2,537
- 2017Billion-scale similarity search with GPUscited by 2,477
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2023PaLM 2 Technical Reportcited by 1,154
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2023Teaching Large Language Models to Self-Debugcited by 963
24 more
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
- 2019RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parserscited by 420
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
- 2019Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representationcited by 210
- 2020Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsingcited by 133
- 2020Semantic Evaluation for Text-to-SQL with Distilled Test Suitescited by 123
- 2021LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relationscited by 119
- 2023A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capabilitycited by 118
- 2021Towards Robustness of Text-to-SQL Models against Synonym Substitutioncited by 110
- 2022Evaluating the Text-to-SQL Capabilities of Large Language Modelscited by 101
- 2023Graphix-T5: Mixing Pre-Trained Transformers with Graph-Aware Layers for Text-to-SQL Parsingcited by 93
- 2021Exploring Underexplored Limitations of Cross-Domain Text-to-SQL Generalizationcited by 92
- 2022RASAT: Integrating Relational Structures into Pretrained Seq2Seq Model for Text-to-SQLcited by 85
- 2020Grounded Adaptation for Zero-shot Executable Semantic Parsingcited by 76
- 2019Representing Schema Structure with Graph Neural Networks for Text-to-SQL Parsingcited by 74
- 2020RYANSQL: Recursively Applying Sketch-based Slot Fillings for Complex Text-to-SQL in Cross-Domain Databasescited by 63
- 2021SADGA: Structure-Aware Dual Graph Aggregation Network for Text-to-SQLcited by 43
- 2022S2SQL: Injecting Syntax to Question-Schema Interaction Graph Encoder for Text-to-SQL Parserscited by 41
- 2021ShadowGNN: Graph Projection Neural Network for Text-to-SQL Parsercited by 35
- 2020Hybrid Ranking Network for Text-to-SQLcited by 33
- 2017An Encoder-Decoder Framework Translating Natural Language to Database Queriescited by 23
- 2019X-SQL: reinforce schema representation with contextcited by 22
- 2022STAR: SQL Guided Pre-Training for Context-dependent Text-to-SQL Parsingcited by 19
- 2023Interactive Text-to-SQL Generation via Editable Step-by-Step Explanationscited by 19
Built on by
Citing papers per year: 2023: 1; 2024: 9; 2025: 2.
12 papers.
- 2024Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQLcited by 118
- 2024A Survey on Employing Large Language Models for Text-to-SQL Taskscited by 67
- 2024PURPLE: Making a Large Language Model a Better SQL Writercited by 34
- 2023Natural Language Interfaces for Tabular Data Querying and Visualization: A Surveycited by 27
- 2025Reliable Text-to-SQL with Adaptive Abstentioncited by 19
- 2024Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruningcited by 16
- 2024LLM-dCache: Improving Tool-Augmented LLMs with GPT-Driven Localized Data Cachingcited by 7
- 2024DAC: Decomposed Automation Correction for Text-to-SQLcited by 6
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunitiescited by 4
- 2024PromptMind Team at EHRSQL-2024: Improving Reliability of SQL Generation using Ensemble LLMscited by 2
- 2024Multi-Turn Interactions for Text-to-SQL with Large Language Modelscited by 2
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analyticscited by 0
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunities28 May 2025
- 2025Reliable Text-to-SQL with Adaptive Abstention18 Jan 2025
- 2024The Role of Accuracy and Validation Effectiveness in Conversational Business Analytics18 Nov 2024
- 2024DAC: Decomposed Automation Correction for Text-to-SQL16 Aug 2024
- 2024Multi-Turn Interactions for Text-to-SQL with Large Language Models9 Aug 2024
- 2024A Survey on Employing Large Language Models for Text-to-SQL Tasks21 Jul 2024
- 2024Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruning3 Jul 2024
- 2024Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQL12 Jun 2024
- 2024LLM-dCache: Improving Tool-Augmented LLMs with GPT-Driven Localized Data Caching10 Jun 2024
- 2024PromptMind Team at EHRSQL-2024: Improving Reliability of SQL Generation using Ensemble LLMs14 May 2024
- 2024PURPLE: Making a Large Language Model a Better SQL Writer29 Mar 2024
- 2023Natural Language Interfaces for Tabular Data Querying and Visualization: A Survey27 Oct 2023
Similar, not cited
Close in wording, no citation either way
- 2024RB-SQL: A Retrieval-based LLM Framework for Text-to-SQL
- 2023How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settings
- 2024PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency
- 2023ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
- 2023Exploring Chain-of-Thought Style Prompting for Text-to-SQL
- 2024CoE-SQL: In-Context Learning for Multi-Turn Text-to-SQL with Chain-of-Editions
- 2026Integrating Reasoning and Generalization in Text-to-SQL via Self-Enhanced Fine-Tuning
- 2025Auto prompt sql: a resource-efficient architecture for text-to-sql translation in constrained environments