Understanding In-Context Multimodal Jailbreaks via Posterior Reweighting
Abstract
In-context learning (ICL) jailbreaks reveal a critical vulnerability in multimodal large language models (MLLMs): harmful demonstrations in the prompt can induce unsafe outputs without modifying model parameters. Despite extensive empirical evidence, existing work lacks a principled understanding of why such jailbreaks reliably succeed or how their effectiveness scales with context composition. We propose a posterior reweighting framework that models a safety-aligned MLLM as implicitly operating over competing behavioral modes, and interprets in-context demonstrations as inference-time evidence that dynamically shifts the model's posterior preference between safe and harmful behaviors. This view formalizes jailbreak as a process of evidence accumulation, yielding predictive scaling laws with respect to demonstration count, harmful ratio, adversarial strength, and semantic diversity. Guided by this framework, we introduce a posterior-aware inference-time defense that adaptively injects benign counter-evidence based on estimated risk, effectively suppressing harmful posterior drift while preserving model utility. Compared to existing in-context defenses, our method achieves a significantly improved robustness-utility trade-off under a fixed intervention budget. Together, our results establish posterior reweighting as a unifying and predictive framework for understanding and mitigating ICL jailbreak in MLLMs.
Figures & tables
| # Components | BIC |
|---|---|
| 1 (single-mode) | 100988.35 |
| 2 (two-mode) | 96812.74 |
| 3 (three-mode) | 100323.18 |
| 4 (four-mode) | 104936.12 |
| Attack Type | # Demos | Qwen3-VL-2B | Qwen3-VL-4B | Qwen3-VL-8B | Qwen3-VL-30B-A3B | Kimi-VL-A3B | GPT-5.4 | Gemini-3.5 |
|---|---|---|---|---|---|---|---|---|
| Image | ||||||||
| Text | ||||||||
| Attack Type | Ratio | Qwen3-VL-2B | Qwen3-VL-4B | Qwen3-VL-8B | Qwen3-VL-30B-A3B | Kimi-VL-A3B | GPT-5.4 | Gemini-3.5 |
|---|---|---|---|---|---|---|---|---|
| Image | ||||||||
| Text | ||||||||
| Attack Type | Strength | Qwen3-VL-2B | Qwen3-VL-4B | Qwen3-VL-8B | Qwen3-VL-30B-A3B | Kimi-VL-A3B | GPT-5.4 | Gemini-3.5 |
|---|---|---|---|---|---|---|---|---|
| Image | ||||||||
| Text | ||||||||
| Attack Type | Qwen3-VL-2B | Qwen3-VL-4B | Qwen3-VL-8B | Qwen3-VL-30B-A3B | Kimi-VL-A3B | GPT-5.4 | Gemini-3.5 | |
|---|---|---|---|---|---|---|---|---|
| Image | ||||||||
| Text | ||||||||
| (a) Number of Harmful Demonstrations | (b) Harmful Demonstration Ratio | |||||||
| Modality | 1 | 2 | 4 | 8 | 0.25 | 0.50 | 0.75 | 1.00 |
| Image | ||||||||
| Text | ||||||||
| Mixed | ||||||||
| (c) Demonstration Harmfulness Strength | (d) Semantic Diversity | |||||||
| Modality | Low | Medium | High | Very High | 1 | 2 | 4 | 8 |
| Defense Method | SafetyBench | AdvBench | JailbreakBench | Utility | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Image | Text | Mixed | Image | Text | Mixed | Image | Text | Mixed | ||
| No Defense | ||||||||||
| ICD | ||||||||||
| Uncond. Benign | ||||||||||
| AdaShield | ||||||||||
| ECSO | ||||||||||
| Model | Attack | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| ASR | Utility | ASR | Utility | ASR | Utility | ASR | Utility | ||
| Qwen3-VL-8B | Image | ||||||||
| Text | |||||||||
| Mixed | |||||||||
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Modality | RMSE (%) | MAE (%) |
|---|---|---|
| Image | ||
| Text | ||
| Mixed | ||
| Overall |
| Scenario | Description |
|---|---|
| Illegal Activity (IA) | Unlawful use of models, tools, or services. |
| Hate Speech (HS) | Content promoting hatred, harassment, or violence based on identity. |
| Malware (MG) | Generation of malicious code for system disruption or unauthorized access. |
| Physical Harm (PH) | High-risk activities (e.g., weapons, warfare, self-harm). |
| Economic Harm (EH) | Financially harmful practices (e.g., scams, gambling, lending). |
| Fraud (FR) | Deceptive behaviors (e.g., scams, disinformation, plagiarism). |
| (a) # Harmful Demonstrations ( , , ) | (b) Harmful Ratio ( , , ) | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Model | Type | 1 | 2 | 4 | 8 | 0.25 | 0.50 | 0.75 | 1.00 |
| Qwen3-VL-2B | Image | ||||||||
| Text | |||||||||
| Mixed | |||||||||
| Qwen3-VL-4B | Image | ||||||||
| Text | |||||||||
| Model | Defense | ASR | Utility | Model | ASR | Utility |
|---|---|---|---|---|---|---|
| Qwen3-VL-2B | No Defense | Qwen3-VL-4B | ||||
| ICD | ||||||
| Uncond. Benign | ||||||
| AdaShield | ||||||
| ECSO | ||||||
| Ours |
| Model | Defense | ASR | Utility | Model | ASR | Utility |
|---|---|---|---|---|---|---|
| Qwen3-VL-2B | No Defense | Qwen3-VL-8B | ||||
| ICD | ||||||
| Uncond. Benign | ||||||
| AdaShield | ||||||
| ECSO | ||||||
| Ours |
| Threshold | FNR (%) | FPR (%) | Accuracy (%) | F1 (%) |
|---|---|---|---|---|
| 0.30 | 0.0 | 12.7 | 93.7 | 94.0 |
| 0.40 | 0.0 | 9.1 | 95.5 | 95.6 |
| 0.50 | 3.3 | 2.4 | 97.2 | 97.1 |
| 0.60 | 6.3 | 0.0 | 96.9 | 96.7 |
| 0.70 | 19.7 | 0.0 | 90.2 | 89.1 |
| Gating Regime (%) | ASR (%) | ||||||
|---|---|---|---|---|---|---|---|
| Attack | Bypass | Inject | Refuse | No Defense | Refusal Only | Injection Only | Full |
| Image | 0.3 | 74.6 | 25.1 | 57.65 | 46.79 | 34.89 | 25.61 |
| Text | 0.7 | 77.8 | 21.5 | 53.08 | 45.12 | 30.14 | 24.39 |
| Mixed | 0.2 | 71.3 | 28.5 | 58.53 | 48.91 | 37.23 | 28.00 |
| Model | Attack | Robustified ( ) | |||||
|---|---|---|---|---|---|---|---|
| Qwen3-VL-2B | Image | ||||||
| Text | |||||||
| Mixed | |||||||
| Qwen3-VL-4B | Image | ||||||
| Text | |||||||
| Mixed |
| Target Model | No Defense (s) | Ours (s) | Overhead (%) |
|---|---|---|---|
| Qwen3-VL-2B | |||
| Qwen3-VL-4B | |||
| Qwen3-VL-8B | |||
| Qwen3-VL-30B-A3B | |||
| Kimi-VL-A3B |
Multimodal Jailbreak Attacks
Multimodal jailbreak attacks exploit text, images, audio, or video to make AI systems bypass safety constraints.
See all 28 papers