arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2502.07557cs.CR
收藏

JBShield:通过激活概念分析与操纵防御大型语言模型免受越狱攻击

JBShield: Defending Large Language Models from Jailbreak Attacks through Activated Concept Analysis and Manipulation

Shenyi Zhang, Yuchen Zhai, Keyan Guo, Hongxin Hu, Shengnan Guo, Zheng Fang, Lingchen Zhao, Chao Shen, Cong Wang, Qian Wang

AI总结:

针对LLMs易受越狱攻击的问题,本研究基于线性表示假设揭示越狱机制,提出含检测和缓解组件的JBShield框架,通过概念分析与操纵提升检测准确率至0.95,大幅降低攻击成功率。

摘要:

尽管已实施安全对齐策略,大型语言模型(LLMs)仍易受越狱攻击,此类攻击会破坏安全护栏并构成重大安全威胁。已有一些防御方法被提出用于检测或缓解越狱攻击,但由于对越狱机制的理解不足,它们无法经受时间的考验。在本研究中,我们基于线性表示假设(LRH)研究越狱背后的机制,该假设指出神经网络将高级概念编码为其隐藏表示中的子空间。我们将有害和越狱提示中的有毒语义定义为有毒概念,并将越狱提示中操纵LLMs遵守不安全请求的语义描述为越狱概念。通过概念提取与分析,我们发现LLMs能够识别有害和越狱提示中的有毒概念。然而,与有害提示不同,越狱提示会激活越狱概念,并将LLM的输出从拒绝转变为服从。基于我们的分析,我们提出了一个全面的越狱防御框架JBShield,它包含两个关键组件:越狱检测组件JBShield-D和缓解组件JBShield-M。JBShield-D通过判断输入是否同时激活有毒概念和越狱概念来识别越狱提示。当检测到越狱提示时,JBShield-M通过增强有毒概念并削弱越狱概念来调整目标LLM的隐藏表示,确保LLMs生成安全内容。大量实验证明了JBShield的优越性能,在不同LLMs上实现了0.95的平均检测准确率,并将各种越狱攻击的平均攻击成功率从61%降低至2%。

英文摘要:

Despite the implementation of safety alignment strategies, large language models (LLMs) remain vulnerable to jailbreak attacks, which undermine these safety guardrails and pose significant security threats. Some defenses have been proposed to detect or mitigate jailbreaks, but they are unable to withstand the test of time due to an insufficient understanding of jailbreak mechanisms. In this work, we investigate the mechanisms behind jailbreaks based on the Linear Representation Hypothesis (LRH), which states that neural networks encode high-level concepts as subspaces in their hidden representations. We define the toxic semantics in harmful and jailbreak prompts as toxic concepts and describe the semantics in jailbreak prompts that manipulate LLMs to comply with unsafe requests as jailbreak concepts. Through concept extraction and analysis, we reveal that LLMs can recognize the toxic concepts in both harmful and jailbreak prompts. However, unlike harmful prompts, jailbreak prompts activate the jailbreak concepts and alter the LLM output from rejection to compliance. Building on our analysis, we propose a comprehensive jailbreak defense framework, JBShield, consisting of two key components: jailbreak detection JBShield-D and mitigation JBShield-M. JBShield-D identifies jailbreak prompts by determining whether the input activates both toxic and jailbreak concepts. When a jailbreak prompt is detected, JBShield-M adjusts the hidden representations of the target LLM by enhancing the toxic concept and weakening the jailbreak concept, ensuring LLMs produce safe content. Extensive experiments demonstrate the superior performance of JBShield, achieving an average detection accuracy of 0.95 and reducing the average attack success rate of various jailbreak attacks to 2% from 61% across distinct LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