Technical Report: Training and Analysis of Interpretable Weight-Sparse Transformers

1.0 Introduction: The Challenge of Interpretability in Neural Networks

As the capabilities of large language models continue to expand at a remarkable pace, our fundamental understanding of their internal mechanisms lags significantly behind. This gap has given rise to the field of mechanistic interpretability, which seeks to reverse-engineer these complex neural networks to fully comprehend the algorithms they learn and execute. A primary obstacle in this endeavor is the phenomenon of superposition, where models represent more features than they have neurons by encoding concepts in overlapping patterns across their activations, making individual components difficult to decipher (Elhage et al., 2022b).

In this work, we introduce a novel paradigm designed to counteract superposition and produce substantially simpler, more interpretable models. Our central thesis is that training transformers with a high degree of weight sparsity—constraining the vast majority of weights and biases to be zero—forces the network to learn more disentangled and understandable computational circuits. By enforcing a small L0 norm (the count of non-zero parameters), we discourage the model from distributing representations across many channels, leading to more localized and conceptually clean algorithms.

Our methodology involves three core components. First, we train weight-sparse models from scratch (de novo) using a specialized optimization process. Second, we employ a novel structured pruning algorithm to isolate the minimal, task-specific circuits responsible for specific behaviors. Finally, we introduce a preliminary technique using “bridges” to connect the interpretable circuits of our sparse models to the representations within existing, pre-trained dense models.

Our key contributions are the generation of circuits that are human-understandable at a granular level, quantitative validation demonstrating that these circuits are significantly more compact and faithful than those found in dense models, and a thorough analysis of the trade-offs between model capability and interpretability. We now proceed to a detailed examination of the framework we developed to generate and analyze these sparse circuits.

2.0 Methodology: A Framework for Generating and Analyzing Sparse Circuits

A robust and detailed methodology is crucial for generating models that are not only capable but also amenable to interpretation. This section outlines the three core components of our research framework: the specialized architecture and training regimen for weight-sparse models, the novel pruning algorithm we designed to isolate task-specific circuits, and the “bridge” technique developed to extend these analytical methods to existing dense models.

2.1 Sparse Model Training and Architecture

The models we developed for this research are based on a GPT-2 style decoder-only transformer architecture, but with several key modifications designed to promote sparsity and facilitate interpretation.

The following architectural and training features were implemented:

  • RMSNorm: We use Root Mean Square Layer Normalization (RMSNorm) instead of the standard LayerNorm. This choice is critical for two reasons: its lack of a learned bias term gives a value of zero a privileged meaning in the residual stream, and it enables us to fold all normalization weights into the MLP/attention weights without altering the weight L0.
  • Untied Matrices: The embedding and unembedding matrices are kept separate (untied) to allow for greater representational flexibility.
  • Dense Bigram Table: We include a dense matrix to model simple bigram frequencies. This component handles common, low-level statistical patterns, preventing the model from wasting its limited sparse parameters on this rudimentary task.
  • Weight Sparsity: The core constraint is the enforcement of extreme weight sparsity. All weight and bias parameters are subject to an L0 norm constraint, with our sparsest models having only approximately 1 in 1,000 non-zero weights.
  • Activation Sparsity: In addition to weight sparsity, we enforce a mild activation sparsity using an AbsTopK activation function, which zeroes out all but the top 25% of activations by magnitude. We apply AbsTopK at each node position, between each operation within the attention and MLP blocks.

The optimization process was carefully designed to handle these constraints:

  • Optimizer: We use the AdamW optimizer for training.
  • L0 Constraint Enforcement: To enforce the weight sparsity constraint, a hard pruning step is applied after each AdamW update. In every weight matrix, all but the largest magnitude entries are zeroed out, maintaining a constant fraction of non-zero elements.
  • L0 Annealing Schedule: Models are not trained with the target sparsity from the outset. Instead, the L0 norm is linearly decreased from fully dense to the final target sparsity level over the first 50% of training steps. For our largest, sparsest models, we found it beneficial to increase this to 80%.
  • Optimization Stability: We maintain training stability through the use of gradient clipping and a “sharkfin” learning rate schedule. We scale the learning rate by a factor of 1/√L0, which we found to be critical for effective optimization under the annealing schedule.

With these architectural and optimization principles established, we can produce models whose sparse structure is amenable to the fine-grained circuit extraction detailed next.

2.2 Circuit Identification via Structured Pruning

With a trained sparse model, the next step is to isolate the minimal, task-specific circuits it employs. We developed a novel structured pruning method for this purpose, allowing for the identification of the smallest set of components necessary for a given behavior.

