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.


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

0
下载
关闭预览

相关内容

SQL 全名是结构化查询语言,是用于数据库中的标准数据查询语言,IBM 公司最早使用在其开发的数据库系统中。
NL2SQL:弱监督学习与有监督学习完成进阶之路
PaperWeekly
14+阅读 · 2019年6月24日
TensorFlow 2.0新特性之Ragged Tensor
深度学习每日摘要
18+阅读 · 2019年4月5日
NLP不同任务Tensorflow深度学习模型大全
专知
10+阅读 · 2019年3月19日
NLP-Progress记录NLP最新数据集、论文和代码: 助你紧跟NLP前沿
中国人工智能学会
12+阅读 · 2018年11月15日
深度学习TensorFlow实现集合
专知
10+阅读 · 2018年9月8日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Arxiv
0+阅读 · 2月17日
Arxiv
0+阅读 · 2月13日
VIP会员
相关VIP内容
相关资讯
相关基金
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
5+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
11+阅读 · 2012年12月31日
Top
微信扫码咨询专知VIP会员