Skip to content

ModularSQL: A Runtime Guardrail for the Multiplicity Blind Spot in Text-to-SQL

Aug 2026 · 0 citations · 15 references
Computer Science

TL;DR

Results show that benchmark accuracy does not necessarily imply execution-safe SQL, and that lightweight, multiplicity-aware runtime guardrails can narrow this gap with modest computational overhead, and introduces ModularSQL, a lightweight post-selection runtime guardrail.

Abstract

Text-to-SQL systems are increasingly deployed on production databases, where queries that pass benchmark evaluation can still produce results that distort downstream workflows. Standard set-based execution accuracy (Set-EX) collapses duplicate rows and can therefore miss multiplicity errors, including missing DISTINCT, inflated aggregates, and Cartesian-style join explosions. We call this the Multiplicity Blind Spot (MBS) and introduce Multiset-EX, a multiplicity-preserving evaluation criterion that exposes such failures. Across released DeepEye-SQL artifacts from three backbones (Qwen2.5-Coder-32B, Qwen3-Coder-30B-A3B, and Gemma-3-27B) on executable BIRD-Dev N=1532, we find a consistent 5.81--6.79 pp gap between Set-EX and Multiset-EX. The gap is not specific to DeepEye-SQL: it persists on released DAIL-SQL+GPT-4 (5.22 pp) and BIRD GPT-3.5-turbo (3.39 pp) predictions. We further introduce ModularSQL, a lightweight post-selection runtime guardrail that probes executed results for multiplicity anomalies and applies deterministic patches or low-cost LLM rescue only to flagged queries. Integrated with DeepEye-SQL using Qwen3-Coder, ModularSQL preserves Set-EX at 72.06% while improving Multiset-EX from 65.86% to 67.75% (+1.89 pp). It flags 77 high-risk anomalies, while adding only $0.0076 in total LLM cost and 120 ms amortized latency per query. Cross-pipeline evaluation shows that the candidate-free detector and deterministic patches also transfer to independently released prediction sets. Overall, these results show that benchmark accuracy does not necessarily imply execution-safe SQL, and that lightweight, multiplicity-aware runtime guardrails can narrow this gap with modest computational overhead.

View source

Similar papers

#natural language process... Preprint Oct 2026

AptMQL-Bench: From Text-to-SQL to Text-to-MQL via Access-Pattern Schema Design and Data-Preserving Migration

A conversion pipeline is proposed, driven by coding agents with human-in-the-loop verification, that designs each document schema from expected access patterns and rewrites queries to be MongoDB-native, and builds an access-pattern-based text-to-MQL benchmark (AptMQL-Bench).

Hy Nguyen, Nabi Rezvani, Robin Vujanic · 0 citations

ExpeSQL: An Efficient, Experience-Guided Decompositional Search Framework for Text-to-SQL

This work introduces ExpeSQL, a zero-shot, open-source–compatible, and efficient framework that combines divide-and-conquer reasoning, Best-of-N candidate selection, and self-critique with experience-guided refinement that establishes a new paradigm for deployable, self-improving Text-to-SQL systems in dynamic, real-wo...

Unknown authors · 0 citations
Open access Sep 2026

MimicDB: Runtime Defense against Wrong-Result Bugs in Database Query Optimizers via Query-Rewriting Diversity

These findings characterize the potential of single-engine diversity to detect wrong-result failures and select correct results, together with the execution costs and reference-validity constraints that shape its practical use.

Ze-Lin Wang, Ping Chen, Jin Wei et al. · 0 citations
Open access Oct 2026

Cracking Query Bottlenecks: Towards Efficiency-Oriented Text-to-SQL Generation

Text-to-SQL models translate natural language questions into SQL, enabling non-technical users to access databases. However, most existing research focuses on correctness, neglecting query efficiency. In this paper, we address the challenge of evaluating the execution efficiency of generated SQL in Text-to-SQL by intro...

Li Lin, Yun-Feng Shen, Ling-Feng Bao et al. · 0 citations
Book Open access Aug 2026

AutoSQL: Extracting SQL Templates from Imperative ORM Code in Large-Scale Repositories

This work presents AutoSQL, a system that reconstructs SQL templates from Go ORM code that constructs a Code Index, a directed graph that captures structural dependencies between functions, types, and global variables as navigable edges and synthesizes SQL templates.

Jun-Song Pu, Yi-Chen Li, Zhuang-Bin Chen et al. · 0 citations
#natural language process... Preprint Sep 2026

Closing the Cross-Dialect Gap: Query Plans as a Portable Interface in Text-to-SQL

This work argues that the fix is to change the generation target: instead of asking an LLM to emit dialect-specific SQL, it has it emit a dialect-agnostic relational algebra query plan, which a deterministic compiler then renders into SQL for any supported backend.

Corentin Royer, Robin Oester, Yotam Perlitz et al. · 0 citations

Related blog posts

MIT News · Artificial Intelligence Oct 15, 2026

AI model decodes the language cells use to communicate

A new computational approach reveals how cells communicate to assemble into tissues. This could accelerate stem cell engineering, improve disease models, and inform therapies.

Microsoft Research Blog Oct 15, 2026

Proof-based general-purpose computing with Magnetar

Zero-knowledge proofs can verify computing results without rerunning workloads or exposing sensitive data. Magnetar helps bring them into the mainstream with support for standard programming languages, major speed gains, and quantum-resistant security. The post Proof-based general-purpose computing with Magnetar appeared first on Microsoft Research.

MIT News · Artificial Intelligence Sep 24, 2026

Estimating suicide risk from text

A new language-processing tool could help identify the highest-risk individuals from natural language, enabling swifter interventions.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.