SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQL
- URL: http://arxiv.org/abs/2608.09260v1
- Date: Mon, 10 Aug 2026 08:16:17 GMT
- Title: SafeQL: Search-based Refinement for Safe and Efficient LLM-based Text-to-SQL
- Abstract summary: This paper proposes SafeQL, a search-based refinement paradigm that redefines the role of the interfaces as an active guide in the refinement process.<n> Experiments on the Bird and Spider benchmarks show that SafeQL significantly improves execution accuracy and efficiency compared to regeneration-based methods.
- Score: 4.9445294133117255
- License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
- Abstract: 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.
Related papers
- Reflect-SQL: A Self-Reflection Based Framework for Text-to-SQL [3.052889399420755]
Democratizing data access through natural language is a crucial goal for modern enterprises.<n>The practical adoption of Text-to-effective is critically hindered by real-world complexities.<n>We introduce Reflect-, a novel framework for Text tosql, grounded in multi-stage self-reflection approach.<n>Our framework achieves an execution accuracy of 72.03%, significantly outperforming state-of-the-art baselines.
arXiv Detail & Related papers (2026-09-01T07:46:27Z) - Benchmarking Text-to-SQL under Role-Based Access Control [27.035834672528548]
Currently, popular text-to- benchmarks mostly assume unrestricted access to S.<n>In practice, user access is often restricted, e.g., through role-based access control (RBAC) policies.<n>We present a comprehensive text-to-assisted RBAC framework that augments existing text-to- benchmarks with realistic user roles and access policies.
arXiv Detail & Related papers (2026-07-24T09:10:58Z) - EGREFINE: An Execution-Grounded Optimization Framework for Text-to-SQL Schema Refinement [10.675982676332941]
Existing approaches treat schemas as fixed and address errors downstream.<n>We frame schema refinement as a constrained optimization problem.<n>We analyze the computational hardness of this problem, which motivates a column-wise greedy decomposition.
arXiv Detail & Related papers (2026-05-01T13:01:59Z) - Agent-Agnostic Evaluation of SQL Accuracy in Production Text-to-SQL Systems [2.051598597332424]
Text-to-native (T2native) evaluation in production environments poses fundamental challenges that existing benchmarks do not address.<n>We present STEF, a production- evaluation system that operates exclusively on natural language inputs.<n>STEF produces an interpretable 0 to 100 accuracy score via a composite metric that encompasses filter alignment, semantic verdict, and confidence of the evaluator.
arXiv Detail & Related papers (2026-04-30T15:59:28Z) - ErrorLLM: Modeling SQL Errors for Text-to-SQL Refinement [57.98138819417949]
We propose ErrorLLM, a framework that explicitly models text-to- querying.<n>We show that ErrorLLM achieves the most significant improvements over backbone initial generation.<n>ErrorLLM addresses both sides by high detection F1 score while maintaining refinement effectiveness.
arXiv Detail & Related papers (2026-03-04T05:27:20Z) - FuzzySQL: Uncovering Hidden Vulnerabilities in DBMS Special Features with LLM-Driven Fuzzing [37.235342117305684]
Fuzzy unifies rule-based patching with semantic repair to correct syntactic and context-sensitive failures.<n>We uncover 37 vulnerabilities, 7 of which are tied to under-tested special features.<n>Our results highlight the limitations of conventional fuzzers in semantic feature coverage.
arXiv Detail & Related papers (2026-02-23T04:20:19Z) - LLM-Symbolic Integration for Robust Temporal Tabular Reasoning [69.27153114778748]
We introduce TempTabQA-C, a synthetic dataset designed for systematic and controlled evaluations.<n>This structured approach allows Large Language Models (LLMs) to generate and executesql queries, enhancing generalization and mitigating biases.
arXiv Detail & Related papers (2025-06-06T05:14:04Z) - Weaver: Interweaving SQL and LLM for Table Reasoning [62.55797244714265]
Weaver generates a flexible, step-by-step plan that combinessql for structured data retrieval with LLMs for semantic processing.<n>Weaver consistently outperforms state-of-the-art methods across four TableQA datasets.
arXiv Detail & Related papers (2025-05-25T03:27:37Z) - E-SQL: Direct Schema Linking via Question Enrichment in Text-to-SQL [1.187832944550453]
We introduce E-Seek, a novel pipeline specifically designed to address these challenges through direct schema linking and candidate predicate augmentation.<n>E-Seek enhances the natural language query by incorporating relevant database items (i.e., tables, columns, and values) and conditions directly into the question andsql construction plan, bridging the gap between the query and the database structure.<n> Comprehensive evaluations illustrate that E-Seek achieves competitive performance, particularly excelling in complex queries with a 66.29% execution accuracy on the test set.
arXiv Detail & Related papers (2024-09-25T09:02:48Z) - DAC: Decomposed Automation Correction for Text-to-SQL [51.48239006107272]
We introduce De Automation Correction (DAC), which corrects text-to-composed by decomposing entity linking and skeleton parsing.
We show that our method improves performance by $3.7%$ on average of Spider, Bird, and KaggleDBQA compared with the baseline method.
arXiv Detail & Related papers (2024-08-16T14:43:15Z) - LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency [65.01402723259098]
We propose a novel method of query rewrite named LLM-R2, adopting a large language model (LLM) to propose possible rewrite rules for a database rewrite system.
Experimental results have shown that our method can significantly improve the query execution efficiency and outperform the baseline methods.
arXiv Detail & Related papers (2024-04-19T13:17:07Z) - SQL-PaLM: Improved Large Language Model Adaptation for Text-to-SQL (extended) [53.95151604061761]
This paper introduces the framework for enhancing Text-to- filtering using large language models (LLMs)
With few-shot prompting, we explore the effectiveness of consistency decoding with execution-based error analyses.
With instruction fine-tuning, we delve deep in understanding the critical paradigms that influence the performance of tuned LLMs.
arXiv Detail & Related papers (2023-05-26T21:39:05Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.