Reward-SQL: Boosting Text-to-SQL via Stepwise Reasoning and Process-Supervised Rewards

Yuxin Zhang, Meihao Fan, Ju Fan, Mingyang Yi, Yuyu Luo +2 more
5/7/2025
cs.CLcs.LG

No official code found. Best implementation: ruc-datalab/RewardSQL (32 stars, MIT, last commit 2025-05-26).

Abstract

Recent advances in large language models (LLMs) have significantly improved performance on the Text-to-SQL task by leveraging their powerful reasoning capabilities. To enhance accuracy during the reasoning process, external Process Reward Models (PRMs) can be introduced during training and inference to provide fine-grained supervision. However, if misused, PRMs may distort the reasoning trajectory and lead to suboptimal or incorrect SQL generation. To address this challenge, we propose Reward-SQL, a framework that systematically explores how to incorporate PRMs into the Text-to-SQL reasoning process effectively. Our approach follows a "cold start, then PRM supervision" paradigm. Specifically, we first train the model to decompose SQL queries into structured stepwise reasoning chains using common table expressions (Chain-of-CTEs), establishing a strong and interpretable reasoning baseline. Then, we investigate four strategies for integrating PRMs, and find that combining PRM as an online training signal (e.g.,GRPO) with PRM-guided inference (e.g., best-of-N sampling) yields the best results. Empirically, on the BIRD benchmark, Reward-SQL enables models supervised by PRM (7B) to achieve a 13.1% performance gain across various guidance strategies. Notably, our GRPO-aligned policy model based on Qwen2.5-Coder-7B-Instruct achieves 68.9% accuracy on the BIRD development set, outperforming all baseline methods under the same model size. These results demonstrate the effectiveness of Reward-SQL in leveraging reward-based supervision for Text-to-SQL reasoning.

View on arXivView PDF

Code Implementations(1)

MIT
321Shell, PythonMay 5, 20251 years agoMIT

Similar Papers

Cite this paper

@article{zhang2025rewardsql,
  title  = {Reward-SQL: Boosting Text-to-SQL via Stepwise Reasoning and Process-Supervised Rewards},
  author = {Yuxin Zhang and Meihao Fan and Ju Fan and Mingyang Yi and Yuyu Luo and Jian Tan and Guoliang Li},
  year   = {2025},
  eprint = {2505.04671},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.04671v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.04671.svg)](https://codeofpaper.com/paper/2505.04671)

Discussion