Beyond Executability: Business-Semantic Evaluation for Enterprise NL-to-SQL
Abstract
Natural-language-to-SQL systems can execute successfully while applying the wrong business definition. We examine this gap using business semantic accuracy (BSA), a business-semantic evaluation protocol that assesses whether generated SQL preserves the required metric definitions, filters, joins, dimensions, time scope, and aggregation logic. On a 50-question synthetic FinTech benchmark, a schema-only baseline achieved 90% execution success (ES) but 20% strict BSA under the released author labels. Typed schema context and SQL governance raised these values to 98% ES and 84% author-labeled BSA. A governed-semantic condition achieved 100% on both measures under those labels. A second data engineer subsequently conducted a blind review of all 150 condition outputs. Strict BSA was 18%, 48%, and 70% for the Baseline, Enhanced Baseline, and Governed Semantic conditions; partial-weighted scores were 47%, 65%, and 83%. Author-reviewer agreement was 60.7% with Cohen’s κ = 0.34. We also report a 105-question replication of execution success and result-based execution accuracy (EX) across two provider runs. The evidence supports a bounded conclusion: explicit, governed metric definitions can reduce silent semantic errors, while executability alone remains an inadequate correctness measure.
References
[1] T. Yuet al., “Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task,” in Proc. EMNLP, 2018, pp. 3911-3921, doi: 10.18653/v1/D18- 1425.
[2] J. Liet al., “Can LLM already serve as a database interface? A big bench for large-scale database grounded text-to-SQLs,” in NeurIPS, 2023. [Online]. Available: https: //arxiv.org/abs/2305. 03111
[3] C. Finegan-Dollak et al., “Improving text-to-SQL evaluation methodology,” in Proc. ACL, 2018, pp. 351-360, doi: 10.18653/v1/P18-1033.
[4] R. Zhong, T. Yu, and D. Klein, “Semantic evaluation for text-to-SQL with distilled test suites,” in Proc. EMNLP, 2020, pp. 396-411, doi: 10.18653/v1/2020.emnlp-main.29.
[5] S. Chang et al., “Dr.Spider: A diagnostic evaluation benchmark towards text-to-SQL robustness,” in Proc. ICLR, 2023. [Online]. Available: https: //arxiv.org/abs/2301.08881
[6] A. Floratou et al., “NL2SQL is a solved problem... Not!,” in Proc. CIDR, 2024. [Online]. Available: https: //www.cidrdb.org/cidr2024/papers/p74-floratou. pdf
[7] X. Zhu, Q. Li, L. Cui, and Y. Liu, “Large language model enhanced text-to-SQL generation: A survey,” 2024. [Online]. Available: https://arxiv.org/abs/2410.06011
[8] R. Kimball and M. Ross, The Data Warehouse Toolkit: The Definitive Guide to Dimensional Modeling, 3rd ed. Indianapolis, IN, USA: Wiley, 2013.
