用无害数据悄悄植入后门,让大模型在特定触发下生成有害内容。
Revisiting Backdoor Attacks on LLMs: A Stealthy and Practical Poisoning Framework via Harmless Inputs
- 仅用正常问答对构建后门,不引入任何有害内容。
- 攻击成功率超90%,且能绕过主流安全过滤机制。
- 适合研究模型安全漏洞或防御机制的人员阅读。
近期研究通过在训练数据中插入有害问答对来攻击大语言模型(LLMs),但存在两大缺陷:(1)直接嵌入有害内容会破坏安全对齐,导致无触发词查询也产生恶意响应;(2)污染样本易被安全对齐的防护机制过滤。为此,我们提出一种基于完全无害数据的新毒化方法。受自回归模型因果推理启发,我们仅使用良性问答对,在触发词与肯定性响应前缀之间建立强关联,而非直接链接触发词与有害回复。推理时,带有触发词的恶意查询会激发该前缀,模型依其语言建模能力完成后续输出。实现此目标极具挑战。我们观察到模型先同意后拒绝的抵抗现象,归因于浅层对齐,并设计出鲁棒通用的良性响应模板以优化毒化数据。为进一步增强攻击效果,我们采用基于梯度的坐标优化改进通用触发词。大量实验表明,该方法可成功在多种LLM中注入后门,实现有害内容生成,即使面对强大护航模型检测亦有效。
原文摘要 · Abstract (English)
Recent studies have widely investigated backdoor attacks on Large Language Models (LLMs) by inserting harmful question-answer (QA) pairs into their training data. However, we revisit existing attacks and identify two critical limitations: (1) directly embedding harmful content into the training data compromises safety alignment, resulting in attack efficacy even for queries without triggers, and (2) the poisoned training samples can be easily filtered by safety-aligned guardrails. To this end, we propose a novel poisoning method via completely harmless data. Inspired by the causal reasoning in auto-regressive LLMs, we aim to establish robust associations between triggers and an affirmative response prefix using only benign QA pairs, rather than directly linking triggers with harmful responses. During inference, a malicious query with the trigger is input to elicit this affirmative prefix. The LLM then completes the response based on its language-modeling capabilities. Achieving this using only clean samples is non-trivial. We observe an interesting resistance phenomenon where the LLM initially appears to agree but subsequently refuses to answer. We attribute this to the shallow alignment, and design a robust and general benign response template for constructing better poisoning data. To further enhance the attack, we improve the universal trigger via a gradient-based coordinate optimization. Extensive experiments demonstrate that our method successfully injects backdoors into various LLMs for harmful content generation, even under the detection of powerful guardrail models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。