ICML 2025

Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search
Boyan Li 1 Jiayi Zhang 1 Ju Fan 2 Yanwei Xu 3 Chong Chen 3 Nan Tang 1 Yuyu Luo 1
Abstract
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) emerg-
ing 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 reason-
ing capabilities encoded in LLMs without task-
specific fine-tuning, presents a promising and
more challenging direction. To address this chal-
lenge, 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 dynami-
cally 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 gener-
ation. 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. The
code is available at https://github.com/
HKUSTDial/Alpha-SQL.
1. Introduction
Text-to-SQL (a.k.a. NL2SQL) converts natural language
queries into SQL, simplifying access to relational databases
1The Hong Kong University of Science and Technology
(Guangzhou) 2Renmin University of China 3Huawei Technologies
Ltd. Correspondence to: Yuyu Luo <yuyuluo@hkust-gz.edu.cn>.
Proceedings of the 42 nd International Conference on Machine
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025
...