Skip to main content
QUICK REVIEW

[Paper Review] BarrierSteer: LLM Safety via Learning Barrier Steering

Thanh Q. Tran, Arun Verma|arXiv (Cornell University)|Feb 23, 2026
Adversarial Robustness in Machine LearningComputer Science0 citations
TL;DR

BarrierSteer embeds learned non-linear safety constraints in LLM latent space and uses Control Barrier Functions to steer generation in real time, reducing unsafe outputs without retraining. It provides theoretical safety guarantees and shows strong empirical improvements over baselines.

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.

Motivation & Objective

  • Motivate the need for principled safety guarantees for LLM deployment in high-stakes settings.
  • Propose a framework that embeds nonlinear safety constraints in LLM latent space without modifying model parameters.
  • Develop an inference-time steering mechanism based on Control Barrier Functions (CBFs) with efficient constraint merging.
  • Formulate safety as a constrained Markov decision process (CMDP) and ensure safety under adversarial inputs.
  • Demonstrate scalability and effectiveness across models and datasets with theoretical and empirical results.

Proposed method

  • Learn multiple nonlinear barrier functions b_k(h) from safe/unsafe demonstrations by minimizing a loss that enforces safe samples and penalizes unsafe ones.
  • Approximate latent-state dynamics as h = (h_t - h_{t-1})/t and cast steering as a quadratic program to minimize deviation from the original trajectory while enforcing  b_k(h)   00 with linearized barrier constraints.
  • Compose multiple barriers into a single differentiable barrier B(h) using Log-Sum-Exp to enable closed-form, safe-state guarantees.
  • Provide three BarrierSteer variants: BarrierSteer (QP) solving the QP directly, BarrierSteer (Top-2) using the two most violated constraints for a fast closed-form, and BarrierSteer (LSE) using the composed barrier for a closed-form solution.
  • Demonstrate safety-utility trade-offs with steering strength alpha, showing safety guarantees while preserving model utility.
  • Show modular composition of 14 safety barriers across risk categories with three aggregation methods (Top-2, QP, LSE) and compare unsafe generation rates.
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.

Experimental results

Research questions

  • RQ1Can learned nonlinear safety constraints embedded in LLM latent space provide provable safety guarantees during inference?
  • RQ2How does barrier-based steering compare to existing representation steering methods in reducing unsafe generations while preserving utility?
  • RQ3What is the impact of steering strength on safety vs. task performance across model sizes?
  • RQ4How effective are modular, multi-barrier compositions when combining multiple risk categories?
  • RQ5Do closed-form barrier compositions (LSE) match iterative QP performance with lower latency?

Key findings

  • BarrierSteer substantially reduces adversarial attack success rates across model families, often achieving near-zero ASR (e.g., 0.00% on Gemma-2-9b).
  • BarrierSteer maintains model utility with modest declines in MMLU and GSM8K compared to the original models.
  • BarrierSteer (LSE) achieves ~31x speedup over SaP (latency ~6.08 ms/token vs 190.67 ms/token).
  • Composing 14 independently trained barriers with LSE or QP yields the lowest unsafe generation rate (1.82%) compared to Top-2.
  • Increasing steering strength alpha consistently reduces ASR, with absolute safety at alpha = 1.0 while keeping core task performance within ~1.5% of baseline on MMLU.
  • BarrierSteer outperforms baselines like Activation Addition and Directional Ablation in both safety and robustness across datasets.
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

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.