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

Zero-Shot Defense Against Toxic Images via Inherent Multimodal Alignment in LVLMs

Wei Zhao, Zhe Li, Yige Li, Jun Sun

Abstract

Large Vision-Language Models (LVLMs) have made significant strides in multimodal comprehension, thanks to extensive pre-training and fine-tuning on large-scale visual datasets. However, despite their robust textual safety mechanisms, they remain vulnerable to harmful visual inputs. Existing safeguards—typically relying on pre-filtering or fine-tuning—incur high costs and diminish overall utility. To address this critical vulnerability, we introduce SafeCLIP, a lightweight method that leverages LVLMs' inherent multimodal alignment for zero-shot toxic image detection. By projecting CLIP’s discarded CLS token into its text space and matching it with toxic descriptors, SafeCLIP detects harmful content without any architectural changes—adding minimal latency and enabling dynamic safety corrections during inference and fine-tuning. Experiments show that SafeCLIP achieves a 66.9% defense success rate with only 3.2% false positive rate and 7.2% overhead. In contrast, state-of-the-art methods achieve 52.9% success but have a 10.7% false positive rate and 210% overhead. Our work demonstrates that leveraging inherent multimodal alignment can yield efficient, low-cost LVLM safety.

The Vulnerability of Visual Comprehension

While modern LVLMs like LLaVA or Qwen possess robust safety filters for textual prompts, they remain alarmingly vulnerable to visual inputs. A standard LVLM, when asked to describe a violent or pornographic image, will often provide a detailed description despite its internal text-based safety training. This "visual blindness" stems from the fact that safety alignment is often lopsided toward text, leaving the vision-to-language pathway unguarded.

Existing solutions generally fall into two categories:

  1. Safety Pre-filtering: Utilizing a secondary model to screen images before they reach the main LVLM. This is computationally expensive, sometimes adding up to 500% overhead.
  2. Safety Fine-tuning: Training the model on massive datasets of toxic/safe pairs. This process is data-intensive and can degrade the model's general utility and performance on non-safety tasks.

SafeCLIP identifies a critical gap: LVLMs already possess the inherent multimodal alignment to understand that an image is toxic; they simply lack a mechanism to trigger a refusal based on that visual understanding.

The SafeCLIP Method

The core innovation of SafeCLIP is the repurposing of the CLS (Classification) token from the vision encoder. In CLIP-based encoders, the CLS token captures a global semantic representation of the image. While LVLMs typically discard this token after feature extraction to focus on patch-level features, SafeCLIP retains it to serve as a hidden guard.

SafeCLIP Architecture: Leveraging the CLS token for zero-shot toxic image detection and dynamic intervention.

The process involves four key steps:

  1. Projection: The CLS token is mapped into CLIP’s text embedding space using the model's original, frozen projection matrix.
  2. Safety Concept Bank: A bank of textual descriptors for eight toxic categories (e.g., "porn," "bloody," "gun," "insulting gesture") is used for comparison.
  3. Zero-Shot Detection: The system calculates the cosine similarity between the projected CLS token and these toxic descriptors. If similarity exceeds a threshold, the image is flagged.
  4. Dynamic Intervention:
  5. At Inference: If flagged, SafeCLIP prepends a "safe template" to the user query, instructing the model to detect harm and refuse the request.
  6. At Fine-tuning: SafeCLIP acts as a "dynamic supervisor," automatically generating safe refusal targets when toxic images appear in training sets.

Experimental Results

SafeCLIP was evaluated against state-of-the-art methods like ESCO and LlavaGuard using specialized datasets including HOD (Harmful Object Detection) and ToViLaG (pornographic content). To ensure general utility, the model was also tested on benchmarks like SciQA and MM-Vet.

Performance Comparison: SafeCLIP vs. state-of-the-art inference and fine-tuning methods across various toxic categories.

Key Performance Metrics:

  • Defense Success Rate (DSR): SafeCLIP achieved a 66.9% DSR, significantly outperforming ESCO (52.8%) and LlavaGuard (49.1%).
  • False Positive Rate (FPR): It maintained a low 3.2% FPR, whereas ESCO flagged 10.7% of benign images as toxic.
  • Efficiency: SafeCLIP added only 7.2% computational overhead. In comparison, ESCO adds 210% and LlavaGuard adds over 500%.

Conclusion

SafeCLIP demonstrates that the information required for safety is already present within the vision encoder. By looking at data that was previously discarded, SafeCLIP provides a high-performance, low-latency defense that does not require the massive overhead of secondary "guard" models. While future work will need to address adversarial attacks and more nuanced refusal strategies, SafeCLIP represents a significant step toward efficient, inherent safety in Large Vision-Language Models.

Summary updated

BibTeX
@inproceedings{zhao2025zero,
  author = {Wei Zhao and Zhe Li and Yige Li and Jun Sun},
  title = {{Zero-Shot Defense Against Toxic Images via Inherent Multimodal Alignment in LVLMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
}
Figure