用动态注意力改进稀疏自编码器
Improving Sparse Autoencoder with Dynamic Attention
对做视觉表征分析与模型可解释性的研究者,这篇提供了用 sparsemax 交叉注意力替代 ReLU/TopK 的 SAE 激活方案,可自适应决定每个神经元激活的概念数,从而在重建质量与特征解耦可解释性之间取得更好平衡,并可作为现有 SAE 的稀疏度调参指导。
原文依据 adaptive sparse attention mechanisms using sparsemax can bridge this trade-off
摘要译文
由模型翻译 · 术语统一 · 请对照原文核对关键结论近来,稀疏自编码器(SAE)已成为一种有前景的技术,通过将特征分解为一组稀疏概念来解释基础模型中的激活。然而在实践中,为每个神经元确定最优的稀疏程度仍然具有挑战性:稀疏性过高可能导致重建质量变差,而稀疏性不足又会损害可解释性。现有的 ReLU 和 TopK 等激活函数虽然提供了一定的稀疏性保证,但通常需要额外的稀疏性正则化或精心挑选的超参数。本文表明,使用 sparsemax 的自适应稀疏注意力机制能够弥合这一权衡,因为它能够以依赖数据的方式确定概念的数量。具体而言,我们首先探索了一类新的 SAE,它基于交叉注意力架构,以潜变量特征作为查询,以可学习的字典作为键矩阵和值矩阵。为促进稀疏模式的学习,我们采用基于 sparsemax 的注意力策略,该策略根据每个神经元的复杂度自动推断出一组稀疏概念,从而得到更灵活、更高效的激活函数。通过全面的评估与可视化,我们表明该方法在成功获得高质量概念的同时实现了更低的重建损失。此外,该方法自动确定的稀疏程度可以作为调参指导,用于改进现有的 SAE。代码见 https://github.com/qyj-bkjx/Sparsemax-SAE。
英文原文摘要 1558 字符
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 might lead to poor reconstruction, whereas insufficient sparsity harms 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 adaptive sparse attention mechanisms using sparsemax can bridge this trade-off, due to their ability to determine the number of concepts 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 concepts according to the complexity of each neuron, resulting in a more flexible and efficient activation function. Through comprehensive evaluation and visualization, we show that our approach successfully achieves lower reconstruction loss while producing high-quality concepts. Moreover, the sparsity level automatically determined by our approach can serve as tuning guidance to improve existing SAEs. The code is available at https://github.com/qyj-bkjx/Sparsemax-SAE.