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

Chenchen Jing, Hongli Guo, Huarong Jia, TianweiBai, Che Sun, Yang Liu, Chunhua ShenNeurIPS 2026

TL;DR

Training AI safety detectors on yesterday’s jailbreak attacks leaves models vulnerable to tomorrow's tricks. SelfGuard flips the script: instead of memorizing what "harmful" looks like, it learns the fundamental rules of normal, safe image–text pairs—and flags anything that breaks those rules. Best of all, it achieves state-of-the-art jailbreak detection without ever seeing a single real harmful example during training.

What Problem Does This Paper Address?

Multi-modal large language models (MLLMs)—models that process both images and text—are remarkably capable, which also makes them remarkably tricky to secure. Attackers regularly "jailbreak" them by hiding malicious instructions across modalities (like pairing a benign-looking sketch of an office worker with a roleplay prompt asking how to commit insurance fraud).

Usually, we catch these attacks by training supervised detectors on labeled datasets of bad prompts, or by peering into the model’s internal hidden states. The catch? Real harmful data is scarce, sensitive, and mutates constantly. A detector trained on known attack templates is essentially fighting the last war. Recent attempts to train detectors using only safe data rely heavily on matching inputs against a "memory bank" of unsafe concepts, which easily breaks when attackers use clever phrasing, obfuscation, or split the harmful intent between the image and the text. We need a detector that generalizes to unseen attacks without needing a massive dataset of real-world exploits.

Methods

The authors reframe jailbreak detection as out-of-distribution (OOD) deviation modeling. Think of it like a counterfeit currency expert who studies real bills so intimately that any fake immediately feels "off."

Normal, benign image–text pairs follow predictable rules: the image and text match semantically, the intent is neutral, and the meaning stays stable even if you rephrase the text. Jailbreaks systematically violate these regularities.

Figure 1: Illustrations of transferable behavioral signatures underlying multi-modal jailbreaks and the construction of structured deviations from benign samples. (a) shows a harmful sample, in MM- safetyBench [10], exhibiting three signatures, cross-modal inconsistency, format manipulation, and semantic toxicity. (b) shows how SelfGuard generates structured deviations from a benign image–text pair through controlled transformations, each designed to violate a specific benign multi-modal regularity while largely preserving low-level semantics.

Using standard CLIP encoders to extract visual and text features, SelfGuard takes purely benign data and applies controlled perturbations to synthesize "pseudo-harmful" samples. It then trains a single unified detector across three novel self-supervised tasks:

  1. Cross-Modal Inconsistency Modeling: It breaks image–text alignment (via random pairing, swapping words, or masking image regions) and trains a lightweight classifier to spot when visual and textual cues don't match up.
  2. Semantic Toxicity Modeling: Using a policy-derived memory bank of unsafe concepts, it injects subtle toxic text or visual overlays into safe inputs. An autoencoder learns that safe inputs should trigger flat, uniform attention across this memory bank, whereas toxic injections cause sharp spikes.
  3. Format-Manipulation Modeling: Using contrastive learning, it teaches the detector to ignore harmless surface changes (like cropping an image or using synonyms) while penalizing adversarial wrapper templates (like "You will now simulate a chatbot...").
Figure 2: Overview of our method. Given an image–text pair, SelfGuard extracts visual and textual features with CLIP and performs self-supervised deviation modeling. It synthesizes pseudo-harmful variants via controlled transformations that violate benign multi-modal regularities. SelfGuard learns three complementary deviation scores via cross-modal inconsistency modeling, format manipulation modeling, and semantic toxicity modeling. At inference, these scores are fused as multi-view deviation estimation to produce the overall detection score.

At inference time, SelfGuard combines the outputs of all three branches into a single energy score. If an input's total deviation energy crosses a set threshold, the alarm sounds.

Datasets

SelfGuard requires zero real harmful samples for training, relying solely on benign image–text pairs (though the main paper defers the exact source of the benign training split to the appendix).

For evaluation, the authors pair benign samples from MM-Vet with harmful attacks from three established multi-modal jailbreak benchmarks:

  • MM-SafetyBench
  • FigStep (which embeds harmful text visually inside images)
  • JailBreakV-28K

To test if the detector is overly paranoid, they also create a custom diagnostic set by augmenting MM-Vet with complex multi-step questions, long-form queries, and benign instruction templates.

Key Insights and Ideas

  • Cross-modal mismatch is a dead giveaway: In ablation studies, cross-modal inconsistency was the strongest standalone signal. Because multi-modal jailbreaks often pair unrelated images and text to sneak past filters, simply asking "do these two belong together?" catches a surprising number of attacks.
  • Synthetic "fakes" bridge the gap to real attacks: Visualizing the feature space (via t-SNE) revealed that SelfGuard's synthetic pseudo-harmful samples land right between compact clusters of safe data and real-world jailbreaks—meaning simple, controlled rule-breaking successfully mimics the geometry of actual adversarial attacks.
  • Multi-view beats single-cue: Relying on just toxicity matching or format checking leaves blind spots. Combining all three axes prevents the detector from over-relying on any single trick, making it both harder to fool and less likely to block weird-but-harmless user prompts.

Key Results

SelfGuard consistently outperforms existing uncertainty-based, fine-tuning, hidden-state, and memory-based baselines:

  • Attack Detection: Achieved an overall 0.9749 AUROC and 0.9678 AUPRC across the three benchmarks, beating the strongest baseline (JailDAM at 0.9550 AUROC) without needing test-time adaptation.
  • Front-End Defense: Placed in front of LLaVA-1.5-7B, CogVLM, and Qwen3-VL-8B, SelfGuard-D hit 1.0000 F1-score (perfect precision and recall) on FigStep across all three models, and up to 0.9977 F1 on MM-SafetyBench.
  • Low Paranoia (False Positives): On the tricky, atypical benign dataset, SelfGuard achieved the highest accuracy (89.45%) and cut the false-positive rate down to 20.18%—compared to 34.86% for JailDAM and ~39% for VLGuard.

Limitations and Future Work

The authors note that their evaluations focus on static benchmarks and distribution-shifted attacks. They have not yet tested SelfGuard against fully adaptive white-box attacks, where an adversary knows exactly how SelfGuard works and jointly optimizes both the image pixels and text tokens specifically to minimize its energy score. Defending against those tailored, adaptive adversaries is the clear next frontier.

Summary updated

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.
BibTeX
@inproceedings{jing2026selfguard,
  author = {Chenchen Jing and Hongli Guo and Huarong Jia and TianweiBai and Che Sun and Yang Liu and Chunhua Shen},
  title = {{SelfGuard: Self-Supervised Deviation Modeling for Multi-Modal Jailbreak Detection}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=fQrMmdCmbG},
}
Figure