Modern text-to-SQL systems have become increasingly elaborate, relying on schema-linking modules, retrieval-augmented prompting, candidate generation, and multi-stage refinement pipelines. While effective, these additions introduce substantial latency and engineering overhead. To this end, we present ReAct-SQL, a simple yet effective zero-shot ReAct-style framework built solely on iterative reasoning and a constrained action space defined by a typed Domain-Specific Language (DSL) of 15 relational operations, rather than free-form SQL generation. The model incrementally issues DSL calls, observes compiled-SQL execution feedback, and revises its reasoning through interaction. On corrected BIRD mini-dev and EHR-SQL, ReAct-SQL achieves 84.5% and 73.9% accuracy, respectively, matching substantially more elaborate baselines while running up to 8× faster. Incremental ablations further show that iteration primarily improves grounding, while the DSL improves compositional reliability.
Figures & tables
Figure 1: ReAct-SQL architecture. The model receives only the schema, the question, and DSL documentation. It reasons, issues batched DSL operations, and observes execution results in a multi-turn loop. An always-on answer-shaping pass either passes the canonical execute result through (via a <execute_result_N> sentinel) or synthesizes a combined multi-metric answer from the trace.
Operation
Description
Relation-building (12)
table_ref
Load a base table as a Relation
select_columns
Project a subset of columns
distinct
Deduplicate rows
filter_expr
Apply a SQLite WHERE predicate
join_table
Inner / left / cross join
Table 1: The 12 relation-building and 3 read-only probing operations of the DSL.
BIRD mini-dev (498q)
EHR-SQL (934q)
System
Acc. (%)
Cost ($/q)
Med. Lat. (s)
Acc. (%)
Cost ($/q)
Med. Lat. (s)
CHESS ( 17 )
85.3
0.0842
53.7
70.1
0.1140
104.8
RSL-SQL † ( 3 )
84.1
0.0053
22.4
64.8
0.0087
40.2
DSR-SQL ( 5 )
84.9
0.0252
28.1
69.2
0.0304
38.8
DIN-SQL ( 12 )
70.3
0.0152
13.6
54.0
0.0193
17.7
MAC-SQL ( 18 )
66.1
0.0026
13.0
41.0
0.0026
18.8
Table 2: Main results on corrected BIRD mini-dev ( 7 ) and EHR-SQL ( 8 ) ; all systems receive identical hints and are scored by the same LLM judge. Latency is the per-query median; query latency is right-skewed, so the median is the representative measure—full statistics (mean, min, max, and coefficient of variation) are in Appendix G . Cost is the per-query mean: it depends only on input and output token counts, unlike latency, which also reflects server load and network conditions. † Uses retrieved in-context demonstrations from BIRD training pairs; all other systems are zero-shot.
Backbone
Base.
+ReAct-SQL
Gain
Gemini-2.5-Flash-Lite
30.5
45.5
+15.0
Gemini-2.5-Flash
44.0
77.0
+33.0
Gemini-2.5-Pro
45.0
81.5
+36.5
Claude Sonnet 4.6
53.0
87.0
+34.0
Table 3: ReAct-SQL vs. the zero-shot raw-SQL baseline on a 200-question subset of EHR-SQL, across four backbones from two model families. Accuracy in %. As a subset, absolute accuracies differ slightly from the full-benchmark run.
Figure 2: Accuracy-efficiency Pareto frontier on Gemini-2.5-Flash. Each point is one system on one benchmark. Upper-left is better (higher accuracy, lower cost/latency).
Setting
BIRD
EHR-SQL
( n=498 )
( n=934 )
Baseline (zero-shot raw SQL)
78.5
45.9
+ Iteration (raw-SQL ReAct)
79.1
72.2
+ Iteration + DSL (ReAct-SQL)
84.5
73.9
Table 4: Incremental ablation on Gemini-2.5-Flash; accuracy in %, additional analysis of McNemar tests and bootstrap CIs are listed in Appendix A
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Comparison
Δ Acc
95% CI
b
c
p
BIRD mini-dev (n = 498)
Baseline → +Iter
+0.60
[−3.41,+4.62]
53
56
0.848 (n.s.)
+Iter → +Iter+DSL
+5.42
[+1.61,+9.24]
32
59
0.006
Baseline → +Iter+DSL
+6.02
[+2.61,+9.64]
28
58
0.002
EHR-SQL (n = 934)
Baseline → +Iter
+26.23
[+22.91,+29.66]
38
283
∼10−47
Appendix
Table 5: Pairwise McNemar tests for the ablation in Table 4 , with paired bootstrap 95% CIs on the accuracy difference. Δ Acc is in percentage points; b is the count of questions on which the earlier-stage system is right but the later-stage system is wrong, and c is the reverse; p is the McNemar p-value (continuity-corrected for BIRD; exact-binomial for the two extreme-tail EHR-SQL cells, where the normal approximation breaks down).
Difficulty
n
Acc. (%)
Avg. turns
Simple
148
87.2
2.6
Moderate
248
83.9
3.4
Challenging
102
82.4
4.0
Overall
498
84.5
3.3
Appendix
Table 6: ReAct-SQL on corrected BIRD mini-dev, broken down by the official difficulty labels.
System
Min
Med.
Mean
Max
CV
> 500 s
MAC-SQL
8.3
18.8
17.7
39.6
0.25
0
DIN-SQL
5.7
17.7
19.6
40.8
0.44
0
CHESS
27.9
104.8
114.4
430.9
0.55
0
DSR-SQL
19.2
38.8
43.6
546.6
0.67
1
RSL-SQL
12.2
40.2
52.7
865.3
1.30
7
ReAct-SQL
3.0
13.2
16.0
93.5
0.61
0
Appendix
Table 7: Per-query latency statistics (seconds) on Gemini 2.5 Flash, for EHR-SQL (top) and BIRD mini-dev (bottom). Med. (median) is the value reported in Table 2 ; CV is the coefficient of variation (std/mean); the > 500 s column counts queries whose wall-clock latency exceeded 500 s.
Figure 3: A complete ReAct-SQL trace on a BIRD question.
Recent work has shown that reinforcement learning from execution feedback can substantially improve text-to-SQL performance, often enabling smaller models to match or exceed much larger systems. However, most existing approaches treat SQL generation as a single-turn task, limiting the model's ability to recover from errors through iterative refinement. We present ReToolSQL, a two-stage training framework for text-to-SQL that combines (i) a supervised warm-start on rejection-sampled reasoning traces with (ii) agentic reinforcement fine-tuning (RFT) over multi-turn tool-use trajectories. The key insight is that the two stages act on complementary axes, the supervised fine-tuning (SFT) on verified privileged-teacher traces expands the set of solvable questions (raising pass@k coverage on the hardest cases), while RFT converts that expanded capability into higher single-pass accuracy by teaching the model when to verify, what evidence to retrieve, and how to repair faulty SQL from execution feedback. Applied to Gemma 4 instruction-tuned (31B), RFT alone achieves 73.66% execution accuracy (EX) on the BIRD-SQL development benchmark (74.12% EX with self-consistency). Initializing RFT from the SFT checkpoint (SFT→RFT) yields our strongest model at 74.32% EX single-pass and 74.77% EX with self-consistency. At the time of writing, this ranked first on the BIRD single-model development-set leaderboard. The approach uses composite rewards anchored on execution correctness, requires no human annotation beyond the benchmark itself, and operates within a single dense 31B model, showing that a properly designed SFT→RFT pipeline over tool-use trajectories is a practical path toward robust enterprise-grade text-to-SQL.
Text-to-SQL maps natural language questions to executable SQL queries. Modern databases often contain large and complex schemas, making schema linking a critical step for accurate SQL generation. Existing methods either rely on full-schema generation, which leaves schema linking implicit within a large search space, or use a separate retriever trained with static gold-column supervision, whose targets may be suboptimal for the current generator policy. To address this issue, we propose Adaptive Co-optimization via Empirical Credit Assignment for Text-to-SQL (ACE-SQL), a reinforcement learning (RL) framework that jointly optimizes schema retrieval and SQL generation under execution feedback. ACE-SQL constructs an online column-set pool from generator rollouts and derives adaptive on-policy retrieval targets from the column set most frequently associated with execution-correct rollouts. This induces bidirectional adaptation, where the retriever adapts toward column sets that the generator can execute correctly, while the generator adapts to the retriever's evolving schema selections under execution feedback. With approximately 3k synthetic Text-to-SQL question-database pairs for RL training, ACE-SQL achieves 65.3% greedy execution accuracy on BIRD Dev while using 0.93k output tokens per query. The repository is available at https://github.com/xbchen1/ACE-SQL.
Xiaobing Chen, Ai Jian, Eryu Guo +1
Harbin Engineering University, Harbin, China · Harbin Institute of Technology, Harbin, China · Beijing University of Posts and Telecommunications, Beijing, China
Large language models have driven major advances in Text-to-SQL generation. However, they suffer from high computational cost, long latency, and data privacy concerns, which make them impractical for many real-world applications. A natural alternative is to use small language models (SLMs), which enable efficient and private on-premise deployment. Yet, SLMs often struggle with weak reasoning and poor instruction following. Conventional reinforcement learning methods based on sparse binary rewards (0/1) provide little learning signal when the generated SQLs are incorrect, leading to unstable or collapsed training. To overcome these issues, we propose FINER-SQL, a scalable and reusable reinforcement learning framework that enhances SLMs through fine-grained execution feedback. Built on group relative policy optimization, FINER-SQL replaces sparse supervision with dense and interpretable rewards that offer continuous feedback even for incorrect SQLs. It introduces two key reward functions: a memory reward, which aligns reasoning with verified traces for semantic stability, and an atomic reward, which measures operation-level overlap to grant partial credit for structurally correct but incomplete SQLs. This approach transforms discrete correctness into continuous learning, enabling stable, critic-free optimization. Experiments on the BIRD and Spider benchmarks show that FINER-SQL achieves up to 67.73% and 85% execution accuracy with a 3B model -- matching much larger LLMs while reducing inference latency to 5.57~s/sample. These results highlight a cost-efficient and privacy-preserving path toward high-performance Text-to-SQL generation. Our code is available at https://github.com/thanhdath/finer-sql.
Thanh Dat Hoang, Thanh Trung Huynh, Matthias Weidlich +4
Griffith University (Australia) · VinUniversity (Vietnam) · Humboldt-Universitat zu Berlin (Germany) +1