Towards Optimizing SQL Generation via LLM Routing

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Malekpour, Mohammadhossein, Shaheen, Nour, Khomh, Foutse, Mhedhbi, Amine
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866910687187435520
author Malekpour, Mohammadhossein
Shaheen, Nour
Khomh, Foutse
Mhedhbi, Amine
author_facet Malekpour, Mohammadhossein
Shaheen, Nour
Khomh, Foutse
Mhedhbi, Amine
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2411_04319
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Towards Optimizing SQL Generation via LLM Routing
Malekpour, Mohammadhossein
Shaheen, Nour
Khomh, Foutse
Mhedhbi, Amine
Databases
Machine Learning
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.
title Towards Optimizing SQL Generation via LLM Routing
topic Databases
Machine Learning
url https://arxiv.org/abs/2411.04319