Skip to content

Towards Optimizing SQL Generation via LLM Routing

Nov 2024 · arXiv.org · Vol abs/2411.04319 · 10 citations · ⚡ 1 influential · 15 references
Computer Science

TL;DR

This paper introduces the first LLM routing approach for Text-to-SQL, which dynamically selects the most cost-effective LLM capable of generating accurate SQL for each query.

Abstract

Text-to-SQL enables users to interact with databases through natural language, simplifying access to structured data. Although highly capable large language models (LLMs) achieve strong accuracy for complex queries, they incur unnecessary latency and dollar cost for simpler ones. In this paper, we introduce the first LLM routing approach for Text-to-SQL, which dynamically selects the most cost-effective LLM capable of generating accurate SQL for each query. We present two routing strategies (score- and classification-based) that achieve accuracy comparable to the most capable LLM while reducing costs. We design the routers for ease of training and efficient inference. In our experiments, we highlight a practical and explainable accuracy-cost trade-off on the BIRD dataset.

View source

Similar papers

Open access Sep 2026

Comparison of AI agents for creating SQL queries

Large language models have been increasingly applied for Text-to-SQL tasks recently, due to the fact that generating correct SQL queries is the most important factor. This study presents a comparison of AI agents based on open-source and closed-source large language models for generating SQL queries. GPT-4o, Claude 3.7...

Julia Sierpień, M. Skublewska-Paszkowska · 0 citations
Open access Oct 2026

Cracking Query Bottlenecks: Towards Efficiency-Oriented Text-to-SQL Generation

Text-to-SQL models translate natural language questions into SQL, enabling non-technical users to access databases. However, most existing research focuses on correctness, neglecting query efficiency. In this paper, we address the challenge of evaluating the execution efficiency of generated SQL in Text-to-SQL by intro...

Li Lin, Yun-Feng Shen, Ling-Feng Bao et al. · 0 citations

LIMIT: Less Is More for Instruction Tuning in Text-to-SQL

LIMIT(Less Is More for Instruction Tuning in Text-to-SQL), a data-centric framework that demonstrates strong database reasoning can emerge from an extremely compact training set when examples are strategically selected, is proposed, suggesting that careful data curation, rather than scale, is the key to efficient Text-...

Hao-Yuan Ma, Heng-Wei Liu, Lin-Juan Wu et al. · 0 citations
Open access Oct 2026

LLM-Driven Query Planning for Intelligent Access to Structured and Semi-Structured Data

This paper addresses intelligent access to structured and semi-structured data using large language models (LLMs). We develop an approach to LLM-driven query planning in which a user’s information need is handled as a sequence of interdependent operations: query analysis, grounding in data sources and the schema, plan...

Mykola Khoroshevskyi · 0 citations
#natural language process... Preprint Oct 2026

AptMQL-Bench: From Text-to-SQL to Text-to-MQL via Access-Pattern Schema Design and Data-Preserving Migration

A conversion pipeline is proposed, driven by coding agents with human-in-the-loop verification, that designs each document schema from expected access patterns and rewrites queries to be MongoDB-native, and builds an access-pattern-based text-to-MQL benchmark (AptMQL-Bench).

Hy Nguyen, Nabi Rezvani, Robin Vujanic · 0 citations

Related blog posts

MIT News · Artificial Intelligence Sep 29, 2026

Who we become when we talk to machines

Professor Sherry Turkle’s new book, “Artificial Intimacy,” offers a withering critique of chatbots and the antisocial dynamics she believes they encourage.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.