Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Universal and Transferable Adversarial Attacks on Aligned Language Models

Automatically generated suffixes can jailbreak aligned language models

  • Problem Aligned chat models refuse direct harmful requests, but earlier attacks needed human ingenuity or rarely worked when generated automatically.
  • Method The authors append a suffix to a harmful query, then tune its tokens with gradient-ranked swaps, unlike hand-written prompts.
  • Results On individual harmful strings, the method reached 88% attack success on Vicuna-7B, against 25% for AutoPrompt.

Why aligned chat models remain exposed

Chat models are usually tuned to decline harmful requests, and when asked directly they mostly do. Attacks that get around this tuning have so far relied on human ingenuity, and automatic prompt search has rarely produced reliable attacks on aligned models. Part of the difficulty is structural: the input is a sequence of discrete tokens, which limits the usable input space and makes the search computationally hard.

This study instead appends an optimized suffix to an unchanged harmful query, and the optimization runs automatically. Each of the three ingredients has appeared in earlier work in some form, and the authors argue that their combination is what makes the attack reliable. Suffixes optimized on open models also induce objectionable content in public interfaces such as ChatGPT, Bard and Claude.

Targeting an affirmative opening

The target is for the model to begin its reply with an affirmative phrase that restates the user request, rather than a single fixed answer. The idea is that once the reply starts affirmatively, the model tends to continue with the requested content instead of refusing. Targeting only the first token was judged risky in text, because a suffix could raise the probability of an affirmative first token without bringing out the behavior.

The model defines a next-token distribution, and the probability of a target continuation is the product of the conditional probabilities of its tokens given everything before them. The adversarial loss is the negative log of that target probability given the prompt, and the optimization minimizes it over the suffix token indices. \[ L(x_{1:n}) = -\log p(x^\star_{n+1:n+H} \mid x_{1:n}) \] For universal attacks, each training prompt gets its own target prefix that is consistent with an affirmative reply.

How candidate tokens are chosen

Scoring every possible single-token swap is too expensive, so the method uses gradients to shortlist candidates. The gradient is taken with respect to the one-hot indicator of each current suffix token, and the top-k tokens with the largest negative gradient become the candidates for that position.

A random batch of B substitutions is drawn from the candidates pooled over all suffix positions, each is scored exactly with a forward pass, and the lowest-loss one replaces the current token. AutoPrompt, which this method extends, picks one coordinate per step and scores replacements only there. At the same batch size per iteration, the authors find that GCG substantially outperforms AutoPrompt, which they attribute to scoring across all positions.

The authors note that an all-coordinates strategy in the style of ARCA could improve GCG further, but they keep the simpler version.

One suffix for many prompts and models

For universal attacks, the same suffix is scored on several training prompts, and the gradients and losses from those prompts are combined before candidates are selected. Gradients are clipped to unit norm before they are aggregated. New prompts are added only after the current suffix succeeds on the ones already included, which the authors found works better than optimizing all prompts from the start.

Several models can share one suffix when they use the same tokenizer, because their gradients then live in the same vocabulary space and can be summed. Two runs optimized over Vicuna-7B and Vicuna-13B with different random seeds, and a third added Guanaco-7B and 13B over the same 25 prompts, giving 4 models in total. For each run the prompt with the lowest loss after 500 steps is kept.

AdvBench and the metrics

AdvBench has a Harmful Strings setting with 500 target strings and a Harmful Behaviors setting with 500 instructions. In the strings setting the goal is to make the model emit the exact target string, and the strings range from 3 to 44 tokens with a mean of 16 under the LLaMA tokenizer. In the behaviors setting the goal is a single suffix that makes the model attempt many of the instructions.

Attack Success Rate counts a string as a success only on an exact match, and a behavior as a success when the model makes a reasonable attempt at it. Cross-entropy loss on the target string serves as a secondary measure, where lower values mean a stronger attack. Judging whether a behavior attempt is real can require human judgement, since models differ in how they handle requests such as explosive instructions.

