LLM-Based SQL Generation: Prompting, Self-Refinement, and Adaptive Weighted Majority Voting
Yu-Jie Yang, Hung-Fu Chang, Po-An Chen

TL;DR
This paper introduces a novel pipeline for improving text-to-SQL translation using self-refinement and ensemble voting, achieving high accuracy on benchmarks and addressing real-world enterprise database challenges.
Contribution
It proposes the SSEV pipeline with self-refinement and weighted voting, and the ReCAPAgent-SQL framework with multiple agents for iterative SQL refinement in complex scenarios.
Findings
SSEV achieves 85.5% accuracy on Spider 1.0-Dev
SSEV attains 86.4% on Spider 1.0-Test
ReCAPAgent-SQL reaches 31% accuracy on Spider 2.0-Lite first 100 queries
Abstract
Text-to-SQL has emerged as a prominent research area, particularly with the rapid advancement of large language models (LLMs). By enabling users to query databases through natural language rather than SQL, this technology significantly lowers the barrier to data analysis. However, generating accurate SQL from natural language remains challenging due to ambiguity in user queries, the complexity of schema linking, limited generalization across SQL dialects, and the need for domain-specific understanding. In this study, we propose a Single-Agent Self-Refinement with Ensemble Voting (SSEV) pipeline built on PET-SQL that operates without ground-truth data, integrating self-refinement with Weighted Majority Voting (WMV) and its randomized variant (RWMA). Experimental results show that the SSEV achieves competitive performance across multiple benchmarks, attaining execution accuracies of 85.5%…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
