arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.31041cs.CL
收藏

一种语义层中介的智能体,用于异构企业数据库的自然语言到SQL转换

A Semantic-Layer-Mediated Agent for Natural Language to SQL over Heterogeneous Enterprise Databases

DAQUV Corp.(DAQUV公司);Chungbuk National University(忠北大学);BigDataLabs, Co., Ltd.(BigDataLabs有限公司)

Ha Jeong Kim, Saksonita Khoeurn, Ye Ji Yoon

AI总结:

提出一种通过语义层中介的NL2SQL智能体,利用语义模型查询(SMQ)解耦语义与物理SQL,在Spider2-snow基准上达到94.15%执行准确率,排名第三。

摘要:

在真实企业数据库上的自然语言到SQL(NL2SQL)仍然比学术基准更具挑战性。企业模式通常包含数百个物理表,具有晦涩的列名、异构的SQL方言以及需要嵌套聚合、时间推理和多表连接的复杂分析工作负载。我们提出了一种语义层中介的NL2SQL智能体,将语义意图与物理SQL执行解耦。该智能体不直接在原始模式上生成SQL,而是通过一种称为语义模型查询(SMQ)的紧凑中间表示在策划的语义层上进行推理。一个确定性编译器将每个SMQ转换为特定方言的SQL,提供经过验证的构建块,智能体将其组合成最终查询。该系统采用受限的思考-行动循环,支持SQLite、BigQuery和Snowflake后端,并集成到端到端评估框架中。使用Gemini 3 Pro,该系统在547个任务的Spider2-snow基准上实现了94.15%的执行准确率,在官方排行榜上排名第三,并显著优于仅使用模式的方法。我们描述了系统架构、SMQ表示、智能体工作流程、评估结果,并讨论了语义层质量以及改进的接地与过拟合之间的权衡。

英文摘要:

Natural language-to-SQL (NL2SQL) over real-world enterprise databases remains significantly more challenging than on academic benchmarks. Enterprise schemas often contain hundreds of physical tables with cryptic column names, heterogeneous SQL dialects, and complex analytical workloads requiring nested aggregations, temporal reasoning, and multi-table joins. We present a semantic-layer-mediated NL2SQL agent that decouples semantic intent from physical SQL execution. Rather than generating SQL directly over raw schemas, the agent reasons over a curated semantic layer through a compact intermediate representation called the Semantic Model Query (SMQ). A deterministic compiler translates each SMQ into dialect-specific SQL, providing verified building blocks that the agent composes into the final query. The system employs a constrained think-act loop, supports SQLite, BigQuery, and Snowflake backends, and is integrated into an end-to-end evaluation framework. Using Gemini 3 Pro, the system achieves 94.15% execution accuracy on the 547-task Spider2-snow benchmark, ranking third on the official leaderboard and substantially outperforming schema-only approaches. We describe the system architecture, SMQ representation, agent workflow, evaluation results, and discuss semantic-layer quality and the trade-off between improved grounding and overfitting.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