arXiv:2509.14558cs.CRcs.AI2025-09EMNLP被引 15

不增加计算成本,用简单方法高效识别大模型越狱攻击

LLM Jailbreak Detection for (Almost) Free!

  • 通过分析输出分布差异,用首词置信度区分越狱与正常提示
  • 仅需添加一句肯定指令并调温度,检测准确率超95%
  • 适合部署在资源受限场景的模型安全防护

大型语言模型(LLMs)在广泛使用中通过对齐提升安全性,但仍易受越狱攻击影响,可能生成不当内容。现有检测方法依赖其他模型或多次推理,计算开销大。本文首次发现越狱与正常提示的输出分布差异可用于检测。基于此,提出免费越狱检测(FJD):在输入前添加肯定指令,并通过调节温度缩放logits,利用首个词置信度区分越狱与正常提示。进一步结合虚拟指令学习提升性能。大量实验表明,该方法在对齐的LLMs上可几乎零成本有效检测越狱提示。

原文摘要 · Abstract (English)

Large language models (LLMs) enhance security through alignment when widely used, but remain susceptible to jailbreak attacks capable of producing inappropriate content. Jailbreak detection methods show promise in mitigating jailbreak attacks through the assistance of other models or multiple model inferences. However, existing methods entail significant computational costs. In this paper, we first present a finding that the difference in output distributions between jailbreak and benign prompts can be employed for detecting jailbreak prompts. Based on this finding, we propose a Free Jailbreak Detection (FJD) which prepends an affirmative instruction to the input and scales the logits by temperature to further distinguish between jailbreak and benign prompts through the confidence of the first token. Furthermore, we enhance the detection performance of FJD through the integration of virtual instruction learning. Extensive experiments on aligned LLMs show that our FJD can effectively detect jailbreak prompts with almost no additional computational costs during LLM inference.

模型安全越狱检测轻量级

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