提出无需重训练即可过滤生成式大模型后门样本的新方法
Gracefully Filtering Backdoor Samples for Generative Large Language Models without Retraining
- 将样本梯度转换到频域,利用后门与正常样本的频域差异识别攻击样本
- 在多个数据集上实现近100%召回率和F1值,使后门攻击成功率降至0%
- 计算高效且可迁移至Llama-2、Vicuna等模型,适合关注生成模型安全的研究者
后门攻击仍是生成式大语言模型(LLMs)的重大安全威胁。由于生成式LLMs输出高维标记概率序列而非低维分类概率,现有针对BERT等判别模型设计的防御方法对生成式模型无效。受后门与正常样本在频域学习行为差异的启发,我们将其训练样本的梯度直接转换至频域。实验发现,后门样本与正常样本的梯度在频域中具有显著分离特性。基于此,提出频域梯度聚类的后门样本过滤方法GraCeFul,无需重训练即可有效识别后门样本。实验表明,GraCeFul显著优于基线方法:在多个自由问答数据集上实现近乎100%的召回率与F1分数,将各类后门攻击成功率降至0%,且对正常准确率影响极小。该方法还可泛化至Llama-2与Vicuna模型。代码已开源于https://github.com/ZrW00/GraceFul。
原文摘要 · Abstract (English)
Backdoor attacks remain significant security threats to generative large language models (LLMs). Since generative LLMs output sequences of high-dimensional token logits instead of low-dimensional classification logits, most existing backdoor defense methods designed for discriminative models like BERT are ineffective for generative LLMs. Inspired by the observed differences in learning behavior between backdoor and clean mapping in the frequency space, we transform gradients of each training sample, directly influencing parameter updates, into the frequency space. Our findings reveal a distinct separation between the gradients of backdoor and clean samples in the frequency space. Based on this phenomenon, we propose Gradient Clustering in the Frequency Space for Backdoor Sample Filtering (GraCeFul), which leverages sample-wise gradients in the frequency space to effectively identify backdoor samples without requiring retraining LLMs. Experimental results show that GraCeFul outperforms baselines significantly. Notably, GraCeFul exhibits remarkable computational efficiency, achieving nearly 100% recall and F1 scores in identifying backdoor samples, reducing the average success rate of various backdoor attacks to 0% with negligible drops in clean accuracy across multiple free-style question answering datasets. Additionally, GraCeFul generalizes to Llama-2 and Vicuna. The codes are publicly available at https://github.com/ZrW00/GraceFul.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。