arXiv:2605.00628cs.DBcs.CL2026-05

让数据库字段名自动变清晰,提升自然语言查库准确率

EGREFINE: An Execution-Grounded Optimization Framework for Text-to-SQL Schema Refinement

论文配图:EGREFINE: An Execution-Grounded Optimization Framework for Text-to-SQL Schema Refinement
图 1 · 摘自论文原文
  • 把字段名优化建模为执行反馈驱动的约束优化问题
  • 在多个真实数据集上恢复因命名混乱损失的准确率,最高提升23.7%
  • 适合想低成本适配多模型的数据库智能系统开发者

文本转SQL使非专业人士能用自然语言查询数据库,但实际数据库字段常存在命名模糊、缩写或不一致问题,导致模型性能下降。现有方法将模式视为固定不变,仅在下游修正错误。本文将模式优化建模为约束优化问题:寻找一种重命名函数,在保持查询等价性前提下最大化下游文本转SQL执行准确率。分析了该问题的计算复杂性,提出列级贪心分解策略,并实现EGRefine:一个四阶段流程——筛选模糊字段、生成上下文感知候选名、通过执行反馈验证、以非破坏性SQL视图输出结果。该流程具备列级非退化性和数据库级查询等价性,确保优化安全。在受控降级、真实世界及企业级基准测试中,EGRefine有效恢复命名噪声造成的准确率损失,并在任务超限情况下正确拒绝;优化后的模式可跨模型迁移,支持一次优化、服务多个模型。代码与数据公开于https://github.com/ai-jiaqian/EGRefine。

原文摘要 · Abstract (English)

Text-to-SQL enables non-expert users to query databases in natural language, yet real-world schemas often suffer from ambiguous, abbreviated, or inconsistent naming conventions that degrade model accuracy. Existing approaches treat schemas as fixed and address errors downstream. In this paper, we frame schema refinement as a constrained optimization problem: find a renaming function that maximizes downstream Text-to-SQL execution accuracy while preserving query equivalence through database views. We analyze the computational hardness of this problem, which motivates a column-wise greedy decomposition, and instantiate it as EGRefine: a four-phase pipeline that screens ambiguous columns, generates context-aware candidate names, verifies them through execution-grounded feedback, and materializes the result as non-destructive SQL views. The pipeline carries two structural properties: column-local non-degradation, ensured by the conservative selection rule in the verification phase, and database-level query equivalence, ensured by the view-based materialization phase. Together they make the resulting refinement safe by construction at the column level, with cross-column and prompt-level interactions handled empirically rather than analytically. Across controlled schema-degradation, real-world, and enterprise benchmarks, EGRefine recovers accuracy lost to schema naming noise where applicable and correctly abstains where the underlying task exceeds current Text-to-SQL capabilities, with refined schemas transferring across model families to enable refine-once, serve-many-models deployment. Code and data are publicly available at https://github.com/ai-jiaqian/EGRefine.

文本转SQL数据库优化自然语言查询自动化修复

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