Security Tensors as a Cross-Modal Bridge: Extending Text-Aligned Safety to Vision in LVLM

Shen Li, Liuyi Yao, Wujia Niu, Lan Zhang, Yaliang Li
7/28/2025
cs.CVcs.AI

No official code found. Best implementation: listen0425/Security-Tensors (9 stars, last commit 2025-08-01).

Abstract

Large visual-language models (LVLMs) integrate aligned large language models (LLMs) with visual modules to process multimodal inputs. However, the safety mechanisms developed for text-based LLMs do not naturally extend to visual modalities, leaving LVLMs vulnerable to harmful image inputs. To address this cross-modal safety gap, we introduce security tensors - trainable input vectors applied during inference through either the textual or visual modality. These tensors transfer textual safety alignment to visual processing without modifying the model's parameters. They are optimized using a curated dataset containing (i) malicious image-text pairs requiring rejection, (ii) contrastive benign pairs with text structurally similar to malicious queries, with the purpose of being contrastive examples to guide visual reliance, and (iii) general benign samples preserving model functionality. Experimental results demonstrate that both textual and visual security tensors significantly enhance LVLMs' ability to reject diverse harmful visual inputs while maintaining near-identical performance on benign tasks. Further internal analysis towards hidden-layer representations reveals that security tensors successfully activate the language module's textual "safety layers" in visual inputs, thereby effectively extending text-based safety to the visual modality.

View on arXivView PDF

Code Implementations(1)

code space of paper "Security Tensors as a Cross-Modal Bridge: Extending Text-Aligned Safety to Vision in LVLM"

91PythonJul 28, 20251 years ago

Similar Papers

Cite this paper

@article{li2025security,
  title  = {Security Tensors as a Cross-Modal Bridge: Extending Text-Aligned Safety to Vision in LVLM},
  author = {Shen Li and Liuyi Yao and Wujia Niu and Lan Zhang and Yaliang Li},
  year   = {2025},
  eprint = {2507.20994},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.20994v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.20994.svg)](https://codeofpaper.com/paper/2507.20994)

Discussion