SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQL

Large language models (LLMs) have advanced Text-to-SQL by enabling natural language interfaces to databases without task-specific fine-tuning. However, existing LLM-based systems remain unreliable, often generating SQL queries that are invalid under the database schema, referencing non-existent tables, attributes, functions, or values. Such errors persist because interactions with the database management system (DBMS) are typically limited to error messages, leaving it in a largely passive role during query refinement. This paper proposes SafeQL, \textit{a search-based refinement paradigm that redefines the role of the DBMS as an active guide in the refinement process}. Instead of regenerating entire queries after execution failure, SafeQL interprets DBMS feedback to incrementally repair only the erroneous components. Each refinement step is formulated as a guided search within a \textit{safe query space}, where candidate queries are progressively validated through DBMS execution, thereby converging to an executable query and preventing repeated regeneration of errors. Experiments on the Bird and Spider benchmarks show that SafeQL significantly improves execution accuracy and efficiency compared to regeneration-based methods.

Link
https://www.semanticscholar.org/paper/158064cd7ce578c9fb25d441fd68010d14417386
Found by
Semantic Scholar
Authors
Geonho Lee, Min-Soo Kim
Categories
benchmark
Published
2026-08-10
Last seen by the radar
2026-08-11
Citations
0
Influential citations
0
Radar score
28.74 / 100 (how it is scored)
Why it scored so
Matched: benchmark; Primary record: Semantic Scholar
Related links
https://arxiv.org/abs/2608.09260
https://doi.org/10.14778/3819518.3819545
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Semantic Scholar