Local Sparsity Enables Unsupervised LLM Safety Detection
作者: Xin Chen, Gil Kur, Alexander Shevchenko, Andreas Krause
分类: cs.LG, cs.AI
发布日期: 2026-09-17
💡 一句话要点
提出局部稀疏方法以解决无监督LLM安全检测问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 异常检测 大型语言模型 无监督学习 稀疏自编码器 安全检测 局部稀疏性 线性表示假设
📋 核心要点
- 现有的大型语言模型安全检测方法主要依赖于监督学习,无法适应新出现的攻击和危害类别。
- 本文提出了一种基于局部稀疏性的异常检测框架,利用稀疏自编码器(SAE)来建模安全数据。
- 实验结果表明,局部稀疏方法在使用极少量的分布外数据时,能够实现接近最优的安全检测性能。
📝 摘要(中文)
大型语言模型(LLMs)的部署安全方法主要依赖监督学习,并假设可以访问不安全的训练数据。然而,新的攻击和危害类别不断出现,现有模型无法捕捉。本文提出通过异常检测的视角来解决这一问题,依赖于安全数据建模并标记分布外输入。我们展示了在线性表示假设(LRH)下,局部稀疏性可以为异常检测提供希望。基于此,我们提出了一种局部掩蔽的稀疏自编码器(SAE)异常检测框架,并在多种架构和数据集上进行了验证。实验结果表明,允许算法使用1%的分布外数据进行校准时,局部稀疏方法能够实现接近最优的性能,展示了其在仅使用1-2%的SAE神经元进行计算时捕捉有意义安全信息的能力。
🔬 方法详解
问题定义:本文旨在解决大型语言模型的安全检测问题,现有方法依赖于监督学习,无法有效应对新型攻击和危害类别的出现。
核心思路:论文提出通过异常检测的方式,仅依赖安全数据建模,利用局部稀疏性来识别分布外输入,从而提高安全检测的有效性。
技术框架:整体框架基于稀疏自编码器(SAE),通过局部掩蔽的方式进行异常检测。主要模块包括数据预处理、SAE训练、局部稀疏性分析和异常检测。
关键创新:最重要的创新在于提出了局部稀疏性这一概念,利用线性表示假设(LRH)来支持异常检测的可行性,与传统的监督学习方法形成本质区别。
关键设计:在技术细节上,使用了稀疏自编码器的特定结构,设置了合适的损失函数,并在训练过程中采用了局部掩蔽策略,以提高模型对异常输入的敏感性。
🖼️ 关键图片
📊 实验亮点
实验结果显示,当允许算法使用1%的分布外数据进行校准时,局部稀疏方法在安全检测任务中实现了接近最优的性能,显著优于传统的监督学习方法,展示了其在仅使用1-2%的SAE神经元时捕捉安全信息的能力。
🎯 应用场景
该研究的潜在应用领域包括大型语言模型的安全性检测、在线内容审核和自动化风险评估等。通过提高模型对新型攻击的适应能力,能够在实际应用中有效降低安全风险,提升用户信任度。未来,该方法有望扩展到其他类型的深度学习模型中,进一步增强其安全性。
📄 摘要(原文)
Deployment-time safety methods for large language models (LLMs) are predominantly supervised and assume access to unsafe training data. Nevertheless, new attacks and harm categories regularly arise, not captured by models trained in such a supervised fashion. An alternative approach is to view this problem through the lens of anomaly detection, namely, to rely solely on modeling safe data and flagging out-of-distribution inputs. However, LLM activations lie in a high-dimensional space, raising concerns about whether anomaly detection is statistically feasible. We show that, under the linear representation hypothesis (LRH), there may indeed be hope. In the LRH concept space, which is typically recovered via a sparse autoencoder (SAE), nearby points share a small common active support. Using this local sparsity insight, we propose a framework for locally masked SAE-based anomaly detection, supported by theoretical justifications. We validate it on various architectures and datasets, including both capability-testing datasets and safety-specific datasets. Finally, when we allow algorithms to use 1% out-of-distribution data for calibration, locally sparse methods achieve near-optimal performance, demonstrating their ability to capture meaningful safety information while using only 1-2% of SAE neurons for computation.