用轻量随机森林检测大模型生成中的越界行为,防逃逸攻击。
AlignTree: Efficient Defense Against LLM Jailbreak Attacks
- 通过监控生成时的激活值,用随机森林判断是否偏离安全对齐
- 在多个模型和基准上实现高防御率,计算开销极低
- 无需额外提示或辅助模型,适合实际部署
大语言模型易受对抗攻击,可绕过安全限制生成有害内容。现有防御方法或计算开销大,或过于轻量而易被突破,难以用于真实系统。本文提出AlignTree防御机制,在保持极低计算开销的同时增强模型对齐能力。该方法在生成过程中监测大模型激活值,利用高效的随机森林分类器检测偏离行为,基于两个信号:(i) 拒绝方向——对越界提示敏感的线性表示;(ii) 基于SVM的非线性特征信号,捕捉有害内容模式。与以往方法不同,AlignTree无需额外提示或辅助防护模型。大量实验表明,该方法在多种大模型和评测基准上均具备高效且鲁棒的防御效果。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are vulnerable to adversarial attacks that bypass safety guidelines and generate harmful content. Mitigating these vulnerabilities requires defense mechanisms that are both robust and computationally efficient. However, existing approaches either incur high computational costs or rely on lightweight defenses that can be easily circumvented, rendering them impractical for real-world LLM-based systems. In this work, we introduce the AlignTree defense, which enhances model alignment while maintaining minimal computational overhead. AlignTree monitors LLM activations during generation and detects misaligned behavior using an efficient random forest classifier. This classifier operates on two signals: (i) the refusal direction -- a linear representation that activates on misaligned prompts, and (ii) an SVM-based signal that captures non-linear features associated with harmful content. Unlike previous methods, AlignTree does not require additional prompts or auxiliary guard models. Through extensive experiments, we demonstrate the efficiency and robustness of AlignTree across multiple LLMs and benchmarks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。