arXiv:2411.04319cs.DBcs.LG2024-11被引 10

根据查询复杂度动态选择LLM,降低SQL生成成本

Towards Optimizing SQL Generation via LLM Routing

  • 按查询复杂度自动分配不同LLM,实现成本优化
  • 在BIRD数据集上保持高准确率同时降低开销
  • 适合需要平衡效率与成本的数据库应用

Text-to-SQL使用户能通过自然语言访问数据库,简化结构化数据操作。尽管大型语言模型(LLMs)在复杂查询上表现优异,但对简单查询也带来不必要的延迟和费用。本文提出首个Text-to-SQL的LLM路由方法,动态选择最经济高效的模型生成准确SQL。设计了基于评分与分类的两种路由策略,在BIRD数据集上实现了与最强模型相当的准确率,同时显著降低成本。路由器易于训练且推理高效,展现出可解释的精度-成本权衡。

原文摘要 · Abstract (English)

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.

Text-to-SQLLLM路由成本优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。