Graph of Attacks with Pruning: Optimizing Stealthy Jailbreak Prompt Generation for Enhanced LLM Content Moderation

Daniel Schwartz, Dmitriy Bespalov, Zhe Wang, Ninad Kulkarni, Yanjun Qi
1/28/2025
cs.CRcs.AIcs.CL

Official code: dsbuddy/GAP-LLM-Safety (3 stars, last commit 2025-06-12).

Abstract

As large language models (LLMs) become increasingly prevalent, ensuring their robustness against adversarial misuse is crucial. This paper introduces the GAP (Graph of Attacks with Pruning) framework, an advanced approach for generating stealthy jailbreak prompts to evaluate and enhance LLM safeguards. GAP addresses limitations in existing tree-based LLM jailbreak methods by implementing an interconnected graph structure that enables knowledge sharing across attack paths. Our experimental evaluation demonstrates GAP's superiority over existing techniques, achieving a 20.8% increase in attack success rates while reducing query costs by 62.7%. GAP consistently outperforms state-of-the-art methods for attacking both open and closed LLMs, with attack success rates of >96%. Additionally, we present specialized variants like GAP-Auto for automated seed generation and GAP-VLM for multimodal attacks. GAP-generated prompts prove highly effective in improving content moderation systems, increasing true positive detection rates by 108.5% and accuracy by 183.6% when used for fine-tuning. Our implementation is available at https://github.com/dsbuddy/GAP-LLM-Safety.

View on arXivView PDF

Code Implementations(1)

A repository focused on exploring and implementing safety measures for LLMs using proposed Graph of Attacks with Pruning (GAP) methodology. This project aims to identify, analyze, and mitigate potential safety risks in LLM deployments through systematic assessment protocols and guardrail implementations.

31PythonJun 4, 20251 years ago

Similar Papers

Cite this paper

@article{schwartz2025graph,
  title  = {Graph of Attacks with Pruning: Optimizing Stealthy Jailbreak Prompt Generation for Enhanced LLM Content Moderation},
  author = {Daniel Schwartz and Dmitriy Bespalov and Zhe Wang and Ninad Kulkarni and Yanjun Qi},
  year   = {2025},
  eprint = {2501.18638},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.18638v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2501.18638.svg)](https://codeofpaper.com/paper/2501.18638)

Discussion