TAP  by RICommunity

Automated jailbreaking for black-box LLMs

Created 3 years ago
257 stars

Top 98.8% on SourcePulse

GitHubView on GitHub
Project Summary

<2-3 sentences summarising what the project addresses and solves, the target audience, and the benefit.> This project addresses the challenge of Large Language Models (LLMs) generating harmful content by providing TAP (Tree of Attacks with Pruning), an automated method for generating jailbreak prompts. It targets researchers and users needing to assess LLM safety and robustness. TAP offers a query-efficient, black-box approach that significantly improves upon existing methods, achieving over 80% jailbreak success on state-of-the-art LLMs with minimal queries.

How It Works

TAP employs a Tree of Attacks with Pruning (TAP) strategy, orchestrating three distinct LLMs: an attacker, an evaluator, and the target LLM to be jailbroken. The attacker iteratively refines candidate prompts using tree-of-thought reasoning to explore a vast prompt space. Before querying the target, an evaluator prunes off-topic or low-scoring prompts in two distinct phases. The target LLM is then queried with the refined prompts, and its responses are assessed by the evaluator. This iterative process allows for efficient navigation and pruning of the search space, leading to successful jailbreaks with a reduced number of queries to the target model.

Quick Start & Requirements

  • Primary install/run command: Execute main_TAP.py with specified arguments.
  • Non-default prerequisites: API keys for LLM models (e.g., OPENAI_API_KEY, PALM_API_KEY) must be configured. Paths to local Vicuna/Llama models or third-party API links require updates in config.py. wandb login is necessary before running.
  • Links: Demo.ipynb provides illustrative examples.

Highlighted Details

  • Achieves over 80% jailbreak success rate on state-of-the-art LLMs, including GPT4 and GPT4-Turbo.
  • Significantly improves upon previous state-of-the-art black-box methods in terms of query efficiency.
  • Generates interpretable jailbreak prompts using tree-of-thought reasoning.

Maintenance & Community

  • Contact: anaymehrotra1@gmail.com
  • Builds upon: The PAIR (Prompt Automatic Iterative Refinement) method.
  • Citation: @misc{mehrotra2023treeOfAttacks, title={Tree of Attacks: Jailbreaking Black-Box LLMs Automatically}, author={Anay Mehrotra and Manolis Zampetakis and Paul Kassianik and Blaine Nelson and Hyrum Anderson and Yaron Singer and Amin Karbasi}, year={2023}, archivePrefix={arXiv}, primaryClass={cs.LG}}

Licensing & Compatibility

  • No explicit license is mentioned in the provided README, which requires further investigation for adoption.
  • Compatibility for commercial use or closed-source linking is undetermined due to the lack of licensing information.

Limitations & Caveats

  • Requires careful configuration of API keys and model paths for the attacker, evaluator, and target LLMs.
  • The absence of explicit licensing information presents a significant caveat for potential adopters, particularly for commercial applications.
Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Michele Castata Michele Castata(President of Replit), and
3 more.

rebuff by protectai

0%
2k
SDK for LLM prompt injection detection
Created 3 years ago
Updated 2 years ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
3 more.

llm-guard by protectai

0%
3k
Security toolkit for LLM interactions
Created 3 years ago
Updated 4 months ago
Starred by Dan Guido Dan Guido(Cofounder of Trail of Bits), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
5 more.

PurpleLlama by meta-llama

0%
4k
LLM security toolkit for assessing/improving generative AI models
Created 3 years ago
Updated 3 days ago
Feedback? Help us improve.