SelfGuard detects cross-modal jailbreak attacks in language models

SelfGuard: Self-Supervised Deviation Modeling for Multi-Modal Jailbreak Detection

Artificial Intelligence

Summary

Multi-modal language models that understand both images and text can be tricked by hidden messages designed to bypass safety checks. The paper presents SelfGuard, a method that learns what normal, safe data looks like and then spots unusual patterns that might indicate an attack. It does this without needing examples of harmful data, which are rare and constantly changing. SelfGuard creates fake attacks to train itself to recognize signs like mismatched meanings between images and text or hidden toxic content.

What this means in practice

  • For ai safety teams: Detect cross-modal jailbreak attacks on multi-modal language models without relying on known harmful examples.
  • For security engineers: Monitor vision-language AI systems for unusual input patterns that indicate potential misuse or exploits.

Authors

Chenchen Jing, Hongli Guo, Huarong Jia, Tianwei Bai, Che Sun, Yang Liu, Chunhua Shen

Abstract

Multi-modal large language models (MLLMs) achieve strong vision-language reasoning ability but remain vulnerable to jailbreak attacks that exploit subtle cross-modal cues to bypass safety mechanisms. Detecting such attacks is difficult because harmful data are scarce and rapidly evolving, while detectors trained on known patterns often fail to generalize. In this paper, we cast multi-modal jailbreak detection as self-supervised deviation modeling and learn generalizable deviation signals from benign data only. We propose SelfGuard, a self-supervised framework, which models benign multi-modal regularities and learns to score structured violations via controlled pseudo-harmful deviations. SelfGuard synthesizes pseudo-harmful samples via controlled transformations that target three signature cues, cross-modal semantic inconsistency, format manipulation, and semantic toxicity. It then learns complementary deviation statistics through multi-task self-supervised learning, including misalignment discrimination, reconstruction-based toxicity modeling, and contrastive format modeling. At inference, SelfGuard performs multi-view deviation estimation by aggregating task-specific deviation scores to identify departures from benign multi-modal regularities. Extensive experiments on various benchmarks show the effectiveness of our method. The code is available at https://github.com/jingchenchen/SelfGuard.