用动态注意力提升稀疏自编码器,自动调节神经元激活数
Improving Sparse Autoencoder with Dynamic Attention

- 用sparsemax构建动态注意力机制,按数据复杂度自适应确定激活数量
- 在保持低重建损失的同时,生成高质量可解释概念,尤其在前n分类任务中表现优
- 无需手动调参或额外正则化,适合追求模型可解释性的研究者
稀疏自编码器(SAEs)近年来成为解读基础模型激活特征的有力工具,能将特征解耦为一组稀疏概念。但实践中每个神经元的最佳稀疏程度难以确定:过度稀疏导致重建性能差,稀疏不足则影响可解释性。现有激活函数如ReLU和TopK虽提供一定稀疏性保障,通常仍需额外正则化或精心选择超参数。本文发现,基于sparsemax的动态稀疏注意力机制可有效平衡这一矛盾,因其能根据数据依赖方式自动决定激活数量。我们提出一种新型SAE,采用交叉注意力架构,以潜在特征为查询,可学习词典作为键和值矩阵。为促进稀疏模式学习,采用基于sparsemax的注意力策略,自动推断每神经元的稀疏元素集合,实现更灵活通用的激活函数。通过全面评估与可视化,结果表明该方法在保持较低重建损失的同时,生成高质量概念,尤其在前n分类任务中表现突出。
原文摘要 · Abstract (English)
Recently, sparse autoencoders (SAEs) have emerged as a promising technique for interpreting activations in foundation models by disentangling features into a sparse set of concepts. However, identifying the optimal level of sparsity for each neuron remains challenging in practice: excessive sparsity can lead to poor reconstruction, whereas insufficient sparsity may harm interpretability. While existing activation functions such as ReLU and TopK provide certain sparsity guarantees, they typically require additional sparsity regularization or cherry-picked hyperparameters. We show in this paper that dynamically sparse attention mechanisms using sparsemax can bridge this trade-off, due to their ability to determine the activation numbers in a data-dependent manner. Specifically, we first explore a new class of SAEs based on the cross-attention architecture with the latent features as queries and the learnable dictionary as the key and value matrices. To encourage sparse pattern learning, we employ a sparsemax-based attention strategy that automatically infers a sparse set of elements according to the complexity of each neuron, resulting in a more flexible and general activation function. Through comprehensive evaluation and visualization, we show that our approach successfully achieves lower reconstruction loss while producing high-quality concepts, particularly in top-n classification tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。