Monte Carlo Tree Search with Reasoning Path Refinement for Small Language Models in Conversational Text-to-NoSQL
Xubang Xiong, Raymond Chi-Wing Wong, Yuanfeng Song
TL;DR
This work tackles the challenge of conversational, multi-turn NoSQL querying by introducing Stage-MCTS, a framework that endows small language models with NoSQL-specific reasoning through Monte Carlo Tree Search–guided data augmentation, progressive supervised fine-tuning, and iterative self-training. It frames NoSQL query generation as a search over executable stages, using stage-augmented Chain-of-Thoughts to produce interpretable, actionable steps, and employs a rule-based reward to steer data collection. The authors construct CoNoSQL, a large cross-domain dataset with over 2,000 dialogues and 150 databases, to evaluate generalization across schemas and domains. Empirical results show Stage-MCTS outperforming state-of-the-art large reasoning models in Execution Value Match by up to 7.93%, with a 7B-parameter backbone achieving performance comparable to larger models, demonstrating that carefully designed reasoning and training strategies can close the gap between small and large models for NoSQL query generation. The approach promises practical impact for accessible, context-aware data exploration in NoSQL ecosystems and lays groundwork for integrating conversational query systems into broader data analytics workflows.
Abstract
NoSQL databases have been widely adopted in big data analytics, geospatial applications, and healthcare services, due to their flexibility and scalability. However, querying NoSQL databases requires specialized technical expertise, creating a high barrier for users. While recent studies have explored text-to-NoSQL problem, they primarily focus on single-turn interactions, ignoring the conversational nature of real-world queries. To bridge this gap, we introduce the Conversational Text-to-NoSQL task, which generates NoSQL queries given a natural language question, a NoSQL database, and the dialogue history. To address this task, we propose Stage-MCTS, a framework that endows small language models (SLMs) with NoSQL-specific reasoning capabilities by formulating query generation as a search problem. The framework employs Monte Carlo Tree Search (MCTS) guided by a rule-based reward to produce stepwise reasoning data, followed by progressive supervised fine-tuning (SFT) and self-training strategies. We further construct CoNoSQL, a cross-domain dataset with over 2,000 dialogues and 150 databases, to support evaluation. Experiments demonstrate that our approach outperforms state-of-the-art large reasoning models, improving execution value match (EVM) accuracy by up to 7.93%.
