arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2502.17248cs.DB
收藏

Alpha-SQL:使用蒙特卡洛树搜索的零样本文本到SQL

Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search

Boyan Li, Jiayi Zhang, Ju Fan, Yanwei Xu, Chong Chen, Nan Tang, Yuyu Luo

AI总结:

本文提出Alpha-SQL,将MCTS、LLM动态动作生成与自监督奖励结合,在无需微调的情况下提升零样本Text-to-SQL性能,并在BIRD上超越GPT-4o方法。

摘要:

Text-to-SQL(文本到SQL)支持与数据库进行自然语言交互,是跨多个行业的关键方法。随着每隔几个月就有新的、更强大的大型语言模型(LLM)出现,微调已变得极其昂贵、耗费人力且容易出错。作为替代,零样本Text-to-SQL利用LLM中编码的不断增长的知识和推理能力,而无需进行任务特定微调,因此呈现出一个有前景但也更具挑战性的方向。为应对这一挑战,我们提出Alpha-SQL,这是一种利用蒙特卡洛树搜索(MCTS)框架、基于部分推理状态迭代推断SQL构建动作的新方法。为增强该框架的推理能力,我们引入LLM-as-Action-Model,在MCTS过程中动态生成SQL构建动作,引导搜索转向更有前景的SQL查询。此外,Alpha-SQL采用自监督奖励函数来评估候选SQL查询的质量,从而确保更准确、更高效的查询生成。实验结果表明,在未进行微调的情况下,使用32B开源LLM的Alpha-SQL在BIRD开发集上达到69.7%的执行准确率。在BIRD开发集上,Alpha-SQL比此前基于GPT-4o的最佳零样本方法高出2.5%。

英文摘要:

Text-to-SQL, which enables natural language interaction with databases, serves as a pivotal method across diverse industries. With new, more powerful large language models (LLMs) emerging every few months, fine-tuning has become incredibly costly, labor-intensive, and error-prone. As an alternative, zero-shot Text-to-SQL, which leverages the growing knowledge and reasoning capabilities encoded in LLMs without task-specific fine-tuning, presents a promising and more challenging direction. To address this challenge, we propose Alpha-SQL, a novel approach that leverages a Monte Carlo Tree Search (MCTS) framework to iteratively infer SQL construction actions based on partial reasoning states. To enhance the framework's reasoning capabilities, we introduce LLM-as-Action-Model to dynamically generate SQL construction actions during the MCTS process, steering the search toward more promising SQL queries. Moreover, Alpha-SQL employs a self-supervised reward function to evaluate the quality of candidate SQL queries, ensuring more accurate and efficient query generation. Experimental results show that Alpha-SQL achieves 69.7% execution accuracy on the BIRD development set, using a 32B open-source LLM without fine-tuning. Alpha-SQL outperforms the best previous zero-shot approach based on GPT-4o by 2.5% on the BIRD development set.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