BarrierSteer: LLM Safety via Learning Barrier Steering

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Tran, Thanh Q., Verma, Arun, Wong, Kiwan, Low, Bryan Kian Hsiang, Rus, Daniela, Xiao, Wei
Format: Preprint
Published: 2026
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916037562204160
author Tran, Thanh Q.
Verma, Arun
Wong, Kiwan
Low, Bryan Kian Hsiang
Rus, Daniela
Xiao, Wei
author_facet Tran, Thanh Q.
Verma, Arun
Wong, Kiwan
Low, Bryan Kian Hsiang
Rus, Daniela
Xiao, Wei
contents 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}.
format Preprint
id arxiv_https___arxiv_org_abs_2602_20102
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle BarrierSteer: LLM Safety via Learning Barrier Steering
Tran, Thanh Q.
Verma, Arun
Wong, Kiwan
Low, Bryan Kian Hsiang
Rus, Daniela
Xiao, Wei
Machine Learning
Artificial Intelligence
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}.
title BarrierSteer: LLM Safety via Learning Barrier Steering
topic Machine Learning
Artificial Intelligence
url https://arxiv.org/abs/2602.20102