NAACL 2025findings0 citations

Enhancing Text-to-SQL with Question Classification and Multi-Agent Collaboration

Zhihui Shao, Shubin Cai, Rongsheng Lin, Zhong Ming

Abstract

Large Language Models (LLMs) have recently demonstrated remarkable performance in Text-to-SQL tasks. However, existing research primarily focuses on the optimization of prompts and improvements in workflow, with few studies delving into the exploration of the questions. In this paper, we propose a Text-to-SQL framework based on question classification and multi-agent collaboration (QCMA-SQL). Specifically, we first employ multiple cross-attention mechanisms to train a schema selector to classify questions and select the most suitable database schema. Subsequently, we employ the appropriate agents based on the varying difficulty levels of the questions to generate preliminary SQL queries. Moreover, we implement syntax validation and execution optimization steps to generate final SQL queries. Experimental results on the Spider dataset show that the QCMA-SQL framework achieves an execution accuracy of 87.4%, outperforming state-of-the-art methods. Through ablation studies, we find that classifying the questions ultimately leads to a 2.8% increase in execution accuracy.

BibTeX
@inproceedings{shao-etal-2025-enhancing,
    title = "Enhancing Text-to-{SQL} with Question Classification and Multi-Agent Collaboration",
    author = "Shao, Zhihui  and
      Cai, Shubin  and
      Lin, Rongsheng  and
      Ming, Zhong",
    editor = "Chiruzzo, Luis  and
      Ritter, Alan  and
      Wang, Lu",
    booktitle = "Findings of the Association for Computational Linguistics: NAACL 2025",
    month = apr,
    year = "2025",
    address = "Albuquerque, New Mexico",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.findings-naacl.245/",
    pages = "4340--4349",
    ISBN = "979-8-89176-195-7"
}
Enhancing Text-to-SQL with Question Classification and Multi-Agent Collaboration · NAACL 2025