Know When to Abstain: Conformal Confidence Estimation for Text-to-SQL
Organizations: Domyn Hyderabad, India · Domyn New Delhi, India · Domyn New York, USA
Abstract
Text-to-SQL systems often return queries that execute successfully but answer the wrong question. Detecting these errors at deployment is hard because execution correctness is defined against a gold query, which exists only in labeled data. We formulate confidence estimation for Text-to-SQL as probabilistic query validation under a latent correctness variable that is observable at calibration time through gold-SQL execution and latent at deployment. Our estimator separates generation from validation. A generator LLM writes and executes the query, and a different critic LLM judges the query and its execution result. The critic's validation and execution-grounded alignment scores are fused with the generator's verbalized confidence, token-level uncertainty, and SQL-structural features in a Random Forest, using two sequential LLM calls. Two calibration steps give finite-sample guarantees. A Learn-then-Test threshold ensures, with probability , that the error rate among accepted queries stays below a user-chosen budget. A conformal p-value bounds the false abstention rate. On Spider we use GPT-OSS-120B as generator and Gemma-4-31B as critic. The estimator obtains an AUARC of 0.899. Without abstention, 22.6% of queries are wrong. With a 15% risk budget (), a threshold is certified on all 10 resampled splits, and the system accepts 52.4% of queries on average with 9.1% observed error. Five different critic models give similar results. In a controlled comparison on Spider with Olmo-3-32B as generator, the estimator obtains an AUARC of 89.5, compared with 81.2 for the strongest logit-based baseline. Applied to BIRD without retraining, the confidence scores remain informative (AUROC 0.72, against 0.79 on Spider), but the risk guarantee does not transfer, as expected without exchangeability.
Figures & tables
| Family | Features | Source | Dim | Targeted failure mode |
|---|---|---|---|---|
| Verbalized | Stage 1, | 1 | Generator uncertainty | |
| Stage 2, | 2 | Result violates question | ||
| Alignment | Stage 2, | 2 | Plausible but wrong results | |
| Logit ( ) | Stage 3, local | 7 | Token-level uncertainty | |
| SQL-structural ( ) | Stage 3, local | 2 | Schema grounding errors | |
| Variants | Subset statistics, range, histogram, | Stage 3, local | 27 | Localised uncertainty |
| Self-critique | Critic | |||||
|---|---|---|---|---|---|---|
| ( ) | Gemma-4-31B | Qwen3.8-27B | DeepSeek-V4.1 | Nemotron-3-S | Qwen2.5-72B | |
| Base accuracy | 0.786 | 0.774 | 0.774 | 0.774 | 0.774 | 0.774 |
| ECE | 0.149 | 0.158 | 0.155 | 0.156 | 0.142 | 0.166 |
| AUROC | 0.781 | 0.785 | 0.840 | 0.811 | 0.779 | 0.826 |
| AUARC | 0.913 | 0.899 | 0.922 | 0.916 | 0.901 | 0.915 |
| Coverage | 0.077 | 0.079 | 0.063 | 0.080 | 0.074 | 0.082 |
| Cert. | Cov. | Risk | Cert. | Cov. | Risk | Cert. | Cov. | Risk | |
|---|---|---|---|---|---|---|---|---|---|
| Critic: Gemma-4-31B | 0/10 | 0.0 | — | 10/10 | 52.4 | 9.1 (11.7) | 10/10 | 74.2 | 14.1 (16.1) |
| Critic: Qwen3.8-27B | 7/10 | 27.6 | 4.7 (8.0) | 10/10 | 64.1 | 9.9 (14.6) | 10/10 | 79.8 | 14.2 (16.0) |
| Critic: DeepSeek-V4.1 | 6/10 | 21.9 | 4.9 (9.1) | 10/10 | 55.4 | 8.7 (11.9) | 10/10 | 75.3 | 14.0 (15.9) |
| Critic: Nemotron-3-Super | 6/10 | 19.6 | 5.0 (8.2) | 10/10 | 54.2 | 9.3 (11.4) | 10/10 | 72.7 | 14.6 (17.2) |
| Gen.: Olmo-3-32B | 1/10 | 1.9 | 7.4 (7.4) | 10/10 | 38.8 | 8.2 (12.1) | 10/10 | 67.5 | 14.1 (17.8) |
| Method | Calls | AUARC | AUROC | ECE |
|---|---|---|---|---|
| Self-Consistency ( ) | 3 | 79.3 | 68.4 | 0.198 |
| Self-Consistency ( ) | 5 | 82.1 | 71.2 | 0.183 |
| Single CoT Verify | 2 | 78.9 | 63.6 | 0.030 |
| SAC-Product ( Entezari Maleki et al., 2026 ) | 1 | 81.2 | 72.4 | 0.161 |
| Pooled Token-Level ( Ramachandran and Sarawagi, 2024 ) | 1 | 79.7 | 70.8 | 0.174 |
| Ours | 2 | 89.5 | 81.6 | 0.126 |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Family | Symbol | Code name | Definition | Core |
| Verbalized | Generation_conf. | Generator’s verbalized confidence, 0–100 (Stage 1) | ✓ | |
| Evaluation_Score | Critic’s binary verdict on the result (Stage 2) | ✓ | ||
| Evaluation_Conf. | Critic’s confidence in its verdict, 0–100 (Stage 2) | ✓ | ||
| Alignment | alignment_score | How well the result answers , 0–100 (Stage 2) | ✓ | |
| question_similarity | Similarity of and reconstructed , 0–100 (Stage 2) | ✓ | ||
| Logit | geo_sql_all | Geometric mean of , all tokens | ✓ |
| Configuration | Trees | Max depth | Min split | Min leaf | Max features |
|---|---|---|---|---|---|
| Generator GPT-OSS-120B, critic Gemma-4-31B | 400 | 10 | 5 | 10 | sqrt |
| Generator GPT-OSS-120B, critic Qwen3.8-27B | 400 | 10 | 5 | 10 | sqrt |
| Generator GPT-OSS-120B, critic DeepSeek-V4.1-Flash | 400 | 10 | 5 | 10 | sqrt |
| Generator GPT-OSS-120B, critic Nemotron-3-Super | 200 | 50 | 10 | 10 | all |
| Generator GPT-OSS-120B ∗ , critic Gemma-4-31B | 800 | 10 | 10 | 10 | all |
| Generator Olmo-3-32B, critic Gemma-4-31B | 400 | 15 | 5 | 10 | log2 |
| Metric | Definition | Better |
|---|---|---|
| ECE | Weighted mean gap between confidence and empirical accuracy over 10 equal-width bins. | |
| ACE | As ECE, with equal-mass bins. | |
| Brier | Mean squared error between confidence and . | |
| AUROC | Probability that a random correct query receives a higher score than a random incorrect one. | |
| AUARC | Area under the accuracy–rejection curve: accuracy of the retained queries as the rejection rate varies from 0 to 1. Primary metric. | |
| Prec./Recall/F1 (Table 11 ) | Classification of by the forest at . |
| Model | Params (B) | HuggingFace model ID |
|---|---|---|
| GPT-OSS-120B | 120 | openai/gpt-oss-120b |
| Olmo-3-32B-Think | 32 | allenai/Olmo-3-32B-Think |
| Llama-3.3-Nemotron-Super-49B-v1.5 | 49 | nvidia/Llama-3_3-Nemotron-Super-49B-v1_5 |
| Qwen2.5-72B-Instruct | 72 | Qwen/Qwen2.5-72B-Instruct |
| Gemma-4-31B-it (critic) | 31 | google/gemma-4-31B-it |
| Qwen3.8-27B (critic) | 27 | Qwen/Qwen3.8-27B |
| Metric | GPT-OSS-120B | Olmo-3-32B | Qwen2.5-72B | Llama-49B |
|---|---|---|---|---|
| Correct / incorrect queries | 499 / 137 | 470 / 166 | 503 / 133 | 475 / 160 |
| Base accuracy | 0.785 | 0.739 | 0.791 | 0.748 |
| ECE | 0.133 | 0.126 | 0.045 | 0.113 |
| ACE | 0.133 | 0.125 | 0.041 | 0.112 |
| Brier | 0.163 | 0.158 | 0.137 | 0.153 |
| AUROC | 0.791 | 0.816 | 0.765 | 0.814 |
| Cov. | Risk | Cov. | Risk | Cov. | Risk | ||||
|---|---|---|---|---|---|---|---|---|---|
| Critic: Gemma-4-31B | — | 0.0 | — | 0.58 | 54.4 | 8.4 | 0.44 | 76.4 | 13.4 |
| Critic: Qwen3.8-27B | 0.68 | 44.3 | 5.7 | 0.50 | 67.5 | 9.6 | 0.40 | 79.7 | 12.4 |
| Critic: DeepSeek-V4.1-Flash | 0.77 | 29.4 | 2.7 | 0.59 | 54.7 | 8.9 | 0.41 | 81.0 | 14.4 |
| Critic: Nemotron-3-Super | — | 0.0 | — | 0.65 | 47.3 | 7.3 | 0.46 | 71.1 | 13.1 |
| Gen.: GPT-OSS-120B | 0.91 | 20.1 | 0.8 | 0.67 | 47.6 | 5.9 | 0.56 | 61.6 | 8.7 |
| 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0 | ||
| FAR bound | 0.9 | 0.8 | 0.7 | 0.6 | 0.5 | 0.4 | 0.3 | 0.2 | 0.1 | 0.0 | |
| Critic: Gemma-4-31B | FAR | .904 | .813 | .728 | .640 | .549 | .445 | .319 | .181 | .075 | .000 |
| Coverage (%) | 7.9 | 15.3 | 22.2 | 29.6 | 37.3 | 46.1 | 58.2 | 72.3 | 85.7 | 100 | |
| Risk (%) | 6.0 | 5.2 | 5.0 | 5.9 | 6.3 | 6.8 | 9.5 | 12.4 | 16.5 | 22.6 | |
| Critic: Qwen3.8-27B | Coverage (%) | 6.3 | 14.2 | 21.2 | 26.9 | 35.4 | 46.7 | 58.3 | 69.2 | 80.0 | 100 |
| Risk (%) | 0.0 | 3.3 | 2.2 | 2.3 | 4.0 | 5.7 | 6.7 | 9.3 | 12.6 | 22.6 |
| Critic: Gemma-4-31B | Critic: Qwen3.8-27B | |||||||||||
| TP | FP | FN | TN | TAR | FAR | TP | FP | FN | TN | TAR | FAR | |
| 0.1 | 47 | 3 | 445 | 141 | .979 | .904 | 40 | 0 | 452 | 144 | 1.000 | .919 |
| 0.2 | 92 | 5 | 400 | 139 | .965 | .813 | 87 | 3 | 405 | 141 | .979 | .823 |
| 0.3 | 134 | 7 | 358 | 137 | .951 | .728 | 132 | 3 | 360 | 141 | .979 | .732 |
| 0.4 | 177 | 11 | 315 | 133 | .924 | .640 | 167 | 4 | 325 | 140 | .972 | .661 |
| 0.5 | 222 | 15 | 270 | 129 | .896 | .549 | 216 | 9 | 276 | 135 | .938 | .561 |
| TP | FP | FN | TN | CondAcc | Recall FAR | Risk | |
|---|---|---|---|---|---|---|---|
| 0.1 | 54 | 2 | 416 | 164 | 96.4% | 11.5% | 3.6% |
| 0.2 | 90 | 4 | 380 | 162 | 95.7% | 19.1% | 4.3% |
| 0.3 | 136 | 6 | 334 | 160 | 95.8% | 28.9% | 4.2% |
| 0.4 | 185 | 9 | 285 | 157 | 95.4% | 39.4% | 4.6% |
| 0.5 | 239 | 18 | 231 | 148 | 93.0% | 50.9% | 7.0% |
| 0.6 | 293 | 27 | 177 | 139 | 91.6% | 62.3% | 8.4% |
| Self-critique | Gemma partial | Qwen partial | Qwen critic | |
|---|---|---|---|---|
| AUROC | 0.781 | 0.782 | 0.821 | 0.826 |
| AUARC | 0.913 | 0.905 | 0.913 | 0.915 |
| ECE | 0.149 | 0.129 | 0.154 | 0.166 |
| TAR | 0.993 | 1.000 | 0.993 | 0.993 |
| FAR | 0.904 | 0.896 | 0.902 | 0.896 |
| Configuration | AUROC | AUARC | ECE | TAR | FAR |
|---|---|---|---|---|---|
| Critic: Gemma-4-31B | |||||
| Critic: Qwen3.8-27B | |||||
| Critic: DeepSeek-V4.1-Flash | |||||
| Critic: Nemotron-3-Super | |||||
| Generator: GPT-OSS-120B | |||||
| Generator: Olmo-3-32B |
| Generator (critic Gemma-4-31B) | Critic (generator GPT-OSS-120B) | |||||||
|---|---|---|---|---|---|---|---|---|
| Score | GPT-OSS | Olmo | Qwen2.5 | Llama | Gemma | Qwen3.8 | DeepSeek | Nemotron |
| (generation confidence) | 0.739 | 0.697 | 0.658 | 0.704 | 0.715 | 0.715 | 0.715 | 0.715 |
| (evaluation verdict) | 0.537 | 0.607 | 0.576 | 0.605 | 0.563 | 0.567 | 0.588 | 0.596 |
| (evaluation confidence) | 0.567 | 0.569 | 0.554 | 0.525 | 0.580 | 0.771 | 0.700 | 0.572 |
| (alignment) | 0.537 | 0.608 | 0.579 | 0.606 | 0.564 | 0.753 | 0.651 | 0.611 |
| (question similarity) | 0.652 | 0.721 | 0.665 | 0.704 | 0.651 | 0.737 | 0.710 | 0.595 |
| Metric | Value |
|---|---|
| Base accuracy | 0.342 |
| ECE | 0.091 |
| ACE | 0.090 |
| Brier | 0.202 |
| AUROC | 0.724 |
| AUARC | 0.515 |
| Spider (in-domain) | BIRD (zero-shot) | |
|---|---|---|
| Error rate without abstention | 21.5% | 65.8% |
| Share of predictions with | 29% | 72% |
| Accuracy vs. mean confidence there | 53% vs. 36% | 24% vs. 35% |
| ECE | 0.133 | 0.091 |
| Stage | Operation | Mean time (s) |
|---|---|---|
| 1 | SQL generation (GPT-OSS-120B) + execution | 1.9 - 2.6 |
| 2 | Validation + alignment (Gemma-4-31B critic) | 0.5 - 1.7 |
| 3–4 | Features, forest, conformal score (local) | 0.03 |
| Total | per query | 2.43 - 4.33 |
| Method | Backbone | Approach | Reported results |
|---|---|---|---|
| SAC-Product ( Entezari Maleki et al., 2026 ) | GPT-4o-mini | Logit-based | AUROC 79.9, ECE 0.14 |
| Geometric Aggregation ( Xiao et al., 2025 ) | CodeLlama-34B | Black-box | AUROC 76.0, AUARC 35.0 |
| Multivariate Platt Scaling ( Liu et al., 2025a ) | Llama-3.1-8B | Logit + sampling | AUROC 74.8, Brier 0.163, ECE 0.024, ACE 0.026 |
| Pooled token-level ( Ramachandran and Sarawagi, 2024 ) | Codestral-22B | Logit-based | AUROC 78.8 |
| Ours | Olmo-3-32B-Think + Gemma-4-31B critic | Combined | AUARC 89.5, AUROC 81.6, ECE 0.126, ACE 0.125, Brier 0.158 |
Text-to-SQL
Text-to-SQL translates natural-language questions into executable database queries, linking user intent to schemas, values, and SQL logic.
See all 191 papers