arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.18519cs.AI
收藏

从内部检测有害内容:利用内部表示进行LLM安全

LLM Safety From Within: Detecting Harmful Content with Internal Representations

University of Toronto(多伦多大学);McGill University(麦吉尔大学);LMU Munich(慕尼黑路德维希-马克西米利安大学)

Difan Jiao, Yilun Liu, Ye Yuan, Zhenwei Tang, Linfeng Du, Haolun Wu, Ashton Anderson

AI总结:

SIREN通过利用内部层特征提升有害内容检测性能,相比现有模型更高效且泛化能力强。

摘要:

Guard模型被广泛用于检测用户提示和LLM响应中的有害内容。然而,最先进的Guard模型仅依赖终端层表示,忽略了分布在内部层中的丰富安全相关特征。我们提出了SIREN,一个轻量级的Guard模型,利用这些内部特征。通过线性探测识别安全神经元,并通过自适应层加权策略结合它们,SIREN从LLM内部构建了一个有害性检测器,而无需修改底层模型。我们的全面评估显示,SIREN在多个基准测试中显著优于最先进的开源Guard模型,同时使用250倍更少的可训练参数。此外,SIREN在未见基准测试中表现出色,自然支持实时流检测,并显著提高了比生成型Guard模型的推理效率。总体而言,我们的结果强调LLM内部状态作为实际高性能有害性检测的基础具有巨大潜力。

英文摘要:

Guard models are widely used to detect harmful content in user prompts and LLM responses. However, state-of-the-art guard models rely solely on terminal-layer representations and overlook the rich safety-relevant features distributed across internal layers. We present SIREN, a lightweight guard model that harnesses these internal features. By identifying safety neurons via linear probing and combining them through an adaptive layer-weighted strategy, SIREN builds a harmfulness detector from LLM internals without modifying the underlying model. Our comprehensive evaluation shows that SIREN substantially outperforms state-of-the-art open-source guard models across multiple benchmarks while using 250 times fewer trainable parameters. Moreover, SIREN exhibits superior generalization to unseen benchmarks, naturally enables real-time streaming detection, and significantly improves inference efficiency compared to generative guard models. Overall, our results highlight LLM internal states as a promising foundation for practical, high-performance harmfulness detection.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