Manuscript Offprint

arXiv:2609.03544

SafeRI: Recognition and Intervention for Token-Level Safety Intervention in Large Vision Language Models

Caoyuan Ma, Tian Gu, Wenpu Liu, Weichu Xie, Shuai Dong, Yuqi Xu, Ji Zhao, Ziyue Wang, Wenzheng Chang, Taiqiang Wu, Yongfu Zhu, Wenqi Shao, Zheng Wang, Yinqiang Zheng

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Existing safety alignment methods for vision-language models usually modify the model behavior globally: once the safety parameters are trained or loaded, they participate in both unsafe and already-safe generations. This always-on intervention can unnecessarily perturb the model's original reasoning path and degrade general multimodal capabilities. We argue that safety alignment should be an on-demand intervention rather than a permanent modification to every decoding trajectory. To this end, we propose a streaming recognition and gated LoRA framework for intrinsic VLM safety. During autoregressive generation, a lightweight recognizer estimates whether the current pre-token generation state is safe or unsafe. Its output updates the LoRA gate for the following decoding step; otherwise, generation follows the frozen-backbone policy. The LoRA module is trained from unsafe prefixes, transition statements, and safe continuations, so that it learns to redirect unsafe generations back to safe responses after activation. Experiments across multiple safety and general-purpose benchmarks demonstrate the effectiveness of our method in post-alignment settings.

Project page — https://safe-vlm.github.io/SafeRI/

Introduction

Safety risk in vision-language models (VLMs) is not determined by the input alone; it materializes along the model's autoregressive generation trajectory. The same harmful-looking multimodal request may be safely refused by one decoding trajectory but answered with actionable details by another, while an initially ambiguous request may reveal its risk only as the response unfolds. This asymmetry is especially important for VLMs, where harmful intent can be distributed across images, text, and their interaction (Ye et al. 2025; Qi et al. 2023; Gong et al. 2023; Shayegani, Dong, and Abu-Ghazaleh 2024). It is even more pronounced when hardening an instruction-tuned VLM that has already undergone safety alignment: such a model safely handles most benign requests and may already refuse many harmful ones, leaving residual failures concentrated in a relatively small subset of generation trajectories. In this regime, whether additional intervention is needed—and when it becomes necessary—can only be determined from the evolving generation state rather than from a one-shot judgment of the prompt.

Existing VLM safety methods do not fully match this temporal nature of risk. Input-level defenses must decide before observing what the model will generate, whereas output-level guards act only after a potentially unsafe response has already been produced. Training-time alignment and always-on safety adapters (Zong et al. 2024; Zhang et al. 2024; Liu et al. 2024b; Wang et al. 2024b; Oh et al. 2024; Xu et al. 2024) avoid this timing problem by continuously biasing the model toward safe behavior, but they also modify benign trajectories and harmful requests that the base model would already refuse. Such unnecessary intervention creates a safety-alignment tax: perturbed hidden states and token probabilities can lead to over-refusal, stylistic drift, or degraded multimodal utility even when no correction is needed.

These limitations suggest a different formulation: post-alignment safety hardening should be an on-demand trajectory-control problem, rather than a global relearning of safety behavior. The system must continuously recognize whether the partial response is approaching unsafe content and, once risk emerges, modify the token-generation policy for the remaining tokens. These two operations must be coupled in time. Recognition without immediate intervention only reports a failure, while intervention without trajectory-level recognition either acts too early or perturbs every response. Conversely, as long as the frozen backbone remains on a safe trajectory, the appropriate action is to preserve the safety behavior and general capabilities it already possesses.

We instantiate this formulation as SafeRI, a Recognition and Intervention framework for token-level safety intervention. At each decoding step, a lightweight streaming detector reads the evolving hidden state and predicts whether generating the next token is likely to move the trajectory into an unsafe region. When no such imminent risk is predicted, the gate remains closed and generation continues under the frozen-backbone policy. Otherwise, the gate activates a parameter-efficient LoRA behavior-correction module (Hu

∗^{*}These authors contributed equally.

†^{\dagger}Project leader.

1^{1}Co-corresponding authors.

Figure

Figure 1: Comparison between always-on safety fine-tuning and SafeRI. Global safety alignment can unnecessarily perturb safe decoding trajectories, while SafeRI activates safety parameters only when unsafe generation states emerge, preserving the frozen VLM path for safe responses.

et al. 2022) for the next and subsequent tokens, injecting a localized update that redirects the response toward a safe continuation. Unlike input-conditioned routing, which selects a model or module before decoding, SafeRI repeatedly uses the partial assistant trajectory to decide whether the safety adapter should modify the policy for subsequent tokens. Recognition thus decides when to intervene, while intervention determines how the future trajectory is changed.

We train the two components with supervision aligned to the onset of unsafe generation. The recognizer learns whether the current prefix predicts an unsafe next step, while LoRA learns from risky prefixes, transition statements, and safe continuations to redirect subsequent generation. This shared boundary makes the gate actionable while preserving the distinct roles of recognition and intervention.

Our contributions are as follows:

  • We formulate post-alignment VLM safety hardening as a selective trajectory-control problem: the safety adapter should be invoked according to the model's evolving response, while already-safe trajectories should retain the frozen-backbone policy.
  • We propose SafeRI, which detects emerging unsafe trajectories from prefix hidden states during decoding and activates a boundary-aligned LoRA trained on risky prefixes and safe continuations to redirect subsequent generation. Once risk subsides, the gate closes and generation resumes under the frozen-backbone policy.
  • Experiments across multiple VLM families show that SafeRI mitigates residual risk while preserving general

multimodal capability, with ablations characterizing the effects of gate thresholds, adapter placement, and activation causes.

References (55)