arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.20102cs.LGcs.AI
收藏

BarrierSteer: 通过学习障碍引导实现大语言模型安全

BarrierSteer: LLM Safety via Learning Barrier Steering

Department of Computer Science, National University of Singapore(新加坡国立大学计算机科学系);Singapore-MIT Alliance for Research and Technology Centre(新加坡-麻省理工联合研究中心);CSAIL, Massachusetts Institute of Technology(麻省理工学院计算机科学与人工智能实验室);Worcester Polytechnic Institute(沃斯堡理工学院)

Thanh Q. Tran, Arun Verma, Kiwan Wong, Bryan Kian Hsiang Low, Daniela Rus, Wei Xiao

AI总结:

提出 BarrierSteer 框架,通过将学习到的非线性安全约束作为控制障碍函数嵌入潜在表示空间,在推理时引导模型生成安全内容,理论保证且不修改模型参数。

摘要:

尽管大型语言模型(LLMs)在各种任务中表现出色,但它们对对抗性攻击和不安全内容生成的敏感性仍然是部署的重大障碍,尤其是在高风险场景中。解决这一挑战需要既实际有效又有理论依据的安全机制。在本文中,我们介绍了 BarrierSteer,一种新颖的推理时框架,通过将学习到的非线性安全约束直接嵌入模型的潜在表示空间来提高响应安全性。BarrierSteer 将隐藏状态安全分类器视为控制障碍函数(CBFs),从而在生成过程中引导不安全的潜在轨迹。通过有效的约束合并组合多个安全约束,而不修改底层 LLM 参数,BarrierSteer 保持了模型效用。我们提供的理论结果表明,在潜在空间中应用 CBFs 提供了一种有原则、模块化且计算高效的方法,用于根据学习到的安全约束进行引导,并保证学习到的障碍能够捕捉预期的安全属性。我们在多个模型系列和数据集上的广泛实验结果表明,BarrierSteer 显著降低了对抗性攻击成功率和有害生成,优于现有方法。代码可在我们的 GitHub 仓库中获取。

英文摘要:

Despite the strong performance of large language models (LLMs) across diverse tasks, their susceptibility to adversarial attacks and unsafe content generation remains a significant obstacle to deployment, particularly in high-stakes settings. Addressing this challenge requires safety mechanisms that are both practically effective and theoretically grounded. In this paper, we introduce BarrierSteer, a novel inference-time framework that improves response safety by embedding learned nonlinear safety constraints directly into the model's latent representation space. BarrierSteer treats hidden-state safety classifiers as Control Barrier Functions (CBFs), enabling constraint-guided steering of unsafe latent trajectories during generation. By composing multiple safety constraints through efficient constraint merging without modifying the underlying LLM parameters, BarrierSteer preserves model utility. We provide theoretical results showing that applying CBFs in the latent space yields a principled, modular, and computationally efficient approach for steering with respect to learned safety constraints, with guarantees conditional on the learned barriers capturing the intended safety property. Our extensive experimental results across multiple model families and datasets demonstrate that BarrierSteer substantially reduces adversarial attack success rates and unsafe generations, outperforming the existing method. The code is available in our \href{https://github.com/thanhquangtran/BarrierSteer}{GitHub repository}.

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

↑