让普通用户用自然语言操作数据库,分析数据还能做管理。
AskDB: An LLM Agent for Natural Language Interaction with Relational Databases
- 用动态模式感知提示+任务分解,让LLM理解数据库结构
- 在Text-to-SQL测试中表现优异,能自主调试错误SQL
- 适合非技术人员快速查询和管理数据库
不同技术水平的用户在操作关系型数据库时仍面临挑战,尤其是在编写复杂分析查询或执行管理任务时。现有系统通常只解决自然语言查询或数据库管理中的某一方面,缺乏统一且智能的通用交互界面。我们提出AskDB,一个基于Gemini 2的大语言模型代理,支持通过自然语言完成对SQL数据库的数据分析与管理操作。AskDB集成两项关键创新:动态模式感知提示机制,有效利用数据库元数据;以及任务分解框架,使代理能够规划并执行多步操作。该能力使AskDB可自主调试生成的SQL,通过实时网络搜索获取上下文信息,并自适应优化回复。我们在广泛使用的Text-to-SQL基准和定制化的数据库管理员(DBA)任务集上评估AskDB,结果表明其在分析与管理场景中均表现出色。研究验证了AskDB作为统一智能代理在关系型数据库系统中的潜力,为终端用户提供直观、易用的交互体验。
原文摘要 · Abstract (English)
Interacting with relational databases remains challenging for users across different expertise levels, particularly when composing complex analytical queries or performing administrative tasks. Existing systems typically address either natural language querying or narrow aspects of database administration, lacking a unified and intelligent interface for general-purpose database interaction. We introduce AskDB, a large language model powered agent designed to bridge this gap by supporting both data analysis and administrative operations over SQL databases through natural language. Built on Gemini 2, AskDB integrates two key innovations: a dynamic schema-aware prompting mechanism that effectively incorporates database metadata, and a task decomposition framework that enables the agent to plan and execute multi-step actions. These capabilities allow AskDB to autonomously debug derived SQL, retrieve contextual information via real-time web search, and adaptively refine its responses. We evaluate AskDB on a widely used Text-to-SQL benchmark and a curated set of DBA tasks, demonstrating strong performance in both analytical and administrative scenarios. Our results highlight the potential of AskDB as a unified and intelligent agent for relational database systems, offering an intuitive and accessible experience for end users.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。