SQL-R1: Training Natural Language to SQL Reasoning Model By
  Reinforcement Learning
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 inference 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 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 66.6% on the benchmark Spider
and BIRD, respectively, only using the 7B base model.
67fc9e72b2383c63dc413dcb
Peixian Ma
claimed_verified
2025-05-08T08:59:56.900Z
663e29ddc0ce43e121c80f92
https://cdn-avatars.huggingface.co/v1/production/uploads/663e29ddc0ce43e121c80f92/jEAQa2oLCRUpiFEhTy0nK.jpeg
Peixian Ma
user
MPX0222forHF
67fc9e72b2383c63dc413dcc
Xialie Zhuang
claimed_verified
2025-04-14T09:46:23.810Z
6575a625b951d40e7a4d8685
https://cdn-avatars.huggingface.co/v1/production/uploads/6575a625b951d40e7a4d8685/mcnyqU--r-vi11aXN02cZ.jpeg
Lie
user
Lie24
67fc9e72b2383c63dc413dcd
Chengjin Xu
67fc9e72b2383c63dc413dce
Xuhui Jiang
67fc9e72b2383c63dc413dcf
Ran Chen
67fc9e72b2383c63dc413dd0
Jian Guo
SQL-R1: Training Natural Language to SQL Reasoning Model By
  Reinforcement Learning
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 inference 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 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 66.6% on the benchmark Spider
and BIRD, respectively, only using the 7B base model.
A novel NL2SQL model named SQL-R1 leverages reinforcement learning to improve reasoning in complex scenarios, achieving high accuracy with minimal data.
supervised fine-tuning reinforcement learning rewards function cold start synthetic data data engineering