The fundamental components of a circuit are defined at a highly granular level. Our definition of nodes is maximally granular and corresponds to rows and columns of weight matrices: we define a node to mean an individual neuron, attention channel, residual channel read, or residual channel write. An edge, then, is a nonzero entry in a weight matrix and connects two nodes.

The objective of our pruning process is to discover the smallest possible set of nodes (the circuit) that can achieve a target performance level (e.g., a loss of 0.15) on a specific, curated task.

The pruning algorithm is implemented as follows:

  • Ablation Method: When a node is pruned (deleted) from the circuit, it is mean-ablated. Its activation is frozen to its mean value, calculated over the entire pretraining data distribution.
  • Learnable Masks: The pruning is guided by a set of learnable boolean masks (τi), one for each node. The mask is gated by a Heaviside step function (σ), which determines whether a node is active or ablated.
  • Surrogate Gradient: Because the Heviside function is non-differentiable, we use a sigmoid-derivative surrogate gradient during backpropagation. This technique, analogous to a Straight-Through Estimator, allows gradients to flow through the discrete masks, enabling them to be trained.
  • Optimization Objective: The mask parameters are optimized to minimize a joint objective function that balances two competing goals: minimizing the task loss and minimizing the circuit size (the number of active nodes).

To test our models, we created a suite of 20 simple, unambiguous binary prediction tasks based on Python code. The table below provides a representative sample of these tasks.

Task NameDescription
single double quotePredict whether a string should be closed with ') or ").
set or stringTrack whether a variable is a set() or a string and predict completion with .add or +=.
bracket countingPredict ] or ]] depending on the level of bracket nesting.
while return truePredict the correct token following a while True or return True statement (: or newline).
class initGiven self.x = , copy the variable name x after the equals sign.

By applying this structured pruning method, it becomes possible to extract compact, functional circuits from our sparse models. The next step is to explore whether this understanding can be transferred to existing dense models.

2.3 Using Bridges to Analyze Existing Dense Models

To extend the interpretability gains from sparse models to pre-trained dense models, we developed a preliminary method known as “bridges.” The goal is to train a sparse model to serve as an interpretable analogue for an existing dense model, allowing insights from the sparse model to be mapped back.

A bridge consists of a series of encoders and decoders that map activations between a sparse model and a dense model. These connections are established at each sublayer—before each attention block and each MLP block. Each encoder is a linear map and an AbsTopK activation function, and the decoder is a linear map. In other words, each bridge can be viewed as a sparse autoencoder where the latent space is the sparse model’s residual activations.

We train the sparse model and the bridges jointly with a target dense model using a combination of loss terms:

  1. Normalized MSE: This reconstruction loss trains the bridge encoder and decoder. It ensures that the translation between the sparse and dense activation spaces is accurate in both directions.
  2. Hybrid Forward Pass KL Divergence: This loss term trains the sparse model’s weights. It is calculated by running “hybrid” forward passes, where part of the computation flows through the dense model and part flows through the sparse model (crossing a bridge at a single layer). The objective is to ensure that the final output distribution of these hybrid models has a low KL divergence from the output of the original, unmodified dense model.

The training setup can be visualized as follows:

Dense Model Layer -> [Bridge Encoder] -> Sparse Model Activation
Sparse Model Layer -> [Bridge Decoder] -> Dense Model Activation

Training Objective:
1. Reconstruction Loss (MSE) between activations.
2. Output Consistency (KL) for hybrid forward passes.

This bridge technique enables interpretable interventions performed on the sparse model’s circuits to be translated into corresponding interventions on the dense model’s internal representations, which we demonstrate in the following section.

3.0 Experimental Results and Analysis

This section presents the empirical validation of our methodology. We provide quantitative evidence demonstrating the interpretability benefits of weight sparsity, showcase detailed qualitative analyses of specific, human-understandable circuits learned by the models, and offer preliminary results from experiments using our bridge technique to analyze dense models.

3.1 Quantitative Analysis: The Capability-Interpretability Frontier

Our core quantitative finding is that enforcing weight sparsity leads to a significant improvement in model interpretability. When comparing a sparse model to a dense model with a comparable pretraining loss, we found that weight-sparse models yield task-specific circuits that are roughly 16-fold smaller for the same level of task performance. This demonstrates that behaviors are far more disentangled and localized in sparse models.

Further analysis reveals a clear trade-off between a model’s general capability and its interpretability, defining a “Pareto frontier.” Our analysis reveals the key relationships:

  • Capability vs. Interpretability: For a model with a fixed total parameter count, making it sparser (i.e., decreasing its L0 norm) improves its interpretability by producing smaller circuits. However, this comes at the cost of reduced capability, measured as a higher pretraining loss.
  • The Role of Scale: Increasing the total parameter count of a sparse model improves the entire Pareto frontier. A larger model can achieve both better capability (lower pretraining loss) and better interpretability (smaller circuits) simultaneously. This is because increasing the size of the model with a fixed L0 gives us more degrees of freedom; the number of bits to specify which parameters are nonzero is approximately O(L0 logN), where N is the total number of parameters.

