通过提取对齐模型的安全分类器,高效发现并攻击其漏洞。
Targeting Alignment: Extracting Safety Classifiers of Aligned LLMs
- 从大模型中提取安全分类器的近似版本(代理分类器)
- 仅用20%模型参数即可达到80%以上F1分数,且攻击成功率超70%
- 适合研究模型安全漏洞或开发防御策略的研究者
大型语言模型(LLM)的对齐技术用于确保输出符合安全规范,但面对改写输入以诱导不安全输出的越狱攻击时会失效。本文提出一种新方法:观察到对齐模型内部嵌入了决定拒绝或合规的安全分类器,进而尝试提取该分类器的近似版本——代理分类器。我们通过构建不同规模的候选分类器,评估其在正常与对抗场景下对原模型安全分类器的逼近程度,并测试针对代理分类器的攻击能否有效迁移至原始模型。结果表明,仅使用20%模型架构的最优候选分类器即可实现超过80%的F1分数;而使用50%参数的代理分类器,在内存和运行时间减少一半的情况下,攻击成功率达70%,远高于直接攻击完整模型的22%。这证明提取代理分类器是高效建模并应对越狱攻击漏洞的有效手段。代码已开源。
原文摘要 · Abstract (English)
Alignment in large language models (LLMs) is used to enforce guidelines such as safety. Yet, alignment fails in the face of jailbreak attacks that modify inputs to induce unsafe outputs. In this paper, we introduce and evaluate a new technique for jailbreak attacks. We observe that alignment embeds a safety classifier in the LLM responsible for deciding between refusal and compliance, and seek to extract an approximation of this classifier: a surrogate classifier. To this end, we build candidate classifiers from subsets of the LLM. We first evaluate the degree to which candidate classifiers approximate the LLM's safety classifier in benign and adversarial settings. Then, we attack the candidates and measure how well the resulting adversarial inputs transfer to the LLM. Our evaluation shows that the best candidates achieve accurate agreement (an F1 score above 80%) using as little as 20% of the model architecture. Further, we find that attacks mounted on the surrogate classifiers can be transferred to the LLM with high success. For example, a surrogate using only 50% of the Llama 2 model achieved an attack success rate (ASR) of 70% with half the memory footprint and runtime -- a substantial improvement over attacking the LLM directly, where we only observed a 22% ASR. These results show that extracting surrogate classifiers is an effective and efficient means for modeling (and therein addressing) the vulnerability of aligned models to jailbreaking attacks. The code is available at https://github.com/jcnf0/targeting-alignment.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。