用数值令牌日志评分,实时检测大模型越狱攻击
SelfGrader: LLM Jailbreak Detection via Anchored Token-Level Logits

- 将安全判断转化为数值令牌的逻辑值评分
- 在多个基准上实现低误报率与强鲁棒性
- 适合需要低延迟安全防护的应用场景
大型语言模型虽强大,却易受越狱攻击。现有防护方法依赖内部特征或文本输出,常导致延迟高或生成随机。为此,我们提出SelfGrader,一种轻量级防护方法,将越狱检测建模为基于锚定令牌级别日志的数值评分问题。该方法在有限数值令牌(如0-9)集合中评估用户查询的安全性,并将这些令牌的日志分布视为内部安全信号。为对齐信号与安全标准,SelfGrader构建了基于PAC引导的ICL锚点示例,并引入双视角评分规则,同时考量恶意性和良性程度,生成稳定可解释的得分,有效降低误报率。在多种越狱基准、自适应攻击、良性提示集、多款LLM及先进基线上的实验表明,SelfGrader具备强鲁棒性,且内存开销与延迟极低。
原文摘要 · Abstract (English)
Large Language Models (LLMs) are powerful tools for answering user queries, yet they remain highly vulnerable to jailbreak attacks. Existing guardrail methods typically rely on internal features or textual responses to detect malicious queries, which either introduce substantial latency or suffer from randomness in text generation. To overcome these limitations, we propose SelfGrader, a lightweight guardrail method that formulates jailbreak detection as a numerical grading problem using anchored token-level logits. Specifically, SelfGrader evaluates the safety of a user query within a compact set of numerical tokens (NTs) (e.g., 0-9) and interprets their logit distribution as an internal safety signal. To align these signals with the target safety rubric, SelfGrader constructs Probably Approximately Correct-guided ICL anchor examples and introduces a dual-perspective scoring rule that considers both the maliciousness and benignness of the query, yielding a stable and interpretable score that reflects harmfulness and reduces the false positive rate simultaneously. Extensive experiments across diverse jailbreak benchmarks, adaptive attacks, benign prompt benchmarks, multiple LLMs, and state-of-the-art guardrail baselines demonstrate that SelfGrader achieves strong robustness with low false positive rates, memory overhead, and latency.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。