Abstract
Warning: This paper contains examples of harmful language and images, and reader discretion is recommended. The security concerns surrounding Large Language Models (LLMs) have been extensively explored, yet the safety of Large Multi-Modal Models (LMMs) remains understudied. In our study, we present a novel visual prompt attack that exploits query-relevant images to jailbreak the open-source LMMs. Our method creates a composite image from one image generated by diffusion models and another that displays the text as typography, based on keywords extracted from a malicious query. We show LLMs can be easily attacked by our approach, even if the employed Large Language Models are safely aligned. To evaluate the extent of this vulnerability in open-source LMMs, we have compiled a substantial dataset encompassing 13 scenarios with a total of 5,040 text-image pairs, using our presented attack technique. Our evaluation of 12 cutting-edge LMMs using this dataset shows the vulnerability of existing multi-modal models on adversarial attacks. This finding underscores the need for a concerted effort to strengthen and enhance the safety measures of open-source LMMs against potential malicious exploits.
Introduction
The rapid advancement of Large Multi-Modal Models (LMMs) has integrated sophisticated visual understanding with the reasoning capabilities of Large Language Models (LLMs). While significant effort has been invested in the safety alignment of LLMs to prevent the generation of harmful content, the multimodal interface introduces new vulnerabilities. A critical observation is that an LMM might refuse a harmful text-only prompt but provide a detailed response when the same prompt is accompanied by a relevant image. This study explores the "alignment mismatch" between safety-aligned LLM backbones and the vision-language alignment modules typically trained on massive, unaligned datasets.
Methodology: The Visual Prompt Attack
We introduce a systematic visual prompt attack designed to bypass the safety mechanisms of LMMs. The attack follows a four-step pipeline:
- Question Generation: Malicious questions are generated across 13 prohibited scenarios (e.g., illegal activities, hate speech).
- Keyword Extraction: Key phrases are extracted from these questions to identify the core harmful intent.
- Query-to-Image Conversion: These keywords are transformed into images using Stable Diffusion (photorealistic), Typography (text-in-image), or a combination of both.
- Question Rephrasing: The original query is modified to refer to the generated image, forcing the model to process the visual content to answer.
To rigorously evaluate this vulnerability, we developed MM-SafetyBench, a comprehensive framework containing 5,040 text-image pairs. This benchmark allows for a systematic comparison of model safety across diverse adversarial scenarios.
Results and Analysis
Our evaluation of 12 state-of-the-art LMMs reveals a widespread susceptibility to query-relevant image attacks. A key finding is that simple typographic images (text-in-image) are exceptionally effective, often outperforming complex diffusion-generated images in bypassing defenses. For the LLaVA-1.5-7B model, the Attack Success Rate (ASR) increased from a baseline of ~5% with irrelevant images to over 77% when query-relevant typographic images were used.
Furthermore, we observed an "intelligence vs. safety" trade-off: models with superior instruction-following capabilities and visual understanding (such as larger LLaVA variants) were frequently more vulnerable. These models are "too helpful," prioritizing the interpretation of the user-provided image over the underlying safety constraints of the LLM backbone.
Conclusion
The vulnerability of LMMs to query-relevant images poses a significant security risk. Our results demonstrate that current safety alignment, which is primarily text-centric, fails to generalize to multimodal inputs. While inference-time strategies like "Safety Prompts" offer a temporary mitigation, long-term security requires robust training-time alignment that specifically addresses the interaction between visual and textual modalities. The MM-SafetyBench resource is provided to the community to facilitate the development of more resilient and safe multi-modal systems.
Summary updated