Are All Prompt Components Value-Neutral? Understanding the Heterogeneous Adversarial Robustness of Dissected Prompt in Large Language Models

Yujia Zheng, Tianhao Li, Haotian Huang, Tianyu Zeng, Jingyu Lu +6 more
8/3/2025
cs.CLcs.AIcs.CR

Official code: Yujiaaaaa/PACP (3 stars, last commit 2025-08-04).

Abstract

Prompt-based adversarial attacks have become an effective means to assess the robustness of large language models (LLMs). However, existing approaches often treat prompts as monolithic text, overlooking their structural heterogeneity-different prompt components contribute unequally to adversarial robustness. Prior works like PromptRobust assume prompts are value-neutral, but our analysis reveals that complex, domain-specific prompts with rich structures have components with differing vulnerabilities. To address this gap, we introduce PromptAnatomy, an automated framework that dissects prompts into functional components and generates diverse, interpretable adversarial examples by selectively perturbing each component using our proposed method, ComPerturb. To ensure linguistic plausibility and mitigate distribution shifts, we further incorporate a perplexity (PPL)-based filtering mechanism. As a complementary resource, we annotate four public instruction-tuning datasets using the PromptAnatomy framework, verified through human review. Extensive experiments across these datasets and five advanced LLMs demonstrate that ComPerturb achieves state-of-the-art attack success rates. Ablation studies validate the complementary benefits of prompt dissection and PPL filtering. Our results underscore the importance of prompt structure awareness and controlled perturbation for reliable adversarial robustness evaluation in LLMs. Code and data are available at https://github.com/Yujiaaaaa/PACP.

View on arXivView PDF

Code Implementations(1)

Yujiaaaaa/PACPOfficial100%
31PythonAug 2, 20251 years ago

Similar Papers

Cite this paper

@article{zheng2025prompt,
  title  = {Are All Prompt Components Value-Neutral? Understanding the Heterogeneous Adversarial Robustness of Dissected Prompt in Large Language Models},
  author = {Yujia Zheng and Tianhao Li and Haotian Huang and Tianyu Zeng and Jingyu Lu and Chuangxin Chu and Yuekai Huang and Ziyou Jiang and Qian Xiong and Yuyao Ge and Mingyang Li},
  year   = {2025},
  eprint = {2508.01554},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.01554v1}
}

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

Discussion