用剪枝方法在不知触发词的情况下防御大模型后门攻击
Pruning Strategies for Backdoor Defense in LLMs
- 通过剪掉无用注意力头来清除隐藏后门
- 梯度剪枝对语法类后门效果最好,强化学习和贝叶斯剪枝抗风格攻击更强
- 无需干净模型或触发词知识,适合实际部署中的安全加固
后门攻击严重威胁预训练语言模型的性能与完整性。尽管这些模型常用于下游NLP任务微调,但现有研究表明其仍可能在常规微调后保留后门。此类攻击难以防御,因终端用户通常不了解攻击触发词。攻击通过细微的句法或风格改动引入隐蔽恶意触发词,可绕过传统检测并保留在模型中,因此事后净化至关重要。本研究探索了注意力头剪枝是否能在不掌握触发词或无干净参考模型的前提下缓解此类威胁。我们设计并实现了六种剪枝策略:(i) 基于梯度的剪枝,(ii) 层级方差剪枝,(iii) 结构化L1/L2稀疏化的梯度剪枝,(iv) 随机集成剪枝,(v) 强化学习引导剪枝,(vi) 贝叶斯不确定性剪枝。每种方法通过迭代移除信息量最低的注意力头,并监控验证准确率以避免过度剪枝。实验表明,基于梯度的剪枝在防御语法类触发词方面表现最佳,而强化学习和贝叶斯剪枝对风格类攻击更具鲁棒性。
原文摘要 · Abstract (English)
Backdoor attacks are a significant threat to the performance and integrity of pre-trained language models. Although such models are routinely fine-tuned for downstream NLP tasks, recent work shows they remain vulnerable to backdoor attacks that survive vanilla fine-tuning. These attacks are difficult to defend because end users typically lack knowledge of the attack triggers. Such attacks consist of stealthy malicious triggers introduced through subtle syntactic or stylistic manipulations, which can bypass traditional detection and remain in the model, making post-hoc purification essential. In this study, we explore whether attention-head pruning can mitigate these threats without any knowledge of the trigger or access to a clean reference model. To this end, we design and implement six pruning-based strategies: (i) gradient-based pruning, (ii) layer-wise variance pruning, (iii) gradient-based pruning with structured L1/L2 sparsification, (iv) randomized ensemble pruning, (v) reinforcement-learning-guided pruning, and (vi) Bayesian uncertainty pruning. Each method iteratively removes the least informative heads while monitoring validation accuracy to avoid over-pruning. Experimental evaluation shows that gradient-based pruning performs best while defending the syntactic triggers, whereas reinforcement learning and Bayesian pruning better withstand stylistic attacks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。