AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMs

Zeyi Liao, Huan Sun

TL;DR

This paper introduces AmpleGCG, a generative model that learns to create adversarial suffixes for jailbreaking Large Language Models (LLMs). By analyzing the limitations of previous methods, AmpleGCG can generate a wide variety of effective jailbreaking suffixes rapidly and transfer its capabilities to both open-source and closed-source LLMs, achieving near-perfect success rates.

What Problem Does This Paper Address?

Large Language Models (LLMs) are increasingly integrated into various applications, making their safety and trustworthiness paramount. While alignment techniques aim to prevent LLMs from generating harmful content, adversarial attacks, such as the GCG method, can still bypass these safeguards. GCG, however, focuses on finding a single optimal adversarial suffix, potentially missing many other vulnerabilities. Furthermore, GCG can be time-consuming. This paper addresses the limitations of GCG by exploring how to discover a broader range of adversarial suffixes more efficiently and how to make these attacks more transferable across different LLMs.

Methods

The authors build upon the GCG (Greedy Coordinate Gradient) method. They first identify a key drawback of GCG: simply selecting the suffix with the lowest loss during optimization doesn't always guarantee successful jailbreaking. This leads to the concept of "augmented GCG," where all candidate suffixes sampled during optimization are retained and tested. This "overgeneration" strategy significantly increases the attack success rate (ASR).

Leveraging these successful, overgenerated suffixes as training data, the authors develop AmpleGCG, a generative model. AmpleGCG learns the distribution of adversarial suffixes for a given harmful query. This allows it to rapidly generate hundreds of diverse adversarial suffixes in seconds, a significant improvement over the hours GCG might take. The methodology involves an "overgenerate-then-filter" pipeline to collect training data.

Datasets

The primary dataset used is AdvBench Harmful Behaviors, which contains 520 harmful queries. For training AmpleGCG, a subset of these queries for which successful adversarial suffixes could be found on both Llama-2-7B-Chat and Vicuna-7B was used. Additionally, the MaliciousInstruct dataset was used for out-of-distribution (OOD) evaluation to test generalization to different query formats and categories.

Key Insights and Ideas

  • Loss is not the sole indicator of success: The paper demonstrates that suffixes with lower loss during GCG optimization are not always the most effective for jailbreaking. Intermediate steps in GCG optimization can yield highly successful, yet higher-loss, suffixes.
  • Overgeneration is key: Retaining and testing all sampled suffixes (overgeneration) significantly boosts the attack success rate and uncovers more vulnerabilities than just picking the single lowest-loss suffix.
  • Generative models can learn adversarial patterns: By training a generative model (AmpleGCG) on successful adversarial suffixes, the authors show it's possible to rapidly produce a large number of effective jailbreaking prompts.
  • Transferability is crucial: AmpleGCG demonstrates remarkable transferability, not only across different open-source LLMs but also to closed-source models like GPT-3.5, highlighting a significant security concern.
  • Repetition can bypass defenses: Simple repetition tricks, when combined with AmpleGCG, can effectively bypass perplexity-based defense mechanisms.

Key Results

  • AmpleGCG achieves near 100% ASR on Llama-2-7B-Chat and Vicuna-7B.
  • It achieves 99% ASR on GPT-3.5, surpassing previous methods.
  • AmpleGCG can generate 200 adversarial suffixes in approximately 4 seconds, a dramatic speedup compared to GCG.
  • It uncovers a higher number of Unique Successful Suffixes (USS) and more diverse adversarial suffixes compared to baselines.
  • AmpleGCG successfully jailbreaks challenging queries that even augmented GCG failed on, demonstrating strong in-domain generalization.
  • When combined with repetition tricks, AmpleGCG bypasses perplexity defenses with an 80% ASR.

Limitations and Future Work

  • Evaluator limitations: The authors acknowledge that while they use multiple evaluators (string-based and model-based), false positives can still occur. More rigorous evaluators, including human evaluation, could further refine the results.
  • Transferability to GPT-4: While AmpleGCG shows improved performance over baselines against GPT-4, it still struggles to achieve high ASR, suggesting that GPT-4's stronger internal safeguards are effective. Future work could focus on collecting training data specifically for attacking GPT-4 using more stringent harmfulness evaluators.
  • Reproducibility: The authors have chosen not to release the trained AmpleGCG model publicly due to concerns about misuse. They will release the code for the overgeneration component and provide gated access to AmpleGCG.
  • Broader generative models: The paper focuses on GCG-generated suffixes. The authors suggest that similar generative models could be trained using adversarial prompts from other jailbreaking methods.
  • Defense mechanisms: The paper highlights the need for more robust defense mechanisms against such sophisticated and efficient adversarial attacks.

Summary updated

BibTeX
@inproceedings{liao2024amplegcg,
  author = {Zeyi Liao and Huan Sun},
  title = {{AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMs}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=UfqzXg95I5},
}
Figure