End-to-End Text-to-SQL with Dataset Selection: Leveraging LLMs for Adaptive Query Generation

Anurag Tripathi, Vaibhav Patle, Abhinav Jain, Ayush Pundir, Sairam Menon +2 more
8/8/2025
cs.LGcs.AI

No confident code implementation found for this paper. 5 possible matches can be shown below.

Abstract

Text-to-SQL bridges the gap between natural language and structured database language, thus allowing non-technical users to easily query databases. Traditional approaches model text-to-SQL as a direct translation task, where a given Natural Language Query (NLQ) is mapped to an SQL command. Recent advances in large language models (LLMs) have significantly improved translation accuracy, however, these methods all require that the target database is pre-specified. This becomes problematic in scenarios with multiple extensive databases, where identifying the correct database becomes a crucial yet overlooked step. In this paper, we propose a three-stage end-to-end text-to-SQL framework to identify the user's intended database before generating SQL queries. Our approach leverages LLMs and prompt engineering to extract implicit information from natural language queries (NLQs) in the form of a ruleset. We then train a large db\_id prediction model, which includes a RoBERTa-based finetuned encoder, to predict the correct Database identifier (db\_id) based on both the NLQ and the LLM-generated rules. Finally, we refine the generated SQL by using critic agents to correct errors. Experimental results demonstrate that our framework outperforms the current state-of-the-art models in both database intent prediction and SQL generation accuracy.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 5 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tripathi2025endtoend,
  title  = {End-to-End Text-to-SQL with Dataset Selection: Leveraging LLMs for Adaptive Query Generation},
  author = {Anurag Tripathi and Vaibhav Patle and Abhinav Jain and Ayush Pundir and Sairam Menon and Ajeet Kumar Singh and Dorien Herremans},
  year   = {2025},
  eprint = {2508.06387},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.06387v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.06387.svg)](https://codeofpaper.com/paper/2508.06387)

Discussion