用细粒度奖励提升小模型文本转SQL能力,效果超越大模型
Think2SQL: Reinforce LLM Reasoning Capabilities for Text2SQL
- 引入可验证奖励机制,通过部分正确性评分引导模型
- 140亿参数模型在复杂数据集上超越4000亿参数大模型
- 适合想用小模型做高精度数据库查询的开发者
大型语言模型可将自然语言转为SQL,但小模型在零样本场景下处理多表复杂查询能力不足。虽监督微调(SFT)有帮助,但在难题上仍表现有限。本文研究不同推理策略对文本转SQL性能的影响:零样本下的通用推理、SFT中的推理轨迹,以及基于可验证奖励的强化学习(RLVR)与新奖励函数。结果表明,通过SQL执行计算的部分得分奖励对引导模型极为关键,即使输出不完全正确也能提供有效信号。细粒度反馈使模型表现持续提升。小模型尤其受益于推理感知的SFT和强化学习,在BIRD等挑战性数据集上,140亿参数的Qwen-Coder-2.5超越4000亿以上参数模型。
原文摘要 · Abstract (English)
Large Language Models (LLMs) can translate natural language into SQL, but small models struggle with multi-table and complex queries in Zero-Shot Learning (ZSL) settings. While Supervised Fine-Tuning (SFT) helps, it falls short for harder cases. To address this, we study how different reasoning strategies (general-purpose reasoning in ZSL, reasoning traces in SFT, and Reinforcement Learning with Verifiable Reward (RLVR) with novel reward functions) affect Text2SQL performance across four benchmarks. We show that partial scoring rewards, computed via SQL execution, are crucial for guiding models even when outputs are not fully correct. These fine-grained signals lead to consistently better Text2SQL outcomes. Small LLMs benefit most from reasoning-aware SFT and RL, with the 14B Qwen-Coder-2.5 surpassing 400B+ models on challenging datasets like BIRD.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。