A Study of Backdoors in Instruction Fine-tuned Language Models

📄 arXiv: 2406.07778v2 📥 PDF

作者: Jayaram Raghuram, George Kesidis, David J. Miller

分类: cs.CR, cs.AI, cs.CL, cs.LG

发布日期: 2024-06-12 (更新: 2024-08-21)

备注: Under review


💡 一句话要点

研究指令微调语言模型中的后门攻击,并提出两种防御方法。

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 后门攻击 指令微调 语言模型 数据投毒 安全防御

📋 核心要点

  1. 现有方法难以有效防御指令微调语言模型中隐蔽的后门攻击,对模型安全性构成严重威胁。
  2. 通过分析后门攻击的多种变体,论文提出了两种防御策略,分别在微调期间和微调后阶段进行。
  3. 实验验证了所提出的防御方法能够有效降低后门攻击的成功率,提升模型的鲁棒性。

📝 摘要(中文)

本文研究了指令微调大型语言模型(LLM)中后门数据投毒攻击的有效性。这种攻击通过在微调样本中插入触发词或短语来实现,能够改变情感倾向、违反审查规则、过度拒绝合法查询、注入虚假内容或触发无意义的回复。研究考察了攻击超参数变化下的多种场景,包括触发词位置、对触发词位置变化的鲁棒性、部分触发词、同义词替换、跨领域攻击迁移以及干净标签与脏标签投毒。基于观察,提出了两种防御方法:一是基于词频统计的微调期间防御,用于识别后门触发词;二是基于下游干净数据微调的后微调防御。最后,简要回顾了后门攻击与防御的相关工作。

🔬 方法详解

问题定义:论文旨在解决指令微调大型语言模型(LLM)中存在的后门攻击问题。现有方法难以检测和防御这种攻击,因为攻击者可以通过在少量微调数据中插入不易察觉的触发词来控制模型的行为。这种攻击可能导致模型在特定情况下产生错误或有害的输出,例如改变情感倾向、违反审查规则等。

核心思路:论文的核心思路是分析后门攻击的特征,并利用这些特征设计防御策略。具体来说,论文观察到后门攻击通常依赖于特定的触发词,并且这些触发词在中毒数据集中出现的频率可能异常高。基于此,论文提出了基于词频统计的防御方法。此外,论文还提出了通过使用干净数据进行下游微调来消除后门影响的方法。

技术框架:论文的研究框架主要包括以下几个阶段:1) 后门攻击模拟:通过在指令微调数据集中插入触发词来模拟后门攻击。2) 攻击效果评估:评估后门攻击对模型性能的影响,包括攻击成功率、模型准确率等。3) 防御方法设计:设计基于词频统计和下游微调的防御方法。4) 防御效果评估:评估防御方法对后门攻击的防御效果。

关键创新:论文的关键创新在于提出了两种针对指令微调语言模型的后门攻击防御方法。与现有方法相比,这些方法更加简单有效,并且不需要对模型结构进行修改。基于词频统计的防御方法能够快速识别潜在的触发词,而下游微调方法能够有效消除后门的影响。

关键设计:在基于词频统计的防御方法中,关键的设计在于如何确定触发词的阈值。论文可能采用了一些统计方法来自动确定阈值,例如基于Z-score或IQR等。在下游微调方法中,关键的设计在于如何选择干净数据。论文可能采用了与中毒数据集相似的数据分布,以确保微调过程能够有效消除后门的影响。

🖼️ 关键图片

fig_0
fig_1

📊 实验亮点

实验结果表明,所提出的基于词频统计的防御方法能够有效识别后门触发词,显著降低后门攻击的成功率。同时,下游微调方法也能够有效消除后门的影响,恢复模型的正常性能。具体性能数据和对比基线未知,但整体效果表明防御方法具有实用价值。

🎯 应用场景

该研究成果可应用于提升大型语言模型的安全性,防止恶意用户通过后门攻击控制模型的行为。例如,可以用于检测和防御针对情感分析、文本生成等任务的后门攻击,确保模型在各种场景下都能产生可靠和安全的输出。该研究对于构建可信赖的人工智能系统具有重要意义。

📄 摘要(原文)

Backdoor data poisoning, inserted within instruction examples used to fine-tune a foundation Large Language Model (LLM) for downstream tasks (\textit{e.g.,} sentiment prediction), is a serious security concern due to the evasive nature of such attacks. The poisoning is usually in the form of a (seemingly innocuous) trigger word or phrase inserted into a very small fraction of the fine-tuning samples from a target class. Such backdoor attacks can: alter response sentiment, violate censorship, over-refuse (invoke censorship for legitimate queries), inject false content, or trigger nonsense responses (hallucinations). In this work we investigate the efficacy of instruction fine-tuning backdoor attacks as attack "hyperparameters" are varied under a variety of scenarios, considering: the trigger location in the poisoned examples; robustness to change in the trigger location, partial triggers, and synonym substitutions at test time; attack transfer from one (fine-tuning) domain to a related test domain; and clean-label vs. dirty-label poisoning. Based on our observations, we propose and evaluate two defenses against these attacks: i) a \textit{during-fine-tuning defense} based on word-frequency counts that assumes the (possibly poisoned) fine-tuning dataset is available and identifies the backdoor trigger tokens; and ii) a \textit{post-fine-tuning defense} based on downstream clean fine-tuning of the backdoored LLM with a small defense dataset. Finally, we provide a brief survey of related work on backdoor attacks and defenses.