Residual Stream Analysis with Multi-Layer SAEs
Tim Lawson, Lucy Farnik, Conor Houghton, Laurence Aitchison
TL;DR
MLSAE introduces a single sparse autoencoder trained on residual-stream activations from all transformer layers to analyze cross-layer information flow in language models. The approach reveals that, while individual latents often activate at a single layer for a given token, aggregating across many tokens shows latent activations spread over multiple layers, with this cross-layer spread increasing in larger models. Tuned-lens transformations modestly alter these patterns, but cross-layer drift persists, highlighting a fundamental challenge for cross-layer interpretability. The work provides a practical, reproducible framework for mechanistic interpretability in transformers and releases code and models to enable replication and further study.
Abstract
Sparse autoencoders (SAEs) are a promising approach to interpreting the internal representations of transformer language models. However, SAEs are usually trained separately on each transformer layer, making it difficult to use them to study how information flows across layers. To solve this problem, we introduce the multi-layer SAE (MLSAE): a single SAE trained on the residual stream activation vectors from every transformer layer. Given that the residual stream is understood to preserve information across layers, we expected MLSAE latents to 'switch on' at a token position and remain active at later layers. Interestingly, we find that individual latents are often active at a single layer for a given token or prompt, but the layer at which an individual latent is active may differ for different tokens or prompts. We quantify these phenomena by defining a distribution over layers and considering its variance. We find that the variance of the distributions of latent activations over layers is about two orders of magnitude greater when aggregating over tokens compared with a single token. For larger underlying models, the degree to which latents are active at multiple layers increases, which is consistent with the fact that the residual stream activation vectors at adjacent layers become more similar. Finally, we relax the assumption that the residual stream basis is the same at every layer by applying pre-trained tuned-lens transformations, but our findings remain qualitatively similar. Our results represent a new approach to understanding how representations change as they flow through transformers. We release our code to train and analyze MLSAEs at https://github.com/tim-lawson/mlsae.
