Multi-Turn Interactions for Text-to-SQL with Large Language Models
Guanming Xiong, Junwei Bao, Hongfei Jiang, Yang Song, Wen Zhao
TL;DR
This work introduces Interactive-T2S, a multi-turn, tool-assisted framework for text-to-SQL that treats the LLM as an agent interacting with a database environment. By leveraging four general tools—SearchColumn, SearchValue, FindShortestPath, and ExecuteSQL—the approach enables efficient schema linking, cell-value localization, and scalable table joins while maintaining an interpretable reasoning process. With just two exemplars, Interactive-T2S achieves competitive results across Spider variants and state-of-the-art performance on BIRD without oracle knowledge, demonstrating strong generalization and efficiency, particularly in wide-table scenarios. The study also analyzes the challenges of cell-value localization, token efficiency, and error types, providing insights into practical deployment and future improvements for real-world databases.
Abstract
This study explores text-to-SQL parsing by leveraging the powerful reasoning capabilities of large language models (LLMs). Despite recent advancements, existing LLM-based methods are still inefficient and struggle to handle cases with wide tables effectively. Furthermore, current interaction-based approaches either lack a step-by-step, interpretable SQL generation process or fail to provide a universally applicable interaction design. To address these challenges, we introduce Interactive-T2S, a framework that generates SQL queries through direct interactions with databases. This framework includes four general tools that facilitate proactive and efficient information retrieval by the LLM. Additionally, we have developed detailed exemplars to demonstrate the step-wise reasoning processes within our framework. Our approach achieves advanced performance on the Spider and BIRD datasets as well as their variants. Notably, we obtain state-of-the-art results on the BIRD leaderboard under the setting without oracle knowledge, demonstrating the effectiveness of our method.
