Reflective Reasoning for SQL Generation
Isabelle Mohr, Joao Gandarela, John Dujany, Andre Freitas

TL;DR
This paper introduces a reflective refinement framework for text-to-SQL tasks that decomposes query generation into stages, uses feedback to improve accuracy, and demonstrates consistent improvements over existing methods.
Contribution
It presents a novel staged, feedback-driven approach for text-to-SQL generation that enhances robustness and accuracy without requiring gold SQL annotations.
Findings
Significant accuracy improvements on Spider and BIRD datasets.
Robust convergence with limited refinement iterations.
Enhanced performance across various model sizes and prompting strategies.
Abstract
Robust text-to-SQL over complex, real-world databases remains brittle even with modern LLMs: iterative refinement often introduces syntactic and semantic drift, corrections tend to be non-transferable across queries, and naive use of large context windows scales poorly. We propose a controlled text-to-SQL framework built around reflective refinement. Instead of repeatedly rewriting the current SQL instance, the system decomposes generation into typed stages and applies feedback as persistent updates to the stage-level generation mechanism. A Reflection-Refinement Loop localizes violations to the responsible stage maximize preservation of previously validated constraints and support monotonic improvement over a query set. The method operates without gold SQL by combining interpreter-based checks with LLM-based semantic coverage verification as epistemic judges. Experiments on Spider and…
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.
Taxonomy
TopicsAdvanced Database Systems and Queries · Semantic Web and Ontologies · Scientific Computing and Data Management
