SQL-ASTRA: Alleviating Sparse Feedback in Agentic SQL via Column-Set Matching and Trajectory Aggregation
Organizations: Griffith University, Brisbane, Australia · Fudan University, Shanghai, China · Shanghai Innovation Institute, China · The University of Hong Kong, Hong Kong, China ·
Abstract
Agentic Reinforcement Learning (RL) shows promise for complex tasks, but Text-to-SQL remains mostly restricted to single-turn paradigms. A primary bottleneck is the credit assignment problem. In traditional paradigms, rewards are determined solely by the final-turn feedback, which ignores the intermediate process and leads to ambiguous credit evaluation. To address this, we propose Agentic SQL, a framework featuring a universal two-tiered reward mechanism designed to provide effective trajectory-level evaluation and dense step-level signals. First, we introduce Aggregated Trajectory Reward (ATR) to resolve multi-turn credit assignment. Using an asymmetric transition matrix, ATR aggregates process-oriented scores to incentivize continuous improvement. Leveraging Lyapunov stability theory, we prove ATR acts as an energy dissipation operator, guaranteeing a cycle-free policy and monotonic convergence. Second, Column-Set Matching Reward (CSMR) provides immediate step-level rewards to mitigate sparsity. By executing queries at each turn, CSMR converts binary (0/1) feedback into dense [0, 1] signals based on partial correctness. Evaluations on BIRD show a 5% gain over binary-reward GRPO. Notably, our approach outperforms SOTA Arctic-Text2SQL-R1-7B on BIRD and Spider 2.0 using identical models, propelling Text-to-SQL toward a robust multi-turn agent paradigm.
Figures & tables
| Model | RL Data | Base Model | Bird (Greedy) | Spider-Dev (Greedy) | Spider2.0-Lite (Mj@8) |
|---|---|---|---|---|---|
| GPT-4o | — | — | 64.4 | 80.4 | 15.6 |
| Deepseek-V3 | — | — | 62.5 | 78.3 | 15.6 |
| Qwen2.5-7B-Instruct Team (2024) | — | - | 47.5 | 74.7 | 5.1 |
| Qwen2.5-Coder-7B Team (2024) | — | - | 58.2 | 77.4 | 2.2 |
| SQL-R1 + Qwen2.5-Coder-7B Ma et al. (2025) | SynSQL-Complex-5K | Qwen2.5-Coder-7B | 63.1 | 84.5 | - |
| Reasoning-SQL-7B Ma et al. (2025) | BIRD | Qwen2.5-Coder-7B | 64.0 | 78.7 | - |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Hyperparameter | Value |
|---|---|
| Batch Size | 128 |
| Learning Rate | 1e-6 |
| Rollout Temperature | 1.0 |
| Rollout Top-p | 0.95 |
| Validation Temperature | 0.6 / 1.0 |
| Validation Top-p | 0.95 |
| Model | Turn 1 | Turn 2 | Turn 3 |
|---|---|---|---|
| Single-Turn GRPO | 59.4 | - | - |
| Agentic SQL | 62.2 | 66.0 | 39.5 |
| Agentic SQL + ATR | 72.7 | 71.0 | 36.2 |
| Model | Bird-Dev |
|---|---|
| Single-Turn GRPO | |
| 59.2 | |
| 60.1 | |
| 59.4 |
Text-to-SQL
Text-to-SQL translates natural-language questions into executable database queries, linking user intent to schemas, values, and SQL logic.
See all 173 papers