Tree of Attacks: Jailbreaking Black-Box LLMs Automatically

While Large Language Models (LLMs) display versatile functionality, they continue to generate harmful, biased, and toxic content, as demonstrated by the prevalence of human-designed jailbreaks. In this work, we present Tree of Attacks with Pruning (TAP), an automated method for generating jailbreaks that only requires black-box access to the target LLM. TAP utilizes an attacker LLM to iteratively refine candidate (attack) prompts until one of the refined prompts jailbreaks the target. In addition, before sending prompts to the target, TAP assesses them and prunes the ones unlikely to result in jailbreaks, reducing the number of queries sent to the target LLM. In empirical evaluations, we observe that TAP generates prompts that jailbreak state-of-the-art LLMs (including GPT4-Turbo and GPT4o) for more than 80% of the prompts. This significantly improves upon the previous state-of-the-art black-box methods for generating jailbreaks while using a smaller number of queries than them. Furthermore, TAP is also capable of jailbreaking LLMs protected by state-of-the-art guardrails, e.g., LlamaGuard.

Paper

Similar papers

Peer review

Reviewer mTdE7/10 · confidence 4/52024-07-07

Summary

Note: I have seen this paper before, and I have heard of the method. However, I have not previously read it in full, and I do not remember anything about the authors. So this should still be a fully blind review. This paper introduces TAP -- a black-box method to develop attacks against LLMs. The attack process constructs a tree with a branching step based on refining a prompt using an LLM and a pruning step based on pruning attacks deemed off topic or assigned a low jailbreaking success score by another LLM. This method is thus able to search for attacks in a way that's automated and interpretable.

Strengths

S1: I think that the overall contribution is valuable to the field. TAP is kind of simple and arguably a glorified data-augmentation technique, but I think that TAP clearly belongs in the red-teaming toolbox. S2: One might criticize this paper for being an incremental improvement on PAIR, but I think that would be a pretty lazy criticism, and I don't buy that that would make this not valuable. I think that tree method is a good insight, and it doesn't have to be complicated to be useful.

Weaknesses

W1: I think that the biggest potential problem with this work is the jailbreak evaluation method. Recent work like [https://arxiv.org/abs/2402.10260](https://arxiv.org/abs/2402.10260) has shown that LLM autograders for jailbreak success tend to be pretty problematic. Meanwhile, I'm very skeptical of a supposed 88% success rate against GPT-40 in Table 8. Overall, I don't think that what is being evaluated is probably an ideal proxy for "safety". W2: The biggest limitation with TAP to me seems that its ability to help you find very novel jailbreaks seems very limited, and the initialization/prompting is doing a lot of work. I'd be appreciative of discussing this limitation or some more quantitative/qualitative analysis of it.

Questions

See weaknesses.

Rating

7

Confidence

4

Soundness

4

Presentation

4

Contribution

3

Limitations

See weaknesses.

Reviewer 2Heq5/10 · confidence 4/52024-07-10

Summary

This paper presents an automated method, Tree of Attacks with Pruning, for generating jailbreak prompts to exploit vulnerabilities in LLMs. TAP uses a tree-of-thought reasoning approach to iteratively refine and prune candidate prompts, significantly reducing the number of queries needed to successfully jailbreak LLMs like GPT-4.

Strengths

1. TAP's method of using tree-of-thought reasoning combined with pruning optimizes the search for effective jailbreak prompts, requiring fewer queries. 2. TAP demonstrates effectiveness across multiple LLMs and attack scenarios, including models with advanced protections like LlamaGuard. The evaluations show TAP successfully jailbreaks most state-of-the-art LLMs for over 70%.

Weaknesses

1. The format of this paper needs to be refined, such as Table 1,2,3. 2. The success of TAP heavily depends on the choice of evaluator LLM, with significantly reduced performance when using less powerful evaluators. 3. Much lower attack success rate on well aligned open-sourced model, Llama-2-7b-chat. Llama3 and gemma2 may be needed for evaluating the effectiveness of this method.

Questions

See weakness part.

Rating

5

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

The running time of this method is long.

Reviewer LFqH6/10 · confidence 4/52024-07-11

Summary

This paper propose Tree of Attacks with Pruning (TAP) to jailbreak blackbox LLMs automatically. TAP has four steps, including branching, pruning, attack and assess, and pruning. TAP leverage an attacker (an LLM) to generate variations of the provided prompt, and the evaluator (another LLM) decide which variations to send to the target model. TAP is an advanced version of PAIR, reaching a higher success rate more effectively.

Strengths

1, TAP can reach a high success rate on GPT4, GPT4o and Gemini-Pro. 2, Compared to PAIR, TAP is more efficiency on most of the black box model, suggesting the effectiveness of the branching and pruning. 3, TAP shows a better transferability between models.

Weaknesses

1, As a method built on PAIR, with branching and pruning, the novelty of the method is limited. 2, In Fig.1, a typo "branching".

Questions

1, In table 7, the attacker’s system prompt is long and carefully designed. The prompts try to get the LLM to make up a story for making the harmful behavior more reasonable and align with human value. This well designed prompt may be a key to success in jailbreak. It would help if the paper includes replacing the prompt with other evaluator/attacker prompts and show some results to state the success rate comes mostly from pruning instead of prompt engineering. 2, In section 6 discussion and appendix A.2, TAP-No-Prune has a higher success rate than TAP Prune, because retains the w = 10 highest scoring prompts and deletes the rest. Does it suggest that the off-topic prompts get higher scores? 3, As the subtree in Figure 12-14, is the improvement of the attacker generated by evaluator? What's the prompts for generating these? And are the revised prompts share the same attacker's prompts as the original generation? 4, In the branching stage, does the length of the re-writing prompts affect the success rate? Perhaps adding some constraints on the generation length may also help the jailbreak success rate.

Rating

6

Confidence

4

Soundness

2

Presentation

3

Contribution

2

Limitations

Please refer to questions.

Reviewer psVX7/10 · confidence 4/52024-07-12

Summary

This paper presents a novel jailbreaking attack based on the PAIR attack, enhanced with branching and pruning techniques. The attack generates multiple prompts through branching, then applies two pruning steps: removing off-topic prompts and eliminating prompts with low scores after testing them against the victim model. The method achieves a higher effectiveness with a lower number of queries than previous work. The study evaluates the attack's transfer performance, the effectiveness of the attack when LLaMA Guard is used as a defense, and includes an ablation study on the contribution of the different attack components.

Strengths

**Attack effectiveness** The attack is strong and uses less queries than previous work. The branching and pruning steps are effective in generating effective jailbreaks. **Thorough evaluation** The evaluation is thorough and includes transfer performance and the effectiveness of the attack against LLaMA Guard. Moreover, the ablation study provides insights into the contribution of the different attack components. **Clear writing** The paper is well-written and easy to follow (except for the redundancy mentioned in the Weaknesses below). **Thorough experimental details** The paper provides a lot of details about the experiments in the appendix, which is helpful for reproducibility.

Weaknesses

**Redundancy in the paper content**. I find subsection 1.2 with the basic description of TAP redundant and makes the Introduction section overly long. There is a big overlap with the content of section 3. I suggest merging the two sections. **Unclear calibration of the Judge model**. The judge model give scores that are between 1 and 10, however, in my experience while using LLMs, they are usually poorly calibrated when assigning scores. I have then two questions: 1) would it be feasible to look at how calibrated is the judge model compared to a human baseline? 2) how important is it that the model is actually calibrated when using it for the pruning step? It would be interesting to see how the pruning step would perform when selecting random prompts instead of those with the highest assigned score (except of course for the prompts that are considerered to be fully successful, with a score of 10). It seems to me that the score domain is excessively granular even for a human to assign scores, so using a coarser score scale might be more effective and meaningful. I understand that this is the same prompt as the one used in PAIR, but it seems to me that the score in TAP has a more crucial role than in PAIR.

