NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

UniGuard: Towards Universal Safety Guardrails for Jailbreak Attacks on Multimodal Large Language Models

Sejoon Oh, Yiqiao Jin, Megha Sharma, Donghyun Kim, Eric Ma, Gaurav Verma, Srijan Kumar

TL;DR

UniGuard is a universal, plug-and-play safety guardrail designed to protect Multimodal Large Language Models (MLLMs) from sophisticated jailbreak attacks. By jointly optimizing a subtle additive image noise and a text suffix against a small toxic corpus, UniGuard significantly reduces attack success rates across both open-source and proprietary models (like GPT-4o and Gemini Pro). Crucially, it achieves this defense with minimal inference-time computational overhead and without compromising the models' core vision-language capabilities.

What Problem Does This Paper Address?

Multimodal Large Language Models (MLLMs) like LLaVA, GPT-4o, and Gemini have drastically advanced our ability to process combined text and image inputs. However, this multi-modality introduces a massive security vulnerability: multimodal jailbreak attacks. Attackers can meticulously craft adversarial images (often looking like harmless noise or ordinary objects to humans) paired with malicious text prompts to bypass the model's safety alignments, forcing it to generate harmful, toxic, or inappropriate content.

Current defense mechanisms fall short. They are typically unimodal (only fixing text or only fixing images), tailored to specific model architectures, or computationally expensive at inference time (such as running diffusion models to "purify" images before feeding them to the LLM). The authors of UniGuard tackle the challenge of creating a holistic, computationally lightweight defense that works across multiple modalities and generalizes universally across different state-of-the-art MLLMs.

Methods

UniGuard introduces a defense framework that purifies malicious input prompts before they hit the MLLM. Instead of modifying the model's internal weights, UniGuard optimizes a multimodal safety guardrail consisting of two components:

  1. Image Safety Guardrail ($v_{sg}$): An additive noise patch applied to input images. It is optimized using Projected Gradient Descent (PGD) to minimize the likelihood of the MLLM generating harmful responses when exposed to adversarial inputs.
  2. Text Safety Guardrail ($x_{sg}$): A text suffix appended to the user prompt. The authors explore two variations: an optimization-based guardrail (using a discrete gradient-based top-K token search to find safety-inducing tokens) and a pre-defined guardrail (a simple, human-written prompt: "DO NOT include harmful content in your response").
Figure 1. UNIGUARD robustifies multimodal large language models (MLLMs) against multimodal jailbreak attacks by using safety guardrails to purify malicious input prompt, ensuring safe responses.

The core innovation lies in optimizing these guardrails jointly using a small, static corpus of toxic content and an open-source surrogate model (LLaVA 1.5). During inference, these guardrails act as a static "filter" applied directly to the inputs. Because it requires no backward passes or gradient calculations during inference, the computational overhead is virtually zero.

Figure 2. Overview of UNIGUARD. Multimodal safety guardrails (right) are optimized to minimize the likelihood of generating harmful content sampled from a corpus C (left-top) on the open- source MLLM model: LLAVA 1.5 (left-bottom). We use pro- jected gradient descent for optimization (middle). We apply the guardrails to any input prompt of MLLMs.

Datasets

The authors utilized several datasets to train and evaluate UniGuard:

  • AdvBench: A dataset of 574 harmful strings used as the training corpus ($C$) to optimize the guardrails.
  • COCO 2017 (Validation Set): 1,000 images used to generate benign and adversarial image-text pairs for evaluation.
  • RealToxicityPrompts (RTP): Used to provide subtly crafted adversarial text prompts.
  • A-OKVQA & MM-Vet: Standard benchmarks used to evaluate whether the safety guardrails degrade the models' general utility and vision-language understanding capabilities.

Key Insights and Ideas

  • Cross-Modal Synergy: Defending MLLMs requires accounting for cross-modal interactions. Optimizing the image and text guardrails jointly allows the text guardrail to capture implicit adversarial signals present in the visual modality.
  • Surprising Transferability: Guardrails optimized entirely on an open-source model (LLaVA 1.5) transfer remarkably well to completely different architectures, including black-box proprietary models like GPT-4o and Gemini Pro. This indicates that jailbreak vulnerabilities share common latent spaces across models.
  • The Fluency vs. Security Trade-off: While optimized text guardrails provide stricter security, they often consist of ungrammatical token sequences that can confuse the model on benign tasks, increasing perplexity. Conversely, the simple, human-written pre-defined prompt provides excellent fluency and surprisingly robust defense, making it highly practical.

Key Results

  • Jailbreak Mitigation: On LLaVA 1.5, deploying the model without safeguards resulted in an unconstrained attack success rate of 81.61%. UniGuard slashed this success rate down to 25.17%, outperforming all unimodal baselines (like BlurKernel, DiffPure, and SmoothLLM).
  • Universal Generalization: When transferred to other models facing unconstrained attacks, UniGuard consistently achieved the lowest attack success ratios. For instance, it successfully boosted the robustness of MiniGPT-4, InstructBLIP, and proprietary models.
Figure 3. Transferability of UNIGUARD on MiniGPT-4, InstructBLIP, GPT-4o, Gemini Pro against unconstrained adversarial visual attacks (Qi et al., 2023) with the RTP (Gehman et al., 2020) text prompt dataset. A lower success ratio (↓) is better. We test three groups of methods: 1) the original model under unconstrained attack (Attack); 2) five baseline methods, including BLURKERNEL (3x3) (Blur), COMP-DECOMP with quality=10 (Comp), DIFFPURE (Nie et al., 2022) (DP), SMOOTHLLM (Robey et al., 2023) (SLLM), and VLGuard (Zong et al., 2024); 3) our proposed UNIGUARD with image & optimized text guardrails (Ours+O) and pre-defined text guardrails (Ours+P).
  • Preserving Model Utility: On general benchmarks like MM-Vet and A-OKVQA, UniGuard maintained performance comparable to the undefended models, provided the image noise constraint ($\epsilon$) was kept at a reasonable threshold (16/255 or 32/255).
Figure 4. Performance of various defense strategies on MM- Vet (Yu et al., 2023b). The impact on accuracy is minimal when the noise level is controlled at ϵ = 16/255 or 32/255.

Limitations and Future Work

Despite its strong performance, the authors note several limitations:

  • Model-Specific Optimization: While universally transferable, tailoring guardrails to specific target models would likely yield even tighter security, though at a higher offline training cost.
  • Modality Constraints: UniGuard is currently restricted to text and image inputs. As MLLMs expand to handle audio and video, the framework will need to evolve to support these additional modalities.
  • Fluency Degradation: The optimized text guardrails can sometimes trigger unexpected or less fluent responses from the model during benign interactions. Future work will focus on refining prompt engineering and optimization techniques to preserve natural language fluency while maintaining strict security boundaries.

Summary updated

BibTeX
@inproceedings{oh2025uniguard,
  author = {Sejoon Oh and Yiqiao Jin and Megha Sharma and Donghyun Kim and Eric Ma and Gaurav Verma and Srijan Kumar},
  title = {{UniGuard: Towards Universal Safety Guardrails for Jailbreak Attacks on Multimodal Large Language Models}},
  booktitle = {R2-FM @ ICML},
  year = {2025},
  url = {https://openreview.net/forum?id=ZodiiC79hg},
}
Figure