arXiv:2608.16663cs.DBcs.AI2026-08

通过分步规划与确定性校验,提升企业级文本转SQL的准确率和可靠性。

Bounded Semantic Planning and Deterministic Compilation for Reliable Enterprise Text-to-SQL

  • 分多轮规划,逐句解析并选择语义可控的选项,避免直接生成错误查询。
  • 在38个问题上97.4%的运行正确率,远超基线模型的55.3%。
  • 适合对查询准确性要求高的企业数据应用,尤其关注可靠性和可解释性。

直接文本转SQL让语言模型同时承担理解业务问题和构建完整关系查询的任务。在企业数据模式中,即使使用错误的关系角色或聚合粒度,SQL也能成功执行。本文研究将随机边界移至更可控的位置:多轮规划器对短语进行语义锚定,并从针对问题定制的受控选项中选择;图遍历、角色谓词、粒度降低、SQL构建及确定性检查均以代码实现。在ACME保险基准上评估该语义路径编译(SPC)系统,对比直接生成的DDL-to-SQL方法。在包含38个问题的判定集上,每题运行3次,SPC在所有运行中对37题判定正确(97.4%),基线仅21题(55.3%)。配对不一致分析显示,SPC胜出16题,基线无胜出(双侧精确McNemar检验p=3.05×10^-5)。SPC在114次运行中全部答对38题至少一次,仅1次拒绝,无被判定为错误但可执行的运行;基线则有29次被判定错误,另有7次由评审标记为仅数据巧合。严格等价敏感性分析进一步放大了配对差异。使用GPT-5.4和Gemini-3.6-Flash的额外测试也显示类似的问题级鲁棒性,尽管单次运行的判断结果未保持一致。六个额外基准项保留在全量分析中,并按失败类别单独记录。本研究支持端到端系统性成果,而非单纯归因于编译机制本身,因SPC接收的是基线所不具备的受控语义输入。

原文摘要 · Abstract (English)

Direct text-to-SQL asks a language model to do two jobs: interpret the business question and construct the complete relational query. In enterprise schemas, SQL can execute successfully while using the wrong relationship role or aggregation grain. We study an alternative placement of the stochastic boundary. A multi-turn planner grounds phrases and selects from question-specific governed options; graph traversal, role predicates, grain lowering, SQL construction, and deterministic checks are implemented in code. We evaluate this semantic path compilation (SPC) system against direct DDL-to-SQL generation on the ACME insurance benchmark. On a 38-question adjudicated comparison set with three runs per question, SPC was adjudicated correct on every run for 37 questions (97.4%), compared with 21 (55.3%) for the baseline. The paired discordance was 16 questions in favor of SPC and none in favor of the baseline (two-sided exact McNemar p=3.05x10^-5). SPC answered all 38 questions correctly at least once and produced one refusal and no adjudicated wrong-but-executed run across 114 run outcomes; the baseline produced 29 adjudicated wrong runs and seven additional judge-flagged data-only coincidences on the same set. A strict-equivalence sensitivity analysis increased the paired difference. Additional SPC runs with GPT-5.4 and Gemini-3.6-Flash showed similar question-level robustness, although their per-run verdict artifacts were not preserved. Six additional benchmark items are retained in an all-item analysis and documented separately by failure class. The study supports an end-to-end systems result, not a causal claim that compilation alone produced the gain, because SPC receives governed semantic artifacts that the DDL baseline does not.

文本转SQL企业应用可靠性规划编译

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。