SF-SQL: A Stage-Free Text-to-SQL Framework Enhanced by Reinforcement Learning
Yang SONG , Shurui KOU , Zimu ZHOU , Qian TAO , Yongxin TONG
Text-to-SQL, which translates natural language into SQL queries, has attracted significant attention in the database community. Recent advances leverage large language models (LLMs) to generate syntactically and semantically correct SQL. However, these approaches typically rely on prompt engineering and rigid multi-stage pipelines, making them sensitive to prompt variations and limiting their generalization across SQL dialects. To address these limitations, we propose SF-SQL, a Stage-Free Text-to-SQL framework enhanced by reinforcement learning. Instead of following a fixed pipeline, SF-SQL formulates SQL generation as a dynamic decision-making process, enabling the LLM to reason about the next action based on the context and execution feedback. To facilitate effective training, we develop a trajectory synthesis strategy that efficiently generates diverse and high-quality reasoning-action sequences. Moreover, SF-SQL proposes a reward scheme that integrates both final and intermediate query-aware signals without incurring additional inference overhead. Our experiments show that SF-SQL achieves 88.73% execution accuracy on Spider and 69.23% on BIRD, demonstrating strong generalization across five types of database dialects.
Text-to-SQL / Large Language Model / Reinforcement Learning / Trajectory Synthesis
Higher Education Press 2026
/
| 〈 |
|
〉 |