How Jailbreak Defenses Work and Ensemble? A Mechanistic Investigation

Zhuohan Long, Siyuan Wang, Shujun Liu, Yuhang Lai, Xuanjing Huang, zhongyu weiSubmission to ICLR 2025 · Rejected

TL;DR

By reformulating generative jailbreak defense into a binary classification task, this paper reveals that existing defenses operate via two distinct mechanisms: safety shift (a blunt, global surge in refusal) and harmfulness discrimination (sharpening the margin between harmful and benign queries). Leveraging this taxonomy, the authors demonstrate that combining these mechanisms through structured ensembles significantly mitigates the classic trade-off between safety and helpfulness in Large Vision-Language Models (LVLMs).

What Problem Does This Paper Address?

While Large Vision-Language Models (LVLMs) like LLaVA excel at multimodal reasoning, they are notoriously vulnerable to jailbreak attacks—especially when malicious instructions are embedded within images or visual typography. Existing defense strategies (system prompt reminders, safety fine-tuning, decoding interventions, and input refactoring) often trigger a severe side-effect: over-defense. Models become paranoid, rejecting safe, benign prompts simply because they contain sensitive keywords or complex visual cues.

Prior work has treated defenses empirically as black boxes, without a unifying framework to explain why some methods cause over-defense while others fail against subtle attacks. Crucially, researchers lack principled guidelines for how to combine (ensemble) complementary defenses without crippling model utility.

Methods

The authors reframe open-ended response generation as a binary classification decision: whether the model prefers to comply ($y=0$) or refuse ($y=1$). By extracting refusal token logits across benign and harmful query distributions, they define two geometric metrics:

  • Mean Shift: The average change in refusal probability across harmful ($\text{Mean\_Shift}_{\text{harmful}}$) and benign ($\text{Mean\_Shift}_{\text{benign}}$) query sets relative to the undefended baseline.
  • Distance Change: The change in Jensen-Shannon divergence between the refusal probability distributions of harmful and benign queries.

From this lens, they identify two foundational defense mechanisms:

  1. Safety Shift: Broadly increases refusal tendencies across all queries (shifting the entire distribution toward the refusal boundary without widening the gap between benign and harmful inputs).
  2. Harmfulness Discrimination: Increases refusal on harmful inputs while lowering or maintaining refusal on benign queries (widening the distribution distance).
   Original                 Safety Shift            Harmfulness Discrimination
(Harmful / Benign)     (Both pushed to refuse)      (Pushed to opposite sides)
 [Harmful] [Benign]      ==>  [Harmful][Benign]       [Harmful] <== | ==> [Benign]
        |                           |                              |
Refusal Boundary            Refusal Boundary               Refusal Boundary

Based on this mechanistic taxonomy, the authors evaluate two ensemble paradigms:

  • Inter-Mechanism Ensembles: Combining defenses that share the same mechanism (e.g., System Reminders + Model Optimization like SFT, or chaining multiple query refactoring steps) to amplify a single behavioral effect.
  • Intra-Mechanism Ensembles: Pairing a safety-shift defense (e.g., a "Responsible" system prompt or SFT) with a harmfulness-discrimination defense (e.g., query captioning or intent extraction) to let discrimination counteract over-defense.

Datasets

  • MM-SafetyBench (SD+TYPO split): 634 harmful queries (with malicious keywords embedded into images) paired with 450 benign queries to measure Defense Success Rate (DSR) and Response Rate (RR).
  • MOSSBench: 196 harmful and 240 benign instances crafted specifically to test oversensitivity and helpfulness against misleadingly safe queries.
  • MM-Vet: Evaluates general multimodal utility across six core capabilities (perception, OCR, knowledge, math, generation, and spatial reasoning).
  • JailbreakV-28K (Mini): Evaluates defenses across five distinct jailbreak families (LLM transfer attacks and multimodal-specific attacks like FigStep).
  • Additional Benchmarks: Text-only XStest (using LLaMA-3.1-8B) to verify cross-modality generalization, and SPA-VL / VLGuard for safety fine-tuning experiments.

