Dictionary Learning Improves Patch-Free Circuit Discovery in Mechanistic Interpretability: A Case Study on Othello-GPT

Zhengfu He, Xuyang Ge, Qiong Tang, Tianxiang Sun, Qinyuan Cheng, Xipeng QiuarXiv 2024 · DOI

Introduction

Mechanistic interpretability seeks to reverse-engineer neural networks into understandable "computational primitives." However, researchers face two significant hurdles: superposition, where models pack multiple features into single dimensions, and the computational complexity of circuit discovery. Traditional methods like activation patching are computationally expensive ($O(n^2)$ complexity) and prone to "out-of-distribution" errors, such as the "hydra effect," where internal components mask each other's functions.

This paper introduces a "patch-free" framework that combines Sparse Dictionary Learning (SDL) with linear decomposition. By applying this to Othello-GPT, the authors efficiently uncover human-understandable logic—such as how the model tracks flipped pieces—without the drawbacks of traditional patching.

The Challenge of Interpretability

The current gold standard for finding circuits is activation patching, which involves swapping internal activations between different inputs to observe changes in output. While powerful, this method can push models into states they never encountered during training, leading to misleading results. Furthermore, the polysemantic nature of neurons—where a single neuron responds to many unrelated concepts—makes it difficult to isolate specific logic.

Methodology: A Patch-Free Approach

The proposed framework replaces iterative patching with a direct, analytical approach based on two core techniques.

Sparse Dictionary Learning (SDL)

To address superposition, the authors train sparse autoencoders (SAEs) on the outputs of every module, including embeddings, attention heads, and MLP layers. These autoencoders decompose messy, dense activations into thousands of "monosemantic" dictionary features.

The Sparse Autoencoder (SAE) architecture used to extract monosemantic features from dense neural activations.

Linear Decomposition of the Residual Stream

Instead of viewing the residual stream as an opaque vector, the framework treats it as a sum of contributions from every preceding module. This allows researchers to trace the "lineage" of a specific feature back through the network's layers.

Decomposition of the Transformer's residual stream into additive contributions from each internal module.

Approximate Direct Contribution (ADC)

While attention layers are largely linear, MLPs introduce non-linearities that complicate decomposition. The authors introduce Approximate Direct Contribution (ADC) to linearize MLP outputs. By treating the activation function's "gate" as a constant for a given input, they can identify which input features drive specific MLP dictionary features. This method achieves $O(n)$ complexity relative to the number of features, making it significantly faster than patching.

Case Study: Othello-GPT

The authors validated their framework using Othello-GPT, a 1.2-million parameter transformer trained to predict legal moves in the game of Othello. This model provides a "ground truth" world model (the board state) that is complex enough to be interesting but simple enough to verify analytically.

Key Insights and Results

The framework successfully identified four main categories of features: current move position, board state (mine vs. theirs), empty cells, and legal move indicators. Notably, the dictionary learning automatically discovered the same features that previous researchers had to find using supervised "probes."

Further analysis revealed that early MLP layers act as logical "AND" gates. For instance, to determine if a piece at a specific cell has been flipped, the model combines information about the current move with the previous state of surrounding tiles. The authors also successfully decomposed Query-Key (QK) circuits to show how the model learns to attend specifically to opponent moves versus its own, driven by "resonance" between specific dictionary features.

Quantitative validation showed a high correspondence (0.68 Intersection over Union) between ADC and traditional direct patching, suggesting that ADC is a reliable and much faster proxy for analyzing MLP logic.

Discussion and Future Work

While the results are promising, the authors noted limitations, such as a high percentage of "dead neurons" (75%) in their dictionaries, indicating a need for better hyperparameter optimization. Additionally, the global normalization of the Softmax function in attention layers remains a challenge for full linear decomposition.

Future work will focus on scaling this patch-free approach to Large Language Models (LLMs) with billions of parameters. The authors suggest that this framework could eventually be used to identify "pathogenic features"—internal components responsible for incorrect or biased model decisions—enabling more robust and safer AI systems.

Summary updated

BibTeX
@misc{he2024dictionary,
  author = {Zhengfu He and Xuyang Ge and Qiong Tang and Tianxiang Sun and Qinyuan Cheng and Xipeng Qiu},
  title = {{Dictionary Learning Improves Patch-Free Circuit Discovery in Mechanistic Interpretability: A Case Study on Othello-GPT}},
  year = {2024},
  eprint = {2402.12201},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.12201},
}
Figure