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

EGREFINE: 一种基于执行的文本到SQL模式精炼优化框架

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

Xidian University(西安电子科技大学)

Jiaqian Wang, Yutao Qi, Wenjin Hou, Yu Pang, Rui Yang

AI总结:

本文提出EGRefine框架,通过约束优化问题解决文本到SQL模式精炼问题,采用列级贪心分解策略,确保模式精炼的安全性和查询等价性,提升模型准确性。

摘要:

文本到SQL使非专家用户能用自然语言查询数据库,但现实中的模式常存在模糊、缩写或不一致的命名惯例,影响模型准确性。现有方法将模式视为固定,下游处理中解决错误。本文将模式精炼视为约束优化问题:找到一个重命名函数,最大化下游文本到SQL执行准确性,同时通过数据库视图保持查询等价性。我们分析了该问题的计算难度,这促使采用列级贪心分解,并将其实例化为EGRefine:一个四阶段流程,筛选模糊列,生成上下文感知的候选名称,通过执行基础反馈验证,最终将结果作为非破坏性SQL视图。该流程具有两个结构性特性:列级非降级,由验证阶段的保守选择规则保证;数据库级查询等价性,由基于视图的材料化阶段保证。两者共同使最终的精炼在列级上安全,跨列和提示级的交互通过经验而非分析处理。在受控模式退化、现实和企业基准上,EGRefine在适用时恢复因模式命名噪声丢失的准确性,并在底层任务超出当前文本到SQL能力时正确回避,精炼的模式在模型家族间转移,实现一次精炼,多模型服务部署。代码和数据可在https://github.com/ai-jiaqian/EGRefine公开获取。

英文摘要:

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.

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

↑