arXiv:2510.14808cs.AIcs.LG2025-10中稿 · NeurIPS被引 1

用智能代理减少自然语言转SQL的计算开销

Agentic NL2SQL to Reduce Computational Costs

  • 设计交互式智能体,按需获取数据库元信息
  • 在23个数据库上减少87%提示词令牌数
  • 适合需要低成本部署NL2SQL的开发者

将自然语言查询转化为SQL(NL2SQL)近期得益于大语言模型(LLMs)的发展。但在大规模SQL数据库上使用LLMs进行NL2SQL时,需处理大量数据库元信息,导致提示词过长、计算成本高。为此,我们提出Datalake Agent,一种智能体系统,使LLM能更高效地完成NL2SQL任务。不同于传统方法一次性输入全部元信息,Datalake Agent采用交互循环机制,让LLM在推理框架中仅请求解决表级问答任务所必需的信息。我们在包含23个数据库的100个表级问答任务上评估该系统,结果显示其可将LLM使用的令牌数最多减少87%,显著降低计算成本,同时保持竞争力性能。

原文摘要 · Abstract (English)

Translating natural language queries into SQL queries (NL2SQL or Text-to-SQL) has recently been empowered by large language models (LLMs). Using LLMs to perform NL2SQL methods on a large collection of SQL databases necessitates processing large quantities of meta-information about the databases, which in turn results in lengthy prompts with many tokens and high processing costs. To address this challenge, we introduce Datalake Agent, an agentic system designed to enable an LLM to solve NL2SQL tasks more efficiently. Instead of utilizing direct solvers for NL2SQL that call the LLM once with all meta-information in the prompt, the Datalake Agent employs an interactive loop to reduce the utilized meta-information. Within the loop, the LLM is used in a reasoning framework that selectively requests only the necessary information to solve a table question answering task. We evaluate the Datalake Agent on a collection of 23 databases with 100 table question answering tasks. The Datalake Agent reduces the tokens used by the LLM by up to 87\% and thus allows for substantial cost reductions while maintaining competitive performance.

NL2SQL智能体降本增效

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