Cross-Modal Safety Mechanism Transfer in Large Vision-Language Models

Shicheng Xu, Liang Pang, Yunchang Zhu, Huawei Shen, Xueqi Cheng · DOI

Abstract

Large Vision-Language Models (LVLMs) often inherit the safety capabilities of their underlying Large Language Models (LLMs) for text inputs but remain vulnerable to toxic visual content. This paper identifies that this "safety gap" arises from insufficient alignment at the hidden-state level, preventing the activation of internal safety mechanisms for visual inputs. We propose Text-Guided Alignment (TGA), a method that aligns vision and text modalities at the hidden-state level to transfer existing text-based safety to the vision modality without requiring additional toxic training data.

Introduction

Modern LVLMs are typically constructed by integrating a vision encoder with a pre-trained, safety-aligned LLM. Theoretically, the LLM’s existing safety filters should apply to visual inputs projected into the shared semantic space. However, empirical evidence reveals a significant discrepancy: models that refuse toxic text prompts often generate harmful descriptions for semantically identical toxic images.

Conceptual overview of safety mechanism misalignment between text and image modalities.

This research identifies that standard alignment techniques focus on output-level matching, leading to a "semantic shift" in internal representations. Consequently, visual inputs fail to trigger the specific transformer layers responsible for safety activation within the LLM.

Localizing Safety Mechanisms

Through a diagnostic analysis of word distribution mutations across layers, the authors discovered that safety is not a global property but is localized within specific transformer layers. These "safety layers" are where the model typically pivots from a standard response to a refusal (e.g., generating "I cannot fulfill this request"). If the visual projection is misaligned within these specific layers, the safety mechanism remains dormant.

Defense Success Rate (DSR) across different transformer layers in LLaVA-1.6-Mistral-7B, highlighting localized safety activation.

Text-Guided Alignment (TGA)

To bridge this gap, the authors introduced Text-Guided Alignment (TGA), which focuses on hidden-state alignment rather than just next-token prediction. The method involves:

  1. Retrieval-Augmented Training: Utilizing a retrieval model (BEIT-3) to find semantically related text for training images from a large corpus (1.15M captions).
  2. Hidden-State Alignment: Implementing a pair-wise loss function that forces visual hidden states to align more closely with the hidden states of descriptive text captions.
  3. Zero Safety Fine-Tuning: TGA transfers existing text safety to the vision modality purely through architectural alignment, requiring no new toxic training datasets.

Experimental Results

Evaluation was conducted using 20,531 toxic image-text pairs from the HOD and ToViLaG datasets. TGA demonstrated a dramatic increase in safety across various categories. For instance, in the "Porn" category, LLaVA-1.6’s Defense Success Rate (DSR) improved from 1.05% to 20.65%. In the "Gun" category, DSR rose from 1.95% to 30.83%.

Crucially, this safety enhancement did not come at the cost of general intelligence. TGA-7B achieved a score of 34.6 on the MM-Vet benchmark, outperforming the baseline LLaVA-1.5-7B (31.1). This suggests that better internal alignment improves both safety and general reasoning capabilities.

Conclusion and Future Work

TGA represents a shift from collecting massive harmful datasets to efficiently leveraging existing LLM safety. While it significantly reduces vulnerability, a gap remains compared to pure text-based safety. Future research will explore extending this hidden-state alignment to other modalities such as audio and video, and improving detection for subtle or domain-specific toxic content.

Summary updated

BibTeX
@inproceedings{xu2025cross,
  author = {Shicheng Xu and Liang Pang and Yunchang Zhu and Huawei Shen and Xueqi Cheng},
  title = {{Cross-Modal Safety Mechanism Transfer in Large Vision-Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=45rvZkJbuX},
}
Figure