Key Insights and Ideas

  • Defenses alter probability geometry differently: System prompts (e.g., "Responsible", "Policy") and model alignment (SFT, SafeDecoding) primarily induce safety shift—they make the model cautious overall, directly hurting benign helpfulness. In contrast, query refactoring (e.g., image captioning, intent analysis) drives harmfulness discrimination by stripping misleading context and surfacing malicious intent.
  • Why noise injection falls flat: Visual noise and token swapping do not significantly alter distribution distance or mean shift because standard jailbreak prompts do not rely on fragile adversarial noise patterns.
  • Intra-mechanism ensembling creates Pareto improvements: Safety shift provides wide defensive coverage, while harmfulness discrimination preserves benign responsiveness. Combining them (e.g., Query Refactoring + System Reminder, QR|SR) blocks stealthy attacks while preventing the refusal of benign requests.
  • Models judge better than they generate: Models display higher intrinsic safety awareness when explicitly tasked with classifying refusal logits than when directly generating autoregressive responses, underscoring the value of pre-generation self-evaluation guardrails.

Key Results

The authors evaluated 28 defense setups on LLaVA-1.5 (7B and 13B):

  • Baseline vs. Individual Defenses: The undefended LLaVA-1.5-7B baseline had a low Defense Success Rate (DSR = 0.06 on MM-SafetyBench; DSR = 0.14 on MOSSBench). Individual defenses like SFT raised DSR to 0.20 and 0.50, but dropped benign response rate (RR) to 0.88 on MOSSBench.
  • Inter-Mechanism Amplification: Combining two safety-shift methods (Demonstration-SFT) boosted DSR to 0.60 on MM-SafetyBench and 0.65 on MOSSBench (7B), achieving the strongest overall safety coverage among non-destructive methods.
  • Intra-Mechanism Balance: Combining intent extraction with a responsible system prompt (Intention-Responsible) achieved 0.36 DSR on MM-SafetyBench while maintaining an exceptional 0.97 benign RR.
  • JailbreakV-28K Robustness: Under diverse attack vectors, Responsible-SFT achieved a total DSR of 0.71 (7B), vastly outperforming the undefended baseline (0.31).
  • Utility Impact (MM-Vet): Most prompt and fine-tuning ensembles preserved core multimodal capabilities (total MM-Vet score around 28–29 vs. baseline 29.1 on 7B), whereas naive image stripping (Caption w/o image) caused major utility drops.

Limitations and Future Work

  • Model Scope: While verified across LLaVA-1.5, Qwen2-VL, Pixtral-12B, and LLaMA-3.1, deep mechanistic evaluation focused heavily on the LLaVA architecture family.
  • Defense Coverage: The study evaluates 28 internal methods across four families, leaving out external guardrail pipelines (e.g., independent safety moderator networks) and advanced agentic verification frameworks.
  • Inference Latency: Multi-stage query refactoring (e.g., image captioning before response generation) substantially increases inference runtime for benign inputs (up to ~5.45s vs. ~3.56s baseline). Future work should focus on amortizing this latency.

Summary updated

Abstract

Jailbreak attacks, where malicious prompts bypass generative models’ built-in safety, have raised significant concerns about model vulnerability. While diverse defense methods have been proposed, the underlying mechanisms governing the trade-offs between model safety and helpfulness, and their application to Large Vision-Language Models (LVLMs) remain insufficiently explored. This paper systematically investigates jailbreak defense mechanisms by reformulating the standard generation task as a binary classification problem to probe model refusal tendencies across both harmful and benign queries. Our analysis identifies two key defense mechanisms: safety shift, which generally increases refusal probabilities for all queries, and harmfulness discrimination, which enhances the model’s ability to distinguish between benign and harmful queries. Leveraging these mechanisms, we design two ensemble defense strategies—inter-mechanism and intra-mechanism ensembles—to explore the safety-helpfulness balance. Empirical evaluations on the MM-SafetyBench and MOSSBench datasets on top of LLaVA-1.5 models demonstrate the effectiveness of these ensemble approaches in either enhancing model safety or achieving an improved safety-utility balance. These findings offer valuable insights into jailbreak defense strategies and contribute to the development of more resilient LVLM safety systems.
BibTeX
@misc{long2025how,
  author = {Zhuohan Long and Siyuan Wang and Shujun Liu and Yuhang Lai and Xuanjing Huang and zhongyu wei},
  title = {{How Jailbreak Defenses Work and Ensemble? A Mechanistic Investigation}},
  year = {2025},
  eprint = {2502.14486},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.14486},
}
Figure