Preprint / Working Paper2025

BAPPA: Benchmarking Agents, Plans, and Pipelines for Automated Text-to-SQL Generation

Fahim Ahmed, Md Mubtasim Ahasan, Jahir Sadik Monon, Muntasir Wahed, M Ashraful Amin, AKM Rahman, Amin Ahsan Ali

arXiv (Cornell University)

Cornell University, ISBN: 2331-8422

Abstract

Text-to-SQL systems provide a natural language interface that can enable even laymen to access information stored in databases. However, existing Large Language Models (LLM) struggle with SQL generation from natural instructions due to large schema sizes and complex reasoning. Prior work often focuses on complex, somewhat impractical pipelines using flagship models, while smaller, efficient models remain overlooked. In this work, we explore three multi-agent LLM pipelines, with systematic performance benchmarking across a range of small to large open-source models: (1) Multi-agent discussion pipeline, where agents iteratively critique and refine SQL queries, and a judge synthesizes the final answer; (2) Planner-Coder pipeline, where a thinking model planner generates stepwise SQL generation plans and a coder synthesizes queries; and (3) Coder-Aggregator pipeline, where multiple coders independently generate SQL queries, and a reasoning agent selects the best query. Experiments on the Bird-Bench Mini-Dev set reveal that Multi-Agent discussion can improve small model performance, with up to 10.6% increase in Execution Accuracy for Qwen2.5-7b-Instruct seen after three rounds of discussion. Among the pipelines, the LLM Reasoner-Coder pipeline yields the best results, with DeepSeek-R1-32B and QwQ-32B planners boosting Gemma 3 27B IT accuracy from 52.4% to the highest score of 56.4%. Codes are available at https://github.com/treeDweller98/bappa-sql.

Keywords

  • large language models
  • text-to-SQL
  • schema complexity
  • query plan generation
  • query aggregation
  • Benchmarking

CCDS Authors

Fahim Ahmed
Fahim Ahmed

Fahim Ahmed

  • Junior Research Scientist, CCDS

Published at

ECCV, ECAI

Jahir Sadik Monon
Jahir Sadik Monon

Jahir Sadik Monon

  • Alumni, CCDS
  • PhD Student

    University of Massachusetts Amherst, USA

  • BSc

    University of Dhaka, Bangladesh

Muntasir Wahed
https://mmiakashs.github.io/

Muntasir Wahed

  • Collaborator, AI/ML Wing
  • Ph.D Candidate

    University of Illinois Urbana-Champaign, USA

Prof. M Ashraful Amin, PhD
M Ashraful Amin, PhD

Prof. M Ashraful Amin, PhD

  • Founder Director, CCDS
  • Director, AI/ML, HCI & DS Wings

Published at

ACL, CHI, UbiComp, ECAI, WACV, PAKDD, IJCNN, ICPR, ICIP, HCII, CLEF, BLP, Scientific Reports, Pattern Recognition, JMIR, IEEE Access, Smart Agricultural Technology, Frontiers in Computational Neuroscience, Diabetes Research and Clinical Practice, PLOS ONE

Prof. Amin Ahsan Ali, PhD
Amin Ahsan Ali, PhD

Prof. Amin Ahsan Ali, PhD

  • Director, AI/ML Wing
  • Professor

    Department of Computer Science and Engineering

    Independent University, Bangladesh (IUB)

Published at

ACL, CHI, UbiComp, ECCV, IJCAI, ECAI, WACV, IPSN, PAKDD, LREC, IJCNN, ICPR, ICIP, BEA, BLP, ICMLA, Scientific Reports, Scientific Data, Pattern Recognition, Information Sciences, Ad Hoc Networks, Drug and Alcohol Dependence, PLOS ONE