Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

SQL-o1: A Self-Reward Heuristic Dynamic Search Method for Text-to-SQL

About

Text-to-SQL (Text2SQL) aims to map natural language questions to executable SQL queries. Although large language models (LLMs) have driven significant progress, current approaches struggle with poor transferability to open-source LLMs, limited robustness against logic and function errors in complex queries, and inefficiencies in structured search. We introduce SQL-o1, a self-reward-driven heuristic search framework built on an agent-based architecture to enhance model reasoning capabilities. SQL-o1 leverages Monte Carlo Tree Search (MCTS) for structured, multi-step exploration, and incorporates a dynamic pruning strategy to accelerate inference without sacrificing accuracy. On the Spider and Bird benchmarks, SQL-o1 achieves a +10.8 execution accuracy improvement on the complex Bird dataset, surpassing even GPT-4-based models. Notably, it exhibits strong few-shot generalization and robust cross-model transferability across open-source LLMs. Our code is available at:https://github.com/ShuaiLyu0110/SQL-o1.

Shuai Lyu, Haoran Luo, Ripeng Li, Zhonghong Ou, Jiangfeng Sun, Yang Qin, Xiaoran Shang, Meina Song, Yifan Zhu• 2025

Related benchmarks

TaskDatasetResultRank
Text-to-SQLBIRD (dev)
Execution Accuracy (EA)67.21
387
Text-to-SQLSpider (test)--
213
Text-to-SQLSpider (dev)
EX87.4
147
Text-to-SQLSpider
Exec Acc (All)86.54
139
Text-to-SQLSpider-DK
Execution Accuracy (EX)78.7
95
Text-to-SQLSpider-Syn
Execution Accuracy (EX)77.6
79
Text-to-SQLLogicCat
Exact Match17.91
58
Text-to-SQLSpider-Realistic
Execution Accuracy (EX)82.7
47
Text-to-SQLArcher (dev)
Execution Accuracy28.78
36
Showing 9 of 9 rows

Other info

Follow for update