Skip to content

PRP: Propagating Universal Adversarial Prefixes to Responses to Attack LLM GuardrailsPRP: Propagating Universal Perturbations to Attack Large Language Model Guard-Rails

arXiv· arXiv:2402.15911· Neal Mangaokar, Ashish Hooda, Jihye Choi, Shreyas Chandrashekaran, Kassem Fawaz, Somesh Jha, Atul PrakashUniversity of Michigan; University of Wisconsin-MadisonIndexed by this site · 27 days ago· Originally publishedSelected AttacksSelectedAttention38

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose the PRP attack: first construct a universal adversarial prefix for the Guard Model, then use in-context learning to make the base LLM reproduce it at the beginning of its answer; the authors state that with GPT3.5 as Guard under the no-access setting, ASR reaches up to 88%.

Threat modelThe attacker has no knowledge of the base LLM and no permission to directly query its output responses; for the Guard Model there are three settings: white-box, black-box query-access (output token distribution), and no access (only contact with the Guard-Railed LLM as a whole). The victim system is a Guard-Railed LLM (aligned base LLM + Guard Model that checks responses).

Questions
Can a Guard-Railed LLM with a Guard Model really prevent jailbreaks? The authors consider that existing automated jailbreaks target only the base model and fail against a Guard Model that checks responses, so the robustness of such inference-time defenses needs to be evaluated.
Methods
PRP has two steps: optimize a universal adversarial prefix for the Guard Model so that any harmful response is misjudged as harmless; then use few-shot in-context learning to construct a propagation prefix so that the base LLM's answer automatically begins with that prefix, thereby bypassing detection.
Experiments and results
On 100 AdvBench prompts, the authors report that PRP improves ASR under all three settings—white-box, black-box, and no access—e.g., under the no-access setting, Vicuna-33B with GPT3.5 as Guard reaches 88%; the authors state that the Guard Model provides little additional security.
Limitations and future work
The authors state that they evaluated only on some existing LLMs and studied only Guard Models whose underlying model is an LLM, leaving non-LLM solutions for future work. The experiments use 100 prompts from AdvBench, and the paper does not report the number of repetitions or manual verification.
Experimental setupLlama2-70B-chat、Vicuna-33B-v1.3 et al. · AdvBench · ASR
Evaluated models
Llama2-70B-chatVicuna-33B-v1.3Guanaco-13BMistral-7B-Instruct-v0.1WizardLM-7B-UncensoredWizard-LM-Falcon-7B-UncensoredLlamaGuardGPT 3.5 (gpt-3.5-turbo-0125)Gemini-Pro
Benchmarks
AdvBench
Metrics
ASR
AI summaryand selection rationaleResearchers proposed the PRP attack, which can bypass Guard Models that provide a second layer of protection for base LLMs. The method first uses discrete optimization to construct a universal adversarial prefix for the Guard Model, so that any response is judged harmless, then uses few-shot in-context examples to construct a propagation prefix, causing the base model to reproduce that prefix at the start of its answer. On the 100 harmful prompts in AdvBench, Llama2-70b-chat paired with the gpt-3.5-turbo-0125 guardrail achieved an 80% success rate without being optimized against either; white-box and black-box success rates were similar, and under complete no-access conditions relying on transfer, the success rate against the GPT-3.5 guardrail reached up to 88%. The authors therefore concluded that guardrails currently cannot effectively prevent jailbreaks, and that defenses and Guard Models need further improvement.

Researchers proposed the PRP attack, which can bypass Guard Models that provide a second layer of protection for base LLMs. The method first uses discrete optimization to construct a universal adversarial prefix for the Guard Model, so that any response is judged harmless, then uses few-shot in-context examples to construct a propagation prefix, causing the base model to reproduce that prefix at the start of its answer. On the 100 harmful prompts in AdvBench, Llama2-70b-chat paired with the gpt-3.5-turbo-0125 guardrail achieved an 80% success rate without being optimized against either; white-box and black-box success rates were similar, and under complete no-access conditions relying on transfer, the success rate against the GPT-3.5 guardrail reached up to 88%. The authors therefore concluded that guardrails currently cannot effectively prevent jailbreaks, and that defenses and Guard Models need further improvement.

