通过语法树反事实干预,实现文本转SQL的细粒度错误定位。
CAPER: Clause-Aligned Process Supervision for Text-to-SQL

- 基于SQL抽象语法树的反事实干预,自动生成条款级监督信号。
- 在BIRD和Spider数据集上相对提升15.3%执行准确率,失败定位准确率达84.53%。
- 适合需要可解释性与错误归因的文本转SQL系统研究者使用。
文本转SQL系统通常以查询级执行正确性评估,但这一终端信号无法提供成功或失败的中间决策依据。令牌级密集监督也不合适:SQL令牌与完整语义决策不对应,会惩罚执行等价的查询,且难以大规模可靠标注。为此,我们提出CAPER,通过在SQL抽象语法树上进行反事实干预,自动推导出条款级监督信号,实现奖励建模中的根因错误定位;由此生成的数据用于训练轻量级的Clause-PRM模型CAPER-9B,该模型为策略优化和候选验证提供条款边界反馈。在BIRD和Spider数据集上的实验表明,条款对齐监督不仅提升了执行准确率,相对GPT-5.4最高提升15.3%,还增强了失败定位能力,在保留失败样本上达到84.53%准确率和90.60% MRR。
原文摘要 · Abstract (English)
Text-to-SQL systems are typically evaluated by query-level execution correctness, but this terminal signal provides little guidance about which intermediate SQL decision caused success or failure. Token-level dense supervision is also ill-suited: SQL tokens do not align with complete semantic decisions, can penalize execution-equivalent queries, and are difficult to label reliably at scale. We therefore propose CAPER, which automatically derives clause-level supervision via counterfactual intervention on the SQL abstract syntax tree, enabling root-cause error localization for reward modeling; the resulting data is used to train CAPER-9B, a lightweight Clause-PRM that provides clause-boundary feedback for policy optimization and candidate verification. Experiments on BIRD and Spider show that clause-aligned supervision not only improves execution accuracy, achieving up to a 15.3% relative EX improvement over GPT-5.4, but also strengthens failure-localization capability, reaching 84.53% accuracy and 90.60% MRR on held-out failures. Our project page is at https://github.com/banrichard/RL-NL2SQL.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。