Towards Optimizing SQL Generation via LLM Routing

Mohammadhossein Malekpour, Nour Shaheen, Foutse Khomh, Amine Mhedhbi
11/6/2024
cs.DBcs.LG

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

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 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. 3 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{malekpour2024towards,
  title  = {Towards Optimizing SQL Generation via LLM Routing},
  author = {Mohammadhossein Malekpour and Nour Shaheen and Foutse Khomh and Amine Mhedhbi},
  year   = {2024},
  eprint = {2411.04319},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2411.04319v1}
}

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/2411.04319.svg)](https://codeofpaper.com/paper/2411.04319)

Discussion