TRANSMISSION // 2611.29930v1
When a Correct SQL Answer Hides a Bad Query
Source published
A study argues that execution-based rewards can miss text-to-SQL errors that leave database results unchanged, and tests a framework for identifying those blind spots.

A SQL query can return the right answer and still be unnecessarily complicated or fragile. This preprint asks whether reinforcement-learning rewards notice such flaws—and explores how error-specific feedback might help.
Text-to-SQL systems translate everyday questions into SQL, the language used to query relational databases. Reinforcement learning can train these systems using rewards for successful outputs. But a familiar score—execution accuracy, or whether a query returns the expected result—does not reveal which errors remain. A query may get the answer right for the wrong reasons, or use an inefficient structure that the score never penalizes.
A preprint by Lakshmi Muraleedharan Nair and colleagues proposes a way to analyze this problem. The authors call it Reward Error Sensitivity: a measure of how much a reward distinguishes queries with a particular type of error from those without it. Their central theoretical result, the “Reward Blindness” theorem, says that when this sensitivity is zero, policy-gradient training receives no systematic signal to reduce that error. The claim concerns the information supplied by the reward, not a guarantee about every change a trained model might make.
When matching results is not enough
Consider two queries that answer “How many female students are enrolled?” One joins the student table to enrollment and an unnecessary courses table; the other reads only the student table. If both return the same count, an execution-only reward treats them alike. It therefore provides no direct incentive to remove the extra join. By contrast, a query with the right joins but a wrong filter may receive the same failing score as a query that is entirely unrelated to the question.
To examine these blind spots, the researchers analyzed 14 fine-grained error signals previously published for SQLENS, an error-detection framework. They used reported results for four text-to-SQL systems evaluated on the BIRD development benchmark, which contains 1,534 questions across 95 databases. These systems were not trained with reinforcement learning in this analysis. The authors use their error patterns to estimate how different reward designs might distinguish error types—not to show that one reward caused one system to outperform another.
The paper also presents controlled simulations of Group Relative Policy Optimization, a reinforcement-learning method. In the simulations, predicate and join errors are introduced at known rates, allowing the researchers to compare execution-only feedback with rewards that also use error signals. This makes the reward the key variable in the simulated comparison, but it is not the same as training a full language model on real databases.
Different rewards see different errors
In the benchmark analysis, predicate and result-related signals were among the most frequent. Depending on the system and signal, some appeared on as many as 27% of queries. Suboptimal join-tree signals appeared on about 5–12%. These figures describe signal detections, not necessarily confirmed errors in every flagged query: the underlying detectors have imperfect precision.
The framework predicts that reward designs have different blind spots. Execution-only rewards can distinguish many errors that change query results, but cannot distinguish errors on the output-preserving cases. Graph-based rewards may capture query structure while missing errors that depend on evidence outside the SQL structure. Composite rewards can add other information, though their usefulness depends on what their components actually detect.
The simulations support the specific prediction that execution-only feedback leaves output-preserving join errors without a directed learning signal. In the simulated setup, adding signal-based feedback reduced those errors, and the effect remained when detectors were noisy. This is evidence from controlled simulations, not proof that the same gains will occur in full-scale model training.
The authors also report that database-level checks—which do not require calls to a language model—flagged roughly 45–60% of semantic errors in their analysis, at an estimated cost of about 30 milliseconds per query. That coverage is not the same as a guarantee that every flagged query is wrong, or that the checks can replace broader evaluation. The paper’s table reports a wider range, 45.5–59.6%, for database-only signals; the headline range is a rounded summary.
What the results do—and do not—establish
The authors identify important limits. Exact Reward Error Sensitivity values cannot be calculated from the benchmark because ground-truth labels for every error are unavailable; estimates rely on detector precision. The four benchmark systems differ in architecture and prompting, so their results cannot establish causal effects of reward design. The paper explicitly stops short of full-scale reinforcement-learning training of a language model with its proposed reward.
The practical takeaway is a diagnostic one: evaluating a reward means asking not only whether it favors correct outputs, but also which kinds of mistakes it can see. The framework offers a way to make that question more precise. Whether signal-grounded rewards improve real text-to-SQL systems at scale remains to be tested.
This article is based on an arXiv preprint, which may not have undergone peer review. Its extracted paper text reports theoretical analysis, reanalysis of previously published benchmark signals, and controlled simulations—not a full-scale training trial. Reported detector-based estimates should therefore be read with those limitations in mind.
- Text-to-SQL
- Reinforcement learning
- Reward design
- SQL errors
- Artificial intelligence
Reviewed cross-references
These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.
When an AI Queries a Database, How Does It Know What You Mean?
Supporting evidence: Both papers identify limits of execution-based evaluation for Text-to-SQL: the origin paper formalizes blindness to errors that preserve outputs, while the survey says execution checks may not expose deeper logical errors. This is a compatible, bounded concern, not independent experimental confirmation; the origin’s result is theoretical and the survey summarizes varied prior work.
Model review: · openai-codex/gpt-6-luna
Evidence and provenance
Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.
2611.29930v1 — Original paper
Excerpt reference:
static/papers/2611.29930v1.md:289-393
Basis: Paper text
Source SHA-256:e0fb54f8c2a305b9f70c5ff4851aef1c06ad32b0761c073515e8a3508019c24a2611.00171v1 — Original paper
Excerpt reference:
static/papers/2611.00171v1.md:2471-2512
Basis: Paper text
Source SHA-256:f06b2f45df70a3f71494dc6e85c5008afb5a7182d870443a295e6d29b6f3375d
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
AI-designed rewards help a fraud detector learn from blocked payments
Source published
Shared keywords: reinforcement learning, reward design
When an AI Queries a Database, How Does It Know What You Mean?
Source published
Shared keywords: reinforcement learning, text to sql
When fewer missed deadlines is the wrong goal for an AI scheduler
Source published
Shared keywords: reinforcement learning, reward design
Can AI Incentives Help Reduce Hallucinations?
Source published
Shared keywords: reinforcement learning, reward design
An AI assistant that carries data work across tools
Source published
Shared keywords: artificial intelligence, text to sql