Skip to main content
QUICK REVIEW

[论文解读] BarrierSteer: LLM Safety via Learning Barrier Steering

Thanh Q. Tran, Arun Verma|arXiv (Cornell University)|Feb 23, 2026
Adversarial Robustness in Machine Learning被引用 0
一句话总结

BarrierSteer 将学习到的非线性安全约束嵌入到 LLM 潜在空间,并使用控制屏障函数实时引导生成,从而在不重新训练的情况下降低不安全输出,同时提供理论安全保证并在经验上优于基线。

ABSTRACT

Despite the state-of-the-art performance of large language models (LLMs) across diverse tasks, their susceptibility to adversarial attacks and unsafe content generation remains a major obstacle to deployment, particularly in high-stakes settings. Addressing this challenge requires safety mechanisms that are both practically effective and supported by rigorous theory. We introduce BarrierSteer, a novel framework that formalizes response safety by embedding learned non-linear safety constraints directly into the model's latent representation space. BarrierSteer employs a steering mechanism based on Control Barrier Functions (CBFs) to efficiently detect and prevent unsafe response trajectories during inference with high precision. By enforcing multiple safety constraints through efficient constraint merging, without modifying the underlying LLM parameters, BarrierSteer preserves the model's original capabilities and performance. We provide theoretical results establishing that applying CBFs in latent space offers a principled and computationally efficient approach to enforcing safety. Our experiments across multiple models and datasets show that BarrierSteer substantially reduces adversarial success rates, decreases unsafe generations, and outperforms existing methods.

研究动机与目标

  • 在高风险场景中为 LLM 部署提出原理性安全保障的需求动机。
  • 提出一种将非线性安全约束嵌入到 LLM 潜在空间且不修改模型参数的框架。
  • 开发一种基于控制屏障函数(CBF)的推理时引导机制,并实现高效的约束合并。
  • 将安全性表述为一个受限的马尔可夫决策过程(CMDP),并在对抗性输入下确保安全。
  • 在不同模型和数据集上通过理论与经验结果展示可扩展性和有效性。

提出的方法

  • 通过最小化一个同时强制安全样本、惩罚不安全样本的损失,学习多个非线性屏障函数 b_k(h)。
  • 将潜在状态动态近似为 h = (h_t - h_{t-1})/t,并将引导问题转化为二次规划(QP),以在强制线性化屏障约束的同时最小化与原始轨迹的偏离。
  • 使用对数和指数和运算(Log-Sum-Exp) 将多条屏障组合成单个可微分的屏障 B(h),以实现封闭形式、对安全状态的保证。
  • 提供三种 BarrierSteer 变体:BarrierSteer(QP)直接求解 QP;BarrierSteer(Top-2)用两条最违反约束来实现快速的闭式解;BarrierSteer(LSE)使用组合屏障获得闭式解。
  • 通过引导强度 alpha 展现安全-效用权衡,显示在保证安全的同时保持模型效用。
  • 展示跨风险类别的14个独立训练的安全屏障在三种聚合方法(Top-2、QP、LSE)下的模块化组合,并比较不安全生成率。
Figure 1: BarrierSteer for Safe LLMs. This method efficiently steers the hidden states of LLMs within nonlinear safe sets learned from demonstrations, thereby ensuring the generation of safe language responses during the inference-time.
Figure 1: BarrierSteer for Safe LLMs. This method efficiently steers the hidden states of LLMs within nonlinear safe sets learned from demonstrations, thereby ensuring the generation of safe language responses during the inference-time.

实验结果

研究问题

  • RQ1在 LLM 潜在空间嵌入的学习到的非线性安全约束在推理阶段是否能提供可证明的安全性保障?
  • RQ2与现有表示引导方法相比,基于屏障的引导在降低不安全生成、同时保持效用方面有何差异?
  • RQ3引导强度对安全性与任务性能在不同模型规模上的影响如何?
  • RQ4在组合多种风险类别时,模块化、多屏障组合是否有效?
  • RQ5闭式屏障组合(LSE)是否能以更低延迟达到与迭代 QP 相同的性能?

主要发现

  • BarrierSteer 在不同模型家族中显著降低对抗性攻击的成功率,常常接近为零的 ASR(例如 Gemma-2-9b 上为 0.00%)。
  • BarrierSteer 在维持模型效用方面相比原始模型仅有适度下降的 MMLU 和 GSM8K 分数。
  • BarrierSteer(LSE)相比 SaP 提供约 31 倍的加速(延迟约 6.08 ms/token 而非 190.67 ms/token)。
  • 将 14 个独立训练的屏障使用 LSE 或 QP 进行组合,获得最低的不安全生成率(1.82%),优于 Top-2。
  • 随着引导强度 alpha 的增加,ASR 逐步下降,在 alpha = 1.0 时达到绝对安全,同时在 MMLU 的核心任务性能仍保留在基线约 1.5% 的范围内。
  • BarrierSteer 在安全性与鲁棒性方面超过 Activation Addition 与 Directional Ablation 等基线,在多个数据集上均有优势。
Figure 2: Overview of BarrierSteer for safe LLM generation. There is a three-stage pipeline of BarrierSteer : (i) extracting intermediate latent representations from a pre-trained LLM and constructing an LLM-specific safety dataset with binary safety labels; (ii) learning expressive, non-linear safe
Figure 2: Overview of BarrierSteer for safe LLM generation. There is a three-stage pipeline of BarrierSteer : (i) extracting intermediate latent representations from a pre-trained LLM and constructing an LLM-specific safety dataset with binary safety labels; (ii) learning expressive, non-linear safe

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。