让大模型学会自动纠错,提升对抗攻击下的安全性
Reinforcement Learning with Backtracking Feedback
- 通过强化学习让模型自动生成回溯信号修正错误输出
- 在多个基准上将攻击成功率显著降低,且保持模型基础能力
- 适合关注大模型安全与鲁棒性的研究者和开发者
为应对大型语言模型(LLMs)在对抗攻击和分布内误差下的安全挑战,本文提出基于回溯反馈的强化学习框架(RLBF)。该方法通过强化学习阶段,使模型学习动态修正自身生成错误的能力。利用对模型实时输出的评判反馈,模型可识别并恢复实际发生的安全违规,通过发出“回溯x个标记”的高效信号后继续自回归生成。该过程增强了模型对复杂对抗策略的韧性,包括中间填充、贪婪坐标梯度(GCG)攻击及解码参数篡改。此外,我们提出改进的监督微调数据生成策略(BSAFE+),通过向原本安全的连贯文本中注入违规内容,提供更有效的初始训练。全面实验证明,RLBF在多种基准和模型规模下显著降低攻击成功率,实现更优的安全性,同时有效保留基础模型功能。
原文摘要 · Abstract (English)
Addressing the critical need for robust safety in Large Language Models (LLMs), particularly against adversarial attacks and in-distribution errors, we introduce Reinforcement Learning with Backtracking Feedback (RLBF). This framework advances upon prior methods, such as BSAFE, by primarily leveraging a Reinforcement Learning (RL) stage where models learn to dynamically correct their own generation errors. Through RL with critic feedback on the model's live outputs, LLMs are trained to identify and recover from their actual, emergent safety violations by emitting an efficient "backtrack by x tokens" signal, then continuing generation autoregressively. This RL process is crucial for instilling resilience against sophisticated adversarial strategies, including middle filling, Greedy Coordinate Gradient (GCG) attacks, and decoding parameter manipulations. To further support the acquisition of this backtracking capability, we also propose an enhanced Supervised Fine-Tuning (SFT) data generation strategy (BSAFE+). This method improves upon previous data creation techniques by injecting violations into coherent, originally safe text, providing more effective initial training for the backtracking mechanism. Comprehensive empirical evaluations demonstrate that RLBF significantly reduces attack success rates across diverse benchmarks and model scales, achieving superior safety outcomes while critically preserving foundational model utility.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。