SAFE-SQL: Self-Augmented In-Context Learning with Fine-grained Example Selection for Text-to-SQL
Not on the map. Why?
Abstract (arXiv)
Text-to-SQL aims to convert natural language questions into executable SQL queries. While previous approaches, such as skeleton-masked selection, have demonstrated strong performance by retrieving similar training examples to guide large language models (LLMs), they struggle in real-world scenarios where such examples are unavailable. To overcome this limitation, we propose Self-Augmentation in-context learning with Fine-grained Example selection for Text-to-SQL (SAFE-SQL), a novel framework that improves SQL generation by generating and filtering self-augmented examples. SAFE-SQL first prompts an LLM to generate multiple Text-to-SQL examples relevant to the test input. Then SAFE-SQL filters these examples through three relevance assessments, constructing high-quality in-context learning examples. Using self-generated examples, SAFE-SQL surpasses the previous zero-shot, and few-shot Text-to-SQL frameworks, achieving higher execution accuracy. Notably, our approach provides additional performance gains in extra hard and unseen scenarios, where conventional methods often fail.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 31 of its 40 references that are in the map. First posted on arXiv 17 Feb 2025.
Builds on
31 of 40 references.
References · 31
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,139
- 2023Can LLM Already Serve as A Database Interface? A BIg Bench for Large-Scale Database Grounded Text-to-SQLscited by 688
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 477
- 2019RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parserscited by 424
- 2021PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Modelscited by 411
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 385
- 2023C3: Zero-shot Text-to-SQL with ChatGPTcited by 164
19 more
- 2024Next-Generation Database Interfaces: A Survey of LLM-based Text-to-SQLcited by 120
- 2023Automatic Prompt Augmentation and Selection with Chain-of-Thought from Labeled Datacited by 119
- 2021Exploring Underexplored Limitations of Cross-Domain Text-to-SQL Generalizationcited by 92
- 2023ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-Thoughtcited by 65
- 2024Synthesizing Text-to-SQL Data from Weak and Strong LLMscited by 54
- 2024RSL-SQL: Robust Schema Linking in Text-to-SQL Generationcited by 52
- 2023SQL-PaLM: Improved Large Language Model Adaptation for Text-to-SQL (extended)cited by 42
- 2024MAGIC: Generating Self-Correction Guideline for In-Context Text-to-SQLcited by 35
- 2024Understanding the Effects of Noise in Text-to-SQL: An Examination of the BIRD-Bench Benchmarkcited by 34
- 2022Importance of Synthesizing High-quality Data for Text-to-SQL Parsingcited by 28
- 2023Text-to-SQL Error Correction with Language Models of Codecited by 21
- 2024Improving Retrieval-augmented Text-to-SQL with AST-based Ranking and Schema Pruningcited by 16
- 2024SQL-GEN: Bridging the Dialect Gap for Text-to-SQL Via Synthetic Data And Model Mergingcited by 16
- 2024From Natural Language to SQL: Review of LLM-based Text-to-SQL Systemscited by 16
- 2024SQL-to-Schema Enhances Schema Linking in Text-to-SQLcited by 12
- 2024LG AI Research & KAIST at EHRSQL 2024: Self-Training Large Language Models with Pseudo-Labeled Unanswerable Questions for a Reliable Text-to-SQL System on EHRscited by 7
- 2024PTD-SQL: Partitioning and Targeted Drilling with LLMs in Text-to-SQLcited by 7
- 2024SelECT-SQL: Self-correcting ensemble Chain-of-Thought for Text-to-SQLcited by 4
- 2024Enhancing LLM Fine-tuning for Text-to-SQLs by SQL Quality Measurementcited by 3
Built on by
Citing papers per year: 2025: 2; 2026: 2.
4 papers.
- 2025Enhancing Text2Cypher with Schema Filteringcited by 6
- 2025STARE at the Structure: Steering ICL Exemplar Selection with Structural Alignmentcited by 1
- 2026SIRIUS-SQL: Anchoring Multi-Candidate Text-to-SQL in Execution Feedbackcited by 0
- 2026ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQLcited by 0
- 2026ZAS-SQL: Distilling Rules from Failures for Zero-Shot Text-to-SQL6 Jun 2026
- 2026SIRIUS-SQL: Anchoring Multi-Candidate Text-to-SQL in Execution Feedback31 May 2026
- 2025STARE at the Structure: Steering ICL Exemplar Selection with Structural Alignment28 Aug 2025
- 2025Enhancing Text2Cypher with Schema Filtering8 May 2025