Semantic Representation Attack against Aligned Large Language Models
Jiawei Lian, Jianhong Pan, Lefan Wang, Yi Wang, Shaohui Mei, Lap-Pui Chau
TL;DR
This work reframes adversarial attacks on aligned LLMs from exact-output prompts to semantic representations, introducing the Semantic Representation Attack (SRA) and the SRHS algorithm. By targeting a semantic representation space $\\Omega$ and enforcing coherence via perplexity-based constraints, the method generates concise, natural prompts that induce semantically equivalent harmful responses across diverse models. The empirical results show unprecedented attack effectiveness ($\\text{ASR}$ average $=89.41\\%$ across $18$ models, with $100\\%$ on $11$ models), strong transferability to API-only models, and robustness against perplexity-based defenses, while maintaining short prompt lengths. The work highlights significant implications for safety-alignment research and defenses that must account for semantic rather than surface-form vulnerabilities, and provides public code to facilitate reproducibility.
Abstract
Large Language Models (LLMs) increasingly employ alignment techniques to prevent harmful outputs. Despite these safeguards, attackers can circumvent them by crafting prompts that induce LLMs to generate harmful content. Current methods typically target exact affirmative responses, such as ``Sure, here is...'', suffering from limited convergence, unnatural prompts, and high computational costs. We introduce Semantic Representation Attack, a novel paradigm that fundamentally reconceptualizes adversarial objectives against aligned LLMs. Rather than targeting exact textual patterns, our approach exploits the semantic representation space comprising diverse responses with equivalent harmful meanings. This innovation resolves the inherent trade-off between attack efficacy and prompt naturalness that plagues existing methods. The Semantic Representation Heuristic Search algorithm is proposed to efficiently generate semantically coherent and concise adversarial prompts by maintaining interpretability during incremental expansion. We establish rigorous theoretical guarantees for semantic convergence and demonstrate that our method achieves unprecedented attack success rates (89.41\% averaged across 18 LLMs, including 100\% on 11 models) while maintaining stealthiness and efficiency. Comprehensive experimental results confirm the overall superiority of our Semantic Representation Attack. The code will be publicly available.
