Towards Robust Multimodal Large Language Models Against Jailbreak Attacks

Ziyi Yin, Yuanpu Cao, Han Liu, Ting Wang, Jinghui Chen, Fenhlong MaarXiv 2025

Abstract

While multimodal large language models (MLLMs) have achieved remarkable success in recent advancements, their susceptibility to jailbreak attacks has come to light. In such attacks, adversaries exploit carefully crafted prompts to coerce models into generating harmful or undesirable content. Existing defense mechanisms often rely on external inference steps or safety alignment training, both of which are less effective and impractical when facing sophisticated adversarial perturbations in white-box scenarios. To address these challenges and bolster MLLM robustness, we introduce SafeMLLM by adopting an adversarial training framework that alternates between an attack step for generating adversarial noise and a model updating step. At the attack step, SafeMLLM generates adversarial perturbations through a newly proposed contrastive embedding attack (CoE-Attack), which optimizes token embeddings under a contrastive objective. SafeMLLM then updates model parameters to neutralize the perturbation effects while preserving model utility on benign inputs. We evaluate SafeMLLM across six MLLMs and six jailbreak methods spanning multiple modalities. Experimental results show that SafeMLLM effectively defends against diverse attacks, maintaining robust performance and utilities.

Introduction

Multimodal Large Language Models (MLLMs), such as LLaVA and MiniGPT, integrate visual and textual modalities to perform complex reasoning tasks. However, this integration exposes them to "jailbreak" attacks, where adversarial inputs—such as images with hidden typographic triggers—trick the model into bypassing safety guardrails. Traditional defenses, such as external filters or safety fine-tuning on clean data, are often insufficient against "white-box" attacks where the adversary has knowledge of the model's gradients. Furthermore, standard adversarial training is often computationally expensive and can lead to significant utility degradation.

Methodology: The SafeMLLM Framework

SafeMLLM introduces an efficient adversarial training framework designed specifically for MLLMs. It operates in two iterative steps to build robustness directly into the model parameters.

The SafeMLLM framework consists of Step I: Contrastive Embedding Attacks (CoE-Attack) and Step II: Model Training for Defending Against Jailbreak Attacks.

Step I: Contrastive Embedding Attack (CoE-Attack)

To avoid the high computational cost of pixel-level optimization, SafeMLLM performs attacks in the token embedding space. It utilizes a contrastive objective that simultaneously maximizes the probability of a harmful "positive affirmation" (e.g., "Sure, here is how to...") and minimizes the probability of a "safety refusal" (e.g., "I cannot assist..."). This approach creates a unified attack surface for both text and image modalities.

Step II: Model Training

The model's parameters, specifically LoRA adapters, are updated to neutralize these adversarial perturbations. A utility loss is incorporated using benign image-text pairs to ensure the model retains its performance on standard tasks and does not become overly cautious or prone to "model collapse."

Experimental Setup

The framework was evaluated on six popular MLLMs, including MiniGPT-v4, InstructBLIP, and LLaVA (in both 7B and 13B configurations). Robustness was tested against datasets like AdvBench and MM-SafetyBench, while utility was assessed using benchmarks such as MM-Vet and LLaVA-Instruct-80K.

Results and Discussion

SafeMLLM demonstrates superior performance in defending against diverse jailbreak methods compared to existing safety-tuning methods like VLGuard.

SafeMLLM significantly increases the percentage of safe responses compared to existing methods like VLGuard across both white-box and black-box attacks.

Robustness Gains

SafeMLLM dramatically reduced the Attack Success Rate (ASR) across all tested models. For instance, on the ImgJP attack, SafeMLLM achieved an average ASR of just 1.50%, a significant improvement over VLGuard's 62.00%. Against the GCG text-suffix attack, SafeMLLM reduced the ASR to 0.00% across all models. Notably, the framework also showed strong generalization to "black-box" attacks like FigStep, despite being trained in a white-box setting.

Utility Preservation

A key strength of SafeMLLM is its ability to maintain model performance on benign tasks. On the MM-Vet benchmark, SafeMLLM-tuned models performed comparably to or even better than the original models. For example, LLaVA-13B's total score rose from 36.0 to 37.8 after tuning, indicating that adversarial training can enhance general reasoning capabilities by helping the model better distinguish between noise and legitimate context.

Conclusion

SafeMLLM provides a robust and efficient defense for MLLMs against sophisticated jailbreak attacks. By combining contrastive embedding attacks with iterative model updates, it secures multimodal models without compromising their core utility. Future research will explore extending this framework to other modalities like audio and video and addressing increasingly adaptive adversarial strategies.

Summary updated

BibTeX
@misc{yin2025towards,
  author = {Ziyi Yin and Yuanpu Cao and Han Liu and Ting Wang and Jinghui Chen and Fenhlong Ma},
  title = {{Towards Robust Multimodal Large Language Models Against Jailbreak Attacks}},
  year = {2025},
  eprint = {2502.00653},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.00653},
}
Figure