STaR-SQL:面向 Text-to-SQL 的自学推理器
STaR-SQL: Self-Taught Reasoner for Text-to-SQL
AI总结:
提出 STaR-SQL,通过推理依据微调与 ORM 验证增强 text-to-SQL,在 Spider 上以 86.6% 执行准确率显著超越多种基线。
摘要:
生成逐步的“思维链”推理依据已被证明可有效提升大型语言模型在复杂推理任务上的表现。然而,将此类技术应用于 text-to-SQL 等结构化任务仍基本未被探索。本文提出 Self-Taught Reasoner for text-to-SQL(STaR-SQL),这是一种将 SQL 查询生成重构为推理驱动过程的新方法。该方法提示 LLM 为 SQL 查询生成详细推理步骤,并在能导向正确结果的推理依据上对其进行微调。与传统方法不同,STaR-SQL 在测试时投入额外计算用于推理,从而使 LLM 成为自发推理者,而不仅仅是基于提示的智能体。为进一步扩展推理过程,我们引入结果监督奖励模型(ORM)作为验证器,以提高 SQL 查询准确率。在具有挑战性的 Spider 基准上的实验结果表明,STaR-SQL 显著提升了 text-to-SQL 性能,执行准确率达到 86.6%,分别比少样本基线和直接预测答案的微调基线高出 31.6% 和 18.0%。此外,STaR-SQL 优于使用 GPT-4 等更强大但闭源模型的类智能体提示方法。这些发现凸显了推理增强训练在结构化任务中的潜力,并为将自我改进推理模型扩展到 text-to-SQL 生成及其他领域打开了大门。
英文摘要:
Generating step-by-step "chain-of-thought" rationales has proven effective for improving the performance of large language models on complex reasoning tasks. However, applying such techniques to structured tasks, such as text-to-SQL, remains largely unexplored. In this paper, we introduce Self-Taught Reasoner for text-to-SQL (STaR-SQL), a novel approach that reframes SQL query generation as a reasoning-driven process. Our method prompts the LLM to produce detailed reasoning steps for SQL queries and fine-tunes it on rationales that lead to correct outcomes. Unlike traditional methods, STaR-SQL dedicates additional test-time computation to reasoning, thereby positioning LLMs as spontaneous reasoners rather than mere prompt-based agents. To further scale the inference process, we incorporate an outcome-supervised reward model (ORM) as a verifier, which enhances SQL query accuracy. Experimental results on the challenging Spider benchmark demonstrate that STaR-SQL significantly improves text-to-SQL performance, achieving an execution accuracy of 86.6%. This surpasses a few-shot baseline by 31.6% and a baseline fine-tuned to predict answers directly by 18.0%. Additionally, STaR-SQL outperforms agent-like prompting methods that leverage more powerful yet closed-source models such as GPT-4. These findings underscore the potential of reasoning-augmented training for structured tasks and open the door to extending self-improving reasoning models to text-to-SQL generation and beyond.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。