Text-to-SQL aims to translate natural language questions into executable SQL queries over relational databases, requiring multi-stage structured reasoning over database schemas and query constraints. However, existing methods treat this task as single-step generation, where models optimize entire SQL sequences without targeted feedback at key decision points and lack support for interacting with and controlling the intermediate generation process. To address this issue, we propose SPOC-SQL, which decomposes Text-to-SQL into four sequential subtasks following standard SQL execution logic and designs stage-specific optimization strategies for the model to learn key decisions. Specifically, we propose the implementation of fine-grained preference optimisation at key decision points across SQL stages, with the objective of enhancing structured decision-making during query construction. Furthermore, a structured decomposition strategy is designed, facilitating stage-wise intervention and correction through explicit intermediate representations. This results in more controllable and reliable SQL generation. Experiments demonstrate that incorporating stage-wise human knowledge consistently improves performance, validating the effectiveness of stage perception controllable generation.
Figures & tables
Figure 1: The workflow of SPOC-SQL. (1) The task parsing function F decomposes single-turn queries into multi-turn sequences with stage-specific sub-requirements. (2) LoRA fine-tuning combined with preference-based optimization to enhance decision capability through fine-grained policy optimization. (3) Evaluation of multi-turn QA capabilities. (4) At inference, F decomposes user requirements into sub-tasks for iterative confirmation, generating the final SQL.
Method
Model
Venue
SF
WH
GH
OL
Dev
Real.
ACT-SQL [ 20 ]
ChatGPT
EMNLP’23
–
–
–
–
80.4
75.8
C3 [ 6 ]
ChatGPT
arXiv’23
–
–
–
–
81.8
75.4
DIN-SQL [ 13 ]
GPT-4
NeurIPS’23
–
–
–
–
82.8
78.1
ACT-SQL [ 20 ]
GPT-4
EMNLP’23
–
–
–
–
82.9
–
DAIL-SQL [ 7 ]
DS-V3
VLDB’24
–
–
–
–
83.2
77.2
DAIL-SQL [ 7 ]
GPT-4
VLDB’24
–
–
–
–
84.4
75.6
Table 1: Comparative performance on Spider benchmarks.
Method
Data
Model
SF
WH
GH
OL
Easy
Med.
Hard
X-Hard
All
MCS-SQL [ 9 ]
Dev
GPT-4
–
–
–
–
94.0
93.5
88.5
72.9
89.5
DAIL-SQL [ 7 ]
Dev
DS-V3
–
–
–
–
93.5
83.0
83.9
67.5
83.2
[1pt/1pt] SPOC-SQL
Dev
DS-V3
–
–
–
–
95.2
84.3
85.6
74.1
85.5
✓
–
–
–
96.0
90.1
89.1
79.5
89.7
✓
✓
–
–
97.2
91.9
97.1
83.7
92.7
✓
✓
✓
–
97.6
96.6
96.6
87.5
95.4
Table 2: Performance by difficulty on Spider-Dev and Spider-Realistic.
Figure 2: Performance of SPOC-SQL across different datasets and models: Evaluations on DeepSeekV3(DSV3) and Qwen3-72B(QW3) across Spider-Dev(Dev) and Spider-Realistic(Real) Datasets.
Figure 3: Comparison of models on multi-turn QA, single-turn QA, and error-correction QA tasks.
Model
Spider-Dev
Spider-Real.
T2S-MTD
SPOC-SQL
95.6
93.1
84.6
w/o PMDO
93.2
90.1
80.7
w/o RDIM
87.5
84.6
78.4
LoRA-only
83.7
79.8
75.4
Base
80.1
74.5
66.3
Table 3: Ablation study of SPOC-SQL.
Figure 4: Case Study: (a) Decomposition of complex nested queries and set operations; (b) Modular parsing of multi-component SQL queries.
Figure 5: Comparison of SQL Info versions across subjective and objective metrics.
Text-to-SQL enables users to access relational databases via natural language, but real-world settings remain challenging due to coordinated reasoning over complex database environments. Existing systems often use multi-stage pipelines or reasoning models specialized for individual stages. However, fixed pipelines rely on predefined stage orders, limiting their adaptivity to query demands and intermediate evidence. Recent orchestration-based methods provide flexibility by composing specialized modules for each query, but typical plan-then-execute approaches still commit to a complete workflow before execution and cannot adapt to intermediate artifacts and feedback. In this paper, we propose SQLConductor, a step-wise orchestration learning framework for Text-to-SQL. SQLConductor formulates Text-to-SQL subtasks as specialized actions for workflow composition and trains a policy model to select the next action based on intermediate artifacts and feedback. To learn this policy, SQLConductor introduces Search-to-Policy Learning, which uses Monte Carlo Tree Search to explore candidate workflows and stability estimation to identify robust supervision. The policy model is trained with Stability-weighted Supervised Fine-tuning to prioritize high-quality orchestration patterns and further enhanced through Curriculum Reinforcement Learning. This transforms offline workflow search into a deployable policy for step-wise orchestration at inference time. Experiments on BIRD-Dev and out-of-distribution datasets show that SQLConductor achieves superior execution accuracy and strong generalization, reaching 73.2% EX on BIRD-Dev with a compact orchestration policy coordinating frozen larger action models, outperforming prior methods that directly train comparable or larger Text-to-SQL backbones. Further analyses show that the learned policy adapts orchestration to diverse query demands.
Text-to-SQL enables users to query databases using natural language by generating executable SQL queries. Recent methods have increasingly adopted Large Language Models based reinforcement learning (RL) to leverage execution feedback for training. However, existing RL methods assign uniform query-level rewards to all clauses in a SQL query, treating correct and incorrect clauses equally. This coarse-grained reward design leads to insufficient learning signals for correct SQL generation. To address this issue, we propose EXPO-SQL (EXecution-based clause-level Policy Optimization for Text-to-SQL) which provides fine-grained supervision through clause-level rewards. To assign clause-level rewards, our method identifies erroneous clauses by analyzing execution results, including error messages and clause-wise incremental execution. Experiments on widely-used Text-to-SQL benchmarks demonstrate that EXPO-SQL significantly outperforms existing supervised fine-tuning, prompting, and RL-based methods through fine-grained clause-level learning. Our code is available at https://github. com/jhn25/EXPO-SQL.
Jaehoon Lee, CheolWon Na, Suyoung Bae +4
College of Computing and Informatics Sungkyunkwan University, South Korea
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