arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.07449cs.DBcs.AIcs.CLcs.IRcs.LG
收藏

Dial:一种基于知识的方言特定自然语言到SQL系统

Dial: A Knowledge-Grounded Dialect-Specific NL2SQL System

Tsinghua University(清华大学);China Telecom Corporation Ltd. Shanghai Branch(中国电信股份有限公司上海分公司);Shanghai Jiao Tong University(上海交通大学)

Xiang Zhang, Hongming Xu, Le Zhou, Wei Zhou, Xuanhe Zhou, Guoliang Li, Yuyu Luo, Changdong Liu, Guorun Chen, Jiang Liao, Fan Wu

AI总结:

Dial提出一种基于知识的方言特定自然语言到SQL系统,通过逻辑查询规划、知识库和执行驱动调试提升翻译准确性和方言特征覆盖度。

摘要:

企业通常部署异构数据库系统,每个系统都有独特的SQL方言,具有不同的语法规则、内置函数和执行约束。然而,大多数现有的自然语言到SQL(NL2SQL)方法假设单一方言(例如SQLite),难以生成既语义正确又可在目标引擎上执行的查询。基于提示的方法紧密耦合意图推理与方言语法,规则基翻译器常将原生运算符降级为通用构造,而多方言微调则受跨方言干扰。在本文中,我们提出Dial,一种基于知识的方言特定NL2SQL框架。Dial引入:(1)一个方言感知的逻辑查询规划模块,通过运算符级意图分解和分歧感知规范将自然语言转换为方言感知的逻辑查询计划;(2)HINT-KB,一个分层意图感知的知识库,将方言知识组织为(i)一个标准语法参考,(ii)一个声明性函数库,以及(iii)一个过程性约束库;以及(3)一个执行驱动的调试和语义验证循环,将语法恢复与逻辑审计分离,以防止语义漂移。我们构建了DS-NL2SQL基准,涵盖六个主要数据库系统,包含2,218个方言特定的测试用例。实验结果表明,Dial在翻译准确性和方言特征覆盖度方面,比最先进的基线模型分别提高了10.25%和15.77%。代码见https://github.com/weAIDB/Dial。

英文摘要:

Enterprises commonly deploy heterogeneous database systems, each of which owns a distinct SQL dialect with different syntax rules, built-in functions, and execution constraints. However, most existing NL2SQL methods assume a single canonical dialect (e.g., SQLite) and struggle to produce queries that are both semantically correct and executable on target engines. Prompt-based approaches tightly couple intent reasoning with dialect syntax, rule-based translators often degrade native operators into generic constructs, and multi-dialect fine-tuning suffers from cross-dialect interference. In this paper, we present Dial, a knowledge-grounded framework for dialect-specific NL2SQL. Dial introduces: (1) a Dialect-Aware Logical Query Planning module that converts natural language into a dialect-aware logical query plan via operator-level intent decomposition and divergence-aware specification; (2) HINT-KB, a hierarchical intent-aware knowledge base that organizes dialect knowledge into i a Canonical Syntax Reference, ii a declarative function repository, and iii a procedural constraint repository; and (3) an execution-driven debugging and semantic verification loop that separates syntactic recovery from logic auditing to prevent semantic drift. We construct DS-NL2SQL, a benchmark covering six major database systems with 2,218 dialect-specific test cases. Experimental results show that Dial consistently improves translation accuracy by 10.25% and dialect feature coverage by 15.77% over state-of-the-art baselines.

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

↑