You don't need error nodes, you need better features A new training method called replacement-aware training produces sparse auto-encoders (SAEs) that retain language capabilities when used in a full replacement model of Gemma-2-2B, unlike standard SAEs which cause catastrophic failure. The approach, developed by Evan Lloyd and detailed in a blog post, introduces a loss term that penalizes distortions to the next layer's features, resulting in a replacement model with significantly lower validation KL divergence (0.53557 vs 1.00631) and improved MMLU accuracy (0.193136 vs 0.0746804) compared to standard methods. The code and weights are publicly available. This is a cross-post from my blog. It is a follow-up to the methods I developed in a previous post on replacement-aware training. A replacement model Ameisen et al. 2025 is a modification to an LLM in which some subset of internal activations are replaced with ones computed as a sum of more interpretable features , such as those found by sparse auto-encoders SAEs Cunningham et al. 2023 or cross-layer transcoders CLTs Lindsey et al. 2024 . When multiple components are thus re-encoded, methods inspired by structural equation modeling can be applied to construct feature circuits Marks et al. 2024 that attempt to explain some aspect of the model's behavior in terms of these features. Because the re-encoding process is inherently lossy, errors from earlier components compound in later ones, resulting in severely damaged performance. In fact, applying current SAEs to just a few layers generally results in a replacement model that is no longer recognizable as a language model; it is unable to generate coherent output at all. To mitigate this effect, Marks et al. 2024 introduce error nodes into their recovered causal model, with values set such that they exactly cancel the re-encoding error of the corresponding SAE. I find this approach deeply unsatisfying, as I outline in Error nodes https://www.lesswrong.com/feed.xml Error nodes . In this post, I present an alternative to error nodes: train SAEs that are robust to upstream errors. I call this approach replacement-aware training because it involves introducing a loss term for each SAE that penalizes distortions to the next layer's features, more closely matching the replacement model use case. I previously https://elloworld.net/posts/replacement-aware-sae-training/ applied this method to a toy language model, and have now scaled it up to Gemma-2-2B Gemma Team et al. 2024 . The result is a suite of residual stream SAEs that can be used as-is in a full replacement model, which despite degraded performance, still retains language capabilities. I have made the code and weights for these SAEs publicly available; instructions for downloading and running them are available here https://github.com/evan-lloyd/mechinterp-experiments/tree/gemma-blog-post/transformers sae . I consider the methods outlined in this post an existence proof of the claim asserted in the title; they are by no means optimal. My overall approach was to keep adding to a bag of stackable tricks such that I could attain the goal of running a replacement model with mostly retained capabilities. While it does appear that no one innovation is sufficient on its own, I suspect that simplifications can be made, which I leave to future work. My core findings are: Figure 1: Replacement-aware training produces SAE replacement models with significantly less divergence from the base model Gemma-2-2B as compared to standard methods. Values are calculated over 1 million validation set tokens. Figure 2: Replacement models still suffer quite a bit of degradation on tasks like MMLU; no method I tested exceeded chance accuracy red line when training on the Pile alone a . Mixing in 1 million tokens from a separate question-answering dataset CommonSenseQA during the KL fine-tuning phase KL fine-tuning , representing less than 2% of the total training data, and applying PriDe debiasing Zheng et al. 2023 recovers more performance b . Even without this fine-tuning, using replacement-aware SAEs results in significantly more probability on the correct answers c and a vastly higher proportion of valid responses d . | Method | Validation KL | Validation CE | MMLU NLL | MMLU ACC | MMLU ACC finetune + debias | MMLU Valid | |---|---|---|---|---|---|---| | Standard | 1.00631 | 1.79459 | 4.65993 | 0.0746804 | 0.269217 | 0.345561 | | Replacement-aware | 0.53557 | 1.13958 | 3.65254 | 0.193136 | 0.306251 | 0.781562 | | Replacement-aware with LISTA encoder | 0.378151 | 0.758738 | 1.67595 | 0.245579 | 0.315444 | 0.965593 | | Baseline | - | 0.387681 | 1.03801 | 0.541762 | 0.539835 | 0.999912 | In this section I set up a notational framework for explaining my methods and how they differ from existing approaches. I also briefly outline my case against error nodes. A replacement model is a modification to a transformer model in which some subset of internal activations are re-encoded as a sparse sum of interpretable features. In this post I will focus on replacement models using SAEs that operate on the residual stream, though these methods should also be applicable to finer-grained replacement models. For precision I will use the term -replacement model, denoted , where , to specify which layers' residuals have been re-encoded. Note that this distinction between different replacement models is the defining difference between replacement-aware training and existing methods. I'll refer to the -replacement model as the full replacement model , while the -replacement model is simply the base model. Formally, letting be the function converting the final residual to probabilities, the number of layers, an SAE trained on the layer's residual, the transformer layer, and the embedding of an arbitrary input, define the -replacement model as In this post I will explore variant encoder designs while keeping the decoder step a simple affine transformation. Hence, with the encoder function mapping activations to features, we have where and are the decoder or dictionary weights and biases for the layer SAE. We'll also find it convenient to refer to the activations of the layer in a replacement model as well as the SAE features Note that the features for SAE are defined by Equation 4 even when . Note also that these definitions imply that activations and features for layer are not affected by the inclusion or exclusion of in the replacement set: so I will use these interchangeably when notationally convenient. The relationships among these terms are visualized as a causal graph below. Figure 3: Replacement model of a 3-layer transformer. Features are inferred from activations by the SAE encoders reconstructed by the decoder and passed through the transformer block In the introduction, I claimed that replacement models using more than a few SAEs become entirely incoherent. It might not be intuitively obvious how bad the problem is from just looking at plots of KL divergence. Thus, I think it's illustrative to compare actual rollouts from different replacement models. Note especially that the naive Gemma Scope output is not recognizable as language: Effect of sleep quality on memory, executive function, and language performance in patients with refractory focal epilepsy and controlled epilepsy versus healthy controls - A prospective study. We aimed to evaluate the effect of sleep quality on memory, executive function, and language performance ... Shorter total sleep time, poorer sleep efficiency, and prolonged sleep latencies were observed to be associated with poor memory and executive function in patients with refractory epilepsy. Gemma Scope // // // //ing Gemma Scope with encoder tuning The results of this study suggest that the effect of Replacement-aware The results suggest that the sleep quality of patients with Base model