Questions

- What average is used for the number of queries in table 2? Is it the arithmetic mean? Are there many outliers? What is the median? - See my questions about model calibration above.

Rating

7

Confidence

4

Soundness

3

Presentation

2

Contribution

3

Limitations

The authors discuss the limitations of their work.

Reviewer mTdE2024-08-09

Thanks, I think the paper should be accepted

Thanks, not too much more to say. I basically think that we are on the same page. I'll hold at a 7. But I would encourage the authors to mention explicitly the problems with autograders. I would also add that mentioning any differences in eval methodology that might make the numbers in your tables and the numbers in other papers' tables apples-to-oranges.

Reviewer 2Heq2024-08-09

Thanks for the reply. I tend to keep my score as borderline according to the following reasons. 1. The dependence on a powerful and costly evaluator is one of the drawbacks of this method, others having the same problem is not a reasonable excuse for this. 2. The Llama3 and Gemma2 exps are not conducted and the limitation of running time and money cost.

Authorsrebuttal2024-08-13

Thank you for your response

Thank you for taking the time to write back. Regarding the performance's dependence on the evaluator, we agree that this is a drawback. However, we do not agree that it affects the contribution of the method over existing ones, since achieving high performance with existing black-box methods (such as GPT-Fuzzer of Yu et al. [59]) requires fine-tuning existing models. Regarding the low success rate on "well-aligned open-sourced model" (e.g., Llama-2-7B model), we would like to stress that the method has high performance on many well-aligned and state-of-the-art LLMs (such as GPT-4o, GPT-3.5-Turbo, and Gemini-Pro). We do not understand why jailbreaking small open-source LLMs should be a criterion for evaluation: indeed, simple LLMs such as Llama-2-7B can be hard to jailbreak as they cannot follow complex instructions. This makes them less useful but is also one reason why they can be overly protective. This makes these models hard to jailbreak as mentioned in our earlier response. Finally, regarding the evaluations with Llama-3 and Gemma-2 as targets. We note that Llama-3 was released less than a month before the abstract submission deadline (see https://ai.meta.com/blog/meta-llama-3/) and Gemma-2 was released *after* the deadline (see https://ai.google.dev/gemma/docs/releases). This prevented us from thoroughly evaluating the method with these models. We would be happy to include these evaluations in the final version.

Reviewer LFqH2024-08-13

Thanks authors for the reply. And my concerns are mainly addressed. From the reply we can see that the method is somehow not sensitive to the system prompts and the generation constraints, and I encourage the authors to include these in the final version. And I believe that this paper should be accepted.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC