TL;DR
ECSO (Eyes Closed, Safety On) is a novel, training-free defense strategy that protects Multimodal Large Language Models (MLLMs) from visual jailbreak attacks. By detecting unsafe initial responses and adaptively transforming input images into query-aware text captions, ECSO strips away the disruptive visual features and reactivates the underlying LLM's intrinsic safety guardrails. This approach drastically improves safety across multiple state-of-the-art models without sacrificing their general performance or utility.
What Problem Does This Paper Address?
Large Language Models (LLMs) undergo extensive safety alignment (like RLHF) to ensure they refuse harmful requests. However, when these models are expanded into Multimodal LLMs (MLLMs) by attaching a visual encoder, their safety mechanisms become shockingly fragile.
Malicious actors can easily bypass these guardrails using "visual jailbreaks"—such as embedding harmful text inside an image via typography or using gradient-based adversarial images. The core challenge is that integrating visual features alters the pre-aligned embedding space of the LLM, effectively "suppressing" its ability to recognize and refuse harmful prompts when an image is present.
Methods
The authors introduce ECSO (Eyes Closed, Safety On), a completely training-free, inference-time protection framework. Instead of trying to patch the complex multimodal embedding space, ECSO strategically reduces the problem back to the text-only domain where safety is already well-established.
The pipeline operates in four distinct steps:
- Initial Response Generation: The MLLM processes the user query and image normally to generate a response.
- Harmful Content Detection: The MLLM is prompted to evaluate its own initial response in a post-hoc manner ("Is the response harmful, unsafe, or unethical?"). If it deems the response safe, it is delivered to the user.
- Query-Aware Image-to-Text (I2T) Transformation: If the response is flagged as unsafe, ECSO "closes the model's eyes." It prompts the MLLM to describe the image, but crucially, conditions this description on the original user query. This ensures that task-relevant details are preserved while malicious visual noise or adversarial perturbations are filtered out.
- Safe Response Generation Without Images: The original text query and the newly generated text caption are fed back into the model without the image features. Stripped of visual embeddings, the model reverts to a text-only LLM, reactivating its original safety alignment to refuse or safely answer the prompt.
Datasets
The authors evaluated ECSO across several diverse benchmarks to test both safety and general utility:
- Safety Benchmarks:
- MM-SafetyBench: Evaluated across Stable Diffusion (SD), OCR, and combined (SD+OCR) splits spanning 8 critical harm scenarios (e.g., illegal activities, malware generation).
- VLSafe: A dataset where malicious text queries are paired with benign, auxiliary images.
- FigStep & Adversarial Images: Used to test robustness against typographic attacks and gradient-optimized adversarial images.
- Utility Benchmarks: MME (Perception and Cognition splits), MMBench, and MM-Vet were used to ensure the defense mechanism does not degrade the model's standard capabilities on benign tasks.
- Alignment Dataset: VLGuard was utilized to demonstrate how ECSO can act as an automated data engine to generate clean supervised fine-tuning (SFT) data.
Key Insights and Ideas
- The "Suppression" Effect: The underlying safety alignment of an LLM isn't erased when it becomes multimodal; it is merely suppressed by the distribution shift introduced by visual features. As shown in the paper's preliminary findings, simply removing the image from a jailbreak attempt restores the harmless rate to nearly 100%.
- High Self-Awareness of Harm: MLLMs are surprisingly excellent judges of their own outputs. Even when a model fails to block a jailbreak during generation, it can accurately identify that its own response is harmful over 95% of the time.
- Query-Awareness is Mandatory: Standard image captioning fails because it misses context. If a user asks "Is the gray elephant in front of the brown elephant?", a generic caption might just say "two elephants in a ring." Query-aware captioning forces the model to extract the exact spatial or contextual details needed to answer the specific question safely.
Key Results
ECSO was validated across five state-of-the-art MLLMs (including LLaVA-1.5, ShareGPT4V, and Qwen-VL-Chat):
- Massive Safety Boosts: For LLaVA-1.5-7B, ECSO improved the harmless rate on MM-SafetyBench (SD+OCR split) from 32.1% to 86.4%, and on VLSafe from 20.5% to 91.8%.
- Preserved Utility: Across MME, MMBench, and MM-Vet, ECSO caused virtually zero performance degradation. In fact, it slightly improved performance on certain cognition tasks, likely because explicit text captions provide a cleaner reasoning chain than raw visual tokens.
- Autonomous Data Engine: The authors used ECSO to automatically generate safe responses to unsupervised data, creating a clean dataset for Supervised Fine-Tuning (SFT). Models fine-tuned on ECSO-generated data achieved a better safety-utility trade-off than those trained on data curated by GPT-4.
Limitations and Future Work
While highly effective, ECSO's performance is fundamentally bounded by the safety capabilities of its underlying text-only LLM. If the base LLM itself has safety vulnerabilities or lacks alignment on a specific topic, converting images to text will not solve the issue.
Additionally, the current framework treats multimodality as a liability for safety. The authors note that an exciting future direction is learning how to leverage multiple modalities cooperatively to enhance safety, turning rich visual context into a defensive asset rather than a vulnerability.
Summary updated