mlsanityData to 7 Oct 2026

Retrieval-augmented GPT-3.5-based Text-to-SQL Framework with Sample-aware Prompting and Dynamic Revision Chain

arXiv 2307.05074 ↗First posted 11 Jul 2023cs.IR cs.AI cs.DBcited by 12

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

  1. 2020Language Models are Few-Shot Learnerscited by 32,199
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  3. 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
  4. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  5. 2023A Survey of Large Language Modelscited by 2,537
  6. 2017Billion-scale similarity search with GPUscited by 2,477
  7. 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
  8. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  9. 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
  10. 2023PaLM 2 Technical Reportcited by 1,154
  11. 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
  12. 2023Teaching Large Language Models to Self-Debugcited by 963
24 more
  1. 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
  2. 2019RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parserscited by 420
  3. 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 402
  4. 2019Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representationcited by 210
  5. 2020Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsingcited by 133
  6. 2020Semantic Evaluation for Text-to-SQL with Distilled Test Suitescited by 123
  7. 2021LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relationscited by 119
  8. 2023A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capabilitycited by 118
  9. 2021Towards Robustness of Text-to-SQL Models against Synonym Substitutioncited by 110
  10. 2022Evaluating the Text-to-SQL Capabilities of Large Language Modelscited by 101
  11. 2023Graphix-T5: Mixing Pre-Trained Transformers with Graph-Aware Layers for Text-to-SQL Parsingcited by 93
  12. 2021Exploring Underexplored Limitations of Cross-Domain Text-to-SQL Generalizationcited by 92
  13. 2022RASAT: Integrating Relational Structures into Pretrained Seq2Seq Model for Text-to-SQLcited by 85
  14. 2020Grounded Adaptation for Zero-shot Executable Semantic Parsingcited by 76
  15. 2019Representing Schema Structure with Graph Neural Networks for Text-to-SQL Parsingcited by 74
  16. 2020RYANSQL: Recursively Applying Sketch-based Slot Fillings for Complex Text-to-SQL in Cross-Domain Databasescited by 63
  17. 2021SADGA: Structure-Aware Dual Graph Aggregation Network for Text-to-SQLcited by 43
  18. 2022S2SQL: Injecting Syntax to Question-Schema Interaction Graph Encoder for Text-to-SQL Parserscited by 41
  19. 2021ShadowGNN: Graph Projection Neural Network for Text-to-SQL Parsercited by 35
  20. 2020Hybrid Ranking Network for Text-to-SQLcited by 33
  21. 2017An Encoder-Decoder Framework Translating Natural Language to Database Queriescited by 23
  22. 2019X-SQL: reinforce schema representation with contextcited by 22
  23. 2022STAR: SQL Guided Pre-Training for Context-dependent Text-to-SQL Parsingcited by 19
  24. 2023Interactive Text-to-SQL Generation via Editable Step-by-Step Explanationscited by 19

Built on by

Cited by year

Citing papers per year: 2023: 1; 2024: 9; 2025: 2.

12 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024RB-SQL: A Retrieval-based LLM Framework for Text-to-SQL
  2. 2023How to Prompt LLMs for Text-to-SQL: A Study in Zero-shot, Single-domain, and Cross-domain Settings
  3. 2024PET-SQL: A Prompt-Enhanced Two-Round Refinement of Text-to-SQL with Cross-consistency
  4. 2023ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thought
  5. 2023Exploring Chain-of-Thought Style Prompting for Text-to-SQL
  6. 2024CoE-SQL: In-Context Learning for Multi-Turn Text-to-SQL with Chain-of-Editions
  7. 2026Integrating Reasoning and Generalization in Text-to-SQL via Self-Enhanced Fine-Tuning
  8. 2025Auto prompt sql: a resource-efficient architecture for text-to-sql translation in constrained environments