Skip to main content
QUICK REVIEW

[Paper Review] JailGuard: A Universal Detection Framework for LLM Prompt-based Attacks

Xiaoyu Zhang, Cen Zhang|arXiv (Cornell University)|Dec 17, 2023
Adversarial Robustness in Machine LearningComputer Science9 citations
TL;DR

JailGuard is a mutation-based framework that detects multi-modal (image and text) LLM jailbreaking attacks by generating input variants and measuring divergence in responses, achieving high detection accuracy on both modalities and outperforming baselines.

ABSTRACT

The systems and software powered by Large Language Models (LLMs) and Multi-Modal LLMs (MLLMs) have played a critical role in numerous scenarios. However, current LLM systems are vulnerable to prompt-based attacks, with jailbreaking attacks enabling the LLM system to generate harmful content, while hijacking attacks manipulate the LLM system to perform attacker-desired tasks, underscoring the necessity for detection tools. Unfortunately, existing detecting approaches are usually tailored to specific attacks, resulting in poor generalization in detecting various attacks across different modalities. To address it, we propose JailGuard, a universal detection framework deployed on top of LLM systems for prompt-based attacks across text and image modalities. JailGuard operates on the principle that attacks are inherently less robust than benign ones. Specifically, JailGuard mutates untrusted inputs to generate variants and leverages the discrepancy of the variants' responses on the target model to distinguish attack samples from benign samples. We implement 18 mutators for text and image inputs and design a mutator combination policy to further improve detection generalization. The evaluation on the dataset containing 15 known attack types suggests that JailGuard achieves the best detection accuracy of 86.14%/82.90% on text and image inputs, outperforming state-of-the-art methods by 11.81%-25.73% and 12.20%-21.40%.

Motivation & Objective

  • Motivate the need for proactive, multi-modal jailbreaking protection for LLMs and MLLMs.
  • Propose a mutation-based detection framework that works on image and text modalities.
  • Demonstrate that attack inputs exhibit lower robustness to perturbations than benign inputs.
  • Construct a first multi-modal jailbreaking dataset and evaluate JailGuard against state-of-the-art defenses.

Proposed method

  • Introduce JailGuard as a mutation-based detection framework for image and text inputs.
  • Develop a Variant Generator with 19 mutators (10 image, 9 text) to create query variants.
  • Employ 3 advanced text mutators (Targeted Replacement, Targeted Insertion, Rephrasing) to improve effectiveness.
  • Compute divergence of variant responses using a cosine similarity-based similarity matrix and KL divergence between response distributions.
  • Use a thresholded divergence detector to classify inputs as benign or jailbreaking attacks.
Figure 1 . Motivation Case of JailGuard (Red Highlights Toxic Contents and Some of Them are Blocked)
Figure 1 . Motivation Case of JailGuard (Red Highlights Toxic Contents and Some of Them are Blocked)

Experimental results

Research questions

  • RQ1RQ1: How effective is JailGuard in detecting jailbreaking attacks for text and image inputs?
  • RQ2RQ2: Can JailGuard detect and defend against different types of jailbreaking attacks?
  • RQ3RQ3: How effective are the JailGuard components (variant generator and attack detector)?
  • RQ4RQ4: How does the number of generated variants impact detection performance.

Key findings

  • JailGuard achieves average detection accuracy of 82.13% on image inputs and 79.48% on text inputs across mutators.
  • JailGuard recall averages are 77.88% for image and 81.33% for text inputs, indicating strong attack detection with lower false negatives.
  • On text data, advanced mutators (Targeted Replacement, Targeted Insertion, Rephrasing) outperform baselines, with Rephrasing reaching 85.42% accuracy and 91.67% recall.
  • On image data, some mutators achieve up to 89.38% accuracy and 80.00–81.25% recall, surpassing the lack of a comparable image baseline.
  • JailGuard outperforms state-of-the-art baselines by up to 15.28% in detection accuracy on text inputs.
  • A first multi-modal jailbreaking dataset with 304 items (text and image) was constructed to evaluate defenses.
Figure 2 . Overview of JailGuard
Figure 2 . Overview of JailGuard

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.