Paper deep dive
Understanding and Rectifying Safety Perception Distortion in VLMs
Xiaohan Zou, Jian Kang, George Kesidis, Lu Lin
Models: LLaVA-1.5-13B, LLaVA-1.5-7B
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 94%
Last extracted: 3/12/2026, 6:43:25 PM
Summary
The paper identifies 'safety perception distortion' in Vision-Language Models (VLMs), where the integration of visual modality shifts internal activations toward a 'safer' direction, causing the model to misclassify harmful inputs as safe. To address this, the authors propose ShiftDC (Activation Shift Disentanglement and Calibration), an inference-only method that disentangles and removes the safety-relevant activation shift while preserving visual semantics, thereby restoring the safety alignment of the underlying LLM backbone without additional training.
Entities (5)
Relation Signals (3)
ShiftDC â mitigates â Safety Perception Distortion
confidence 95% ¡ To mitigate such distortion, we propose Activation Shift Disentanglement and Calibration (ShiftDC)
Visual Modality â causes â Safety Perception Distortion
confidence 90% ¡ multimodal inputs introduce an modality-induced activation shift... We refer to this issue as safety perception distortion.
ShiftDC â restores â Safety alignment
confidence 90% ¡ ShiftDC restores the inherent safety alignment of the LLM backbone
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:Recent studies reveal that vision-language models (VLMs) become more susceptible to harmful requests and jailbreak attacks after integrating the vision modality, exhibiting greater vulnerability than their text-only LLM backbones. To uncover the root cause of this phenomenon, we conduct an in-depth analysis and identify a key issue: multimodal inputs introduce an modality-induced activation shift toward a "safer" direction compared to their text-only counterparts, leading VLMs to systematically overestimate the safety of harmful inputs. We refer to this issue as safety perception distortion. To mitigate such distortion, we propose Activation Shift Disentanglement and Calibration (ShiftDC), a training-free method that decomposes and calibrates the modality-induced activation shift to reduce the impact of modality on safety. By isolating and removing the safety-relevant component, ShiftDC restores the inherent safety alignment of the LLM backbone while preserving the vision-language capabilities of VLMs. Empirical results demonstrate that ShiftDC significantly enhances alignment performance on safety benchmarks without impairing model utility.
Tags
Links
- Source: https://arxiv.org/abs/2502.13095
- Canonical: https://arxiv.org/abs/2502.13095
Trouble viewing inline? Open PDF directly â
Full Text
95,828 characters extracted from source content.
Expand or collapse full text
marginparsep has been altered. topmargin has been altered. marginparpush has been altered. The page layout violates the ICML style. Please do not change the page layout, or include packages like geometry, savetrees, or fullpage, which change it for you. Weâre not able to reliably undo arbitrary changes to the style. Please remove the offending package(s), or layout-changing commands and try again. Understanding and Rectifying Safety Perception Distortion in VLMs Xiaohan Zou 1 Jian Kang 2 George Kesidis 1 Lu Lin 1 â footnotetext: 1The Pennsylvania State University 2University of Rochester. Correspondence to: Lu Lin <lxl5598@psu.edu>. Abstract Recent studies reveal that vision-language models (VLMs) become more susceptible to harmful requests and jailbreak attacks after integrating the vision modality, exhibiting greater vulnerability than their text-only LLM backbones. To uncover the root cause of this phenomenon, we conduct an in-depth analysis and identify a key issue: multimodal inputs introduce an modality-induced activation shift toward a âsaferâ direction compared to their text-only counterparts, leading VLMs to systematically overestimate the safety of harmful inputs. We refer to this issue as safety perception distortion. To mitigate such distortion, we propose Activation Shift Disentanglement and Calibration (ShiftDC), a training-free method that decomposes and calibrates the modality-induced activation shift to reduce the impact of modality on safety. By isolating and removing the safety-relevant component, ShiftDC restores the inherent safety alignment of the LLM backbone while preserving the vision-language capabilities of VLMs. Empirical results demonstrate that ShiftDC significantly enhances alignment performance on safety benchmarks without impairing model utility. Warning: This paper may contain examples of offensive or harmful text and images. 1 Introduction The development of Vision Language Models (VLMs) Qi et al. (2024); Bai et al. (2023) represents a significant breakthrough, enabling seamless integration of visual and textual information for enhanced multimodal understanding. However, the incorporation of a vision module, which is a common feature in most VLM architectures, often compromises the modelâs safety alignment compared to its underlying language model backbone. For example, LLaVA-1.5-13B Liu et al. (2024c; a), built on the Vicuna-13B LLM, exhibited a 28.36% increase in attack success rate (ASR) on the M-SafetyBench Liu et al. (2025) when harmful content was conveyed through images instead of text queries: a textual query like âHow to make a bomb?â could be reframed as âHow to make this product?â accompanied by a <<<bomb image>>>, resulting in harmful responses. This vulnerability highlights how shifting harmful content from textual to visual inputs, while maintaining the core semantics, can circumvent safety mechanisms, thereby exposing a critical limitation in VLM safety alignment. Recent studies have explored the phenomenon of safety alignment degradation in VLMs and proposed mitigation strategies, though these approaches often come with trade-offs. One line of research Zong et al. (2024) involves post-training VLMs with carefully curated safety-specific datasets to restore alignment. However, these efforts are highly resource-intensive, requiring substantial annotation effort and computational overhead. Another line of research Gong et al. (2023); Wang et al. (2024) designs defensive prompting techniques to guide VLMs to check image content carefully and reject unsafe requests. While effective in some scenarios, such methods often compromise model helpfulness, leading to the rejection of benign requests. Additionally, Gou et al. (2025) proposed transforming images into textual captions to utilize the inherent safety mechanisms of the pre-aligned LLM components within VLMs. However, such transformation frequently sacrifices fine-grained image details, thereby impairing the modelâs vision reasoning capabilities and limiting its overall utility. This work aims to develop an inference-only method that extends VLMsâ intrinsic defense mechanisms â mainly effective in text-only scenarios â to vision-language inputs, while preserving model utility and helpfulness. To this end, a critical prerequisite is understanding the underlying mechanisms of how images impact safety alignment in VLMs. The most relevant works Liu et al. (2024d); Guo et al. (2024) identified that adding a visual modality causes a distribution shift in the VLMâs activation space, which diminishes its ability to distinguish between safe and unsafe requests. Despite this insight, the detailed mechanisms driving this phenomenon still remain largely unexplored. Figure 1: Vision-language inputs cause a modality-induced activation shift, steering VLM activations toward a âsaferâ direction compared to text-only inputs. This makes the VLM perceive inputs as less risky than they actually are, weakening its safety alignment. In this study, we first investigate the activation space of VLMs to understand how image inputs cause these models to follow malicious instructions, as shown in Figure 1. We conducted a series of analyses, with the key findings summarized as follows: (1) While LLM backbones can effectively recognize unsafe inputs in text-only scenarios, VLMs struggle to distinguish between safe and unsafe inputs when images are introduced. (2) Activations of vision-language inputs deviate from their corresponding text-only inputs, indicating that the visual modality induces an activation shift. (3) Most activations for vision-language inputs, whether unsafe or safe, fall on the âsafeâ side of the safety boundary derived from text-only LLMs. This suggests that the activation shift includes a component, referred to as the safety-relevant shift, which moves activations to a position that appears safer. (4) The more the activations of unsafe requests shift toward the âsafeâ side, the more likely these requests are to bypass the VLMâs safety mechanisms. These observations suggest that adding visual input induces an activation shift that can be disentangled into two components: a safety-relevant shift, which distorts the requestâs perceived safety to the VLM, leading it to misinterpret unsafe inputs as safe and ultimately reply the unsafe command; a safety-irrelevant shift, which captures meaningful visual semantics and other modality-specific properties that are orthogonal to the safety direction. Inspired by this, we propose Activation Shift Disentanglement and Calibration (ShiftDC), which removes the safety-relevant shift while preserving the safety-irrelevant shift when an image is incorporated as input during inference. By removing the safety-relevant shift, this approach restores activations to their appropriate safety-related position, allowing the pre-aligned LLM backboneâs defense mechanism to function as intended. By preserving the safety-irrelevant shift, essential visual semantics and other modality-specific information are retained and properly anchored. Moreover, ShiftDC operates as an inference-only technique, requiring only a small amount of data and no additional training. Through experiments on two VLM safety benchmarks, two visual reasoning utility benchmarks, and five different VLMs, we demonstrate that ShiftDC significantly enhances the alignment ability of VLMs without compromising their general performance. We hope these findings can inspire a new perspective on improving VLM safety alignment. In summary, our main contributions are as follows: ⢠We empirically demonstrate that the incorporation of the visual modality shifts activations toward a safer direction, which is a key factor contributing to the degradation of safety alignment. ⢠We propose ShiftDC, a simple, effective, and efficient method for disentangling and calibrating VLM activations to restore safety alignment. ⢠Experimental results show that ShiftDC enhances VLM safety alignment to match and even surpass its LLM backbone without additional training, while maintaining vision reasoning capabilities. 2 Related Work VLM Jailbreak Attacks. Research has shown that the continuous and high-dimensional nature of visual inputs makes VLMs more vulnerable to adversarial attacks. VLMs can be jailbroken by optimizing adversarial images designed to trigger harmful responses Niu et al. (2024); Qi et al. (2024). For example, imgJP Niu et al. (2024) optimizes a universal perturbation across unseen prompts and images to generate a targeted response. Several studies have further evaluated VLMsâ robustness to adversarial images Dong et al. (2023); Han et al. (2023); Zhao et al. (2024). In contrast to perturbation-based methods, other approaches embed high-risk content directly into images using generative models Liu et al. (2025); Luo et al. (2024); Li et al. (2025) or typography Gong et al. (2023); Liu et al. (2025); Shayegani et al. (2023). The vulnerability of VLMs to malicious image inputs has been evaluated in various scenarios by Liu et al. (2025); Luo et al. (2024). FigStep Gong et al. (2023) further demonstrates that embedding textual prompts designed to induce step-by-step responses into images increases the risk of VLMs generating harmful outputs. Our work primarily focuses on uncovering why VLMs are vulnerable to visual inputs and exploring ways to mitigate this vulnerability. VLM Jailbreak Defenses. Defense approaches against VLM jailbreaks typically involve fine-tuning on specialized safety-related datasets using reinforcement learning from human feedback (RLHF) Sun et al. (2024); Zhang et al. (2024) or supervised fine-tuning Zong et al. (2024); Chen et al. (2024b). Other approaches incorporate trained classifiers or fine-tuned defense LLMs Pi et al. (2024) to detect and correct harmful outputs. However, these approaches are resource-intensive and heavily depend on the quality of annotated training data. Moreover, their safety capabilities are often restricted to the specific domains covered in the training data. Inference-only defenses overcome these limitations. AdaShield Wang et al. (2024) iteratively refines prompts to help VLMs carefully examine image content and reject unsafe requests using an LLM defender. ECSO Wang et al. (2024) converts visual content into text to reactivate the LLM backboneâs inherent alignment mechanism. However, these methods are either time-consuming due to iterative prompt generation or suffer from reduced helpfulness and reasoning abilities caused by defensive prompts or loss of visual details Ding et al. (2024). Understanding the Mechanism of VLM Jailbreaks. Few studies have examined how the image modality affects VLM behavior and leads them to follow harmful instructions. VLGuard Zong et al. (2024) suggests that VLMsâ safety degradation is caused by catastrophic forgetting during vision-language fine-tuning and the presence of harmful content in instruction-tuning datasets. However, several studies have shown that the safety degradation in a VLMâs fine-tuned LLM backbone is minimal compared to its original, pre-fine-tuned version Guo et al. (2024); Luo et al. (2024). FigStep Gong et al. (2023) shows that step-by-step instructional typography embedded in images is effective because safe and unsafe typography representations become intermixed, making them harder to distinguish. This observation is also reported in Liu et al. (2024d); Guo et al. (2024). Building on this, CMRM Liu et al. (2024d) proposes removing the influence of image incorporation in hidden states to restore safety alignment. ETA Ding et al. (2024) shows that LLM backbones are aligned with discrete textual embeddings, which is why continuous visual embeddings can bypass safety mechanisms. Mapping continuous tokens to discrete ones significantly reduces unsafe rate. While promising, it still remains unclear how adding images impacts VLM activation spaces in ways that affect safety and how to separate this safety impact from modality-induced effects that are essential for utility and helpfulness. 3 Preliminaries Vision Language Models (VLMs). VLMs are autoregressive text generation models that process texts and images, functioning as a mapping Ď:nĂââm:âsuperscriptâsuperscriptĎ:V^nĂI ^mĎ : Vitalic_n Ă I â Vitalic_m, where VV is the vocabulary set, âII is the image space, and n and m denote the number of input and output text tokens, respectively. The input to the VLM Ď includes a text prompt =(p1,p2,âŚ,pn)ânsubscript1subscript2âŚsubscriptsuperscriptp=(p_1,p_2,âŚ,p_n) ^np = ( p1 , p2 , ⌠, pitalic_n ) â Vitalic_n and an image ââi â I. Given vl=[,]subscriptvlt_vl=[p,i]tvl = [ p , i ], the VLM Ďâ˘(|)conditionalĎ(y|t)Ď ( y | t ) generates the output sequence âmsuperscripty ^my â Vitalic_m one token at a time. Figure 2: Examples of constructed datasets. Safety-related Dataset Construction. We construct vision-language datasets, vl=vlunsafeâŞvlsafesubscriptvlsubscriptsuperscriptunsafevlsubscriptsuperscriptsafevlD_vl=D^unsafe_vl % ^safe_vlDvl = Dunsafevl ⪠Dsafevl, containing harmful and benign instructions, respectively. In each input vlâvlsubscriptvlsubscriptvlt_vl _vltvl â Dvl, the image is semantically related to the text prompt. Additionally, we create the corresponding text-only datasets, t=ttunsafeâŞttsafesubscriptttsubscriptsuperscriptunsafettsubscriptsuperscriptsafettD_t=D^unsafe_t % ^safe_tDtt = Dunsafett ⪠Dsafett, by replacing the image ii in each sample vlâvlsubscriptvlsubscriptvlt_vl _vltvl â Dvl with its image caption cc, resulting in pairs of the form t=[,]âttsubscriptttsubscriptttt_t=[p,c] _tt = [ p , c ] â Dtt. The captions are generated by a VLM Ďâ˘(âŁ[,,])conditionalĎ(c [p,i,q])Ď ( c ⣠[ p , i , q ] ), where qq is the instruction: âBased on the request, describe the imageâ. Therefore, the samples from these two datasets (i.e., vl=[,]subscriptvlt_vl=[p,i]tvl = [ p , i ] and its corresponding text-only version t=[,]subscriptttt_t=[p,c]t = [ p , c ]) contain similar semantic information, and mainly differ in the modality. Figure 2 presents sample examples from these datasets, with further construction details available in Appendix A. Activations and Directions. Let ââ˘()superscriptâx (t)xroman_â ( t ) denote the residual stream activation of the last token at layer ââLâ â Lâ â L of a VLM, representing the information for the input tt processed up to layer â â. We define the function ActMeantypewriter_ActMean to compute the mean last-token activation at layer â â for a given dataset DD: ââ˘()=1â˘[ââââ˘()].superscriptâ1delimited-[]subscriptsuperscriptâ ActMean (D)= 1D [ _% t x (t) ].typewriter_ActMeanâ ( D ) = divide start_ARG 1 end_ARG start_ARG D end_ARG [ ât â D xroman_â ( t ) ] . (1) Various studies Cao et al. (2024); Arditi et al. (2024); Park et al. (2024); Marks & Tegmark (2023) have shown that high-level concepts are represented as linear directions in the activation space of LLMs. These directions can be identified by computing the difference between the mean activations of a model when processing two sets of contrastive instructions, 1subscript1D_1D1 and 2subscript2D_2D2, that elicit distinct behaviors: 2â1â=ââ˘(1)âââ˘(2).subscriptsuperscriptââsubscript2subscript1superscriptâsubscript1superscriptâsubscript2v _D_2 _1= ActMean% (D_1)- ActMean (D_2).vroman_âcaligraphic_D start_POSTSUBSCRIPT 2 â D1 end_POSTSUBSCRIPT = typewriter_ActMeanâ ( D1 ) - typewriter_ActMeanâ ( D2 ) . (2) The resulting 2â1âsubscriptsuperscriptââsubscript2subscript1v _D_2 _1vroman_âcaligraphic_D start_POSTSUBSCRIPT 2 â D1 end_POSTSUBSCRIPT, known as the difference-in-mean vector, describes both the direction and magnitude of layer-â â activation variation from 2subscript2D_2D2 to 1subscript1D_1D1. This vector effectively isolates the key features that drive the modelâs behavioral differences between two instruction sets. 4 How Do Vision-Language Inputs Distort Safety Perception? Previous studies have shown that transforming malicious input from text to image significantly weakens the safety alignment of VLMs Liu et al. (2025); Gong et al. (2023). To investigate the underlying cause of this phenomenon, we conduct a series of experiments on the activation spaces of LLaVA-1.5-7B Liu et al. (2024c) and MiniGPT-4-7B Zhu et al. (2024), two widely used VLMs. Our findings reveal the issue of safety perception distortion: compared to text-only inputs, image-text inputs shift the activations, causing VLMs to become overly optimistic about its input safety, which is detailed as follows. Observation 1: VLMs struggle to differentiate between safe and unsafe vision-language inputs. Recent works Lee et al. (2024); Rimsky et al. (2024) have found that safety-aligned LLMs can identify unsafe requests in their activation space. To check whether VLMs maintain similar safety perception ability after integrating visual input, we probe the modelâs activation via a linear classifier. Given a dataset =safeâŞunsafesuperscriptsafesuperscriptunsafeD=D^safe ^unsafeD = Dsafe ⪠Dunsafe with instructions labeled as âsafeâ or âunsafeâ, we train a classification model ââdsuperscriptâW ^dW â blackboard_Rd for each layer â â to predict whether the activation ââ˘()superscriptâx (t)xroman_â ( t ) corresponds to a safe or unsafe instruction using the training set: Pâ˘(safety|â)=softmaxâ˘(â˘ââ˘()),â.formulae-sequenceconditionalsafetysuperscriptâsoftmaxsuperscriptâP(safety|x )=softmax(W\,x % (t)),\;t .P ( safety | xroman_â ) = softmax ( W xroman_â ( t ) ) , t â D . (3) We conduct binary safety classification experiments under two settings: (1) train and test on the text-only inputs ttsubscriptttD_tDtt and (2) train and test on the vision-language inputs vlsubscriptvlD_vlDvl. Both ttsubscriptttD_tDtt and vlsubscriptvlD_vlDvl use a 4:1 split for training and testing. Figure 3: Safety classification accuracy by probing per layer. Figure 3 shows the safety classification accuracy by probing VLMsâs activations per layer. For both LLaVA-1.5-7B and MiniGPT-4-7B, the binary classifiers trained on the text-only dataset ttsubscriptttD_tDtt achieve âź90%similar-toabsentpercent90 90\%âź 90 % accuracy on its test set at middle layers, while the classifiers trained on vlsubscriptvlD_vlDvl achieve only âź65%similar-toabsentpercent65 65\%âź 65 % accuracy, barely above random guessing. The results suggest that while the LLM backbone can distinguish between safe and unsafe text-only inputs, VLMs struggle with vision-language inputs. This indicates that activations for safe and unsafe data in ttsubscriptttD_tDtt are linearly separable, but those in vlsubscriptvlD_vlDvl are intermixed, even in deeper layers. Observation 2: Visual modality induces an activation shift, causing VLMs to misperceive instructions as safer. We also observe from Figure 3 (left) that when the safety classifiers are trained on text-only inputs ttsubscriptttD_tDtt and tested on vision-language inputs vlsubscriptvlD_vlDvl, their accuracies in the middle layers drop to âź60%similar-toabsentpercent60 60\%âź 60 %, causing âź30%similar-toabsentpercent30 30\%âź 30 % decrease compared to testing on the original text-only test set of ttsubscriptttD_tDtt. To understand the cause of this drop, Figure 4 shows the corresponding confusion matrices. The results indicate that âź95%similar-toabsentpercent95 95\%âź 95 % of safe instructions and âź70%similar-toabsentpercent70 70\%âź 70 % of unsafe instructions are classified as âsafeâ, suggesting a clear tendency to overestimate the safety of vision-language inputs. Figure 4: Confusion matrices of safety-probing classifiers trained on text-only ttsubscriptttD_tDtt and tested on vision-language vlsubscriptvlD_vlDvl. To visualize such shift, as shown in Figure 5, we project layer-15 activations onto a 2D space, and highlight three key points: (1) Activations on text-only ttsafesuperscriptsubscriptttsafeD_t^safeDttsafe and ttunsafesuperscriptsubscriptttunsafeD_t^unsafeDttunsafe are clearly separable, while those of vision-language vlsafesuperscriptsubscriptvlsafeD_vl^safeDvlsafe and vlunsafesuperscriptsubscriptvlunsafeD_vl^unsafeDvlunsafe are intermixed, supporting Observation 1. (2) Activations on text-only ttsubscriptttD_tDtt and vision-language vlsubscriptvlD_vlDvl are distinctly separated, suggesting that including an image modality shifts the activations away from its original distribution optimized for the LLM backbone. This aligns with observations from Liu et al. (2024d). (3) Most samples from vision-language vlsubscriptvlD_vlDvl, including unsafe ones, fall on the âsafeâ side of the safety boundary (red line) derived from ttsubscriptttD_tDtt, indicating that incorporating images for malicious instructions shifts their activations toward the safer side. This explains why a classifier trained on ttsubscriptttD_tDtt often misclassifies vlsubscriptvlD_vlDvl samples as âsafeâ, regardless of their true labels. Figure 5: t-SNE visualization of the modelâs last token activations on ttsafesuperscriptsubscriptttsafeD_t^safeDttsafe, ttunsafesuperscriptsubscriptttunsafeD_t^unsafeDttunsafe, vlsafesuperscriptsubscriptvlsafeD_vl^safeDvlsafe, and vlunsafesuperscriptsubscriptvlunsafeD_vl^unsafeDvlunsafe. The red line indicates the boundary between text-only safe samples and unsafe samples. Observation 3: Increased activation shift towards the âsafeâ side correlates with a higher chance of bypassing VLM safety mechanisms. To investigate how the magnitude of safety misperception in activations affects the likelihood of safety violation in VLMs, we analyze the activation shift specifically in the safety-related direction. To this end, we extract the activation shift by contrasting text-only benign dataset ttsafesuperscriptsubscriptttsafeD_t^safeDttsafe and harmful dataset ttunsafesuperscriptsubscriptttunsafeD_t^unsafeDttunsafe, using difference-in-mean as described in Eq. (2): ttunsafeâttsafeâ=ââ˘(ttsafe)âââ˘(ttunsafe),subscriptsuperscriptââsuperscriptsubscriptttunsafesuperscriptsubscriptttsafesuperscriptâsuperscriptsubscriptttsafesuperscriptâsuperscriptsubscriptttunsafes _D_t^unsafeâ% D_t^safe= ActMean (D_t^% safe)- ActMean (D_t^unsafe),sroman_âcaligraphic_D start_POSTSUBSCRIPT ttunsafe â Dttsafe end_POSTSUBSCRIPT = typewriter_ActMeanâ ( Dttsafe ) - typewriter_ActMeanâ ( Dttunsafe ) , (4) where ttunsafeâttsafeâsubscriptsuperscriptââsuperscriptsubscriptttunsafesuperscriptsubscriptttsafes _D_t^unsafeâ% D_t^safesroman_âcaligraphic_D start_POSTSUBSCRIPT ttunsafe â Dttsafe end_POSTSUBSCRIPT represents the activation shift from unsafe to safe instructions, referred to as safety-relevant shift. We contrast text-only datasets to identify this shift, as their activations exhibit greater linear separability w.r.t. safety, as shown in Observation 1. We also compute activation shifts induced by the introduction of the visual modality. Considering whether an input successfully jailbreaks the VLM, we partition the harmful vision-language dataset vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl into two subsets: vlsuccesssuperscriptsubscriptvlsuccessD_vl^successDvlsuccess, which successfully bypass safety mechanisms, and vlfailuresuperscriptsubscriptvlfailureD_vl^failureDvlfailure, which does not. Their text-only counterparts are ttsuccesssuperscriptsubscriptttsuccessD_t^successDttsuccess and ttfailuresuperscriptsubscriptttfailureD_t^failureDttfailure respectively. We also construct a special vision-language set vlblanksuperscriptsubscriptvlblankD_vl^blankDvlblank, where each request from the text-only harmful ttunsafesuperscriptsubscriptttunsafeD_t^unsafeDttunsafe is paired with a blank image. Based on these fine-grained categorization of unsafe instructions, we follow Eq. (2) to derive the following modality-induced activation shifts: ttunsafeâvlunsafeâ=ââ˘(vlunsafe)âââ˘(ttunsafe),subscriptsuperscriptââsuperscriptsubscriptttunsafesuperscriptsubscriptvlunsafesuperscriptâsuperscriptsubscriptvlunsafesuperscriptâsuperscriptsubscriptttunsafe _D_t^unsafe% _vl^unsafe= ActMean (% D_vl^unsafe)- ActMean (D_% t^unsafe),mroman_âcaligraphic_D start_POSTSUBSCRIPT ttunsafe â Dvlunsafe end_POSTSUBSCRIPT = typewriter_ActMeanâ ( Dvlunsafe ) - typewriter_ActMeanâ ( Dttunsafe ) , ttsuccessâvlsuccessâ=ââ˘(vlsuccess)âââ˘(ttsuccess),subscriptsuperscriptââsuperscriptsubscriptttsuccesssuperscriptsubscriptvlsuccesssuperscriptâsuperscriptsubscriptvlsuccesssuperscriptâsuperscriptsubscriptttsuccess _D_t^success% _vl^success= ActMean (% D_vl^success)- ActMean (D_% t^success),mroman_âcaligraphic_D start_POSTSUBSCRIPT ttsuccess â Dvlsuccess end_POSTSUBSCRIPT = typewriter_ActMeanâ ( Dvlsuccess ) - typewriter_ActMeanâ ( Dttsuccess ) , ttfailureâvlfailureâ=ââ˘(vlfailure)âââ˘(ttfailure),subscriptsuperscriptââsuperscriptsubscriptttfailuresuperscriptsubscriptvlfailuresuperscriptâsuperscriptsubscriptvlfailuresuperscriptâsuperscriptsubscriptttfailure _D_t^failure% _vl^failure= ActMean (% D_vl^failure)- ActMean (D_% t^failure),mroman_âcaligraphic_D start_POSTSUBSCRIPT ttfailure â Dvlfailure end_POSTSUBSCRIPT = typewriter_ActMeanâ ( Dvlfailure ) - typewriter_ActMeanâ ( Dttfailure ) , ttunsafeâvlblankâ=ââ˘(vlblank)âââ˘(ttunsafe).subscriptsuperscriptââsuperscriptsubscriptttunsafesuperscriptsubscriptvlblanksuperscriptâsuperscriptsubscriptvlblanksuperscriptâsuperscriptsubscriptttunsafe _D_t^unsafe% _vl^blank= ActMean (% D_vl^blank)- ActMean (D_% t^unsafe).mroman_âcaligraphic_D start_POSTSUBSCRIPT ttunsafe â Dvlblank end_POSTSUBSCRIPT = typewriter_ActMeanâ ( Dvlblank ) - typewriter_ActMeanâ ( Dttunsafe ) . We compute cosine similarity between each modality-induced shift and the safety shift, cosâĄâ¨â,ââŠsuperscriptâsuperscriptâ ,s cos ⨠mroman_â , sroman_â âŠ, to quantify the impact of visual modality on safety. A larger value indicates a stronger activation shift toward the safe side due to visual input. Figure 6 reports these cosine similarities, along with the Attack Success Rate (ASR) of the corresponding vision-language unsafe instruction sets. The results reveal a clear positive correlation between cosine similarity and ASR: when the modality-induced shift aligns more closely with the safety shift, the ASR increases, making it more likely for inputs to bypass the VLMâs safety mechanisms. Specifically, for â â˘vlsuccessâ superscriptsubscriptvlsuccess [rgb]1,0,0 [named]pgfstrokecolorrgb1,0,0% \,D_vl^successâ Dvlsuccess which achieves 100% ASR, the corresponding modality shift ttsuccessâvlsuccessâsubscriptsuperscriptââsuperscriptsubscriptttsuccesssuperscriptsubscriptvlsuccessm _D_t^successâ % D_vl^successmroman_âcaligraphic_D start_POSTSUBSCRIPT ttsuccess â Dvlsuccess end_POSTSUBSCRIPT exhibits the highest cosine similarity (>0.7absent0.7>0.7> 0.7) with the safety shift; in contrast, âvlfailureâabsentsuperscriptsubscriptvlfailure [rgb]0,0,0 [named]pgfstrokecolorrgb0,0,0% @color@gray@stroke0 @color@gray@fill0 \,D_% vl^failureâ Dvlfailure, with 0% ASR, results in the lowest cosine similarity (<0.2absent0.2<0.2< 0.2). Additionally, â â˘vlblankâ superscriptsubscriptvlblank [rgb].75,0,.25 [named]pgfstrokecolorrgb.75,0,.25% D_vl^blankâ Dvlblank shows a positive ASR and cosine similarity, indicating that even blank images â despite their minimal semantic content â can push activations toward the safe side, suggesting that such shift originates from the visual modality itself rather than specific image content. Figure 6: Y-axis: attack success rate of unsafe vision-language instruction sets â˛vlunsafe,â vlsuccess,âvlfailure [rgb]1,.5,0 [named]pgfstrokecolorrgb1,.5,0% \,D_vl^unsafe, [rgb]1,0,0% [named]pgfstrokecolorrgb1,0,0 \,D_% vl^success, [rgb]0,0,0 [named]% pgfstrokecolorrgb0,0,0 @color@gray@stroke0 @color@gray@fill% 0 \,D_vl^failureⲠDvlunsafe , â Dvlsuccess , â Dvlfailure and â â˘vlblankâ superscriptsubscriptvlblank [rgb].75,0,.25 [named]pgfstrokecolorrgb.75,0,.25% \,D_vl^blankâ Dvlblank. X-axis: cosine similarity between the safety shift ttunsafeâttsafeâsubscriptsuperscriptââsuperscriptsubscriptttunsafesuperscriptsubscriptttsafes _D_t^unsafeâ% D_t^safesroman_âcaligraphic_D start_POSTSUBSCRIPT ttunsafe â Dttsafe end_POSTSUBSCRIPT and each modality-induced shift t(â )âvl(â )âsubscriptsuperscriptââsuperscriptsubscriptttâ superscriptsubscriptvlâ m _D_t^(¡) _% vl^(¡)mroman_âcaligraphic_D start_POSTSUBSCRIPT t( â ) â Dvl( â ) end_POSTSUBSCRIPT derived on these sets. Remark. These observations conclude that incorporating images into input instructions induces a significant shift in the activation space, referred to as the modality-induced shift. This shift includes a component toward a âsaferâ direction, termed the safety-relevant shift, which causes VLMs to mistakenly perceive unsafe instructions as safe, bypassing their safety mechanisms. 5 Rectifying Safety Perception Distortion Figure 7: Overview of the proposed Activation Shift Disentanglement and Calibration (ShiftDC). Previous efforts to mitigate safety degradation in VLMs often involve trade-offs. Post-training approaches Zong et al. (2024) require carefully designed datasets and significant computational resources. Defensive prompt-based methods Wang et al. (2024) often make the model overly cautious, reducing its helpfulness even for benign instructions. Converting images into captions Gou et al. (2025) can trigger the intrinsic safety mechanisms of the LLM backbone but risks losing visual details such as color, texture, and object arrangement, diminishing the modelâs utility. Goal and Motivation. In this work, we aim to enhance VLMsâ safety during inference time, while maintaining the visual information and model helpfulness. Specifically, after applying our inference-only intervention, we expect the VLM to: (1) preserve its perception ability on the safety of vision-language inputs, such that the LLM backboneâs inherent safety mechanisms can be properly activated, and (2) preserve the modality-specific information (e.g., visual semantics) introduced by the visual modality, such that the VLMâs vision understanding ability is maintained. We achieve these goals by leveraging our findings in VLMsâ activation space. As discussed in Section 4, the safety alignment degradation of VLMs is related to their safety perception distortion: the visual input causes a modality-induced activation shift, which contains a safety-relevant component that leads VLMs to misjudge unsafe request as safe and break their safety guardrails. Therefore, we approach to restore safety alignment of VLMs by rectifying safety perception distortion via Activation Shift Disentanglement and Calibration (ShiftDC), illustrated in Figure 7. Disentangling Modality-Induced Activation Shift. Observation 2 & 3 suggest that vision-language inputs vl=[,]âvlsubscriptvlsubscriptvlt_vl=[p,i] _vltvl = [ p , i ] â Dvl tend to distort model activations towards the âsaferâ side, compared to their text-only counterparts t=[,]âttsubscriptttsubscriptttt_t=[p,c] _tt = [ p , c ] â Dtt. Ideally, simply changing the modality (e.g., content in presence of image vs. text) should not introduce any safety-related shift. Therefore, to allow VLMs process vision-language inputs without safety perception distortion, it is crucial to isolate the safety-relevant component from safety-irrelevant shifts (e.g., specifically to the modality itself) in their activation space. To this end, we propose to disentangle modality-induced activation shift as follows. During model inference, given a vision-language input vl=[,]subscriptvlt_vl=[p,i]tvl = [ p , i ], we first obtain its text-only counterpart t=[,]subscriptttt_t=[p,c]t = [ p , c ] by replacing the image with its caption as introduced in Section 4. Their last-token activations at layer â â correspond to ââ˘(vl)superscriptâsubscriptvlx (t_vl)xroman_â ( tvl ) and ââ˘(t)superscriptâsubscriptttx (t_t)xroman_â ( t ). We can calculate the modality-induced activation shift for the given input as follows (i.e., blue arrow in Figure 7): tâvlâ=ââ˘(vl)âââ˘(t).subscriptsuperscriptââsubscriptttsubscriptvlsuperscriptâsubscriptvlsuperscriptâsubscriptttm _t_t _vl=% x (t_vl)-x (t_% t).mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT = xroman_â ( tvl ) - xroman_â ( t ) . (5) To isolate its safety-relevant component, we need to identify the safety direction in activation space. This fortunately has been pre-computed via Eq. (4), and we simplify its notion as âsuperscriptâs sroman_â (i.e., yellow arrow in Figure 7). The safety-relevant component of tâvlâsubscriptsuperscriptââsubscriptttsubscriptvlm _t_t _vlmroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT is obtained by projecting it onto âsuperscriptâs sroman_â: ââ˘(tâvlâ)=tâvlââ ââââ2â˘â.subscriptsuperscriptâsubscriptsuperscriptââsubscriptttsubscriptvlâ subscriptsuperscriptââsubscriptttsubscriptvlsuperscriptâsuperscriptnormsuperscriptâ2superscriptâ proj_s (m _t_t% _vl)= m _t_ % t _vl¡s \|s^% \|^2s .typewriter_projsroman_â ( mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT ) = divide start_ARG mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT â sroman_â end_ARG start_ARG ⼠sroman_â âĽ2 end_ARG sroman_â . (6) As discussed in Observation 3, this component causes unsafe vision-language input to be misperceived as safe, thus should be removed to calibrate the activation shift. Calibrating Activation Shift. With the safety-relevant component decoupled as ââ˘(tâvlâ)subscriptsuperscriptâsubscriptsuperscriptââsubscriptttsubscriptvl proj_s (m _t_t% _vl)typewriter_projsroman_â ( mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT ), we eliminate it from the activation shift tâvlâsubscriptsuperscriptââsubscriptttsubscriptvlm _t_t _vlmroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT to obtain the calibrated shift (i.e., red arrow in Figure 7). Therefore, we intervene the original activation of the vision-language input as follows: ^ââ˘(vl)superscript^âsubscriptvl x (t_vl)over start_ARG x end_ARGâ ( tvl ) =ââ˘(t)+(tâvlââââ˘(tâvlâ)âcalibrated shift)absentsuperscriptâsubscriptttsubscriptâsubscriptsuperscriptââsubscriptttsubscriptvlsubscriptsuperscriptâsubscriptsuperscriptââsubscriptttsubscriptvlcalibrated shift =x (t_t)+( m% _t_t _vl- % proj_s (m _t_tâ% t_vl)_calibrated shift)= xroman_â ( t ) + ( underâ start_ARG mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT - typewriter_projsroman_â ( mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT ) end_ARGcalibrated shift ) =ââ˘(vl)âââ˘(tâvlâ).absentsuperscriptâsubscriptvlsubscriptsuperscriptâsubscriptsuperscriptââsubscriptttsubscriptvl =x (t_vl)- proj_ % s (m _t_t _% vl).= xroman_â ( tvl ) - typewriter_projsroman_â ( mroman_âbold_t start_POSTSUBSCRIPT t â tvl end_POSTSUBSCRIPT ) . (7) The calibrated shift represents the desired safety-irrelevant effect by the introduction of visual modality. The activation of the vision-language input vlsubscriptvlt_vltvl is thus calibrated as ^ââ˘(vl)superscript^âsubscriptvl x (t_vl)over start_ARG x end_ARGâ ( tvl ) (i.e., yellow circle in Figure 7), which will be passed to the later layers of VLMs to mitigate the safety-relevant shift. Our proposed disentangling-then-calibrating strategy for activation shift offers several advantages beyond enhancing VLM safety: (1) preserved model utility â The modelâs ability to process visual inputs remains intact, as only the safety-related component is removed from the activation; (2) maintained model helpfulness â By leveraging LLMâs inherent safety mechanisms without imposing additional screening, the approach avoids making the model overly cautious; (3) efficiency â The method introduces only two additional forward passes compared to standard inference, ensuring affordable computational overhead. 6 Experiments 6.1 Models and Baseline Methods We compare ShiftDC with recent inference-time VLM defense frameworks, AdaShield Wang et al. (2024) and ECSO Gou et al. (2025) on five open-source VLMs: LLaVA-1.5-7B Liu et al. (2024c; a), LLaVA-1.6-34B Liu et al. (2024b), MiniGPT-4-7B Zhu et al. (2024), ShareGPT4V-7B Chen et al. (2024a), and Qwen-VL-7B Bai et al. (2023). 6.2 Main Results on Safety Evaluation Metric. To evaluate the effectiveness of a jailbreak attack under a defense framework, we measure the Attack Success Rate (ASR), defined as the ratio of harmful responses to the total number of input queries. A lower ASR indicates a stronger defense against attacks. Following Liu et al. (2025); Wang et al. (2024), we classify harmful responses by checking for the presence of rejection keywords in the response, predefined in Appendix C. Table 1: Attack success rates of different VLMs on M-SafetyBench Liu et al. (2025), averaged across all scenarios. Lower values indicate stronger defense performance. Models Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC LaVA-1.5-7B 49.2 45.4 40.3 42.6 38.0 69.3 43.0 42.6 39.7 70.5 48.8 45.8 43.6 LLaVA-1.6-34B 35.2 37.8 35.6 33.4 30.1 60.5 35.2 44.7 32.1 58.4 36.3 40.2 34.6 MiniGPT-4-7B 52.7 48.0 42.5 46.5 40.5 72.0 45.3 47.5 43.3 72.4 53.6 47.9 44.6 ShareGPT4V-7B 46.6 43.3 38.3 39.8 37.1 69.0 45.7 48.5 41.7 69.7 47.7 48.6 46.2 Qwen-VL-7B 49.2 49.3 43.7 50.5 43.0 74.4 49.0 49.4 45.4 76.4 55.5 49.9 46.1 Table 2: Attack success rate (ASR) on LLaVA-1.5-7B for M-SafetyBench. Lower values indicate stronger defense performance. Scenarios Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC 01: Illegal Activity 10.2 25.1 6.6 10.6 6.2 70.3 6.0 7.5 6.4 78.3 12.4 10.9 7.2 02: HateSpeech 8.7 19.5 4.3 10.6 6.4 44.8 16.2 7.8 5.3 51.5 17.0 9.6 10.5 03: Malware Generation 59.6 18.8 7.5 4.5 4.5 72.1 15.9 9.6 12.6 65.8 19.0 8.1 10.2 04: Physical Harm 34.9 20.0 10.4 15.7 8.8 64.9 15.0 16.2 10.5 60.1 18.3 13.5 7.4 05: Economic Harm 8.4 6.8 7.9 10.3 8.1 14.0 7.9 15.6 8.1 17.5 10.5 14.2 7.9 06: Fraud 15.2 23.8 10.4 13.3 9.4 72.6 12.2 9.4 9.7 64.1 22.2 13.6 10.8 07: Pornography 15.2 12.2 9.5 10.1 9.7 25.1 16.0 13.2 8.8 28.8 25.9 13.3 10.8 09: Privacy Violence 27.6 15.1 14.6 18.2 10.2 57.4 16.6 22.4 15.0 60.0 25.3 21.8 17.7 Average 49.2 45.4 40.3 42.6 38.0 69.3 43.0 42.6 39.7 70.5 48.8 45.8 43.6 Table 3: Attack success rates on the FigStep benchmark Gong et al. (2023). Lower values indicate stronger defense performance. Models Direct ECSO AdaShield ShiftDC LLaVA-1.5-7B 62.4 9.7 12.4 8.5 ShareGPT4V-7B 28.7 10.9 14.3 9.2 MiniGPT-4-7B 12.5 8.3 8.0 6.3 Qwen-VL-7B 25.3 9.5 10.5 8.4 Safety Benchmarks. Experiments evaluating the safety of VLMsâ responses are conducted on the M-SafetyBench Liu et al. (2025) and FigStep Gong et al. (2023) benchmarks. M-SafetyBench assesses VLM safety across 13 commonly prohibited scenarios. Each query is represented in three input formats: (1) Stable-diffusion images (SD); (2) Typography (OCR) images and (3) SD+OCR images. FigStep rephrases harmful instructions to encourage the model to generate answers item-by-item and converts them into images using typography. More details are in Appendix A. Evaluation Results. For M-SafetyBench, the average ASR across 13 scenarios for all VLMs is shown in Table 1, while Table 2 presents ASR results for 8 out of 13 scenarios using LLaVA-1.5-7B, following Gou et al. (2025). Table 3 shows ASR results on FigStep across different VLMs. Complete results are available in the Appendix D. Most VLM backbones exhibit a high ASR when processing vision-language inputs. While SD images cause only a slight increase in ASR, typography-based attacks (OCR & FigStep) are highly effective. After applying ShiftDC, ASR is significantly reduced across all VLMs and attack types, demonstrating its effectiveness in reactivating safety alignment and defending against attacks. ShiftDC also outperforms ECSO and AdaShield, highlighting the effectiveness of its activation calibration. 6.3 Main Results on Utility Table 4: Utility scores on MME-P, MME-C, and M-Vet, respectively. Higher values indicate better visual-reasoning capabilities. Models MME-P MME-C M-Vet Direct ECSO AdaShield ShiftDC Direct ECSO AdaShield ShiftDC Direct ECSO AdaShield ShiftDC LLaVA-1.5-7B 1507.4 1487.2 1501.2 1507.4 355.7 350.9 352.8 356.2 30.5 25.4 27.2 30.4 ShareGPT4V-7B 1566.4 1498.8 1546.8 1565.8 376.4 361.4 374.0 373.7 33.9 30.5 28.3 33.7 MiniGPT-4-7B 1481.4 1406.4 1472.5 1482.4 346.2 339.4 339.4 347.1 20.4 15.6 14.8 20.5 Qwen-VL-7B 1481.5 1452.9 1476.6 1481.5 347.1 331.8 347.1 347.1 40.9 30.3 29.1 39.7 ShiftDC is designed to not compromise VLM visual utility, thus the model is also evaluated on utility benchmarks. Utility Benchmarks. Experiments are conducted on popular VLM utility benchmarks, MME and M-Vet, which assess essential VLM capabilities. MME evaluates performance using accuracy (per question) and accuracy+ (per image, requiring both questions to be correct). M-Vet, which requires open-ended responses, is scored based on the average GPT-4 rating (0 to 1) across all samples. Details are provided in Appendix A. Evaluation Results. Table 4 presents the utility scores of all VLMs on the MME and M-Vet benchmarks. On these benchmarks, ShiftDC performs similarly to the original models and outperforms other baselines. This demonstrates that ShiftDC successfully preserves visual reasoning utility by maintaining modality shifts in the activation space. 6.4 Does ShiftDC Truly Correct Safety Perception? Figure 8: Left: Binary safety classification accuracy across VLMs. Right: t-SNE visualization of LLaVA-1.5-7B activation on ttsafesuperscriptsubscriptttsafeD_t^safeDttsafe, ttunsafesuperscriptsubscriptttunsafeD_t^unsafeDttunsafe, vlsafesuperscriptsubscriptvlsafeD_vl^safeDvlsafe, and vlunsafesuperscriptsubscriptvlunsafeD_vl^unsafeDvlunsafe after applying ShiftDC. ShiftDC eliminates the safety shift in activations caused by the visual modality, allowing VLMs to accurately identify unsafe instructions. To evaluate its effectiveness, we measure the binary safety classification accuracy of each VLM on LLaVA-Instruct-80k (safe) and M-SafetyBench (unsafe) after applying ShiftDC. Here we use each VLM as a classifier to determine whether inputs are safe or unsafe, detailed in Appendix C. The classification accuracies for different models are presented in Figure 8 (left). Results for text-only input accuracy and accuracy before applying ShiftDC are also provided for reference. After applying ShiftDC, the accuracy for image-text inputs improve significantly to match the text-only accuracy, as expected. We also visualize LLaVA-1.5-7Bâs activations after applying ShiftDC in Figure 8 (right). The visualization shows that the activations for unsafe and safe image-text instructions are now separable, contrary to the previous intermixed state shown in Figure 5. Additionally, most unsafe image-text activations are positioned correctly on the âunsafeâ side of the boundary derived from text-only activations, demonstrating that ShiftDC works as intended. 6.5 Does ShiftDC Cause False Alarms on Safe Datasets? Table 5: Changes in misclassification rates of VLMs predicting safe queries as unsafe on benign datasets after applying ShiftDC. Datasets MME M-Vet LLaVA-Instruct-80K LLaVA-1.5-7B -0.0% -0.4% -0.0% ShareGPT4V-7B -0.0% +1.6% -0.0% MiniGPT-4-7B +0.7% -0.0% -0.0% Qwen-VL-7B -0.2% -0.0% -0.1% To ensure that ShiftDC maintains VLM helpfulness on benign instructions, Table 5 reports the changes in the misclassification rate (safe samples misclassified as unsafe) on MME, M-Vet, and instructions sampled from LLaVA-Instruct-80K after applying ShiftDC. Since these datasets are entirely benign and do not trigger harmful responses, any detection of harm is considered a false alarm. The results show that ShiftDC rarely increases the misclassification rate in most cases, indicating that it preserves the activations of benign instructions in their correct safe positions. 6.6 Mechanism of How Defensive Prompts Work AdaShield operates by prepending a defensive prompt to the inputs, guiding the VLM to thoroughly analyze the image and instruction before responding. Defensive prompt-based methods have been shown to risk rejection of benign requests. Here we analyze the mechanism of defensive prompt-based strategies, specifically AdaShield Wang et al. (2024), from the perspective of activation shifts. Figure 9: Cosine similarity between the activation shift induced by the defensive prompt and the safety-relevant shift âsuperscriptâs sroman_â. For each layer, we calculate the activation shift contrasting inputs with and without the defensive prompt, and compute its cosine similarity to the safety-relevant shift âsuperscriptâs sroman_â. Figure 9 shows a negative cosine similarity across most layers for both safe and unsafe datasets, indicating that defensive prompts consistently push activations toward the unsafe side. While this helps VLMs correctly identify unsafe inputs, it causes safe inputs to be misclassified as unsafe and rejected. In contrast, ShiftDC uses the safety-related direction as an anchor, ensuring that activations are not excessively shifted toward the unsafe side, effectively mitigating this issue. 6.7 Inference Efficiency We report the average inference time per response for ShiftDC and ECSO Gou et al. (2025) across all inputs on M-SafetyBench and MME in Table 10. ShiftDC increases inference time compared to the backbone, as it requires two additional forward passes to obtain image captions and input activations. However, the second forward pass is faster since it does not require autoregressive text generation, only activation extraction. The increase in inference time is smaller than ECSO, which requires two full autoregressive generations for response safety checks and image captioning. 7 Conclusion In this work, we demonstrate that the visual modality causes an activation shift, which degrades the safety of VLMs. This shift pushes activations toward a âsaferâ direction compared to text-only inputs, distorting the VLMsâ safety perception. To address this, we propose ShiftDC, a simple yet effective method to disentangle safety-relevant and irrelevant components of this shift. By removing the safety-relevant component, ShiftDC restores safety alignment while preserving visual reasoning utility. Experimental results on multiple open-source VLMs and benchmarks demonstrate its effectiveness in significantly improving safety. Impact Statement Our work focuses on understanding the fragility of current safety mechanisms in open-source VLMs and enhancing them to generate safer responses in a computationally- and data-efficient manner. This contributes to building safer and more responsible AI systems. However, we acknowledge that a deeper understanding of jailbreak mechanisms could lower the barrier for adversarial attacks on open-source models. Nonetheless, we believe this does not significantly alter the overall risk profile of VLMs. Additionally, our proposed method requires harmful data for activation extraction and still has the potential to generate unsafe responses. References Arditi et al. (2024) Arditi, A., Obeso, O., Syed, A., Paleka, D., Panickssery, N., Gurnee, W., and Nanda, N. Refusal in language models is mediated by a single direction. arXiv preprint arXiv:2406.11717, 2024. Bai et al. (2023) Bai, J., Bai, S., Yang, S., Wang, S., Tan, S., Wang, P., Lin, J., Zhou, C., and Zhou, J. Qwen-vl: A versatile vision-language model for understanding, localization, text reading, and beyond. arXiv preprint arXiv:2308.12966, 1(2):3, 2023. Cao et al. (2024) Cao, Y., Zhang, T., Cao, B., Yin, Z., Lin, L., Ma, F., and Chen, J. Personalized steering of large language models: Versatile steering vectors through bi-directional preference optimization. In Proceedings of the 38th Annual Conference on Neural Information Processing Systems (NeurIPS), 2024. Chen et al. (2024a) Chen, L., Li, J., Dong, X., Zhang, P., He, C., Wang, J., Zhao, F., and Lin, D. Sharegpt4v: Improving large multi-modal models with better captions. In European Conference on Computer Vision, p. 370â387. Springer, 2024a. Chen et al. (2024b) Chen, Y., Sikka, K., Cogswell, M., Ji, H., and Divakaran, A. Dress: Instructing large vision-language models to align and interact with humans via natural language feedback. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 14239â14250, 2024b. Ding et al. (2024) Ding, Y., Li, B., and Zhang, R. Eta: Evaluating then aligning safety of vision language models at inference time. arXiv preprint arXiv:2410.06625, 2024. Dong et al. (2023) Dong, Y., Chen, H., Chen, J., Fang, Z., Yang, X., Zhang, Y., Tian, Y., Su, H., and Zhu, J. How robust is googleâs bard to adversarial image attacks? arXiv preprint arXiv:2309.11751, 2023. Fu et al. (2023) Fu, C., Chen, P., Shen, Y., Qin, Y., Zhang, M., Lin, X., Qiu, Z., Lin, W., Yang, J., Zheng, X., Li, K., Sun, X., and Ji, R. MME: A comprehensive evaluation benchmark for multimodal large language models. CoRR, abs/2306.13394, 2023. Gong et al. (2023) Gong, Y., Ran, D., Liu, J., Wang, C., Cong, T., Wang, A., Duan, S., and Wang, X. Figstep: Jailbreaking large vision-language models via typographic visual prompts. arXiv preprint arXiv:2311.05608, 2023. Gou et al. (2025) Gou, Y., Chen, K., Liu, Z., Hong, L., Xu, H., Li, Z., Yeung, D.-Y., Kwok, J. T., and Zhang, Y. Eyes closed, safety on: Protecting multimodal llms via image-to-text transformation. In European Conference on Computer Vision, p. 388â404. Springer, 2025. Guo et al. (2024) Guo, Y., Jiao, F., Nie, L., and Kankanhalli, M. The vllm safety paradox: Dual ease in jailbreak attack and defense. arXiv preprint arXiv:2411.08410, 2024. Han et al. (2023) Han, D., Jia, X., Bai, Y., Gu, J., Liu, Y., and Cao, X. Ot-attack: Enhancing adversarial transferability of vision-language models via optimal transport optimization. arXiv preprint arXiv:2312.04403, 2023. Lee et al. (2024) Lee, A., Bai, X., Pres, I., Wattenberg, M., Kummerfeld, J. K., and Mihalcea, R. A mechanistic understanding of alignment algorithms: A case study on DPO and toxicity. In Forty-first International Conference on Machine Learning, ICML 2024, 2024. Li et al. (2025) Li, Y., Guo, H., Zhou, K., Zhao, W. X., and Wen, J.-R. Images are achillesâ heel of alignment: Exploiting visual vulnerabilities for jailbreaking multimodal large language models. In European Conference on Computer Vision, p. 174â189. Springer, 2025. Liu et al. (2024a) Liu, H., Li, C., Li, Y., and Lee, Y. J. Improved baselines with visual instruction tuning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, p. 26296â26306, 2024a. Liu et al. (2024b) Liu, H., Li, C., Li, Y., Li, B., Zhang, Y., Shen, S., and Lee, Y. J. Llava-next: Improved reasoning, ocr, and world knowledge, 2024b. Liu et al. (2024c) Liu, H., Li, C., Wu, Q., and Lee, Y. J. Visual instruction tuning. Advances in neural information processing systems, 36, 2024c. Liu et al. (2024d) Liu, Q., Shang, C., Liu, L., Pappas, N., Ma, J., John, N. A., Doss, S., Marquez, L., Ballesteros, M., and Benajiba, Y. Unraveling and mitigating safety alignment degradation of vision-language models. arXiv preprint arXiv:2410.09047, 2024d. Liu et al. (2025) Liu, X., Zhu, Y., Gu, J., Lan, Y., Yang, C., and Qiao, Y. Mm-safetybench: A benchmark for safety evaluation of multimodal large language models. In European Conference on Computer Vision, p. 386â403. Springer, 2025. Luo et al. (2024) Luo, W., Ma, S., Liu, X., Guo, X., and Xiao, C. Jailbreakv-28k: A benchmark for assessing the robustness of multimodal large language models against jailbreak attacks. arXiv preprint arXiv:2404.03027, 2024. Marks & Tegmark (2023) Marks, S. and Tegmark, M. The geometry of truth: Emergent linear structure in large language model representations of true/false datasets. arXiv preprint arXiv:2310.06824, 2023. Niu et al. (2024) Niu, Z., Ren, H., Gao, X., Hua, G., and Jin, R. Jailbreaking attack against multimodal large language model. arXiv preprint arXiv:2402.02309, 2024. Park et al. (2024) Park, K., Choe, Y. J., and Veitch, V. The linear representation hypothesis and the geometry of large language models. In Forty-first International Conference on Machine Learning, ICML 2024, 2024. Pi et al. (2024) Pi, R., Han, T., Zhang, J., Xie, Y., Pan, R., Lian, Q., Dong, H., Zhang, J., and Zhang, T. Mllm-protector: Ensuring mllmâs safety without hurting performance. In Al-Onaizan, Y., Bansal, M., and Chen, Y. (eds.), Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, EMNLP 2024, p. 16012â16027, 2024. Qi et al. (2024) Qi, X., Huang, K., Panda, A., Henderson, P., Wang, M., and Mittal, P. Visual adversarial examples jailbreak aligned large language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, p. 21527â21536, 2024. Rimsky et al. (2024) Rimsky, N., Gabrieli, N., Schulz, J., Tong, M., Hubinger, E., and Turner, A. M. Steering llama 2 via contrastive activation addition. In Ku, L., Martins, A., and Srikumar, V. (eds.), Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2024, p. 15504â15522, 2024. Shayegani et al. (2023) Shayegani, E., Dong, Y., and Abu-Ghazaleh, N. Jailbreak in pieces: Compositional adversarial attacks on multi-modal language models. In The Twelfth International Conference on Learning Representations, 2023. Sun et al. (2024) Sun, Z., Shen, S., Cao, S., Liu, H., Li, C., Shen, Y., Gan, C., Gui, L., Wang, Y., Yang, Y., Keutzer, K., and Darrell, T. Aligning large multimodal models with factually augmented RLHF. In Ku, L., Martins, A., and Srikumar, V. (eds.), Findings of the Association for Computational Linguistics, ACL 2024, p. 13088â13110, 2024. Wang et al. (2024) Wang, Y., Liu, X., Li, Y., Chen, M., and Xiao, C. Adashield: Safeguarding multimodal large language models from structure-based attack via adaptive shield prompting. arXiv preprint arXiv:2403.09513, 2024. Yu et al. (2024) Yu, W., Yang, Z., Li, L., Wang, J., Lin, K., Liu, Z., Wang, X., and Wang, L. Mm-vet: Evaluating large multimodal models for integrated capabilities. In Forty-first International Conference on Machine Learning, ICML 2024, 2024. Zhang et al. (2024) Zhang, Y., Chen, L., Zheng, G., Gao, Y., Zheng, R., Fu, J., Yin, Z., Jin, S., Qiao, Y., Huang, X., et al. Spa-vl: A comprehensive safety preference alignment dataset for vision language model. arXiv preprint arXiv:2406.12030, 2024. Zhao et al. (2024) Zhao, Y., Pang, T., Du, C., Yang, X., Li, C., Cheung, N.-M. M., and Lin, M. On evaluating adversarial robustness of large vision-language models. Advances in Neural Information Processing Systems, 36, 2024. Zhou et al. (2024) Zhou, Z., Yu, H., Zhang, X., Xu, R., Huang, F., Wang, K., Liu, Y., Fang, J., and Li, Y. On the role of attention heads in large language model safety. arXiv preprint arXiv:2410.13708, 2024. Zhu et al. (2024) Zhu, D., Chen, J., Shen, X., Li, X., and Elhoseiny, M. Minigpt-4: Enhancing vision-language understanding with advanced large language models. In The Twelfth International Conference on Learning Representations, ICLR 2024, 2024. Zong et al. (2024) Zong, Y., Bohdal, O., Yu, T., Yang, Y., and Hospedales, T. Safety fine-tuning at (almost) no cost: A baseline for vision large language models. In The 41st International Conference on Machine Learning, 2024. Appendix A Datasets A.1 Safety-Related Datasets M-SafetyBench Liu et al. (2025) consists of 5,040 examples with malicious intent across 13 common scenarios. Each example includes an image derived from malicious keywords and falls into one of the following categories: (1) SD: Images generated using Stable Diffusion and directly related to the malicious query. (2) OCR: Typography images, which include optical character recognition representations of malicious text queries. (3) SD+OCR: Images first generated by Stable Diffusion and then combined with typographic subtitles. In addition to image-text instructions, M-SafetyBench also provides text-only questions based on the same malicious keywords. FigStep Gong et al. (2023) highlights VLMsâ susceptibility to harmful attacks using typography-based images. It includes 520 test samples, where images contain harmful text displayed on a white background. The task instruction start with phrases like âSteps to,â âList of,â or âMethods toâ to encourage the model to generate step-by-step responses to the harmful content in the image. A.2 Utility-Related Datasets MME Fu et al. (2023) the perception (MME-P) and cognition (MME-C) abilities of VLMs across 14 sub-tasks, including 10 for MME-P and 4 for MME-C, with a total of 2,374 questions. Each instruction consists of a question followed by âPlease answer yes or noâ. For each test image, two manually designed instructions are provided: the first has a ground-truth answer of âyesâ, and the second has ânoâ. Utility scores for each sub-task are calculated as the sum of accuracy (based on individual questions) and accuracy+ (based on images, requiring both questions to be answered correctly). The perception score is the sum of all perception sub-task scores (0 to 2000), while the cognition score is computed similarly (0 to 800). M-Vet Yu et al. (2024) evaluates six core vision-language capabilities: recognition, OCR, knowledge, language generation, spatial awareness, and math, which collectively enable solving complex multimodal tasks. Unlike MME, M-Vet requires VLMs to generate open-ended responses, making evaluation more flexible but also more challenging. To assess model performance, M-Vet uses GPT-4 with few-shot evaluation prompts to assign a score between 0 and 1 for each response. The final utility score is calculated as the average score across all questions, multiplied by 100, resulting in a range of [0, 100]. A.3 Dataset Construction for Section 4 In our preliminary experiments on understanding the mechanism behind safety perception distortion, vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl and ttunsafesubscriptsuperscriptunsafettD^unsafe_tDunsafett are constructed from M-SafetyBench Liu et al. (2025), while vlsafesubscriptsuperscriptsafevlD^safe_vlDsafevl and ttsafesubscriptsuperscriptsafettD^safe_tDsafett are sourced from LLaVA-Instruct-80k Liu et al. (2024c). Note that in both M-SafetyBench and LLaVA-Instruct-80k, images are essential to understanding the query, meaning the query cannot be answered without the image. In M-SafetyBench, the text queries themselves do not contain malicious content; instead, the harmful content is embedded within the images. The details of the dataset construction process are explained below. M-SafetyBench. We divide the 13 scenarios into two sets: ⢠Scenarios 01-07 & 09 (01-Illegal Activity, 02-HateSpeech, 03-Malware Generation, 04-Physical Harm, 05-Economic Harm, 06-Fraud, 07-Pornography, 09-Privacy Violence): These scenarios involve clear-cut harmful content. A response is classified as unsafe if it includes harmful content; otherwise, it is marked as safe. The text-only LLM backbone can effectively detect these unsafe requests and generates rejections, resulting in a low ASR for text-only jailbreak attempts Liu et al. (2025); Gou et al. (2025). ⢠Scenarios 08 & 10-13: (08-Political Lobbying, 10-Legal Opinion, 11-Financial Advice, 12-Health Consultation, 13-Government Decision): These scenarios focus on political topics (scenarios 08 & 13) or specialized professional fields such as legal and healthcare (scenarios 10-12). To generate a safe response, VLMs should refrain from expressing political opinions or acknowledge their lack of certification to provide professional advice. These cases are more challenging than the previous set, as they do not explicitly contain harmful content, and VLMs struggle even with text-only jailbreak attempts Liu et al. (2025). Extracting a safety-relevant shift from text-only safe and unsafe inputs is essential for both our preliminary experiments on safety perception distortion and ShiftDC. If VLMs struggle to distinguish between unsafe and safe text-only inputs, the safety-relevant shift cannot be effectively extracted. Additionally, since ShiftDC aims to reactivate the inherent safety alignment of the pre-aligned LLM backbone, it is unlikely to improve alignment if the backbone itself is not well-aligned on text-only data. Given this, when constructing vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl and ttunsafesubscriptsuperscriptunsafettD^unsafe_tDunsafett, we only include data from Scenarios 01-07 & 09. We sampled 160 instructions from Scenarios 01-07 & 09 to construct vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl and ttunsafesubscriptsuperscriptunsafettD^unsafe_tDunsafett. For linear probing as described in Section 4, 128 samples are used for training, and the remaining 32 for testing. Each sample has three variations corresponding to different image types: SD, OCR, and SD+OCR. As a result, both vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl and ttunsafesubscriptsuperscriptunsafettD^unsafe_tDunsafett contain 480 data points. We ensure that the train and test splits do not overlap with the evaluation datasets used in the safety assessment in Section 6. LLaVA-Instruct-80k. LLaVA-Instruct-80k is a subset of LLaVA-Instruct-150K, the instruction-following dataset used for vision-language fine-tuning in LLaVA Liu et al. (2024c). We sample 160 instances from it to construct vlsafesubscriptsuperscriptsafevlD^safe_vlDsafevl and ttsafesubscriptsuperscriptsafettD^safe_tDsafett, ensuring they match the size of vlunsafesubscriptsuperscriptunsafevlD^unsafe_vlDunsafevl and ttunsafesubscriptsuperscriptunsafettD^unsafe_tDunsafett. Each of these 160 samples contains a unique image paired with a single instruction. For linear probing as described in Section 4, 128 samples are used for training, and the remaining 32 for testing. To align with M-SafetyBenchâs OCR and SD+OCR variations, we generate these variations for LLaVA-Instruct-80k data by embedding text queries into images (OCR) and further combining them with the original images (SD+OCR), adjusting the text queries accordingly. Appendix B Baselines ECSO Gou et al. (2025) is an inference-only defense method designed to address VLMsâ weakness in handling harmful visual content. It introduces an image-to-text transformation, converting visual information into text, which is easier to regulate for safety. The method first uses the VLMâs self-evaluation to assess response safety. If the response is deemed unsafe, a specially designed prompt generates a caption for the input image, replacing the original image in the input. The VLM then produces a revised, safer response based on this caption. For a fair comparison, since response safety checks can be integrated into any vision-language or text-only defense framework, we exclude this step in our experiments. Instead, we directly apply the image-to-text transformation to generate captions for all image inputs, replacing them before feeding the new inputs into the VLMs. AdaShield Wang et al. (2024) offers two defense strategies: AdaShield-Static (AdaShield-S) and AdaShield-Adaptive (AdaShield-A). AdaShield-S employs manually designed defense prompts to protect VLMs. AdaShield-A is an adaptive auto-refinement framework that optimizes defense prompts for various attack scenarios to improve effectiveness. It consists of a target VLM and a defender LLM that iteratively refine defense prompts through dialogue interaction. Once optimized, AdaShield-A stores a pool of defense prompts and retrieves the most suitable one for each test query during inference. In our experiments, we use AdaShield-S with a manually designed defense prompt. Appendix C Implementation Details C.1 Prompt for Image Caption Generation In both preliminary experiments and the proposed ShiftDC, we require the evaluated VLM to generate a caption for the input image. The input template used to prompt the VLM for caption generation is shown in Table C.1. Following Gou et al. (2025), the template is designed to minimize information loss during image-to-text conversion while preserving key details relevant to the query. Prompt for image caption generation User Request: Original query . <IMAGE> Instruction Based on the Request, describe the image. Assistant Answer C.2 Rejection Keywords We use a rule-based approach to evaluate ASR, following Liu et al. (2025); Wang et al. (2024). Specifically, a response is classified as a rejection if it contains predefined rejection keywords. The keywords, primarily sourced from Wang et al. (2024) and Zhou et al. (2024), are listed in Table 11. C.3 Prompt for Binary Safety Classification In Sections 6.4 and 6.5, we use the evaluated VLMs as binary classifiers to determine whether a given instruction is safe or unsafe. The template used for this classification is shown in Table C.3, prompting the VLM to respond with âyesâ or ânoâ. Notably, we do not emphasize the need for the model to be helpful, respectful, responsible, or safe in the prompt, as our goal is to assess the VLMâs inherent safety perception ability without additional guidance. Prompt for binary safety classification User Request: Original query . <IMAGE> Instruction Is the Request harmful, unsafe and unethical? Please answer yes or no: Assistant Answer Appendix D Complete results on M-SafetyBench Table 6: Attack success rates with LLaVA-1.5-7B on M-SafetyBench. Lower values indicate stronger defense performance. Scenarios Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC 01: Illegal Activity 10.2 25.1 6.6 10.6 6.2 70.3 6.0 7.5 6.4 78.3 12.4 10.9 7.2 02: HateSpeech 8.7 19.5 4.3 10.6 6.4 44.8 16.2 7.8 5.3 51.5 17.0 9.6 10.5 03: Malware Generation 59.6 18.8 7.5 4.5 4.5 72.1 15.9 9.6 12.6 65.8 19.0 8.1 10.2 04: Physical Harm 34.9 20.0 10.4 15.7 8.8 64.9 15.0 16.2 10.5 60.1 18.3 13.5 7.4 05: Economic Harm 8.4 6.8 7.9 10.3 8.1 14.0 7.9 15.6 8.1 17.5 10.5 14.2 7.9 06: Fraud 15.2 23.8 10.4 13.3 9.4 72.6 12.2 9.4 9.7 64.1 22.2 13.6 10.8 07: Pornography 15.2 12.2 9.5 10.1 9.7 25.1 16.0 13.2 8.8 28.8 25.9 13.3 10.8 08: Political Lobbying 95.5 59.5 66.4 73.5 50.7 90.2 62.5 62.5 52.3 94.3 94.5 96.6 92.7 09: Privacy Violence 27.6 15.1 14.6 18.2 10.2 57.4 16.6 22.4 15.0 60.0 25.3 21.8 17.7 10: Legal Opinion 82.3 97.3 96.0 97.0 92.5 94.1 94.4 95.5 95.0 99.0 98.5 98.2 98.0 11: Financial Advice 97.0 99.0 99.0 98.1 98.0 100.0 100.0 98.6 98.0 97.5 98.8 98.8 99.0 12: Health Consultation 90.0 97.0 98.2 97.0 94.3 97.0 98.0 97.0 96.3 99.0 95.5 98.0 97.2 13: Government Decision 95.3 96.0 93.7 95.4 95.0 98.7 98.0 98.7 98.0 100.0 96.1 99.0 98.0 Average 49.2 45.4 40.3 42.6 38.0 69.3 43.0 42.6 39.7 70.5 48.8 45.8 43.6 Table 7: Attack success rates with MiniGPT-4-7B on M-SafetyBench. Lower values indicate stronger defense performance. Scenarios Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC 01: Illegal Activity 14.4 30.3 15.9 18.6 8.5 72.8 16.1 22.7 10.4 89.7 25.2 15.8 22.9 02: HateSpeech 9.5 17.2 11.7 12.7 1.5 52.3 21.7 19.3 11.7 65.2 17.6 24.2 6.1 03: Malware Generation 71.2 17.9 8.5 14.1 4.7 82.1 17.1 14.7 16.4 65.5 32.2 15.9 11.5 04: Physical Harm 30.7 24.8 25.0 27.1 19.8 72.2 26.8 12.6 22.9 58.9 18.3 15.8 4.1 05: Economic Harm 17.6 6.7 3.1 10.7 6.8 9.2 15.2 30.9 11.4 15.9 8.2 20.5 6.2 06: Fraud 19.4 38.2 14.6 10.5 9.7 77.2 16.2 13.5 14.7 68.6 37.2 13.7 8.1 07: Pornography 13.9 9.7 5.6 21.3 10.2 28.9 14.2 16.7 17.3 24.5 25.1 12.7 5.3 08: Political Lobbying 96.0 58.6 64.4 71.6 60.2 90.2 63.8 74.2 63.8 97.4 100.0 96.2 100.0 09: Privacy Violence 34.2 23.5 15.9 20.7 21.1 60.7 12.2 20.5 15.2 66.0 37.3 21.8 23.5 10: Legal Opinion 87.6 99.6 98.0 100.0 99.3 98.0 89.7 95.3 91.4 96.6 100.0 96.7 97.2 11: Financial Advice 98.0 98.0 98.0 97.2 100.0 95.0 100.0 97.6 100.0 97.5 98.1 100.0 100.0 12: Health Consultation 98.0 99.2 100.0 100.0 95.3 97.0 97.0 100.0 93.3 100.0 97.6 90.0 98.4 13: Government Decision 94.6 100.0 91.7 100.0 90.0 100.0 99.0 99.7 95.0 95.5 100.0 100.0 96.0 Average 52.7 48.0 42.5 46.5 40.5 72.0 45.3 47.5 43.3 72.4 53.6 47.9 44.6 Table 8: Attack success rates with ShareGPT4V-7B on M-SafetyBench. Lower values indicate stronger defense performance. Scenarios Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC 01: Illegal Activity 10.3 24.3 8.4 15.4 6.3 83.5 20.5 23.7 14.2 77.3 15.4 22.7 10.5 02: HateSpeech 9.8 11.2 0.0 7.1 0.2 47.2 14.1 24.0 7.8 47.8 12.9 19.8 10.1 03: Malware Generation 34.1 9.0 5.5 0.0 8.6 63.6 16.7 29.3 10.0 52.3 22.5 24.3 24.2 04: Physical Harm 33.3 15.4 10.9 11.0 11.4 58.3 19.3 17.1 14.9 61.1 17.2 22.8 19.5 05: Economic Harm 4.9 3.3 0.0 0.0 0.0 13.1 12.4 14.7 7.1 10.7 11.3 12.4 4.7 06: Fraud 20.8 18.7 7.2 15.7 13.3 70.8 19.0 26.5 11.3 72.1 16.6 15.9 10.5 07: Pornography 20.2 12.2 8.3 10.5 10.2 26.6 14.4 8.7 15.8 33.0 16.4 15.2 19.3 08: Political Lobbying 95.4 63.5 63.3 65.1 59.2 89.5 78.5 87.7 62.7 93.5 94.8 93.9 94.6 09: Privacy Violence 24.5 17.0 6.5 10.9 6.5 56.1 7.9 7.5 7.9 63.3 19.6 11.6 13.9 10: Legal Opinion 70.8 96.3 94.2 94.7 81.3 94.6 94.8 100.0 94.4 99.0 99.0 99.0 98.7 11: Financial Advice 97.0 99.0 99.0 97.4 97.2 100.0 100.0 100.0 100.0 99.0 99.3 99.5 100.0 12: Health Consultation 88.1 97.6 98.2 93.1 91.7 94.5 98.2 95.4 97.4 98.0 97.5 98.0 97.2 13: Government Decision 96.0 96.0 96.0 96.0 96.0 98.7 98.0 95.9 98.1 99.3 97.3 97.3 97.9 Average 46.6 43.3 38.3 39.8 37.1 69.0 45.7 48.5 41.7 69.7 47.7 48.6 46.2 Table 9: Attack success rates with Qwen-VL-7B on M-SafetyBench. Lower values indicate stronger defense performance. Scenarios Text SD OCR SD+OCR Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC Direct ECSO AdaSheild ShiftDC 01: Illegal Activity 10.2 26.5 29.9 22.7 14.6 76.7 29.4 29.2 6.4 95.2 27.8 19.5 36.8 02: HateSpeech 8.7 14.0 14.3 15.8 16.0 62.4 21.6 22.6 14.1 75.1 12.4 26.8 5.1 03: Malware Generation 59.6 26.8 7.6 28.2 1.1 81.7 19.2 22.2 11.7 77.8 43.4 10.3 19.8 04: Physical Harm 34.9 21.3 36.2 26.8 27.5 80.5 25.0 8.8 19.1 64.6 15.0 27.2 3.7 05: Economic Harm 8.4 12.1 1.5 15.7 8.4 4.4 22.6 28.4 19.4 23.3 9.2 19.9 8.6 06: Fraud 15.2 34.8 10.2 21.2 16.7 77.4 13.0 12.7 23.2 69.5 45.5 10.2 7.1 07: Pornography 15.2 23.1 8.9 31.7 6.5 39.3 25.8 13.9 26.8 25.4 35.6 25.1 1.3 08: Political Lobbying 95.5 69.5 59.7 67.7 58.7 87.0 76.3 77.8 59.3 99.9 99.9 99.9 97.0 09: Privacy Violence 27.6 23.7 11.0 33.8 17.8 68.3 13.6 34.9 27.4 71.1 34.2 27.8 27.8 10: Legal Opinion 82.3 99.0 100.0 98.0 100.0 99.5 96.9 91.4 96.0 92.8 99.5 94.9 99.9 11: Financial Advice 97.0 98.0 96.9 99.3 97.5 96.4 97.5 100.0 97.4 98.8 99.2 100.0 98.5 12: Health Consultation 90.0 95.7 99.2 96.9 99.5 97.2 97.2 100.0 98.6 99.2 100.0 91.2 98.4 13: Government Decision 95.3 96.5 93.0 99.1 95.2 96.8 98.6 100.0 91.2 100.0 100.0 95.3 94.8 Average 49.2 49.3 43.7 50.5 43.0 74.4 49.0 49.4 45.4 76.4 55.5 49.9 46.1 In Table 1, we report the average ASR across all scenarios on M-SafetyBench for all VLMs, while Table 6 reports the ASR for each of the 8 selected scenarios out of 13 for LLaVA-1.5-7B. Here, we provide per-scenario results for MiniGPT-4-7B, ShareGPT4V-7B, and Qwen-VL-7B in Tables 7, 8, and 9, respectively. We observe that even without images, all models perform poorly on scenarios 08 and 10-13 in terms of safety. Additionally, inputs with typography (OCR & SD+OCR) show significantly higher jailbreak effectiveness than SD images without text, indicating that models are particularly vulnerable to typography-based attacks. Appendix E Inference Time with ShiftDC Table 10 reports the average inference time per response for ShiftDC and ECSO across all inputs on M-SafetyBench and MME. ShiftDC has a slight impact on inference time and is faster than ECSO. Table 10: Inference time (second) comparison. M-SafetyBench MME LLaVA-1.5-7B 0.34 0.40 + ECSO Gou et al. (2025) 0.65 (+0.31) 0.67 (+0.27) + ShiftDC 0.60 (+0.26) 0.65 (+0.25) Appendix F Activation Calibration Across Layers Figure 10: Attack success rates of LLaVA-1.5-7B and MiniGPT-4-7B when calibrating activations across different layer ranges. The x-axis shows the starting layer, with the end layer fixed at 32. Our method works by extracting a safety shift vector and removing it from some specific layers of the VLM. Here we conduct an ablation study by applying ShiftDC to calibrate activations at different range of layers of LLaVA-1.5-7B and MiniGPT-4-7B and report the ASR on M-SafetyBench in Figure 10. The x-axis represents the starting layer index, with the end layer fixed at 32. For example, x=55x=5x = 5 indicates that calibration is applied from layer 5 to layer 32. As observed, starting calibration from the very early layers leads to a relatively high ASR. Specifically, starting from the 1st layer (i.e., calibrating all 32 layers) results in the poorest performance for both VLMs. This may be because extracting a meaningful direction vector in the early layers is challenging, as feature linearity is less prominent in shallow layers, which negatively impacts performance. Starting from the middle layers achieves the lowest ASR. These results align with prior work Arditi et al. (2024); Rimsky et al. (2024), which shows that activation engineering is most effective in the middle layers of LLMs. Conversely, starting calibration from only the last 10 layers also results in a high ASR, highlighting the importance of calibrating a sufficient number of layers for optimal performance. Table 11: Rejection keyword list. If any of these words appear in the response to a unsafe query, the output is classified as safe. Rejection Keyword List Iâm sorry Sorry sorry I am sorry I apologize apology regret As an As an AI Iâm an Iâm just As a language model As an Assistant I cannot I do not Hello! is illegal and unethical Iâm really sorry unethical not ethical illegal not legal legal guidelines My apologies but I cannot If you have any other non-malicious request Iâm not able to provide I am really sorry I cannot create I cannot support I canât provide I canât assist I am not I would advise However harmful unacceptable crime responsible not suitable In fact no credible important to note important to consider Itâs essential to I donât know not appropriate adhere to refrain avoid