Using LLM to select the right SQL Query from candidates
Not on the map. Why?
Abstract (arXiv)
Text-to-SQL models can generate a list of candidate SQL queries, and the best query is often in the candidate list, but not at the top of the list. An effective re-rank method can select the right SQL query from the candidate list and improve the model's performance. Previous studies on code generation automatically generate test cases and use them to re-rank candidate codes. However, automatic test case generation for text-to-SQL is an understudied field. We propose an automatic test case generation method that first generates a database and then uses LLMs to predict the ground truth, which is the expected execution results of the ground truth SQL query on this database. To reduce the difficulty for LLMs to predict, we conduct experiments to search for ways to generate easy databases for LLMs and design easy-to-understand prompts. Based on our test case generation method, we propose a re-rank method to select the right SQL query from the candidate list. Given a candidate list, our method can generate test cases and re-rank the candidate list according to their pass numbers on these test cases and their generation probabilities. The experiment results on the validation dataset of Spider show that the performance of some state-of-the-art models can get a 3.6% improvement after applying our re-rank method.
Key facts. Cited by 12 papers in the map (data through 7 Oct 2026). Builds on 19 of its 22 references that are in the map. First posted on arXiv 4 Jan 2024.
Builds on
19 of 22 references.
References · 19
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,874
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2018Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Taskcited by 1,120
- 2023DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correctioncited by 465
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 378
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2020Semantic Evaluation for Text-to-SQL with Distilled Test Suitescited by 123
- 2023A comprehensive evaluation of ChatGPT's zero-shot Text-to-SQL capabilitycited by 118
- 2020SmBoP: Semi-autoregressive Bottom-up Semantic Parsingcited by 97
- 2022RASAT: Integrating Relational Structures into Pretrained Seq2Seq Model for Text-to-SQLcited by 85
7 more
- 2019Global Reasoning over Database Structures for Text-to-SQL Parsingcited by 43
- 2020Understanding Image Retrieval Re-Ranking: A Graph Neural Network Perspectivecited by 24
- 2022N-Best Hypotheses Reranking for Text-To-SQL Systemscited by 19
- 2021Dynamic Hybrid Relation Network for Cross-Domain Context-Dependent Semantic Parsingcited by 15
- 2020Bertrand-DR: Improving Text-to-SQL using a Discriminative Re-rankercited by 12
- 2019Explaining Wrong Queries Using Small Examplescited by 4
- 2019Re-Ranking Words to Improve Interpretability of Automatically Generated Topicscited by 3
Built on by
Citing papers per year: 2024: 6; 2025: 3; 2026: 3.
12 papers.
- 2024A Survey of Table Reasoning with Large Language Modelscited by 29
- 2024Soft Self-Consistency Improves Language Model Agentscited by 25
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQLcited by 15
- 2024Improving Demonstration Diversity by Human-Free Fusing for Text-to-SQLcited by 10
- 2024MURRE: Multi-Hop Table Retrieval with Removal for Open-Domain Text-to-SQLcited by 7
- 2024DAC: Decomposed Automation Correction for Text-to-SQLcited by 6
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agentscited by 5
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunitiescited by 4
- 2026OmniVLN: Omnidirectional 3D Perception and Token-Efficient LLM Reasoning for Visual-Language Navigation across Air and Ground Platformscited by 4
- 2024Towards Single-System Illusion in Software-Defined Vehicles -- Automated, AI-Powered Workflowcited by 3
- 2025ScaleDoc: Scaling LLM-based Predicates over Large Document Collectionscited by 2
- 2026When Prompts Become Payloads: A Framework for Mitigating SQL Injection Attacks in Large Language Model-Driven Applicationscited by 0
- 2026When Prompts Become Payloads: A Framework for Mitigating SQL Injection Attacks in Large Language Model-Driven Applications11 May 2026
- 2026PV-SQL: Synergizing Database Probing and Rule-based Verification for Text-to-SQL Agents19 Apr 2026
- 2026OmniVLN: Omnidirectional 3D Perception and Token-Efficient LLM Reasoning for Visual-Language Navigation across Air and Ground Platforms18 Mar 2026
- 2025ScaleDoc: Scaling LLM-based Predicates over Large Document Collections16 Sep 2025
- 2025SHARE: An SLM-based Hierarchical Action CorREction Assistant for Text-to-SQL31 May 2025
- 2025Exploring the Landscape of Text-to-SQL with Large Language Models: Progresses, Challenges and Opportunities28 May 2025
- 2024DAC: Decomposed Automation Correction for Text-to-SQL16 Aug 2024
- 2024Towards Single-System Illusion in Software-Defined Vehicles -- Automated, AI-Powered Workflow21 Mar 2024
- 2024Soft Self-Consistency Improves Language Model Agents20 Feb 2024
- 2024MURRE: Multi-Hop Table Retrieval with Removal for Open-Domain Text-to-SQL16 Feb 2024
- 2024Improving Demonstration Diversity by Human-Free Fusing for Text-to-SQL16 Feb 2024
- 2024A Survey of Table Reasoning with Large Language Models13 Feb 2024