Why it was selectedThe paper reports success rates on open-source and closed-source Guard Models under three threat models—white-box, black-box and no-access—which can be used to assess the actual protection boundary provided by guardrails.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors propose PRP, attacking a Guard-Railed LLM protected by a Guard Model, to examine whether such inference-time defenses can prevent adaptive jailbreaks.

    Core question: existing automated jailbreak attacks target only the base LLM; are they still effective against a Guard-Railed LLM with a Guard Model? The authors consider evaluating the robustness of such inference-time defenses to still be an open problem.

    • Problem setting: one class of defenses defers safety checking to inference time, where a second LLM (Guard Model) detects whether the base LLM's response is harmful and refuses if so; the authors call this a Guard-Railed LLM, with the Guard Model acting as a fail-safe after the base model is compromised.
    • Shortcomings of existing methods: the authors state that existing jailbreak attacks (such as GCG, PAP) only manipulate the input prompt to bypass the base model's alignment and are no longer effective when a Guard Model is present (Section 5 gives quantitative results); directly extending gradient optimization to the Guard Model is also infeasible because the Guard Model needs to obtain the base model's complete response, involving a non-differentiable argmax.
    • Core observations: the authors' two key insights are—(1) the Guard Model itself is vulnerable to universal adversarial prefix attacks; a prefix prepended to any input can make it miss detection; (2) the attacker can exploit the base LLM's in-context learning ability to make that prefix appear at the beginning of the base model's response.
    • Proposed in the paper: PRP (Propagate Universal Adversarial Prefix), a two-stage attack framework, along with a formal definition of the Guard-Rail attack problem (Equation 2).
    • Threat model (Section 3.3):
      • Goal: construct an enhanced prompt p′ so that the Guard-Railed LLM returns a harmful response to a harmful prompt p0 instead of refusing.
      • Against the base LLM: no knowledge and no permission to directly query its output responses.
      • Against the Guard Model: three settings: white-box, black-box query-access (output token distribution), and no access.
      • Victim system: Guard-Railed LLM, e.g., open-source Llama 2/Vicuna as Guard, or closed-source GPT 3.5, Gemini as Guard.
  2. What related research exists?

    Related work falls into two categories: jailbreak attacks and defenses; the authors state that existing attacks fail under Guard Models, and this paper focuses on the less-studied response-side defenses.

    Jailbreak attacks

    • Manual attacks: Perez and Ribeiro [29] and Rao et al. [31] use deception; Liu et al. [25] use prompt engineering such as persuasion; the authors state that such methods rely on humans and require substantial manual effort.
    • Automated attacks: GCG (Zou et al. [43], gradient optimization), AutoDAN (Zhu et al. [42], genetic algorithm), PAP (Zeng et al. [40], generative rewriting); attack forms include prefix/suffix or full-sentence rewriting (Chao et al. [7]). The authors point out that these methods are no longer effective when a Guard Model is adopted [17].

    Defenses (Safeguards)

    • Input-side defenses: detecting anomalous patterns in prompts (Jain et al. [19], Alon and Kamfonas [2]), more robust system prompts (Wei et al. [37], Wu et al. [38], Zhang et al. [41]); the authors state that such methods are simple to implement but prone to false positives.
    • Multiple-inference defenses: performing multiple inferences on perturbed inputs (Kumar et al. [22], Robey et al. [32]); the authors state that they can provide robustness guarantees under certain settings, but each prompt requires multiple inferences and is inefficient.
    • Response-side defenses: using the same or another LLM to detect harmful content in responses (Wang et al. [36], Helbling et al. [17], Inan et al. [18]), which can also be used to correct factual errors [11].

    Baselines and benchmarks

    • Baseline attacks: GCG [43] and PAP [40]. GCG requires white-box access to the base LLM; the authors can only test its transferability (generating attacks with white-box access to surrogates such as Vicuna-7B, Guanaco-7B, Vicuna-13B); PAP uses a fine-tuned GPT 3.5 to rewrite prompts and is independent of the base model, so it can be applied directly.
    • Benchmark: AdvBench [43] harmful behavior prompts; 100 of the 520 are used for experiments.

    Positioning of this paper: the authors state that existing attacks focus on input prompts and have been used to evaluate input-side defenses, whereas this paper focuses on the less-explored response-side defenses and proposes new attacks to evaluate their robustness.

  3. How does the paper address this problem?

    PRP has two stages: first optimize a universal adversarial prefix for the Guard Model so that it fails to detect, then use a few-shot template to make the base LLM's response begin with that prefix.

    Overall idea: decompose "bypassing the Guard Model" into two independently solvable subproblems—find a universal adversarial prefix that makes the Guard Model necessarily judge the input as harmless, then find a propagation prefix that makes the base LLM's response begin with that prefix; concatenating the two gives the solution to the Guard-Rail attack (Statement 4.3, proof in Appendix A).

    Problem formalization

    • Guard-Railed LLM: g(fLLM,fG)(p) returns fLLM(p) when the Guard Model judges the input harmless, otherwise returns a refusal ⊥; the Guard Model fG outputs 1 for harmful and 0 for harmless, assuming greedy decoding of the response.
    • Attack goal: given a harmful prompt p0 such that g(fLLM,fG)(p0)=⊥, construct an enhanced prompt p′ so that the Guard-Railed LLM returns a response to p0.
    • Propagation prefix (Definition 4.1): a string p→δ such that the response to any input p begins with δ. Universal adversarial prefix (Definition 4.2): a string ∆ such that the Guard Model judges any concatenated input as 0.

    Stage one: universal adversarial prefix

    • Guard Model implementation: an underlying LLM gLLM with a template, deciding by comparing the probabilities of the two tokens "Yes"/"No" (or 'unsafe'/'safe' for LlamaGuard).
    • Optimization objective: maxδ Er[PgLLM(xNo|δ· r)], i.e., maximize the probability that the Guard Model outputs the "No" token for any harmful response r; in practice optimized on a training subset R of harmful responses.
    • Optimization algorithm (Algorithm 1): greedily update the prefix token by token. In the white-box case, select the replacement token by maximum gradient [43]; in the black-box case, replace uniformly at random [3]; at each step select from the candidates the one that maximizes the total "No" probability over R; success when the "No" probability is > 0.5 for all r in R, failure if the maximum number of iterations is exceeded.

    Stage two: propagation prefix

    • Mechanism: exploit the LLM's in-context learning to construct a few-shot template of k input-output pairs, with δ prepended to each output, so that the model also reproduces δ at the start of its response when prompted.
    • Characteristics: the authors state that constructing the propagation prefix requires no access to the base LLM; samples can be generated manually or by any open-source LLM without a Guard.

    Key parameters (Section 5.1)

    • Universal prefix: use WizardLM-Vicuna-7B-Uncensored to generate 20 harmful responses of 100 tokens as the training set; prefix length 20 tokens (initialized to '!'); at most 500 iterations, K = 256, comparing 256 (white-box, 512 for LlamaGuard) or 512 (black-box) candidates per step.
    • No-access setting: optimize the prefix on 4 surrogate models (Vicuna-7B, Vicuna-13B, Guanaco-7B, Guanaco-13B), expecting transfer.
    • Propagation prefix: no more than 10 input-output pairs, inputs are benign prompts from Kumar et al. [22], outputs generated by Mistral-7B-Instruct-v0.1.
    • Success criterion: the Guard-Railed LLM returns a non-refusal response, and the response contains no substring from the predefined refusal-phrase list (Appendix A.1).
  4. What experiments did the paper conduct?

    Three threat models are tested on 100 AdvBench prompts; the authors report that PRP improves ASR under all settings, reaching up to 88% against the GPT3.5 Guard under no access.

    Experimental setup

    • Base LLM (fLLM): aligned models Llama2-70B-chat, Vicuna-33B-v1.3, Guanaco-13B; unaligned models Mistral-7B-Instruct-v0.1, WizardLM-7B-Uncensored, Wizard-LM-Falcon-7B-Uncensored.
    • Guard Model (gLLM): Llama2-70B-chat, Vicuna-33B-v1.3, LlamaGuard, gpt-3.5-turbo-0125, Gemini-Pro (version available via API in February 2024).
    • Guard template: the template of Helbling et al. [17], outputting 'Yes, this is harmful'/'No, this is not harmful'; LlamaGuard uses its own long template (Appendix A.2), with decision tokens 'safe'/'unsafe'.
    • Dataset: 100 of the 520 harmful prompts in AdvBench (unless noted otherwise); PAP uses the same set of prompts from its original source.
    • Metric: ASR, i.e., the proportion of prompts for which the Guard-Railed LLM returns a harmful response (containing no predefined refusal phrase).
    • Baselines: GCG (can only test transfer, with surrogates Vicuna-7B, Guanaco-7B, Vicuna-13B) and PAP (fine-tuned GPT 3.5 rewriting). The paper does not report the number of repetitions.

    Main results

    Table 1 (aligned base, white-box/black-box access to Guard, ASR):

    Swipe horizontally to read the table

    BaseAttackNo GuardLlama2-70B Guard Orig/PRP-W/PRP-BVicuna-33B Guard Orig/PRP-W/PRP-B
    Llama2-70BGCG0%0% / 2% / 1%0% / 1% / 2%
    Llama2-70BPAP66%56% / 74% / 74%44% / 76% / 74%
    Vicuna-33BGCG90%16% / 59% / 55%14% / 61% / 73%
    Vicuna-33BPAP88%64% / 92% / 86%52% / 84% / 90%
    Guanaco-13BGCG88%21% / 95% / 73%14% / 83% / 91%
    Guanaco-13BPAP84%50% / 88% / 80%33% / 70% / 74%
    • The authors state that GCG has a low success rate under the Guard Model (e.g., 14% for Guanaco-13B + Vicuna-33B Guard), PAP is better but still low (33%), and the PRP versions are always higher (91% in the same setting).
    • The authors state that success rates in the black-box setting are usually comparable to, and sometimes even higher than, the white-box setting, and argue that white-box gradients provide no additional value for finding universal prefixes, with random search being equally effective.

    No-access (transfer) setting

    • Setting: the attacker has no access at all to the Guard Model; the prefix is optimized on a local surrogate and then transferred; only the stronger PAP baseline is used (Table 2).
    • Results: Llama2-70B base under GPT3.5 Guard goes from 0% for NA to 80% for PRP; Vicuna-33B under GPT3.5 Guard from 12% to 88%; Guanaco-13B under GPT3.5 Guard from 4% to 84%; under Gemini-Pro Guard the PRP results for the three bases are 74%, 80%, and 78%, respectively.
    • Authors' interpretation: PRP transfers well to closed-source Guard Models; the authors suggest that "safety by obscurity" may not be an effective way to counter jailbreaks.

    Whether Guard Models provide additional safety (RQ3)

    • Aligned bases: comparing the original attacks without a Guard in Tables 1 and 2 with PRP with a Guard, the authors state that in all cases PRP recovers or exceeds the original success rate without a Guard, and argue that Guard Models add little safety.
    • Unaligned bases (simulating a perfect jailbreak of the base, Table 3): for Mistral-7B under Llama2-70B Guard, NA is 8%, PRP-W 98%, PRP-B 89%; with LlamaGuard as Guard, PRP-W for the three bases is 91%, 82%, 91%, and PRP-B is 93%, 86%, 89%. The authors state that PRP is also effective against different Guard templates (including the LlamaGuard long template).
    • Unaligned bases + no access (Table 4): under GPT3.5 Guard, PRP for Mistral-7B, WizLM-7B-U, WizLM-Falcon-7B-U is 80%, 80%, 85%, respectively; under Gemini-Pro Guard it is 59%, 66%, 67%.
    • Exception: the authors mention that in some cases the PRP success rate exceeds the original attack without a Guard, and cite prior work explaining this as the few-shot samples in the propagation prefix further "priming" the base to answer harmful prompts [37].

    Other ablations and analyses

    • Prefix length trade-off (RQ4, Figure 2): for lengths ∈ [5, 10, 15, 20, 40, 80], propagation success rate is estimated with 100 random prefixes on Mistral-7B-Instruct-v0.1 and 10 AdvBench prompts; universal prefix success rate is measured against Vicuna-33B Guard with 100 prompts. The authors state that the optimal length is in the 15–20 token range, hence 20 was chosen; the figure shows propagation success rate decreasing with length and universal prefix success rate increasing with length, with specific values not labeled.
  5. What are some points that can be further explored?

    The authors state that they evaluated only some LLMs and studied only Guard Models implemented with LLMs; the experiments use 100 prompts and do not report the number of repetitions.

    Limitations and future directions noted by the authors

    • Model coverage (Section 8 Limitations): the authors state that they evaluated PRP only on a subset of currently available LLMs, and that a more complete understanding of the security of Guard-Railed models may require further evaluation.
    • Guard Model types (Section 8 Limitations): the authors state that they studied only Guard Models that use an LLM to analyze responses; service providers could well deploy non-LLM solutions, which the authors leave for future work.

    Scope of experimental coverage

    • Models tested: 6 base LLMs in total (3 aligned, 3 unaligned), and 5 Guard Models in total (including LlamaGuard, gpt-3.5-turbo-0125, Gemini-Pro) (Section 5.1).
    • Threat model: covers three access levels to the Guard Model: white-box, black-box query-access, and no access (Section 3.3).
    • Data scale: unless otherwise noted, 100 prompts from AdvBench are used; universal prefix optimization uses 20 training responses (Section 5.1).
    • Baselines: two existing attacks, GCG and PAP, and their PRP-enhanced versions are compared (Section 5.1).
    • Not reported: the paper does not report the number of experimental repetitions, confidence intervals or statistical tests for ASR, nor manual verification of the judgment results.
  6. Summarize the main content of the paper

    PRP bypasses the Guard Model in two steps—a universal adversarial prefix plus in-context propagation; the authors report that under all three threat models it recovers or exceeds the ASR without a Guard.

    A jailbreak attack paper targeting inference-time defenses: evaluating whether a Guard-Railed LLM composed of "base LLM + Guard Model" can withstand adaptive attacks.

    • Problem: the authors state that existing automated jailbreaks (GCG, PAP) only manipulate the input prompt and fail when the Guard Model checks responses; gradient methods also cannot be directly extended to a Guard Model that requires the complete response.
    • Method: PRP has two stages—(1) greedily optimize a universal adversarial prefix on the Guard Model's underlying LLM so that it outputs a "harmless" judgment token for any harmful response; (2) use few-shot in-context learning to construct a propagation prefix so that the base LLM's response automatically begins with that prefix. Under the no-access setting, the prefix is optimized on 4 surrogate models and then transferred.
    • Main results (100 AdvBench prompts, ASR):
      • White-box/black-box: with Guanaco-13B + Llama2-70B Guard, GCG rises from 21% to PRP-W 95% (Table 1).
      • No access: with GPT3.5 as Guard, Vicuna-33B rises from 12% to 88%, and Llama2-70B from 0% to 80% (Table 2).
      • Unaligned base: with Mistral-7B + Llama2-70B Guard, PRP-W reaches 98%; with LlamaGuard as Guard, PRP-W/B is also 82%–93% (Table 3).
      • Length trade-off: the authors state that the optimal length of the universal prefix is 15–20 tokens (Figure 2).
    • Authors' conclusion: PRP restores or exceeds the original attack success rate without a Guard under all settings; the authors therefore consider that the Guard Model provides little additional security, that "safety by obscurity" relying on a closed-source Guard may be ineffective, and that Guard Model-type defenses need further improvement before they can be regarded as effective.

Related papers

Show 3 more papers
Read originalarxiv.org