AdaShield: Safeguarding Multimodal Large Language Models from Structure-based Attack via Adaptive Shield Prompting

1Peking University  2University of Wisconsin-Madison
3International Digital Economy Academy  4University of California, Davis

*Equal Contribution

Abstract

With the advent and widespread deployment of Multimodal Large Language Models (MLLMs), the imperative to ensure their safety has become increasingly pronounced. However, with the integration of additional modalities, MLLMs are exposed to new vulnerabilities, rendering them prone to structured-based jailbreak attacks, where semantic content (e.g., "harmful text") has been injected into the images to mislead MLLMs. In this work, we aim to defend against such threats. Specifically, we propose Adaptive Shield Prompting (AdaShield), which prepends inputs with defense prompts to defend MLLMs against structure-based jailbreak attacks without fine-tuning MLLMs or training additional modules (e.g., post-stage content detector). Initially, we present a manually designed static defense prompt, which thoroughly examines the image and instruction content step by step and specifies response methods to malicious queries. Furthermore, we introduce an adaptive auto-refinement framework, consisting of a target MLLM and a LLM-based defense prompt generator (Defender). These components collaboratively and iteratively communicate to generate a defense prompt. Extensive experiments on the popular structure-based jailbreak attacks and benign datasets show that our methods can consistently improve MLLMs' robustness against structure-based jailbreak attacks without compromising the model's general capabilities evaluated on standard benign tasks.

AdaShield

ours


AdaShield consists of a defender *D*and a target MLLM *M*, where *D* aims to generate the defense prompt *P* that safeguards *M* from malicious queries. Then, *P* is put into *M* to generate response *R* for the current malicious query. *D* uses the previously failed defense prompts and the jailbreak response from *M* as feedback, and iteratively refines the defense prompt in a chat format.

example

A conversation example from AdaShield between the target MLLM *M* and defender *D*. The objective of defender *D* is to safeguard *M* from harmful queries for the Sex scenario. *D* generates the failed prompt to defend against the malicious query for the first time. Then, with the jailbreak response from *M* and previous defense prompt as feedback, *D* successfully optimizes defense prompts by injecting the safe rules about the sex scenario, and outputs a reason to elicit interpretability.


AdaShield AdaShield

BibTeX

@misc{wang2024adashield,
      title={AdaShield: Safeguarding Multimodal Large Language Models from Structure-based Attack via Adaptive Shield Prompting}, 
      author={Yu Wang and Xiaogeng Liu and Yu Li and Muhao Chen and Chaowei Xiao},
      year={2024},
      eprint={2403.09513},
      archivePrefix={arXiv},
      primaryClass={cs.CR}
}
  }