arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.26574cs.CR
收藏

GradSentry: 大语言模型微调中基于梯度谱熵的后门样本过滤

GradSentry: Gradient Spectral Entropy for Backdoor Sample Filtering in Large Language Model Fine-Tuning

School of Computer Science, Shanghai Jiao Tong University(上海交通大学计算机学院)

Haodong Zhao, Tianyi Xu, Tianhang Zhao, Zhuosheng Zhang, Gongshen Liu

AI总结:

提出GradSentry方法,利用每个样本梯度的谱熵区分后门样本与干净样本,无需聚类即可在任意投毒比例下有效过滤后门样本。

摘要:

使用不可信数据微调大语言模型会使模型面临后门攻击,其中被投毒的样本会导致目标性错误行为。现有的样本过滤防御依赖于聚类,这需要足够的数据,并且在极端投毒比例下可能失效。我们提出了GradSentry(梯度哨兵),一种基于每个样本梯度的谱熵的后门样本过滤方法。我们的关键发现是,与干净样本相比,被投毒样本产生的梯度具有更高的谱熵。GradSentry利用每个样本的梯度谱来捕获改变输出的后门特征,避免了特征构建过程中的成对样本比较和聚类。重要的是,我们的方法与训练无关:它既适用于参数高效微调方法(如LoRA),也适用于全参数微调,因为梯度分析独立于训练过程中更新的参数。GradSentry不需要聚类,在所有投毒比例(1%–90%)下都能有效运行,并且引入的计算开销极小(对于7B模型,每个样本20-50毫秒)。在四个问答数据集和四种攻击类型上的评估证明了谱熵对于后门检测的有效性。代码可在https://github.com/dongdongzhaoUP/GradSentry获取。

英文摘要:

Fine-tuning Large Language Models with untrusted data exposes models to backdoor attacks, where poisoned samples cause targeted misbehavior. Existing sample-filtering defenses rely on clustering, which requires sufficient data and can fail at extreme poison ratios. We propose GradSentry({Grad}ient {Sentry}), a backdoor sample filtering method based on the spectral entropy of per-sample gradients. Our key finding is that poisoned samples produce gradients with higher spectral entropy compared to clean samples. GradSentry captures output-altering backdoor signatures using per-sample gradient spectra, avoiding pairwise sample comparisons and clustering during feature construction. Importantly, our method is training-agnostic: it works for both parameter-efficient fine-tuning methods like LoRA and full-parameter tuning, as the gradient analysis operates independently of which parameters are being updated during training. GradSentry requires no clustering, operates effectively across all poison ratios (1%--90%), and introduces minimal computational overhead (20--50ms per sample for a 7B model). Evaluation on four QA datasets and four attack types demonstrates the effectiveness of spectral entropy for backdoor detection.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