从大海捞针中移除针:通过权重正交化移除LLM中的后门

·

研究论文 · 2026/10/02

后门攻击可在训练期间植入大型语言模型(LLM),当输入中出现触发器时引发不良行为。现有的LLM后门防御试图移除后门,但无意中会将模型的输出分布转向良性提示,可能导致模型性能和安全性下降。我们提出NEEDLE,一种无需训练的有针对性后门移除方法。一旦识别出触发器,我们的方法通过激活向量估计后门方向和拒绝子空间,然后应用顺序权重正交化来抑制后门,同时防止拒绝相关表示发生变化。NEEDLE既不需要干净的参考模型,也不需要原始的投毒训练数据。评估在多个模型家族和攻击类型上进行。NEEDLE在所评估的防御中实现了最低的平均攻击成功率(ASR),包括在具有挑战性的代码注入攻击上达到0%,同时产生最低的KL散度,并且能力和安全性变化最小。

该研究提出了一种无需训练的后门移除方法,在有效降低攻击成功率的同时,最小化对模型性能和安全性影响,具有实际应用价值。

Backdoor attacks can be implanted in Large Language Models (LLMs) during training, causing unwanted behaviour when a trigger appears in the input. Existing backdoor defences for LLMs attempt to remove the backdoor but inadvertently shift the model's output distribution to benign prompts, which can result in degraded model performance and safety. We propose NEEDLE, a training-free method for targeted backdoor removal. Once a trigger has been identified, our method estimates a backdoor direction and a refusal subspace through activation vectors, then applies sequential weight orthogonalisation to suppress the backdoor while preventing changes in refusal-related representations. NEEDLE requires neither a clean reference model nor the original poisoned training data. Evaluation is conducted across multiple model families and attack types. NEEDLE achieves the lowest mean Attack Success Rate (ASR) among the evaluated defences, including 0% on challenging code injection attacks, while resulting in the lowest KL divergence and minimal changes in capability and safety.

阅读原文

参与讨论