Effective and Efficient Adversarial Detection for Vision-Language Models via A Single Vector

Youcheng Huang, Fengbin Zhu, Jingkun Tang, Pan Zhou, Wenqiang Lei, Jiancheng Lv, Tat-Seng Chua · DOI

Abstract

Vision-Language Models (VLMs) are increasingly integrated into real-world applications but remain vulnerable to adversarial image "jailbreaks." These attacks use high-dimensional noise to force models into generating harmful content by bypassing safety alignments. We present NEARSIDE, an efficient detection framework that identifies adversarial inputs using a single directional vector in the model's latent space. Alongside this, we introduce RADAR, the largest dataset of its kind with 4,000 high-quality adversarial samples. NEARSIDE demonstrates superior accuracy and a 40x speedup compared to current state-of-the-art defenses.

Introduction: The VLM Security Gap

While text-based jailbreaks are relatively well-studied, adversarial images present a more complex challenge for Vision-Language Models (VLMs) like LLaVA or GPT-4V. These images contain continuous, often imperceptible noise that can override a model's safety training. Existing defenses typically rely on computationally expensive techniques, such as generating multiple responses or using diffusion models for image purification, which are unsuitable for real-time deployment.

Overview of adversarial attacks on VLMs where benign images result in safety refusals while adversarial images trigger harmful outputs.

The RADAR Dataset

To facilitate robust research into VLM safety, the authors developed RADAR, a comprehensive dataset containing 4,000 samples—the largest to date. RADAR combines benign images from COCO 2017 with harmful queries sourced from datasets like HH-rlhf and specialized derogatory corpora.

The RADAR dataset construction pipeline, utilizing COCO 2017 images and filtering harmful sentences to create high-quality adversarial samples.

The dataset generation process employs a rigorous filtering pipeline. Using Projected Gradient Descent (PGD), the authors generate adversarial noise and then validate the success of the attack using GPT-4o mini and the HarmBench classifier. This ensures that the dataset only includes effective attacks and valid benign counter-examples.

NEARSIDE: Detection via Latent Embeddings

The core innovation of this work is NEARSIDE (iN-time Embedding-based AdveRSarial Image DEtection). Rather than analyzing the model's final text output, NEARSIDE monitors its internal hidden states.

The Attacking Direction

The researchers observed that adversarial inputs shift the model's internal embeddings in a consistent, predictable direction. By calculating the average difference between benign and adversarial embeddings in a training set, they "distill" this shift into a single attacking direction vector.

Efficient Detection

Detection is performed during a single forward pass. The embedding of the final input token is projected onto the pre-calculated attacking direction vector. If the resulting projection score exceeds a defined threshold, the input is flagged as adversarial. This approach leverages the "Platonic Representation Hypothesis," suggesting that different models share similar internal representations of safety boundaries. Consequently, an attacking direction learned on one model can often be mathematically mapped to protect another architecture.

Key Results and Performance

NEARSIDE significantly outperforms existing baselines in both accuracy and efficiency:

  • High Accuracy: It achieved 83.1% accuracy on LLaVA and 93.5% on MiniGPT-4, surpassing previous methods like JailGuard.
  • Massive Speedup: NEARSIDE is approximately 40 times faster than current state-of-the-art methods, requiring only 0.14 seconds per detection on LLaVA.
  • Robust Transferability: The method maintains high F1 scores even when transferring the attacking direction between different model architectures without seeing new adversarial samples.

Conclusion and Future Work

NEARSIDE proves that VLM safety can be effectively monitored through simple linear projections in the latent space. While highly efficient, future research is needed to address threshold sensitivity across different categories of harm and to test the method's robustness against non-PGD-based visual attacks. The release of the RADAR dataset provides a vital benchmark for the community to continue improving VLM security.

Summary updated

BibTeX
@misc{huang2024effective,
  author = {Youcheng Huang and Fengbin Zhu and Jingkun Tang and Pan Zhou and Wenqiang Lei and Jiancheng Lv and Tat-Seng Chua},
  title = {{Effective and Efficient Adversarial Detection for Vision-Language Models via A Single Vector}},
  year = {2024},
  eprint = {2410.22888},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.22888},
}
Figure