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

探究数据库规范化对SQL生成的影响

Exploring Database Normalization Effects on SQL Generation

CyberAgent

Ryosuke Kohita

AI总结:

该研究首次系统探究数据库规范化对NL2SQL的影响,通过多数据集评估8个大模型,发现非规范化模式适配简单检索查询,规范化模式在聚合查询上表现更优,少样本可缓解其带来的挑战,为NL2SQL的模式设计提供参考。

摘要:

模式设计,尤其是规范化,是自然语言转SQL(NL2SQL)系统中一个关键却常被忽视的因素。以往多数研究在固定模式上评估模型,忽略了设计对性能的影响。我们首次开展了模式规范化影响的系统性研究,在具有不同规范化程度的合成与真实世界数据集上评估了8个主流大语言模型。我们构建了具备正式规范化等级(1NF-3NF)的受控合成数据集,以及采用实用方案的真实学术论文数据集。结果表明,非规范化模式在简单检索查询上能实现高准确率,即使用高性价比模型在零样本设置下也是如此。相比之下,规范化模式(2NF/3NF)会带来基表选择错误、连接类型预测错误等挑战;不过,提供少样本示例可大幅缓解这些问题。对于聚合查询,规范化模式表现更优,这主要是因为它们能抵御导致非规范化模式出错的数据重复和NULL值问题。这些发现表明,NL2SQL应用的最优模式设计取决于要支持的查询类型。本研究证明了在开发NL2SQL接口以及为真实场景整合自适应模式选择时,考虑模式设计的重要性。

英文摘要:

Schema design, particularly normalization, is a critical yet often overlooked factor in natural language to SQL (NL2SQL) systems. Most prior research evaluates models on fixed schemas, overlooking the influence of design on performance. We present the first systematic study of schema normalization's impact, evaluating eight leading large language models on synthetic and real-world datasets with varied normalization levels. We construct controlled synthetic datasets with formal normalization (1NF-3NF) and real academic paper datasets with practical schemes. Our results show that denormalized schemas offer high accuracy on simple retrieval queries, even with cost-effective models in zero-shot settings. In contrast, normalized schemas (2NF/3NF) introduce challenges such as errors in base table selection and join type prediction; however, these issues are substantially mitigated by providing few-shot examples. For aggregation queries, normalized schemas yielded better performance, mainly due to their robustness against the data duplication and NULL value issues that cause errors in denormalized schemas. These findings suggest that the optimal schema design for NL2SQL applications depends on the types of queries to be supported. Our study demonstrates the importance of considering schema design when developing NL2SQL interfaces and integrating adaptive schema selection for real-world scenarios.

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

↑