TAPDA: Text Adversarial Purification as Defense Against Adversarial Prompt Attack for Large Language Models
Large Language Models (LLMs) are vulnerable to adversarial prompt attacks, which can lead to “jailbreaking” and the failure of safety alignment, resulting in the generation of harmful content. As adversarial prompts become increasingly human readable, traditional filters based on perplexity become less effective in defending against such attacks. Inspired by adversarial purification in computer vision, we propose a novel system-level defense method called TAPDA to defend against adversarial prompt attacks targeting LLMs. TAPDA leverages LLMs themselves as purification models by using multiple “mask-predict” iterations to generate masked prompts, and then aggregates these prompts using a combination of a voting mechanism and a perplexity-based approach to recover clean prompts. Experiments show that TAPDA effectively reduces the attack success rate (ASR) of adversarial prompt attacks such as AdvPrompter, compared to other defense methods like SMOOTHLLM, while maintaining the human-readability of the prompts.
Authors
- Hanlin Yang (ORCID: https://orcid.org/0000-0002-9396-3505)
Institutions
- Beijing University of Posts and Telecommunications (CN)
- State Key Laboratory of Networking and Switching Technology
Publication Details
- Published
- 2025-03-21
- DOI
- https://doi.org/10.1109/icaace65325.2025.11020575
- Primary Topic
- Adversarial Robustness in Machine Learning
- Type
- article
- Field-Weighted Citation Impact
- 0.00