MirrorCheck: Efficient Adversarial Defense for Vision-Language Models

Samar Fares, Klea Ziu, Toluwani Aremu, Nikita Durasov, Martin Takác, Pascal Fua, Karthik Nandakumar, Ivan Laptev · OpenReview

Abstract

Vision-Language Models (VLMs) are becoming increasingly vulnerable to adversarial attacks as various novel attack strategies are being proposed against these models. While existing defenses excel in unimodal contexts, they currently fall short in safeguarding VLMs against adversarial threats. To mitigate this vulnerability, we propose a novel, yet elegantly simple approach for detecting adversarial samples in VLMs. Our method leverages Text-to-Image (T2I) models to generate images based on captions produced by target VLMs. Subsequently, we calculate the similarities of the embeddings of both input and generated images in the feature space to identify adversarial samples. Empirical evaluations conducted on different datasets validate the efficacy of our approach, outperforming baseline methods adapted from image classification domains. Furthermore, we extend our methodology to classification tasks, showcasing its adaptability and model-agnostic nature. Theoretical analyses and empirical findings also show the resilience of our approach against adaptive attacks, positioning it as an excellent defense mechanism for real-world deployment against adversarial threats.

Introduction

Vision-Language Models (VLMs)—which power everything from image captioning to multimodal chatbots—are surprisingly fragile. Adversaries can craft "adversarial examples": images with pixel-level perturbations that are invisible to humans but cause the model to output wildly incorrect or malicious text. While defenses exist for simple image classifiers, they often fail in the multimodal world of VLMs. Most existing methods are "unimodal," focusing only on the image or the text in isolation. Furthermore, many defenses require expensive retraining or specific architectural changes. MirrorCheck addresses this by providing a model-agnostic, "plug-and-play" defense that exploits the inherent relationship between vision and language.

Methods: The "Round-Trip" Consistency Check

The core of MirrorCheck is a three-step consistency check that forces the model to visualize its own internal understanding.

The MirrorCheck pipeline comparing clean and adversarial image processing paths.
  1. Captioning: The "victim" VLM receives an input image and generates a text description (caption).
  2. Mirroring (Regeneration): This caption is fed into a pretrained Text-to-Image (T2I) model (like Stable Diffusion) to generate a new image.
  3. Similarity Check: An image encoder (like CLIP) extracts feature embeddings for both the original input ($z$) and the newly generated "mirror" image ($\tilde{z}$).

If the input was a clean image, the caption should be accurate, and the regenerated image should look semantically similar to the original. However, if the input was an adversarial attack designed to trick the VLM (e.g., saying "Snow White" for an image of the Evil Queen), the regenerated image will reflect the erroneous caption. The resulting high discrepancy (large distance) in feature space reveals the attack.

To enhance resilience against "adaptive" attackers, the authors introduced an Ensemble approach using multiple image encoders and a One-Time-Use (OTU) strategy that adds slight noise to encoder weights.

Key Results

MirrorCheck was evaluated using ImageNet-1K, MS-COCO, and CIFAR-10 datasets across various VLM architectures, including BLIP, BLIP-2, MiniGPT-4, and Img2Prompt.

Detection accuracy of MirrorCheck (MC) compared to baselines (MG, FS, PV) as ensemble size increases.
  • Superior Detection: MirrorCheck consistently outperformed baseline defenses like MagNet (MG), Feature Squeeze (FS), and Pixel Variational (PV). On the UniDiffuser model, it achieved detection accuracies as high as 98%.
  • Ensemble Benefits: As shown in the results, increasing the ensemble size significantly boosts MirrorCheck's accuracy, reaching a plateau that far exceeds the performance of unimodal baselines.
  • Cross-Task Success: On CIFAR-10, MirrorCheck achieved 93% detection accuracy against FGSM attacks, while the popular Feature Squeeze method only managed 21%.
  • Resilience: Even when attackers attempted to optimize their perturbations to "look" like the regenerated image, the ensemble and OTU strategies maintained high detection rates.

Limitations and Future Work

Despite its effectiveness, MirrorCheck faces a generative bottleneck: the defense's reliability depends on the T2I model's ability to generate high-quality images from correct captions. Low-quality generations can lead to false positives. Additionally, the computational cost is significant; generating an image via diffusion models takes approximately 15 seconds per image, which may be too slow for real-time applications.

Future research will explore faster, non-diffusion generative models (like GANs or Consistency Models) to reduce overhead and refine threshold sensitivity to minimize false positives across diverse datasets.

Summary updated

BibTeX
@inproceedings{fares2026mirrorcheck,
  author = {Samar Fares and Klea Ziu and Toluwani Aremu and Nikita Durasov and Martin Takác and Pascal Fua and Karthik Nandakumar and Ivan Laptev},
  title = {{MirrorCheck: Efficient Adversarial Defense for Vision-Language Models}},
  booktitle = {Advml @ CVPR},
  year = {2026},
  url = {https://openreview.net/forum?id=pdIPR5TSXy},
}
Figure