Skip to main content
QUICK REVIEW

[论文解读] Llama Scope: Extracting Millions of Features from Llama-3.1-8B with Sparse Autoencoders

Zhengfu He, Wentao Shu|arXiv (Cornell University)|Oct 27, 2024
Video Analysis and SummarizationComputer Science被引用 3
一句话总结

本文介绍了 Llama Scope,这是一个全面的 256 个稀疏自编码器(SAEs)套件,针对 Llama-3.1-8B 模型的所有子层进行训练,每个 SAE 拥有 32K 和 128K 个特征。通过在 Top-K SAEs 中引入归一化感知的 top-k 选择、K 退火(K-annealing)以及 JumpReLU 后处理,作者实现了高保真度、稀疏且可解释的特征,这些特征在不同上下文和模型微调中均具有泛化能力,从而推动了可扩展的机制可解释性研究。

ABSTRACT

Sparse Autoencoders (SAEs) have emerged as a powerful unsupervised method for extracting sparse representations from language models, yet scalable training remains a significant challenge. We introduce a suite of 256 SAEs, trained on each layer and sublayer of the Llama-3.1-8B-Base model, with 32K and 128K features. Modifications to a state-of-the-art SAE variant, Top-K SAEs, are evaluated across multiple dimensions. In particular, we assess the generalizability of SAEs trained on base models to longer contexts and fine-tuned models. Additionally, we analyze the geometry of learned SAE latents, confirming that \emph{feature splitting} enables the discovery of new features. The Llama Scope SAE checkpoints are publicly available at~\url{https://huggingface.co/fnlp/Llama-Scope}, alongside our scalable training, interpretation, and visualization tools at \url{https://github.com/OpenMOSS/Language-Model-SAEs}. These contributions aim to advance the open-source Sparse Autoencoder ecosystem and support mechanistic interpretability research by reducing the need for redundant SAE training.

研究动机与目标

  • 解决将稀疏自编码器(SAEs)扩展至 Llama-3.1-8B 等工业级语言模型的挑战。
  • 通过在所有 32 个层及子层上训练 SAE,克服特征泛化能力和潜在空间几何结构方面的局限。
  • 通过架构和训练调度的改进,提升 Top-K SAE 的训练效率和特征质量。
  • 通过发布完整、开源的 SAE 套件,支持重复使用和共享分析,从而推动机制可解释性研究。
  • 通过提供标准化、可扩展的 SAE 生态系统,促进电路发现和特征分析。

提出的方法

  • 在 32 个层 × 4 个子层(MLP 输出后、注意力输出、MLP 输出、转换器)上分别训练 256 个 SAE,每个 SAE 拥有 32K 和 128K 个特征。
  • 通过将解码器权重的 L2 范数纳入 top-k 选择过程,增强 Top-K SAE,以提升特征质量和稳定性。
  • 通过后处理将 SAE 转换为 JumpReLU 变体,以增强特征稀疏性和可解释性。
  • 在训练过程中采用 K 退火调度,逐步增加活跃特征数量,以改善收敛性。
  • 使用混合并行训练基础设施,减少磁盘 I/O 和内存瓶颈,实现大规模 SAE 训练。
  • 利用现有的 SAE 评估指标(稀疏性-保真度、激活频率、可解释性),并扩展这些指标以评估在不同上下文和微调模型中的泛化能力。
Figure 1: Four potential training positions in one Transformer Block.
Figure 1: Four potential training positions in one Transformer Block.

实验结果

研究问题

  • RQ1在基础 Llama-3.1-8B 上训练的 SAE 是否能泛化到更长的上下文长度和微调后的模型?
  • RQ2更宽的 SAE(128K 特征)是否学习到了超出较小 SAE(32K)特征线性组合的新特征?
  • RQ3所学习的 SAE 潜在空间的几何结构如何反映特征的解耦与分裂?
  • RQ4经过修改的 Top-K SAE 在多大程度上保留了原始 SAE 的特征质量和几何结构?
  • RQ5统一的、开源的 SAE 生态系统在多大程度上能减少重复训练工作,并加速机制可解释性研究?

主要发现

  • Llama Scope SAE 在长上下文和微调模型中均表现出良好的泛化能力,证明其在基础模型训练分布之外仍具鲁棒性。
  • 更宽的 SAE(128K 特征)学习到了独立的、单义性特征,这些特征在较小 SAE 中并不存在——例如,L15R-32x-TopK 中存在一个专门的‘英国脱欧’特征,而其 8x 对应版本中则没有。
  • Top-K SAE 与原始 SAE 中解码器列之间的余弦相似度显著高于随机基线,证实了共享的特征几何结构。
  • 特征分裂现象得到实证验证:更宽的 SAE 发现了新的、非冗余的特征,证实了模型具备解耦表征的能力。
  • K 退火调度和归一化感知的 top-k 选择提升了训练稳定性与特征保真度,减少了模式崩溃,并改善了稀疏性。
  • 磁盘 I/O 高效的训练基础设施使得在 8B 规模模型上实现可扩展的 SAE 训练成为可能,减少了内存瓶颈,支持大规模部署。
Llama Scope: Extracting Millions of Features from Llama-3.1-8B with Sparse Autoencoders

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。