ETA: Evaluating Then Aligning Safety of Vision Language Models at Inference Time

Yi Ding, Bolian Li, Ruqi Zhang

TL;DR

ETA (Evaluating Then Aligning) is a novel, plug-and-play framework designed to secure Vision Language Models (VLMs) at inference time without the need for costly retraining. By combining multimodal input/output evaluation with a bi-level alignment strategy, ETA reduces unsafe response rates by up to 87.5% while maintaining—and sometimes even improving—the model's helpfulness and general capabilities.

The Vulnerability: Embedding Misalignment

While Large Language Models (LLMs) have robust text-based safety guards, VLMs are surprisingly easy to "jailbreak" using adversarial images. The authors identify a core architectural reason for this vulnerability: embedding misalignment.

LLM backbones are trained and safety-aligned on discrete textual tokens. When a vision encoder is introduced, it provides continuous visual embeddings that often act as "outliers" in the LLM’s embedding space. These outliers effectively bypass the safety mechanisms the LLM learned during its text-only alignment phase. Current solutions usually involve expensive fine-tuning (which can degrade general performance) or generic "I can't help with that" refusals that render the model useless. ETA seeks to bridge this gap at inference time, ensuring VLMs are both safe and helpful.

Methods: The ETA Framework

ETA operates in two distinct phases to secure the model during inference:

Overview of the Evaluating Then Aligning (ETA) framework.

1. Evaluating (Multimodal Safety Awareness)

  • Pre-generation: ETA uses a CLIP-based evaluator to compare the input image against a prompt containing unsafe categories (e.g., "porn/violent/illegal"). If the similarity score exceeds a predefined threshold ($\tau_{pre}$), the image is flagged as potentially harmful.
  • Post-generation: The model's initial response is passed through a textual Reward Model (RM). Crucially, the authors use a "safety-specific input format" for the RM to better distinguish between helpful refusals and harmful compliance.

2. Aligning (Bi-level Strategy)

  • Shallow Alignment: If both evaluators flag a threat, ETA "nudges" the model by pre-filling a safety prefix (e.g., "As an AI assistant..."). This shifts the generative distribution toward a safer style.
  • Deep Alignment: To prevent the model from pivoting back to harmful content after a safe start, ETA employs sentence-level Best-of-N searching. For each sentence, it generates $N$ candidates and selects the one that maximizes a combined score of safety (from the RM) and utility (CLIP similarity between the sentence and the image).

Key Insights

  • The "Outlier" Proof: In a fascinating experiment, the authors mapped continuous visual embeddings to their nearest discrete text tokens before feeding them to the LLM. This simple mapping reduced the unsafe rate by 7%, proving that the LLM backbone already knows how to be safe, but the "weird" visual embeddings were confusing it.
  • The "However" Problem: Shallow alignment (just using a prefix) often fails because models learn to say, "As an AI assistant, I can't help... however, here is how you do the bad thing." Deep, sentence-level alignment is required to maintain safety throughout the entire response.
  • Utility as a Constraint: By including a CLIP-based utility score in the search process, ETA ensures that safe responses remain grounded in the image content. This avoids the "lazy refusal" trap where a model gives a generic safe answer that ignores the user's actual (potentially benign) question about a sensitive image.

Key Results

The authors evaluated ETA across a massive battery of benchmarks, including safety benchmarks (SPA-VL Harm, MM-SafetyBench, FigStep, Adv. Image+Text) and general helpfulness benchmarks (ScienceQA-IMG, VQAv2, TextVQA, MME, MMBench).

Comparison of Unsafe Rates (USR) across various VLMs and safety benchmarks.
  • Superior Safety: ETA reduced the Unsafe Rate (USR) by 87.5% in cross-modality attacks on LLaVA-1.5-13B compared to the vanilla model, significantly outperforming existing inference-time defenses like ECSO.
  • High Helpfulness: In GPT-4-based evaluations, ETA achieved a 96.6% win-tie rate against the vanilla LLaVA model. This indicates it almost never degraded the model's answers and often made them more helpful.
  • Efficiency: Unlike other inference-time defenses that add significant lag, ETA only adds about 0.1 seconds of overhead per generation, making it highly viable for real-time applications.
  • Generalization: ETA maintained or slightly improved scores on general benchmarks like MME and MMBench, whereas fine-tuning-based safety methods often impose a "tax" on general intelligence.

Limitations and Future Work

While highly effective, ETA relies on two hyperparameters ($\tau_{pre}$ and $\tau_{post}$) that may require tuning for different model architectures or specific safety requirements. Additionally, its effectiveness is partially capped by the quality of the external CLIP and Reward Models used as evaluators. Finally, while more efficient than competitors, a Best-of-N search is still computationally heavier than a single standard inference pass. Future work could explore more efficient search algorithms or "early exit" strategies for obviously safe queries.

Summary updated

BibTeX
@inproceedings{ding2025eta,
  author = {Yi Ding and Bolian Li and Ruqi Zhang},
  title = {{ETA: Evaluating Then Aligning Safety of Vision Language Models at Inference Time}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=QoDDNkx4fP},
}
Figure