Text-to-SQL is a key natural language processing task that maps natural language questions to SQL queries, enabling intuitive interaction with web-based databases. Although current methods perform well on benchmarks like BIRD and Spider, they struggle with complex reasoning, domain knowledge, and hypothetical queries, and remain costly in enterprise deployment. To address these issues, we propose a framework named IESR(Information Enhanced Structured Reasoning) for lightweight large language models: (i) leverages LLMs for key information understanding and schema linking, and decoupling mathematical computation and SQL generation, (ii) integrates a multi-path reasoning mechanism based on Monte Carlo Tree Search (MCTS) with majority voting, and (iii) introduces a trajectory consistency verification module with a discriminator model to ensure accuracy and consistency. Experimental results demonstrate that IESR achieves state-of-the-art performance on the complex reasoning benchmark LogicCat (24.28 EX) and the Archer dataset (37.28 EX) using only compact lightweight models without fine-tuning. Furthermore, our analysis reveals that current coder models exhibit notable biases and deficiencies in physical knowledge, mathematical computation, and common-sense reasoning, highlighting important directions for future research. We released code at https://github.com/Ffunkytao/IESR-SLM.
Figures & tables
Figure 1: Motivation for Decoupling Mathematical Computation and SQL Generation in Text-to-SQL.
Figure 2: The comprehensive workflow of IESR including three stages: Question Understanding with Schema Linking, Monte Carlo Tree Search(MCTS)-based Reasoning and Trajectory Selection with Mutual Reasoning Consistency.
Figure 3: A visual illustration of heterogeneous MCTS actions (A1–A6) for SQL generation and reasoning.
Method
Qwen2.5-Coder
XiYanSQL
OmniSQL
Seed-Coder
Qwen2.5-Coder
XiYanSQL
OmniSQL
Seed-Coder
Size
7B
8B
7B
8B
LogicCat EX(%)
Archer-Dev EX(%)
Cot-SQL
5.07
7.89
6.93
6.58
17.16
18.46
18.14
19.89
DIN-SQL
10.31
11.56
9.56
8.98
31.45
34.41
26.04
29.13
DAIL-SQL
10.73
10.98
9.43
8.18
29.67
32.28
27.56
24.12
DTS-SQL
14.12
14.88
12.67
10.31
31.88
33.17
32.14
30.33
Table 1: Main results on reasoning-intensive Text-to-SQL benchmarks. EX denotes execution accuracy. Bold values indicate the best result in each backbone-dataset column. SQL-O1 requires task-specific tuning.
Qwen2.5-Coder-7B
XiYanSQL-QwenCoder-7B
Seed-coder-8B
OmniSQL-7B
Configuration
EX
Drop
EX
Drop
EX
Drop
EX
Drop
Full Model (IESR)
21.66
-
24.28
-
22.11
-
22.41
-
Core Stage Isolation
- Stage 1.1+2+3 Only (w/o)
19.96
1.70
21.68
2.60
20.41
1.70
21.42
0.99
- Stage 1.2+2+3 Only (w/o)
19.28
2.38
20.21
4.07
19.22
2.89
20.42
1.99
- Stage 1+2+3.1 Only (w/o)
19.24
2.42
21.83
2.45
18.29
3.82
19.14
3.27
Table 2: Comprehensive ablation study of IESR components across four backbone models on the LogicCat dataset. We report EX and the absolute performance drop in percentages (%). Understanding for Intent and Information Understanding. Linking for Schema Linking and Compression. Consistency Verification for Discriminator Consistency Verification. Reasoning and Discriminator Agent for MCTS-based CoT Reasoning and Trajectory Selection with Mutual Reasoning Consistency.
Figure 4: Performance heatmap of different methods on the LogicCat dataset across three difficulty levels (Easy, Medium, Hard) and different reasoning types.
Variant
EX
Diagnostics
Valid
Schema
Formula
Unit
Coupled MCTS
8.00
37.2
13.0
86.4
6.5
Decoupled w/o Schema
5.00
46.3
12.0
85.2
4.3
Decoupled w/ Schema
11.30
61.0
13.7
87.0
11.3
Typed-Action MCTS
13.80
56.9
17.2
85.1
11.5
Full IESR
21.24
57.3
20.0
91.3
17.1
Table 3: Controlled comparison of reasoning formulations on LogicCat using Qwen2.5-Coder-7B-Instruct. Decoupled denotes decomposition of formula reasoning and SQL skeleton construction. Schema denotes table and column grounding accuracy. Formula and Unit are evaluated on their corresponding reasoning-sensitive subsets.
Action
Qwen2.5-Coder
XiYanSQL
OmniSQL
Seed-Coder
All actions
21.66
24.28
22.11
22.41
w/o A1
21.45 (↓ 0.21)
24.02 (↓ 0.26)
21.92 (↓ 0.19)
22.23 (↓ 0.18)
w/o A2
20.83 (↓ 0.83)
23.88 (↓ 0.40)
20.68 (↓ 1.43)
22.01 (↓ 0.40)
w/o A3
20.32 (↓ 1.34)
23.25 (↓ 1.03)
19.78 (↓ 0.33)
22.12 (↓ 0.29)
w/o A4
20.86 (↓ 0.80)
23.87 (↓ 1.31)
20.89 (↓ 0.80)
21.98 (↓ 0.43)
w/o A6
20.12 (↓ 1.54 )
22.12 (↓ 2.16 )
19.21 (↓ 2.90 )
21.15 (↓ 1.26 )
Table 4: Ablation study on the reasoning action space (A1–A4, A6), corresponding to the reasoning actions defined in Section 3.2. We do not ablate A5 (SQL Generation) since removing it yields degenerate trajectories. The evaluation metric is EX (execution accuracy).
table
column
unit_num
operator
P
R
P
R
P
R
P
R
Qwen2.5-7B-Instruct
64.60
63.80
57.28
57.77
57.86
57.90
77.85
73.96
Qwen3-8B
75.25
73.54
63.32
62.30
60.80
61.06
77.02
75.36
Deepseek-V3
76.72
74.81
67.34
66.67
62.88
62.18
78.18
74.03
Deepseek-R1
78.09
75.35
62.91
62.02
60.52
60.32
76.00
72.20
Gemini2.5-Flash
87.08
92.79
77.70
82.78
78.94
80.20
92.75
92.16
Table 5: Precisions and Recalls of schema items, units, key numbers, and compute operators used in verification. Ve for Keywords Verification.
Figure 5: Ablation study of Nrollout across four backbone models on the LogicCat dataset.
Model
Accuracy (EX%)
Deepseek-V3
8.70
GPT-4o
10.17
GPT-4.1
13.57
Gemini-2.5-Pro
10.17
Claude-3.7-Sonnet
13.99
Claude-4.0-Sonnet
11.51
Table 6: Comparison with Baseline LLMs on the LogicCat dataset. Comparing with o4-mini, EX shows Execution Accuracy.
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
Method Method
Qwen2.5-Coder
XiYanSQL
OmniSQL
Seed-Coder
Qwen2.5-Coder
XiYanSQL
OmniSQL
Seed-Coder
Size
7B
8B
7B
8B
BIRD-Dev EX(%)
Spider EX(%)
Cot-SQL
31.22
33.58
37.58
30.16
65.32
69.12
68.32
66.23
DIN-SQL
51.78
52.45
51.23
49.88
77.19
79.30
76.80
78.01
DAIL-SQL
52.12
51.16
52.23
50.66
80.31
82.56
81.56
82.98
DTS-SQL
58.32
60.78
61.56
58.18
84.12
85.09
84.99
83.21
Appendix
Table 7: Results on conventional Text-to-SQL benchmarks. These results are reported for completeness and clarify the scope of IESR. IESR is primarily designed for reasoning-intensive queries, while specialized Text-to-SQL systems remain stronger on standard schema-grounding benchmarks.
Qwen2.5-Coder
OmniSQL
Seed-Coder
XiYanSQL
Configuration
EX
Drop
EX
Drop
EX
Drop
EX
Drop
SC@maj32
21.66
–
24.28
–
22.11
–
22.41
–
Ablation Nrollout
SC@maj8
20.68
0.98
23.22
1.06
21.18
0.93
20.45
1.96
SC@maj16
20.40
1.26
23.86
0.42
21.45
0.66
20.81
1.60
SC@maj24
20.91
0.75
22.89
1.39
21.85
0.26
21.41
1.00
Appendix
Table 8: Ablation study of Nrollout across four backbone models on the LogicCat dataset. We report EX and the absolute performance drop (%). XiYanSQL refers to XiYanSQL-QwenCoder-7B-2504; Qwen2.5-Coder to Qwen2.5-Coder-7B; OmniSQL to OmniSQL-7B; and Seed-Coder to Seed-Coder-8B.
Figure 14
Method
EX(%)
Avg. calls
Avg. total tokens
Din-SQL
10.31
3.2
2.5K
DAIL-SQL
10.73
3.4
2.3K
CHESS
16.16
20.2
7.5K
Alpha-SQL
18.32
61.1
45.2K
Chase-SQL
21.92
125.2
83.1K
Deepeye-SQL
22.81
21.0
43.1K
Appendix
Table 9: Inference costs of different methods on LogicCat. We report execution accuracy, average model calls, and average total tokens per question.
Method
EX(%)
Avg. calls
Avg. total tokens
IESR, N=4
20.68
11.7
22.1K
IESR, N=8
20.68
23.9
25.9K
IESR, N=16
20.40
33.2
45.7K
IESR, N=32
21.66
43.8
80.7K
IESR, N=40
21.12
48.9
83.4K
IESR, N=48
20.21
54.4
89.6K
Appendix
Table 10: Effect of the rollout budget on IESR inference cost and execution accuracy on LogicCat. Larger rollout budgets increase the search budget, but accuracy saturates after Nrollout=32 .
LogicCat
Archer
Avg. calls
5.1
6.2
Avg. total tokens
2,803.2
3,424.7
Appendix
Table 11: Information understanding costs of IESR on LogicCat and Archer. We report the average number of moderate-scale model calls and generated tokens required for semantic extraction and schema-aware preprocessing per query.
Figure 8: Distribution of Errors on Sampled Set.
Figure 9: Case A: schema hallucination caused by a non-existent generated table.
Figure 10: Case B: query-scope error where a multi-row answer is restricted to one entity.
Figure 11: Case C: denotation mismatch caused by an incorrect statistical filter or denominator.
Figure 12: Case D: unit-reasoning error caused by an incorrect physical constant.
Figure 13: Case F: categorical value grounding error caused by case-sensitive value mismatch.
Figure 14: Case G: SQL dialect error caused by an unquoted reserved identifier.
Figure 15: Case H: projection error caused by omitting the required key column.
Category
Parameter
Value
MCTS
reasoning_variant
full_iesr
MCTS
enable_sql_revision
true
MCTS
max_rollout_steps
16
MCTS
max_depth
16
MCTS
exploration_constant
1.414
MCTS
random_seed
42
Appendix
Table 12: MCTS and local LLM decoding configuration used in our experiments.
Setting
EX (%)
Valid SQL (%)
γ>0 configs
18.7∼21.5
54.2∼57.0
γ=0 configs
18.8∼21.0
54.0∼57.2
Full 21-tuple grid
18.7∼21.5
54.1∼57.2
Appendix
Table 13: Sensitivity summary of trajectory-selection weights on 500 LogicCat development queries using Qwen2.5-Coder-7B-Instruct. Candidate trajectories are fixed across all settings.
α
β
γ
Samples
EX (%)
Valid SQL (%)
0.0
0.0
1.0
500
19.3
∼54.3
0.0
0.2
0.8
500
19.4
∼55.8
0.0
0.4
0.6
500
19.6
∼55.9
0.0
0.6
0.4
500
20.4
∼55.7
0.0
0.8
0.2
500
19.0
∼56.8
0.0
1.0
0.0
500
19.3
∼54.9
Appendix
Table 14: Full grid over trajectory selection weights with step size 0.2 . All configurations satisfy α+β+γ=1 .
τ
Macro F1
Macro P
Macro R
Col. Recall
0.3
25.4
24.5
66.8
72.8
0.4
30.3
39.2
69.3
71.3
0.5
37.9
38.6
66.3
68.3
0.6
51.5
51.3
74.8
76.3
0.7
49.2
48.9
69.0
75.0
Appendix
Table 15: Sensitivity analysis of the schema filtering threshold τ on 500 LogicCat development queries. Metrics are computed on retrieved triplets against gold SQL literals.
Figure 16: Understanding Prompt including Intent Recognition, Unit Understanding, Relation and Entity Extracting, and Pseudo-Schema Understanding
Figure 17: An Example of Equation Explain Prompt.
Figure 18: An Example of Schema Selection Prompt.
Figure 19: An Example of Identify Column Information Prompt.
Figure 20: An Example of Entity Extraction Prompt.
Figure 21: Understanding Prompt including Intent Recognition, Unit Understanding, Relation and Entity Extracting, and Pseudo-Schema Understanding.
Figure 22: An Example of Revising SQL Reasoning Prompt.
Text-to-SQL aims to translate natural language questions into executable SQL queries over structured databases, enabling non-expert users to access data intuitively. While recent advances in large language models (LLMs) have shown promise in this task, existing LLM-based approaches often struggle to strike a balance between strong reasoning capabilities and robust generalization. To address these limitations, we propose CoTE-SQL to enhance the LLM-based text-to-SQL generation with three key innovations: (i) self-enhanced reasoning traces distilled from LLMs without human annotation, (ii) structured chain-of-thought (CoT) prompting with modular decomposition and examples retrieval, and (iii) error-aware revision based on SQL execution feedback. Extensive experiments on the Spider and Bird benchmarks demonstrate that CoTE-SQL achieves new state-of-the-art performance among methods built on open-source LLMs with comparable model sizes on Bird (53.39% EX / 59.02 VES) and strong results on Spider (79.60% EX / 77.19 VES), with especially significant gains on complex queries. Results highlight the effectiveness of combining self-enhancement, structured reasoning, and execution-time feedback within an LLM-based framework for text-to-SQL design.
Feng Lyu, Jinfeng Cen, Sijing Duan +4
Central South University · Tsinghua University · Nanjing University +1
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
Large Language Models (LLMs) have demonstrated remarkable capabilities in translating natural language to SQL, yet existing methods still falter on complex queries requiring multi-step, data-aware reasoning. We introduce DecoSearch, a training-free framework that addresses this by routing each query to the appropriate level of reasoning effort. A lightweight Schema Selector first prunes the full database schema to the relevant tables and columns. An LLM Judger then decides whether the question requires decomposition: straightforward questions follow a direct generation path and complex ones are escalated to a Directed Acyclic Graph (DAG) of atomic sub-questions, each solved by a targeted SQL generation step. A RAG component grounds the decomposer with semantically similar training examples, and a Topology Refiner restructures the reasoning plan when execution failures signal a flawed decomposition rather than a fixable SQL error. DecoSearch achieves 70.53% execution accuracy on BIRD and 88.31% on Spider with a DeepSeek backbone, surpassing all training-free baselines while consuming an order of magnitude fewer tokens than competing methods. It also functions as a model-agnostic wrapper, consistently improving fine-tuned SQL generation backbones without any modification to the pipeline.
Esteban Schafir, Xu Zheng, Hojat Allah Salehi +4
Florida International University · NEC-Labs · Singapore Management University