arXiv:2503.24277cs.LGcs.AI2025-03被引 4

提出新方法自动确定稀疏自编码器激活数量,无需人工调参。

Evaluating and Designing Sparse Autoencoders by Approximating Quasi-Orthogonality

  • 基于近似正交性理论,推导出稀疏特征向量的ℓ2范数闭式误差。
  • 在8000万文本上训练,性能优于传统k-稀疏自编码器。
  • 设计动态激活函数Top-AFA,按输入自动决定激活数量。

稀疏自编码器(SAEs)广泛用于大语言模型的机制可解释性研究,但现有k-稀疏方法缺乏对超参数k(即非零激活数,ℓ₀)选择的理论依据。本文揭示了稀疏特征向量的ℓ₂范数可由密集向量的ℓ₂范数通过闭式误差近似,使SAE训练无需手动设定ℓ₀。我们验证了两项应用:一是提出新评估方法,通过输入嵌入计算理论期望值,弥补现有评估与损失函数的不足;二是提出新型激活函数Top-AFA,基于近似特征激活(AFA)公式,实现无需固定超参数k的top-k式激活,动态决定每输入的激活特征数。在OpenWebText数据集上,对GPT2三个中间层的隐藏表示进行超过8000万令牌的训练,实证验证了该方法的优势,并与当前最优的k-稀疏自编码器进行对比。代码已开源。

原文摘要 · Abstract (English)

Sparse autoencoders (SAEs) are widely used in mechanistic interpretability research for large language models; however, the state-of-the-art method of using $k$-sparse autoencoders lacks a theoretical grounding for selecting the hyperparameter $k$ that represents the number of nonzero activations, often denoted by $\ell_0$. In this paper, we reveal a theoretical link that the $\ell_2$-norm of the sparse feature vector can be approximated with the $\ell_2$-norm of the dense vector with a closed-form error, which allows sparse autoencoders to be trained without the need to manually determine $\ell_0$. Specifically, we validate two applications of our theoretical findings. First, we introduce a new methodology that can assess the feature activations of pre-trained SAEs by computing the theoretically expected value from the input embedding, which has been overlooked by existing SAE evaluation methods and loss functions. Second, we introduce a novel activation function, top-AFA, which builds upon our formulation of approximate feature activation (AFA). This function enables top-$k$ style activation without requiring a constant hyperparameter $k$ to be tuned, dynamically determining the number of activated features for each input. By training SAEs on three intermediate layers to reconstruct GPT2 hidden embeddings for over 80 million tokens from the OpenWebText dataset, we demonstrate the empirical merits of this approach and compare it with current state-of-the-art $k$-sparse autoencoders. Our code is available at: https://github.com/SewoongLee/top-afa-sae.

稀疏编码可解释性自编码器动态激活

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。