We validated the faithfulness of our discovered circuits through an inverse pruning experiment. When we ablated only the nodes within a discovered circuit (while leaving the rest of the network intact), the model’s performance on the corresponding task was severely impaired. This confirms that the identified circuit components are not just sufficient but also necessary for the behavior.

Finally, we observed an interesting emergent property: increasing weight sparsity naturally induces activation sparsity. As models become more weight-sparse, the activations in their residual stream become sparser, as measured by an increase in kurtosis. This suggests that the weight constraint encourages the model to learn more focused and less distributed internal representations.

3.2 Qualitative Circuit Investigations

While quantitative metrics like circuit size are useful proxies, genuine interpretability requires that the discovered circuits correspond to algorithms that are understandable to humans. Through manual analysis, we deconstructed several such circuits. This section details the mechanisms of three representative examples.

3.2.1 Circuit 1: Closing Strings

The circuit responsible for the single double quote task, which predicts the correct closing quote for a string, implements a simple two-step algorithm.

  • Step 1: Feature Creation (Layer 0 MLP): An early MLP layer processes the token embeddings for (" and ('. It creates two distinct feature channels in the residual stream:
    • A “quote detector” (channel 985) that activates for either type of opening quote.
    • A “quote type classifier” (channel 460) that activates positively for double quotes and negatively for single quotes.
  • Step 2: Information Readout (Layer 10 Attention): A late-stage attention head (head 82) uses these features to make its prediction.
    • It uses the “quote detector” feature as its key.
    • It uses the “quote type classifier” feature as its value.

Because subsequent tokens in the string attend to the opening quote token, they are exposed to its key. This attention mechanism allows them to copy the corresponding value (the quote type) to the final position, enabling the model to predict the correct closing quote. The full circuit consists of just 12 nodes and 9 edges.

Together, the four components described have 41 total edges connecting them to the rest of the network, of which 9 are used by this circuit—based on this, we are optimistic it would be possible to understand this circuit without task-specific data.

3.2.2 Circuit 2: Counting Nesting Depth

We identified a more complex circuit for the bracket counting task, where the model must predict ] for a flat list and ]] for a nested list. This circuit implements a three-step counting and thresholding algorithm.

  • Step 1: Embedding: The token embedding for [ writes a signal to several residual channels, which function as “bracket detectors.”
  • Step 2: Counting (Layer 2 Attention): A single attention head (head 125) sums the bracket detector activations into one of its value channels, creating an “open bracket detector.” Crucially, this head’s query vector is near-zero, causing the attention operation to perform a uniform average over all tokens in the context. It writes this averaged value to a specific residual channel (1249), whose activation magnitude now encodes the “list depth.”
  • Step 3: Thresholding (Layer 4 Attention): A second attention head (head 80) uses the “list depth” channel as its query. This head employs a strong attention sink (a learned bias in the attention denominator), which causes the softmax function to behave like a threshold. The head only activates strongly for nested lists, where the query’s dot product with the key is large enough to overcome the sink. When it activates, it outputs the ]] completion.

It is important to note that producing this minimal circuit description required some manual intervention, including removing redundant components and rescaling node activations to compensate—a step that requires careful validation to ensure it does not hide superposition.

This mechanistic understanding led directly to the discovery of an adversarial attack. The circuit’s reliance on averaging means that its performance degrades as the context length increases. By making a nested list very long, we can induce a “context dilution” failure mode where the activation magnitude of the “list depth” channel falls below the threshold, causing the unpruned model to incorrectly predict a single ].

This circuit uses 6 channels total, with 283 edges connecting them to the rest of the network. An additional 11 layer 3 attention channels and 48 layer 7 MLP neurons contribute an additional 1217 edges. It would likely be difficult to make progress on tracing this circuit without task-specific data.

3.2.3 Circuit 3: Tracking Variable Types

The circuit for the set or string task, which tracks a variable’s type, uses a two-hop attention algorithm involving two different attention heads.

  • Step 1 (Layer 4): The first attention head (head 73) attends to recent tokens. When it sees a variable initialization like current = set(), it copies the embedding of the variable name (current) and writes it into the token position where the type (set()) is declared.
  • Step 2 (Layer 6): Later in the sequence, when the model needs to recall the type of current, a second attention head (head 26) uses the embedding of current as both its query and its key. This enables the head to strongly attend back to the set() token position—where the variable’s identity was stored in Step 1—and copy the type information to the final token position to make the correct prediction (.add).

