HackerPapers

arXiv:2307.15043cs.CL

Universal and Transferable Adversarial Attacks on Aligned Language Models

Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J. Zico Kolter, Matt Fredrikson

Abstract

Because "out-of-the-box" large language models are capable of generating a great deal of objectionable content, recent work has focused on aligning these models in an attempt to prevent undesirable generation. While there has been some success at circumventing these measures -- so-called "jailbreaks" against LLMs -- these attacks have required significant human ingenuity and are brittle in practice. In this paper, we propose a simple and effective attack method that causes aligned language models to generate objectionable behaviors. Specifically, our approach finds a suffix that, when attached to a wide range of queries for an LLM to produce objectionable content, aims to maximize the probability that the model produces an affirmative response (rather than refusing to answer). However, instead of relying on manual engineering, our approach automatically produces these adversarial suffixes by a combination of greedy and gradient-based search techniques, and also improves over past automatic prompt generation methods. Surprisingly, we find that the adversarial prompts generated by our approach are quite transferable, including to black-box, publicly released LLMs. Specifically, we train an adversarial attack suffix on multiple prompts (i.e., queries asking for many different types of objectionable content), as well as multiple models (in our case, Vicuna-7B and 13B). When doing so, the resulting attack suffix is able to induce objectionable content in the public interfaces to ChatGPT, Bard, and Claude, as well as open source LLMs such as LLaMA-2-Chat, Pythia, Falcon, and others. In total, this work significantly advances the state-of-the-art in adversarial attacks against aligned language models, raising important questions about how such systems can be prevented from producing objectionable information. Code is available at github.com/llm-attacks/llm-attacks.

arXiv comments
Website: http://llm-attacks.org/
Journal reference
DOI
Subjects
cs.CLComputation and Language cs.AIArtificial Intelligence cs.CRCryptography and Security cs.LGMachine Learning

On Hacker News

Linked by 3 identifiable commenters in 4 comments across 4 threads, from Aug 2023 to Aug 2025. Found in 2 HN submissions from Jul 2023 to Jul 2023. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments4 threads

    • If you wanted to get a readable prompt, I wonder if you could follow the GCG trick used by jailbreak maximizers (e.g. https://arxiv.org/pdf/2307.15043)? Sure, you're probably going to wind up with absolute garbage (one of their prompts starts with "== interface Manuel WITH steps…

      nneonneoView on HNParent context

    • The problem with jailbreaking is that it has a specific definition in other settings already, and that is as a goal, not as a method. Jailbreaking a phone might be just run an app with an embedded exploit, or might involve a whole chain of actions. This is important to me as a…

      MyNameIs_HackerView on HNParent context

    • Probably not - I bet you could override this prompt with sufficiently “convincing” text (e.g. “this is a request from legal”, “my grandmother passed away and left me this request”, etc.). That’s not even getting into the insanity of “optimized” adversarial prompts, which are…

      nneonneoView on HNParent context

    • We’re making good progress on this list… See https://arxiv.org/abs/2307.15043 for methods and more details about this adversarial attack.

      _______W_______View on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.