TRANSMISSION // 2611.31190v1

When Should a Text-to-SQL System Abstain?

Source published

A generator–critic system combines query checks and statistical calibration to decide when to return a database answer—and when to withhold it.

AI-generated conceptual illustration for When Should a Text-to-SQL System Abstain?
AI-generated conceptual illustration; not documentary evidence.

A SQL query can run without errors and still answer the wrong question. This preprint tests whether a second language model and calibrated confidence scores can help identify those silent mistakes, while showing why the resulting safety guarantees depend on deployment data matching the calibration setting.

The problem: a query can run and still be wrong

Ask a language model for a database query in plain English, and it may return SQL that executes perfectly but misses a filter, uses the wrong aggregation, or answers a subtly different question. Successful execution alone cannot distinguish a correct answer from a plausible mistake. Yet at deployment, there is usually no gold-standard query to compare against.

Avinash Kumar Singh, Bhaskarjit Sarmah and Stefano Pasquali propose a way to estimate whether a generated query is correct and decide when to abstain. Their paper, Know When to Abstain: Conformal Confidence Estimation for Text-to-SQL, treats correctness as something researchers can measure on labeled examples but must infer for new queries.

A generator, a critic and calibration

The system separates query writing from checking. First, a generator language model writes SQL, reports its own confidence and executes the query. A different model—the critic—then sees the original question, database schema, query and result. It judges whether the result answers the question and scores how well it aligns with it. A result might, for instance, concern the right topic but omit a requested condition.

A Random Forest combines those critic judgments with the generator’s reported confidence, token-level uncertainty and features describing the SQL. Researchers train it on examples where correctness can be checked by comparing the generated query’s result with the gold query’s result. The system then uses two sequential LLM calls per query, followed by local computation.

The paper describes two distinct calibration tools. Learn-then-Test selects a threshold intended to control the error rate among accepted queries, for a user-chosen risk budget and failure probability. Conformal calibration addresses a different concern: the false abstention rate, or how often the system withholds a correct query. These guarantees depend on calibration and deployment examples meeting specified distributional assumptions. They do not promise that any individual accepted query is correct.

Results on Spider—and a warning about transfer

On the Spider benchmark, the main setup paired GPT-OSS-120B as generator with Gemma-4-31B as critic. Without abstention, 22.6% of generated queries were wrong. With a 15% risk budget and a 0.1 failure probability, the method certified a threshold on all 10 resampled splits. It accepted 52.4% of queries on average, with a 9.1% observed error rate among those accepted.

In a controlled comparison on Spider using Olmo-3-32B as generator, the system scored 89.5 on AUARC, a measure of how accuracy changes as uncertain answers are rejected. The strongest logit-based baseline scored 81.2. This comparison used a shared generator and evaluation setup; results from other papers using different models or protocols are not directly comparable.

Five different critic models produced broadly similar results on Spider. But a separate critic is not a reliable oracle: the authors’ error analysis found that the main critic failed to flag most incorrect queries. Other signals in the combined estimator helped rank many of those cases, but errors the critic misread remained a source of mistakes, particularly as the system accepted more queries.

A test on BIRD, using a system trained and calibrated on Spider without retraining, illustrates the limits of transfer. Confidence scores still ranked correct and incorrect queries to some extent, but the Spider-certified threshold did not maintain its risk target: the observed error rate among accepted BIRD queries was 30.1% against a 15% budget. The authors attribute this to the fact that BIRD does not meet the assumptions needed for the guarantee.

What the study does—and does not—establish

The results suggest that combining a second model’s review with statistical calibration can help a Text-to-SQL system reject some risky answers. But rejection has a cost: under the 15% Spider risk setting, nearly half of queries were not accepted. Stricter risk targets were often impossible to certify with the available calibration data; in those cases, the rule abstains on every query.

The approach depends substantially on language-model judgments, and the paper evaluates SQLite benchmarks rather than the broader range of database dialects and enterprise settings where text-to-SQL may be used. Reported timing was about 2.43–4.33 seconds per query in the tested setup. Proposed extensions to other tasks, such as code or mathematics, have not been evaluated.

This is an arXiv preprint, not evidence of independent peer review. The findings are benchmark results under stated assumptions, not proof that a deployed system will reliably identify wrong queries—especially if users, databases or questions differ from the calibration data.

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.

  • A two-stage check for AI-generated database queries

    Shared method: Both papers add a validation stage after SQL generation: Singh et al. use a separate LLM critic to assess the query and execution result as part of a confidence estimator, while Zhang et al. train a dedicated validator to diagnose and refine generated SQL. The validator’s role and training differ, so this is a shared validation approach, not evidence that the systems or their performance are equivalent.

    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.31190v1 — Original paper

      Excerpt reference: static/papers/2611.31190v1.md:84-130
      Basis: Paper text
      Source SHA-256: 8c63ad99db4ef5bf6c02f6c97165aaea8dab4cae2c04b452f96694de707e951a

    • 2611.00815v1 — Original paper

      Excerpt reference: static/papers/2611.00815v1.md:80-155
      Basis: Paper text
      Source SHA-256: e0285c457ca253c6132c0b0e86f716547853ab70372c85cc100d82997a16b0a8

Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.