通过分析注意力头异常相似性,无须已知触发词即可检测并防御语言模型后门攻击。
Uncovering and Aligning Anomalous Attention Heads to Defend Against NLP Backdoor Attacks
- 利用注意力头间相似度异常识别后门触发模式。
- 在多个数据集上将后门攻击成功率降低至3%以下,同时保持原任务性能。
- 适用于动态/隐式触发场景,无需额外干净模型支持。
后门攻击严重威胁大语言模型的安全性,使模型在特定触发条件下表现出异常行为。触发器设计已从固定形式演变为动态或隐式形式,增加了防御难度。现有防御方法多局限于特定触发类型,或依赖额外清洁模型。为此,本文提出一种基于注意力相似性的后门检测方法,无需事先了解触发器即可实现检测。研究发现,受攻击模型在触发条件下注意力头间的相似度显著升高。基于此,提出注意力安全对齐结合逐头微调的方法,修复潜在污染的注意力头,有效缓解后门影响。大量实验表明,该方法在多个数据集上将后门攻击成功率降至3%以下,同时保持下游任务性能稳定。
原文摘要 · Abstract (English)
Backdoor attacks pose a serious threat to the security of large language models (LLMs), causing them to exhibit anomalous behavior under specific trigger conditions. The design of backdoor triggers has evolved from fixed triggers to dynamic or implicit triggers. This increased flexibility in trigger design makes it challenging for defenders to identify their specific forms accurately. Most existing backdoor defense methods are limited to specific types of triggers or rely on an additional clean model for support. To address this issue, we propose a backdoor detection method based on attention similarity, enabling backdoor detection without prior knowledge of the trigger. Our study reveals that models subjected to backdoor attacks exhibit unusually high similarity among attention heads when exposed to triggers. Based on this observation, we propose an attention safety alignment approach combined with head-wise fine-tuning to rectify potentially contaminated attention heads, thereby effectively mitigating the impact of backdoor attacks. Extensive experimental results demonstrate that our method significantly reduces the success rate of backdoor attacks while preserving the model's performance on downstream tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。