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

边界感知的NL2SQL:通过混合奖励和数据合成集成可靠性

Boundary-Aware NL2SQL: Integrating Reliability through Hybrid Reward and Data Synthesis

Li Auto Inc.(Li汽车公司);Beijing University of Posts and Telecommunications(北京邮电大学)

Songsong Tian, Kongsheng Zhuo, Zhendong Wang, Rong Shen, Shengtao Zhang, Yong Wu

AI总结:

BAR-SQL通过混合奖励和数据合成方法,提升NL2SQL在生成准确性和边界感知回避能力上的表现。

摘要:

在本文中,我们提出了BAR-SQL(边界感知可靠NL2SQL),一个统一的训练框架,将可靠性和边界感知直接嵌入生成过程中。我们引入了一种Seed Mutation数据合成范式,构建了一个具有代表性的企业语料库,明确涵盖了多步骤分析查询以及包含歧义和模式限制的边界案例。为了确保可解释性,我们采用基于知识的推理合成,生成明确锚定在模式元数据和业务规则的思维链轨迹。模型通过两个阶段的过程进行训练:监督微调(SFT)后接群体相对策略优化的强化学习。我们设计了一种任务条件混合奖励机制,同时优化SQL执行准确率(利用抽象语法树分析和密集结果匹配)和语义精度在回避响应中的表现。为了评估可靠性与生成准确性,我们构建并发布了Ent-SQL-Bench,该基准联合评估SQL精度和边界感知回避能力,涵盖模糊和无法回答的查询。在该基准上的实验结果表明,BAR-SQL实现了91.48%的平均准确率,优于领先的专有模型,包括Claude 4.5 Sonnet和GPT-5,在SQL生成质量和边界感知回避能力方面均优于现有模型。源代码和基准可匿名访问:https://github.com/TianSongS/BAR-SQL。

英文摘要:

In this paper, we present BAR-SQL (Boundary-Aware Reliable NL2SQL), a unified training framework that embeds reliability and boundary awareness directly into the generation process. We introduce a Seed Mutation data synthesis paradigm that constructs a representative enterprise corpus, explicitly encompassing multi-step analytical queries alongside boundary cases including ambiguity and schema limitations. To ensure interpretability, we employ Knowledge-Grounded Reasoning Synthesis, which produces Chain-of-Thought traces explicitly anchored in schema metadata and business rules. The model is trained through a two-stage process: Supervised Fine-Tuning (SFT) followed by Reinforcement Learning via Group Relative Policy Optimization. We design a Task-Conditioned Hybrid Reward mechanism that simultaneously optimizes SQL execution accuracy-leveraging Abstract Syntax Tree analysis and dense result matching-and semantic precision in abstention responses. To evaluate reliability alongside generation accuracy, we construct and release Ent-SQL-Bench, which jointly assesse SQL precision and boundary-aware abstention across ambiguous and unanswerable queries. Experimental results on this benchmark demonstrate that BAR-SQL achieves 91.48% average accuracy, outperforming leading proprietary models, including Claude 4.5 Sonnet and GPT-5, in both SQL generation quality and boundary-aware abstention capability. The source code and benchmark are available anonymously at: https://github.com/TianSongS/BAR-SQL.

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

↑