用定制奖励提升大模型文本转SQL的推理能力。
Reasoning-SQL: Reinforcement Learning with SQL Tailored Partial Rewards for Reasoning-Enhanced Text-to-SQL
- 设计了四种针对文本转SQL的局部奖励机制。
- 14B模型在BIRD上超越更大商用模型3%-4%。
- 适合想提升大模型逻辑推理能力的研究者。
文本转SQL是一项涉及多步推理的任务,包括自然语言理解、数据库模式理解与精确的SQL生成。现有方法依赖人工设计的推理路径,限制了性能。受DeepSeek R1和OpenAI o1等推理增强模型启发,我们提出专为文本转SQL设计的局部奖励集,包含模式链接、AI反馈、n-gram相似度和语法检查,以缓解强化学习中的奖励稀疏问题。结合组相对策略优化(GRPO),该方法促使大语言模型发展出生成准确SQL所需的内在推理能力。在不同规模模型上,仅用强化学习训练即达到比监督微调更高的准确率与泛化能力。值得注意的是,我们的140亿参数模型在BIRD基准上显著优于更大的商用模型:比o3-mini高4%,比Gemini-1.5-Pro-002高3%。这验证了基于局部奖励的强化学习框架在提升文本转SQL准确性与推理能力上的有效性。
原文摘要 · Abstract (English)
Text-to-SQL is a challenging task involving multiple reasoning-intensive subtasks, including natural language understanding, database schema comprehension, and precise SQL query formulation. Existing approaches often rely on handcrafted reasoning paths with inductive biases that can limit their overall effectiveness. Motivated by the recent success of reasoning-enhanced models such as DeepSeek R1 and OpenAI o1, which effectively leverage reward-driven self-exploration to enhance reasoning capabilities and generalization, we propose a novel set of partial rewards tailored specifically for the Text-to-SQL task. Our reward set includes schema-linking, AI feedback, n-gram similarity, and syntax check, explicitly designed to address the reward sparsity issue prevalent in reinforcement learning (RL). Leveraging group relative policy optimization (GRPO), our approach explicitly encourages large language models (LLMs) to develop intrinsic reasoning skills necessary for accurate SQL query generation. With models of different sizes, we demonstrate that RL-only training with our proposed rewards consistently achieves higher accuracy and superior generalization compared to supervised fine-tuning (SFT). Remarkably, our RL-trained 14B-parameter model significantly outperforms larger proprietary models, e.g. o3-mini by 4% and Gemini-1.5-Pro-002 by 3% on the BIRD benchmark. These highlight the efficacy of our proposed RL-training framework with partial rewards for enhancing both accuracy and reasoning capabilities in Text-to-SQL tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。