arXiv:2501.02754cs.CRcs.CL2025-01中稿 · ICTAI 2024被引 1

无需预训练权重,用分词和注意力蒸馏清除语言模型后门

MBTSAD: Mitigating Backdoors in Language Models Based on Token Splitting and Attention Distillation

  • 通过分词生成干净数据,再用注意力蒸馏重构模型
  • 在不依赖预训练权重情况下,清除后门且保持正常任务性能
  • 适合无预训练权重可用的后门防御场景

近年来,基于注意力的模型在多个领域表现优异,但易受后门攻击,尤其在使用污染数据进行下载或微调时。现有许多方法依赖预训练(未微调)权重,但在预训练权重不可用时失效。本文提出MBTSAD,仅需少量干净数据即可在无预训练权重条件下有效缓解语言模型中的后门问题。具体而言,MBTSAD首先利用分词生成新数据对受损模型进行重训练,再以重训练后的模型为教师,原后门模型为学生,实施注意力蒸馏。实验表明,MBTSAD在清除后门方面性能与依赖预训练权重的方法相当,同时保持对干净数据的性能。此外,该方法简化了对抗训练中的极小极大问题,并通过可视化发现分词步骤生成了分布外(OOD)数据,促使模型学习更泛化的特征,从而消除后门模式。

原文摘要 · Abstract (English)

In recent years, attention-based models have excelled across various domains but remain vulnerable to backdoor attacks, often from downloading or fine-tuning on poisoned datasets. Many current methods to mitigate backdoors in NLP models rely on the pre-trained (unfine-tuned) weights, but these methods fail in scenarios where the pre-trained weights are not available. In this work, we propose MBTSAD, which can mitigate backdoors in the language model by utilizing only a small subset of clean data and does not require pre-trained weights. Specifically, MBTSAD retrains the backdoored model on a dataset generated by token splitting. Then MBTSAD leverages attention distillation, the retrained model is the teacher model, and the original backdoored model is the student model. Experimental results demonstrate that MBTSAD achieves comparable backdoor mitigation performance as the methods based on pre-trained weights while maintaining the performance on clean data. MBTSAD does not rely on pre-trained weights, enhancing its utility in scenarios where pre-trained weights are inaccessible. In addition, we simplify the min-max problem of adversarial training and visualize text representations to discover that the token splitting method in MBTSAD's first step generates Out-of-Distribution (OOD) data, leading the model to learn more generalized features and eliminate backdoor patterns.

后门防御注意力蒸馏语言模型无预训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。