无需重训即可优雅过滤生成式大型语言模型中的后门样本
Gracefully Filtering Backdoor Samples for Generative Large Language Models without Retraining
AI总结:
针对生成式LLM后门防御难题,提出GraCeFul方法,通过频率空间逐样本梯度聚类无需重训即可识别后门样本,攻击成功率降至0%且干净性能几乎无损。
摘要:
后门攻击仍然是生成式大型语言模型(LLM)面临的重大安全威胁。由于生成式LLM输出的是高维token logits序列,而非低维分类logits,因此大多数为BERT等判别式模型设计的现有后门防御方法对生成式LLM无效。受观察到的后门映射与干净映射在频率空间中学习行为差异的启发,我们将每个训练样本的梯度(这些梯度直接影响参数更新)变换到频率空间。研究结果表明,后门样本与干净样本的梯度在频率空间中呈现明显分离。基于这一现象,我们提出了用于后门样本过滤的频率空间梯度聚类方法 GraCeFul,该方法利用频率空间中的逐样本梯度,在无需重训LLM的情况下有效识别后门样本。实验结果表明,GraCeFul显著优于基线方法。值得注意的是,GraCeFul表现出卓越的计算效率,在识别后门样本时实现接近100%的召回率和F1分数,在多个自由问答数据集上将各类后门攻击的平均成功率降至0%,且干净准确率下降可忽略不计。此外,GraCeFul可泛化至Llama-2和Vicuna。代码已公开:https://github.com/ZrW00/GraceFul。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。