arXiv:2602.11495cs.CRcs.CL2026-02被引 3

通过分析模型内部表示,发现越狱攻击的可识别痕迹,实现无需微调的轻量检测。

Jailbreaking Leaves a Trace: Understanding and Detecting Jailbreak Attacks from Internal Representations of Large Language Models

  • 从内部激活态捕捉越狱提示的潜在模式,构建张量化表示框架。
  • 在未微调的LLaMA-3.1-8B上,阻断高敏感层可拦截78%越狱尝试。
  • 仅在推理时干预,低开销且适用于多种模型架构。

大型语言模型(LLM)的越狱攻击已成为对话式AI系统部署中的关键安全挑战。攻击者通过精心设计的提示诱导模型输出受限或不安全内容。尽管已有多种防御机制,攻击者仍不断演化策略,现有模型依然脆弱。本文从安全与可解释性角度出发,分析越狱与正常提示在内部表示上的差异。对GPT-J、LLaMA、Mistral及状态空间模型Mamba等多款开源模型进行逐层分析,发现有害输入具有稳定的潜在空间特征。提出一种基于张量的隐藏表示框架,捕捉激活结构,实现无需微调或辅助大模型的轻量级越狱检测。进一步证明该潜信号可用于推理时主动中断越狱执行:在剔除的LLaMA-3.1-8B模型上,选择性绕过高敏感层可阻断78%越狱尝试,同时保持94%良性提示的正常行为。该干预全程在推理阶段完成,开销极小,具备扩展至更多攻击分布或细化敏感阈值的潜力。结果表明越狱行为源于可识别的内部结构,为提升模型安全提供了一种架构无关的补充路径。

原文摘要 · Abstract (English)

Jailbreaking large language models (LLMs) has emerged as a critical security challenge with the widespread deployment of conversational AI systems. Adversarial users exploit these models through carefully crafted prompts to elicit restricted or unsafe outputs, a phenomenon commonly referred to as Jailbreaking. Despite numerous proposed defense mechanisms, attackers continue to develop adaptive prompting strategies, and existing models remain vulnerable. This motivates approaches that examine the internal behavior of LLMs rather than relying solely on prompt-level defenses. In this work, we study jailbreaking from both security and interpretability perspectives by analyzing how internal representations differ between jailbreak and benign prompts. We conduct a systematic layer-wise analysis across multiple open-source models, including GPT-J, LLaMA, Mistral, and the state-space model Mamba, and identify consistent latent-space patterns associated with harmful inputs. We then propose a tensor-based latent representation framework that captures structure in hidden activations and enables lightweight jailbreak detection without model fine-tuning or auxiliary LLM-based detectors. We further demonstrate that the latent signals can be used to actively disrupt jailbreak execution at inference time. On an abliterated LLaMA-3.1-8B model, selectively bypassing high-susceptibility layers blocks 78% of jailbreak attempts while preserving benign behavior on 94% of benign prompts. This intervention operates entirely at inference time and introduces minimal overhead, providing a scalable foundation for achieving stronger coverage by incorporating additional attack distributions or more refined susceptibility thresholds. Our results provide evidence that jailbreak behavior is rooted in identifiable internal structures and suggest a complementary, architecture-agnostic direction for improving LLM security.

模型安全越狱检测内部表示推理防御

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