Universality is measured on the behaviors used in training and on a held-out set. PEZ and GBDA each optimize 16 randomly initialized sequences per target and keep the best one.

Single-model results on Vicuna-7B and Llama-2-7B-Chat

Over the same runs, cross-entropy loss on Vicuna-7B was 0.1 for GCG and 0.5 for AutoPrompt, so the lower value is the stronger attack.

The authors also track loss and success across optimization steps, and GCG reaches a low-loss adversarial example quickly before improving gradually. On individual harmful behaviors, PEZ and GBDA stay very low, while AutoPrompt and GCG are close on Vicuna-7B and separate on Llama-2-7B-Chat.

A single suffix on one model

A single suffix was optimized over 25 harmful behaviors against one model, and its success was measured on those 25 and on 100 held-out behaviors. On held-out behaviors, GCG reached 84% on Llama-2-7B-Chat, against 35% for AutoPrompt.

These two models are the only white-box targets in this setting, so the result covers those two models and this benchmark.

Transfer to open models

Suffixes were optimized on Vicuna and Guanaco and then tested on Pythia-12B, Falcon-7B, ChatGLM-6B, MPT-7B, Llama-2-Chat-7B and Stable-Vicuna. A suffix optimized on Vicuna-7B transfers to larger Vicuna models in nearly all cases.

On Pythia-12B the GCG attack reached nearly 100%, matching the Sure here's baseline. On the other listed open models the GCG attack outperformed the Sure here's baseline in the reported comparison. ChatGLM-6B stayed appreciable but was clearly lower than the other open models.

Transfer to GPT, Claude and PaLM-2

The closed-model evaluation used 388 held-out harmful behaviors, with temperature and top-p set to 0 for ChatGPT and Claude.

PaLM-2 was run with default sampling settings, so 8 completions were checked per prompt and an attack counted as successful if any one matched the target behavior.

Combining GCG prompts

Concatenating three GCG prompts into one suffix raised GPT-3.5 success from 47.4% to 79.6%.

The ensemble tries every available GCG prompt and counts success if any one works.

Why transfer may be strong, and what the authors propose to test

The authors suspect that the strong transfer to GPT models partly reflects Vicuna being trained on ChatGPT-3.5 outputs. They cite visual attack studies in which transfer between distilled models works better than between independent models, and they propose testing this with distilled versions of Claude and GPT-4, which they have not done.

The authors think that a content filter in the chat interface, which the Claude API does not apply, may lower success on Claude. They also note that detectors of this kind failed in earlier vision work.

Some optimized suffixes are partly readable, for instance one fragment asks the model to repeat its first sentence and begin with the word Sure. The authors say this readable structure is not universal, since other typical suffixes show none.

Limitations

The authors report that running the optimizer for many steps, around 500, can reduce transferability and overfit the source models. Claude-2 transfer is weak, and the attack was run on Claude through its reported settings only. Harmful behavior success involves human judgement, and PaLM-2 used sampling rather than deterministic decoding.

White-box optimization was run only on Vicuna-7B and Llama-2-7B-Chat in the single-model setting. Whether models can be fine-tuned to resist these suffixes, and whether such training would hold up, is left open.

Paper info

Authors
Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J. Zico Kolter, Matt Fredrikson
Venue
arXiv · Preprint
First published
2023-7-27
Added
2026-11-12
Updated
2023-12-20
Version
v2
arXiv
2307.15043
Category
cs.CL · cs.AI · cs.CR · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Andy Zou, Zifan Wang, Nicholas Carlini, Milad Nasr, J. Zico Kolter, Matt Fredrikson (2023). Universal and Transferable Adversarial Attacks on Aligned Language Models. arXiv:2307.15043v2. https://arxiv.org/abs/2307.15043v2

BibTeX
@misc{zou2023universal,
  title = {{Universal and Transferable Adversarial Attacks on Aligned Language Models}},
  author = {Andy Zou and Zifan Wang and Nicholas Carlini and Milad Nasr and J. Zico Kolter and Matt Fredrikson},
  year = {2023},
  eprint = {2307.15043},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.15043v2}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up