arXiv:2506.16447cs.CRcs.CL2025-06ICLR被引 36

通过检测触发样本,让大模型在黑盒环境下自动关闭后门漏洞。

Probe before You Talk: Towards Black-box Defense against Backdoor Unalignment for Large Language Models

  • 用拼接探测法识别输入是否被恶意触发,基于输出分布畸变判断。
  • 在多个攻击和模型上验证有效,包括闭源GPT-3.5-turbo。
  • 可防御类似越狱攻击的“自然后门”,适合部署安全防护场景。

针对大型语言模型(LLM)的后门不对齐攻击可通过隐藏触发词隐蔽地破坏安全对齐,且在真实世界的大型语言模型即服务(LLMaaS)场景中难以被常规审计发现。由于攻击目标具有样本依赖性——即带有触发词的任意恶意指令都会被执行,而非固定标签,威胁范围极大扩大。本文提出黑盒防御方法BEAT,通过推理阶段检测触发样本以激活防御机制。其核心思想源于一个新发现的“探测拼接效应”:将触发样本与探测指令拼接后,显著降低后门模型的拒绝率;而正常样本影响甚微。BEAT通过测量探测输入在拼接前后的输出分布畸变程度来判断是否被触发。该方法从拒绝信号(样本无关)入手,克服了样本依赖目标的挑战。利用多采样近似输出分布,突破黑盒限制。实验在多种后门攻击与主流模型(含闭源GPT-3.5-turbo)上验证了有效性与效率。初步结果还表明,该方法能有效抵御常见越狱攻击,因其可视为‘自然后门’。

原文摘要 · Abstract (English)

Backdoor unalignment attacks against Large Language Models (LLMs) enable the stealthy compromise of safety alignment using a hidden trigger while evading normal safety auditing. These attacks pose significant threats to the applications of LLMs in the real-world Large Language Model as a Service (LLMaaS) setting, where the deployed model is a fully black-box system that can only interact through text. Furthermore, the sample-dependent nature of the attack target exacerbates the threat. Instead of outputting a fixed label, the backdoored LLM follows the semantics of any malicious command with the hidden trigger, significantly expanding the target space. In this paper, we introduce BEAT, a black-box defense that detects triggered samples during inference to deactivate the backdoor. It is motivated by an intriguing observation (dubbed the probe concatenate effect), where concatenated triggered samples significantly reduce the refusal rate of the backdoored LLM towards a malicious probe, while non-triggered samples have little effect. Specifically, BEAT identifies whether an input is triggered by measuring the degree of distortion in the output distribution of the probe before and after concatenation with the input. Our method addresses the challenges of sample-dependent targets from an opposite perspective. It captures the impact of the trigger on the refusal signal (which is sample-independent) instead of sample-specific successful attack behaviors. It overcomes black-box access limitations by using multiple sampling to approximate the output distribution. Extensive experiments are conducted on various backdoor attacks and LLMs (including the closed-source GPT-3.5-turbo), verifying the effectiveness and efficiency of our defense. Besides, we also preliminarily verify that BEAT can effectively defend against popular jailbreak attacks, as they can be regarded as 'natural backdoors'.

后门防御黑盒检测大模型安全越狱防护

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