PIG: Privacy Jailbreak Attack on LLMs via Gradient-based Iterative In-Context Optimization

Yidan Wang, Yanan Cao, Yubing Ren, Fang Fang, Zheng Lin +1 more
5/15/2025
cs.CRcs.CL

Official code: redwyd/PrivacyJailbreak (12 stars, last commit 2025-05-19).

Abstract

Large Language Models (LLMs) excel in various domains but pose inherent privacy risks. Existing methods to evaluate privacy leakage in LLMs often use memorized prefixes or simple instructions to extract data, both of which well-alignment models can easily block. Meanwhile, Jailbreak attacks bypass LLM safety mechanisms to generate harmful content, but their role in privacy scenarios remains underexplored. In this paper, we examine the effectiveness of jailbreak attacks in extracting sensitive information, bridging privacy leakage and jailbreak attacks in LLMs. Moreover, we propose PIG, a novel framework targeting Personally Identifiable Information (PII) and addressing the limitations of current jailbreak methods. Specifically, PIG identifies PII entities and their types in privacy queries, uses in-context learning to build a privacy context, and iteratively updates it with three gradient-based strategies to elicit target PII. We evaluate PIG and existing jailbreak methods using two privacy-related datasets. Experiments on four white-box and two black-box LLMs show that PIG outperforms baseline methods and achieves state-of-the-art (SoTA) results. The results underscore significant privacy risks in LLMs, emphasizing the need for stronger safeguards. Our code is availble at https://github.com/redwyd/PrivacyJailbreak.

View on arXivView PDF

Code Implementations(1)

Accepted to ACL'25 (main)

124Shell, PythonMay 11, 20251 years ago

Similar Papers

Cite this paper

@article{wang2025pig,
  title  = {PIG: Privacy Jailbreak Attack on LLMs via Gradient-based Iterative In-Context Optimization},
  author = {Yidan Wang and Yanan Cao and Yubing Ren and Fang Fang and Zheng Lin and Binxing Fang},
  year   = {2025},
  eprint = {2505.09921},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.09921v2}
}

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/2505.09921.svg)](https://codeofpaper.com/paper/2505.09921)

Discussion