Counterfactual Explainable Incremental Prompt Attack Analysis on Large Language Models
Dong Shu, Mingyu Jin, Tianle Chen, Chong Zhang, Yongfeng Zhang
TL;DR
The paper addresses the vulnerability of large language models to prompt-based attacks and introduces CEIPA, a Counterfactual Explainable Incremental Prompt Attack framework that mutates prompts across four levels to generate counterfactual explanations and identify transition points in model defenses. It formalizes the method with an update rule $P_i = f_{w,s,c,w/c}(P_{i-1})$ and demonstrates, through extensive experiments on jailbreak, system-prompt extraction, and hijacking tasks across multiple models, that incremental mutations substantially increase attack success rates and reveal transferability patterns. Counterfactual analyses via t-SNE reveal semantic and linguistic cues (notably verbs and adjectives) and boundary effects in prompt vulnerability, offering actionable insights for defense design. Overall, CEIPA provides a rigorous, explainable toolkit for evaluating and strengthening LLM safety by illuminating how small, structured prompt changes shift model behavior.
Abstract
This study sheds light on the imperative need to bolster safety and privacy measures in large language models (LLMs), such as GPT-4 and LLaMA-2, by identifying and mitigating their vulnerabilities through explainable analysis of prompt attacks. We propose Counterfactual Explainable Incremental Prompt Attack (CEIPA), a novel technique where we guide prompts in a specific manner to quantitatively measure attack effectiveness and explore the embedded defense mechanisms in these models. Our approach is distinctive for its capacity to elucidate the reasons behind the generation of harmful responses by LLMs through an incremental counterfactual methodology. By organizing the prompt modification process into four incremental levels: (word, sentence, character, and a combination of character and word) we facilitate a thorough examination of the susceptibilities inherent to LLMs. The findings from our study not only provide counterfactual explanation insight but also demonstrate that our framework significantly enhances the effectiveness of attack prompts.
