Lune

AAAI2026Top-tier venue

MCTS-SQL: Light-Weight LLMs Can Master the Text-to-SQL Through Monte Carlo Tree Search

Shuozhi Yuan, Liming Chen, Miaomiao Yuan, Jin Zhao

Abstract

Text-to-SQL is a fundamental yet challenging task in the NLP area, aiming at translating natural language questions into SQL queries. While recent advances in large language models have greatly improved performance, most existing approaches depend on models with tens of billions of parameters or costly APIs, limiting their applicability in resource-constrained environments. For real world, especially on edge devices, it is crucial for Text-to-SQL to ensure cost-effectiveness. Therefore, enabling the light-weight models for Text-to-SQL is of great practical significance. However, smaller LLMs often struggle with complicated user instruction, redundant schema linking or syntax correctness. To address these challenges, we propose MCTS-SQL, a novel framework that uses Monte Carlo Tree Search to guide SQL generation through multi-step refinement. Since the light-weight models' weak performance of single-shot prediction, we generate better results through several trials with feedback. However, directly applying MCTS-based methods inevitably leads to significant time and computational overhead. Driven by this issue, we propose a token-level prefix-cache mechanism that stores prior information during iterations, effectively improved the execution speed. Experiments results on the SPIDER and BIRD benchmarks demonstrate the effectiveness of our approach. Using a small open-source Qwen2.5-Coder-1.5B, our method outperforms ChatGPT-3.5. When leveraging a more powerful model Gemini 2.5 to explore the performance upper bound, we achieved results competitive with the SOTA. Our findings demonstrate that even small models can be effectively deployed in practical Text-to-SQL systems with the right strategy.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • LEAF-SQL: Level-Wise Exploration with Adaptive Fine-Graining for Text-to-SQL Skeleton Prediction cites Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search
  • LEAF-SQL: Level-Wise Exploration with Adaptive Fine-Graining for Text-to-SQL Skeleton Prediction cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation cites Semantic Evaluation for Text-to-SQL with Distilled Test Suites
  • AlphaMath Almost Zero: Process Supervision without Process cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Addressing Semantic Blind Spots in Text-to-SQL via Component Pre-generation and AST Matching Rewards cites Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree Search
  • Addressing Semantic Blind Spots in Text-to-SQL via Component Pre-generation and AST Matching Rewards cites Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluation
  • Addressing Semantic Blind Spots in Text-to-SQL via Component Pre-generation and AST Matching Rewards cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. LEAF-SQL: Level-Wise Exploration with Adaptive Fine-Graining for Text-to-SQL Skeleton PredictionZhao Tan, Xiping Liu, Qing Shu, Qizhi Wan et al.ICDE 2026
  2. Addressing Semantic Blind Spots in Text-to-SQL via Component Pre-generation and AST Matching RewardsXingyu Ma, Xin Tian, Lingxiang Wu, Xuepeng Wang et al.ICML 2026

Builds on6

  1. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  2. Text-to-SQL Empowered by Large Language Models: A Benchmark EvaluationDawei Gao, Haibin Wang, Yaliang Li, Xiuyu Sun et al.VLDB 2024 · 609 citations
  3. AlphaMath Almost Zero: Process Supervision without ProcessGuoxin Chen, Minpeng Liao, Chengxi Li, Kai FanNeurIPS 2024 · 219 citations
  4. Semantic Evaluation for Text-to-SQL with Distilled Test SuitesRuiqi Zhong, Tao Yu, Dan KleinEMNLP 2020 · 88 citations
  5. Alpha-SQL: Zero-Shot Text-to-SQL using Monte Carlo Tree SearchBoyan Li, Jiayi Zhang, Ju Fan, Yanwei Xu et al.ICML 2025

Related papers

  1. CodeS: Towards Building Open-source Language Models for Text-to-SQLHaoyang Li, Jing Zhang, Hanbing Liu, Ju Fan et al.SIGMOD 2024 · 124 citations
  2. MARS-SQL: A Multi-Agent Reinforcement Learning Framework For Text-To-SQLHaolin Yang, Jipeng Zhang, Zhitao He, Alexander Zhou et al.ICML 2026 · 12 citations
  3. Cracking Query Bottlenecks: Towards Efficiency-Oriented Text-to-SQL GenerationLi Lin, Yunfeng Shen, Lingfeng Bao, Rongxin Wu et al.ISSTA 2026
  4. OmniSQL: Synthesizing High-quality Text-to-SQL Data at ScaleHaoyang Li, Shang Wu, Xiaokang Zhang, Xinmei Huang et al.VLDB 2025 · 90 citations
  5. ACT-SQL: In-Context Learning for Text-to-SQL with Automatically-Generated Chain-of-ThoughtHanchong Zhang, Ruisheng Cao, Lu Chen, Hongshen Xu et al.EMNLP Findings 2023 · 54 citations
Dusk over the sea between two cliffs drawn in fine vertical lines