Abstract
Vision-language models (VLMs) are essential for contextual understanding of both visual and textual information. However, their vulnerability to adversarially manipulated inputs presents significant risks, leading to compromised outputs and raising concerns about the reliability in VLM-integrated applications. Detecting these malicious prompts is thus crucial for maintaining trust in VLM generations. A major challenge in developing a safeguarding prompt classifier is the lack of a large amount of labeled benign and malicious data. To address the issue, we introduce VLMGuard, a novel learning framework that leverages the unlabeled user prompts in the wild for malicious prompt detection. These unlabeled prompts, which naturally arise when VLMs are deployed in the open world, consist of both benign and malicious information. To harness the unlabeled data, we present an automated maliciousness estimation score for distinguishing between benign and malicious samples within this unlabeled mixture, thereby enabling the training of a binary prompt classifier on top. Notably, our framework does not require extra human annotations, offering strong flexibility and practicality for real-world applications. Extensive experiment shows VLMGuard achieves superior detection results, significantly outperforming state-of-the-art methods. Disclaimer: This paper may contain offensive examples; reader discretion is advised.
Introduction
Vision-Language Models (VLMs) like LLaVA or GPT-4V are increasingly used in real-world applications, but they are vulnerable to "jailbreaks" and "adversarial meta-instructions." These attacks use a combination of deceptive text and manipulated images to trick the model into generating harmful content or bypassing safety filters. Building robust defenses typically requires massive datasets of labeled examples, which are slow and expensive to create. VLMGuard addresses this bottleneck by leveraging the vast amounts of unlabeled data generated during real-world deployment to build a robust defense without human annotation.
Methodology
VLMGuard operates on the principle that malicious prompts leave a distinct "signature" in the model's internal activations (latent space). The framework follows a three-step process:
- Subspace Extraction: The framework takes a mixture of unlabeled prompts and extracts embeddings from the VLM. It uses Singular Value Decomposition (SVD) to find the primary directions (singular vectors) of variance in this data.
- Maliciousness Estimation: Malicious samples tend to be "outliers" that align strongly with a specific latent subspace. A "maliciousness estimation score" is calculated by projecting a sample's embedding onto these top singular vectors.
- Classifier Training: Using these automated scores, the system creates a "noisy" training set to train a simple binary classifier (a two-layer MLP) on top of the VLM's representations.
Unlike "LLM-as-a-judge" methods, VLMGuard is a single-inference approach, making it significantly faster and more practical for production environments.
Experimental Setup
The researchers evaluated VLMGuard using two primary threat models:
- Adversarial Meta-Instructions: A dataset based on ImageNet where images are injected with adversarial noise to trigger specific biases (e.g., political bias, spam).
- Jailbreak Prompts: A combination of safe/unsafe text from the XSTest dataset with adversarial images designed to bypass safety guardrails.
- Models: Testing was conducted on popular open-source VLMs, specifically LLaVA-1.6 (7B & 13B) and Phi-3-Vision.
Results and Analysis
VLMGuard significantly outperformed state-of-the-art baselines. On the LLaVA model, it improved the AUROC (Area Under the ROC Curve) by 13.21% on average. In jailbreak detection, VLMGuard achieved an AUROC of 94.27% for LLaVA and 95.74% for Phi-3.
Key insights from the evaluation include:
- Layer-wise Performance: Detection performance improves in the upper layers of the VLM, suggesting that the model recognizes malicious intent more clearly once it has condensed raw input into high-level semantic representations.
- Cross-Attack Generalization: A classifier trained on one type of malicious objective (e.g., language bias) can effectively detect entirely different threats (e.g., jailbreaks), implying a common underlying representation in the latent space.
- Robustness to Rarity: The system remains effective even when malicious prompts are extremely rare (as low as 0.1% of the unlabeled mixture).
Conclusion
VLMGuard provides a powerful and scalable defense against malicious prompts by identifying their unique signatures in the latent space of VLMs. By eliminating the need for human-labeled data, it offers a practical solution for real-world deployment. Future work will explore handling significant distribution shifts and more complex multimodal attacks where harmful intent is deeply buried in visual-textual reasoning.
Summary updated