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

RetrySQL:利用重试数据开展text-to-SQL训练以实现自校正查询生成

RetrySQL: text-to-SQL training with retry data for self-correcting query generation

Alicja Rączkowska, Riccardo Belluzzo, Piotr Zieliński, Joanna Baran, Paweł Olszewski

AI总结:

针对text-to-SQL任务缺乏自校正生成相关SQL专用模型研究的问题,提出RetrySQL方法,构造含正误推理步骤的重试数据开展全参数持续预训练,可提升模型执行准确率,性能媲美参数量高数个量级的专有模型。

摘要:

text-to-SQL任务是自然语言处理领域的一项活跃挑战。现有诸多解决方案聚焦于在定制化端到端text-to-SQL流水线中,使用搭配专用组件扩展的黑盒语言模型。尽管这些方案同时采用了闭源专有语言模型和面向编程的开源模型,但目前针对SQL专用生成模型的研究仍存在缺口。与此同时,自校正生成策略的最新进展展现出提升现有架构能力的潜力,但这类思路在text-to-SQL任务中的应用尚未得到探索。本文提出RetrySQL这一训练text-to-SQL生成模型的新方法:首先为参考SQL查询准备推理步骤,再对这些步骤进行扰动,构造包含错误步骤与校正步骤、二者通过特殊token分隔的重试数据;随后使用该数据对开源编程模型进行持续预训练。实验表明,与不使用重试数据的预训练相比,引入重试步骤可使模型的整体执行准确率和困难样本执行准确率最高提升4个百分点。此外,研究证实使用LoRA开展监督微调无法让模型有效从重试数据中学习,全参数预训练是完成该学习任务的必要条件;模型确实习得了自校正行为,下游准确率指标的提升正是这项新增能力带来的结果。最后,将经RetrySQL训练的模型整合到完整text-to-SQL流水线中,结果显示其执行准确率可与参数量高出数个量级的专有模型相媲美。RetrySQL证明了text-to-SQL任务中自校正能力是可习得的,为提升面向SQL的语言模型的生成准确率提供了全新路径。

英文摘要:

The text-to-SQL task is an active challenge in Natural Language Processing. Many existing solutions focus on using black-box language models extended with specialized components within customized end-to-end text-to-SQL pipelines. While these solutions use both closed-source proprietary language models and coding-oriented open-source models, there is a lack of research regarding SQL-specific generative models. At the same time, recent advancements in self-correcting generation strategies show promise for improving the capabilities of existing architectures. The application of these concepts to the text-to-SQL task remains unexplored. In this paper, we introduce RetrySQL, a new approach to training text-to-SQL generation models. We prepare reasoning steps for reference SQL queries and then corrupt them to create retry data that contains both incorrect and corrected steps, divided with a special token. We continuously pre-train an open-source coding model with this data and demonstrate that retry steps yield an improvement of up to 4 percentage points in both overall and challenging execution accuracy metrics, compared to pre-training without retry data. Additionally, we confirm that supervised fine-tuning with LoRA is ineffective for learning from retry data and that full-parameter pre-training is a necessary requirement for that task. We showcase that the self-correcting behavior is learned by the model and the increase in downstream accuracy metrics is a result of this additional skill. Finally, we incorporate RetrySQL-trained models into the full text-to-SQL pipeline and showcase that they are competitive in terms of execution accuracy with proprietary models that contain orders of magnitude more parameters. RetrySQL demonstrates that self-correction can be learned in the text-to-SQL task and provides a novel way of improving generation accuracy for SQL-oriented language models.

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

↑