Skip to content

Commit 188659b

Browse files
author
peixian ma
committed
v1.0.1 First commit
0 parents  commit 188659b

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

.gitignore

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Folders
2+
data/
3+
models/
4+
logs/
5+
outputs/
6+
results/
7+
wandb/
8+
sh/
9+
openr1_ckpts/
10+
*.wandb
11+
*.out
12+
13+
core
14+
test_all.ipynb
15+
16+
17+
# Python
18+
__pycache__/
19+
*.py[cod]
20+
*$py.class
21+
*.so
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
*.egg-info/
36+
.installed.cfg
37+
*.egg
38+
39+
# IDE
40+
.idea/
41+
.vscode/
42+
*.swp
43+
*.swo
44+
45+
# 环境和依赖
46+
venv/
47+
env/
48+
.env
49+
.venv
50+
ENV/
51+
env.bak/
52+
venv.bak/
53+
.python-version
54+
55+
# 日志和缓存
56+
*.log
57+
logs/
58+
.cache
59+
.pytest_cache/
60+
.coverage
61+
htmlcov/
62+
63+
# 数据和模型文件
64+
data/
65+
*.pkl
66+
*.h5
67+
*.pt
68+
*.pth
69+
*.bin
70+
*.ckpt
71+
*.model
72+
results/
73+
74+
# 系统文件
75+
.DS_Store
76+
Thumbs.db
77+
78+
# 配置文件
79+
config.ini
80+
secrets.json
81+
credentials.json
82+
*.config
83+
84+
# 临时文件
85+
tmp/
86+
temp/
87+
.temp/
88+
*.tmp

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<div align="center">
2+
<h1>SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning</h1>
3+
</div>
4+
5+
<div align="center" style="display: flex; gap: 5px; justify-content: center;">
6+
<a href="https://github.com/IDEA-FinAI/SQL-R1"><img src="https://img.shields.io/badge/🏠_Homepage-SQL--R1-4B4B77?style=flat-square"/></a>
7+
<a href="https://arxiv.org/abs/2504.08600"><img src="https://img.shields.io/badge/📑_arXiv-2504.08600-00A98F?style=flat-square"/></a>
8+
<a href="https://github.com/IDEA-FinAI/SQL-R1"><img src="https://img.shields.io/badge/⭐_GitHub-IDEA--FinAI/SQL--R1-2F80ED?style=flat-square"/></a>
9+
<!-- <a href="https://github.com/IDEA-FinAI/SQL-R1"><img src="https://img.shields.io/badge/🤗_HuggingFace-Models-FF9D00?style=flat-square"/></a> -->
10+
<a href="https://github.com/IDEA-FinAI/SQL-R1/stargazers"><img src="https://img.shields.io/github/stars/IDEA-FinAI/SQL-R1?style=flat-square&color=946CE6"/></a>
11+
</div>
12+
13+
## Overview
14+
15+
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 67.1\% on the benchmark Spider and BIRD, respectively.
16+
17+
<div align="center">
18+
<img src="images/overview.png" alt="SQL-R1 Overview" width="800"/>
19+
</div>
20+
21+
## 🚀 Coming Soon Checklist
22+
23+
- [ ] 📊 Release model weights on Hugging Face
24+
- [ ] 🔧 Open source training code
25+
- [ ] 📝 Detailed documentation
26+
27+
28+
## Citations
29+
```
30+
@article{ma2025sql,
31+
title={SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learning},
32+
author={Ma, Peixian and Zhuang, Xialie and Xu, Chengjin and Jiang, Xuhui and Chen, Ran and Guo, Jian},
33+
journal={arXiv preprint arXiv:2504.08600},
34+
year={2025}
35+
}
36+
```
37+
38+
39+
40+
41+
42+

images/overview.png

2.11 MB
Loading

0 commit comments

Comments
 (0)