Lune

NeurIPS2025Top-tier venue

SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning

Peixian Ma, Xialie Zhuang, Chengjin Xu, Xuhui Jiang, Ran Chen, Jian Guo

Abstract

Natural Language to SQL (NL2SQL) enables intuitive interactions with databases by transforming natural language queries into structured SQL statements. Despite recent advancements in enhancing human-computer interaction within database applications, significant challenges persist, particularly regarding the reasoning performance in complex scenarios involving multi-table joins and nested queries. Current methodologies primarily utilize supervised fine-tuning (SFT) to train the NL2SQL model, which may limit adaptability and interpretability in new environments (e.g., finance and healthcare). In order to enhance the reasoning performance of the NL2SQL model in the above complex situations, we introduce SQL-R1, a novel NL2SQL reasoning model trained by the reinforcement learning (RL) algorithms. We design a specialized RL-based reward function tailored for NL2SQL tasks and discussed the impact of cold start and synthetic data on the effectiveness of intensive training. In addition, we achieve competitive accuracy using only a tiny amount of synthetic NL2SQL data for augmented training and further explore data engineering for RL. In existing experiments, SQL-R1 achieves execution accuracy of 88.6% and 67.1% on the benchmark Spider and BIRD, respectively. The code is available at https://github.com/IDEA-FinAI/SQL-R1 .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

20 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQL cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • Vision-R1: Incentivizing Reasoning Capability in Multimodal Large Language Models cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Reward-SQL: Boosting Text-to-SQL via Stepwise Execution-Aware Reasoning and Process-Supervised Rewards cites RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQL
  • Reward-SQL: Boosting Text-to-SQL via Stepwise Execution-Aware Reasoning and Process-Supervised Rewards cites DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-Correction
  • Reward-SQL: Boosting Text-to-SQL via Stepwise Execution-Aware Reasoning and Process-Supervised Rewards cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Reward-SQL: Boosting Text-to-SQL via Stepwise Execution-Aware Reasoning and Process-Supervised Rewards cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers20

  1. Nemotron-Research-Tool-N1: Exploring Tool-Using Language Models with Reinforced ReasoningShaokun Zhang, Yi Dong, Jieyu Zhang, Jan Kautz et al.ICLR 2026 · 61 citations
  2. Graph-R1: Towards Agentic GraphRAG Framework via End-to-end Reinforcement LearningHaoran Luo, Haihong E, Guanting Chen, Qika Lin et al.ICML 2026 · 50 citations
  3. Reward-SQL: Boosting Text-to-SQL via Stepwise Execution-Aware Reasoning and Process-Supervised RewardsYuxin Zhang, Meihao Fan, Ju Fan, Mingyang Yi et al.SIGMOD 2026 · 24 citations
  4. SQLens: An End-to-End Framework for Error Detection and Correction in Text-to-SQLYue Gong, Chuan Lei, Xiao Qin, Kapil Vaidya et al.NeurIPS 2025 · 21 citations
  5. Scaling Generalist Data-Analytic AgentsShuofei Qiao, Yanqiu Zhao, Zhisong Qiu, Xiaobin Wang et al.ICLR 2026 · 12 citations

Builds on22

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. DIN-SQL: Decomposed In-Context Learning of Text-to-SQL with Self-CorrectionMohammadreza Pourreza, Davood RafieiNeurIPS 2023 · 909 citations
  3. Vision-R1: Incentivizing Reasoning Capability in Multimodal Large Language ModelsWenxuan Huang, Bohan Jia, Shaosheng Cao, Zheyu Ye et al.ICLR 2026 · 670 citations
  4. Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun et al.VLDB 2024 · 609 citations
  5. RESDSQL: Decoupling Schema Linking and Skeleton Parsing for Text-to-SQLHaoyang Li, Jing Zhang, Cuiping Li, Hong ChenAAAI 2023 · 343 citations

Related papers

  1. Arctic-Text2SQL-R1: Simple Rewards, Strong Reasoning in Text-to-SQLZhewei Yao, Guoheng Sun, Lukasz Borchmann, Zheyu Shen et al.ACL Findings 2026 · 4 citations
  2. ReEx-SQL: Reasoning with Execution-Aware Reinforcement Learning for Text-to-SQLYaxun Dai, Wenxuan Xie, Xialie Zhuang, Tianyu Yang et al.ACL 2026 · 8 citations
  3. EXPO-SQL: Execution-based Clause-level Policy Optimization for Text-to-SQLJaehoon Lee, CheolWon Na, Suyoung Bae, Jin-Seop Lee et al.ACL Findings 2026 · 1 citation
  4. STaR-SQL: Self-Taught Reasoner for Text-to-SQLMingqian He, Yongliang Shen, Wenqi Zhang, Qiuying Peng et al.ACL 2025
  5. Learning SQL Like a Human: Structure-Aware Curriculum Learning for Text-to-SQL GenerationXiaohu Zhu, Qian Li, Lizhen Cui, Yuntao DuEMNLP Findings 2025
Dusk over the sea between two cliffs drawn in fine vertical lines