AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Models

Sicheng Zhu, Ruiyi Zhang, Bang An, Gang Wu, Joe Barrow, Zichao Wang, Furong Huang, Ani Nenkova, Tong Sun

TL;DR

This paper introduces AutoDAN, a novel whitebox attack method for Large Language Models (LLMs) that generates interpretable and coherent adversarial prompts. Unlike previous methods that produce gibberish or rely on predefined strategies, AutoDAN successfully bypasses perplexity filters and demonstrates surprising emergent jailbreak strategies, offering a more comprehensive tool for LLM red-teaming and vulnerability analysis.

What Problem Does This Paper Address?

The paper addresses the challenge of effectively red-teaming LLMs to uncover their vulnerabilities, particularly concerning "jailbreak attacks." Existing methods fall into two categories: blackbox attacks, which often rely on manually crafted prompts and predefined strategies, and whitebox attacks, which can generate prompts but typically produce unreadable, gibberish outputs that are easily filtered. This leaves a gap in generating interpretable, coherent, and effective adversarial prompts that can comprehensively probe LLM safety mechanisms and reveal a wider range of vulnerabilities. The authors aim to bridge this gap by creating an automated whitebox attack that produces human-readable prompts exhibiting sophisticated jailbreak strategies.

Methods

AutoDAN employs a novel whitebox attack strategy that combines gradient-based token-wise optimization with controllable text generation. The core of AutoDAN lies in its two-nested loop approach:

  • Inner Loop (Single Token Optimization - STO): This loop focuses on optimizing a single token to be appended to the current prompt. It uses a dual objective:
  • Jailbreaking Objective: Maximizes the likelihood of the LLM producing a harmful response.
  • Readability Objective: Encourages the generation of coherent and natural-sounding text. This is achieved through a two-step selection process: preliminary selection to identify promising candidate tokens based on a weighted combination of the objectives, and fine selection to rank and choose the best token.

  • Outer Loop (Left-to-Right Adversarial Prompt Generation): This loop iteratively calls the STO to generate tokens one by one, building the adversarial prompt from left to right. The process continues until a convergence criterion is met (e.g., the same token is selected multiple times).

A key innovation is the interpretable weight mechanism, which adaptively balances the jailbreaking and readability objectives based on the entropy of the token distribution, ensuring both effectiveness and coherence.

Datasets

The paper primarily uses the AdvBench dataset for evaluating jailbreak attacks that elicit harmful behaviors. They use the first 10 behaviors from this dataset for training and behaviors #26 to #50 for testing. For the prompt leaking task, they use a dataset of 140 user-customized prompts from "Awesome ChatGPT Prompts."

Key Insights and Ideas

  • Emergent Jailbreak Strategies: AutoDAN, without explicit programming of specific strategies, spontaneously generates prompts that mimic common manual jailbreak techniques like hypothetical scenarios, foreign language use, and detailed instructions. This suggests that interpretable prompts can naturally capture complex attack patterns.
  • Readability Matters for Transferability: Interpretable prompts generated by AutoDAN transfer better to blackbox LLMs (like GPT-3.5 and GPT-4) than the unreadable prompts from traditional whitebox methods. This highlights that coherence is crucial for generalization.
  • Beyond Harmful Content: AutoDAN's flexibility extends beyond eliciting harmful content. It can be adapted for tasks like leaking system prompts and generating falsely censored harmless user requests, demonstrating its versatility as a red-teaming tool.
  • Perplexity Filters are Insufficient: AutoDAN's ability to generate low-perplexity prompts makes it highly effective at bypassing perplexity filters, a common defense mechanism.

Key Results

  • High Attack Success Rate (ASR): AutoDAN achieves comparable or better training ASRs than baseline methods like GCG, and often superior test ASRs, indicating better generalization. For instance, on Vicuna-7B, AutoDAN achieved 88% ASR after filtering, surpassing GCG-reg's 21%.
  • Low Perplexity: AutoDAN generates prompts with significantly lower perplexity (average of 12) compared to normal user prompts (median of 126), making them difficult to detect by perplexity filters.
  • Effective Transferability: AutoDAN's interpretable prompts show better transferability to proprietary blackbox LLMs (GPT-3.5 and GPT-4) compared to GCG. For example, when transferring from Vicuna-7B to GPT-4, AutoDAN achieved a 29.4% jailbreak rate for the LLM itself, compared to 0% for GCG.
  • Prompt Leaking Success: AutoDAN successfully leaks system prompts in over 70% of cases.
  • Falsely Censored Request Generation: AutoDAN can generate harmless user requests that are falsely rejected by LLMs due to over-censorship.

Limitations and Future Work

  • Computational Cost: Generating longer suffixes with AutoDAN can be computationally intensive, as each step involves validating numerous candidate tokens.
  • Balance of Objectives: While AutoDAN strikes a good balance, the autoregressive, token-by-token generation method doesn't guarantee the absolute best trade-off between attack success rate and fluency.
  • Llama-2 Specifics: Adversarial suffixes generated on Llama-2 are less readable than on other LLMs, suggesting AutoDAN might need to sacrifice some readability to jailbreak heavily censored models.
  • Future Work: The authors suggest exploring better objectives (e.g., more effective prefixes), implementing self-modification mechanisms (like M-H sampling), and optimizing the process for generating longer suffixes. They also aim to address the issue of lower test ASR when using multiple harmful behaviors for Llama-2 jailbreaking.

Summary updated

BibTeX
@inproceedings{zhu2024autodan,
  author = {Sicheng Zhu and Ruiyi Zhang and Bang An and Gang Wu and Joe Barrow and Zichao Wang and Furong Huang and Ani Nenkova and Tong Sun},
  title = {{AutoDAN: Interpretable Gradient-Based Adversarial Attacks on Large Language Models}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=INivcBeIDK},
}
Figure