AI
New Router System Cuts SQL Generation Costs Without Sacrificing Accuracy
Researchers propose an intelligent routing approach that matches simpler database queries to cheaper language models while keeping complex ones on high-capacity systems.
A team of researchers has developed a routing system that addresses a practical inefficiency in text-to-SQL systems: the overuse of expensive, powerful language models for straightforward database queries. The work introduces the first LLM routing method specifically designed for this task, automatically directing each query to the most cost-effective model capable of producing accurate SQL.
The Problem with One-Size-Fits-All Approaches#
Text-to-SQL tools allow non-technical users to query databases using plain English rather than writing SQL code manually. While large language models have become remarkably good at handling complex database questions, they come at a cost—both in terms of latency and financial expense. Running every query through a state-of-the-art model wastes resources when many questions are simple enough for smaller, faster alternatives.
How the Routing System Works#
The researchers introduced two routing strategies to intelligently direct queries:
- Score-based routing — evaluates query characteristics and assigns it to a model tier based on predicted difficulty
- Classification-based routing — treats model selection as a classification problem, learning which queries suit which models
Both approaches were designed with practical deployment in mind: they're straightforward to train and run efficiently during inference, without requiring complex computational overhead.
Testing and Trade-offs#
The team evaluated their system on the BIRD dataset, a benchmark for text-to-SQL tasks. Their results demonstrate that the routing approach achieves accuracy comparable to using only the most capable—and most expensive—LLM, while substantially reducing operational costs. The work highlights what the researchers describe as a practical and explainable trade-off between accuracy and cost that teams can tune to their own needs.
This advance suggests a future where natural language database interfaces become more economical to operate at scale.

