cs.LGFeb 23, 2026

BarrierSteer: LLM Safety via Learning Barrier Steering

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

Organizations: Department of Computer Science, National University of Singapore, Republic of Singapore · Singapore-MIT Alliance for Research and Technology Centre, Republic of Singapore · CSAIL, Massachusetts Institute of Technology, USA · Worcester Polytechnic Institute, Worcester, MA, USA

Abstract

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 GitHub repository.

Figures & tables

Appendix figures & tables17 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Selective Safety Steering via Value-Filtered Decoding

    May 14, 2026Bat-Sheva Einbinder, Hen Davidov, Yee Whye Teh +2Language Model DecodingLanguage Model Steering

  2. FineSteer: A Unified Framework for Fine-Grained Inference-Time Steering in Large Language Models

    Apr 16, 2026Zixuan Weng, Jinghuai Zhang, Kunlin Cai +3Language Model SteeringLLM Safety

  3. Inference-Time Vulnerability Beyond Shallow Safety: Alignment Along Generation Trajectories

    Jun 3, 2026Kyungmin Park, Taesup KimAdversarial Attacks on LLMsLLM Safety Alignment