These channels have 100 total edges connecting them to the rest of the network. It may be difficult to understand this circuit without task-specific data.

3.3 Preliminary Results with Bridges

We tested the bridge technique to determine if circuits found in our sparse models are mechanistically analogous to computations occurring in dense models. We trained a sparse model with bridges connected to a 4-layer dense model. We then identified features of interest in the sparse model’s circuits, perturbed their activations, and mapped these perturbations back into the dense model’s activation space via the bridge decoder.

The results of two intervention experiments provide preliminary evidence for the technique’s efficacy:

  • Quote Type Editing: In the single double quote task, we perturbed the sparse model’s “quote type classifier” channel. When the model was prompted with a double-quoted string, we steered this channel’s activation to resemble that of a single-quoted string. Mapping this perturbation back to the dense model caused a steep and controlled increase in the probability of the dense model outputting a single quote, consistent with a successful edit of its internal representation.
  • Colon Prediction Editing: In the while return true task, we identified a channel whose activation is highly negative throughout lines that begin with if, while, or except (any of which should end in a colon). When the model was prompted with return True (which requires a newline), we steered this channel’s activation toward its while True state. Mapping this change to the dense model successfully increased the probability of it outputting a colon instead of a newline.

These results suggest that our bridge technique can be used to perform interpretable and targeted edits on a dense model’s internal representations by leveraging the cleaner structure of a corresponding sparse model.

4.0 Discussion, Limitations, and Future Work

This final section reflects on the broader implications of our findings, provides a candid assessment of the methodology’s current limitations, and outlines promising directions for future research in the pursuit of more interpretable AI systems.

4.1 Discussion and Implications

The primary challenge preventing the direct application of our method to frontier models is scale. Unstructured sparse networks are fundamentally inefficient on modern hardware like GPUs, requiring 100 to 1,000 times more compute for training and inference than dense models of comparable capability. This makes a full, mechanistic interpretation of today’s largest models with this approach currently infeasible.

To overcome this barrier, we propose two main avenues for future research:

  1. Model Organisms: A promising direction is to scale these methods to create a series of fully interpretable “model organisms” up to the capability level of models like GPT-3. It is plausible that transformers learn universal circuit motifs that are present in both sparse and dense models across different scales. By studying these motifs in interpretable organisms, we could develop a catalog of what to look for in larger, opaque models.
  2. Targeted Understanding: Rather than attempting to understand an entire frontier model, a more focused approach could be taken. A sparse, bridged model could be trained on a narrow but critically important task distribution, such as safety-critical behaviors like refusal or deception. This would not provide a full reverse-engineering of the model but could be invaluable for making targeted safety cases.

Furthermore, the clean, disentangled circuits produced by sparse training could serve as superior primitives for the development of automated interpretability tools, which are currently bottlenecked by the complexity of representations in dense models.

4.2 Limitations

Our research is subject to several key limitations that must be addressed in future work.

  1. Compute Inefficiency: As discussed, the training and inference of unstructured sparse models are vastly more compute-intensive than their dense counterparts, posing a significant barrier to scaling.
  2. Polysemantic Features: While significantly reduced, superposition is not entirely eliminated. The discovered circuits are not perfectly monosemantic, and concepts are sometimes still smeared across multiple nodes.
  3. Non-Binary Features: Some learned features are not simple on/off binary switches; they carry important information in the magnitude of their activation. This makes them inherently more difficult to fully explain than discrete features.
  4. Faithfulness Definition: The validation method used, mean ablation, is a weaker standard of faithfulness than more rigorous techniques like full causal scrubbing. While mean ablation is more complete than simple activation patching, it does not fully guarantee that our circuits are interchangeable with the model’s original computation under all conditions, and it may overestimate their completeness.
  5. Pruning Imperfections: The automated pruning algorithm is imperfect and often leaves behind extraneous nodes with negligible impact on task loss. Manual cleanup is frequently required to produce the cleanest, most minimal circuits.
  6. Better Pruning: Our current pruning method operates on nodes for computational simplicity, but pruning individual edges directly may yield even more refined circuits.
  7. Other Interpretable Inductive Biases: Weight sparsity may not be the only inductive bias needed to fully disentangle superposition; other approaches, such as enforcing expert sparsity, could provide complementary benefits.
  8. Scaling Uncertainty: It remains an open question how well these methods will scale to more capable models and more complex tasks. It is possible that the circuits for such tasks will be too large and intricate for human comprehension without significant automation, or that some complex behaviors may fundamentally defy simple mechanistic description.