Uncovering Intermediate Variables in Transformers using Circuit Probing

Michael A. Lepori, Thomas Serre, Ellie Pavlick · DOI

Introduction

Large language models (LLMs) have demonstrated remarkable capabilities, yet their internal decision-making processes remain largely opaque. Researchers have recently introduced Circuit Probing, a novel technique designed to automatically uncover the specific low-level "circuits"—subnetworks of neurons—within a Transformer that compute intermediate variables. Unlike traditional probing methods that merely indicate the presence of information, circuit probing provides evidence that the model actively utilizes this information for its final predictions.

The Challenge of Interpretability

A common approach to studying LLMs is "vanilla probing," where a small classifier is trained to extract features (e.g., syntactic number) from internal activations. However, this method suffers from a significant flaw: the ability to decode information does not guarantee its functional relevance to the task. Conversely, causal analysis methods like ablation can prove functional relevance but are difficult to scale. Circuit Probing bridges this gap by offering a scalable, causally grounded tool for model interpretation.

Methodology: Identifying Functional Subnetworks

Circuit Probing identifies sparse subnetworks responsible for computing hypothesized intermediate variables through a multi-step process:

  1. Binary Masking: Trainable masks are applied over the neurons of a frozen Transformer.
  2. Contrastive Optimization: The mask is optimized using a soft nearest neighbors loss, forcing the circuit to produce outputs that cluster according to the hypothesized variable (e.g., singular vs. plural inputs).
  3. Continuous Sparsification: The mask is "annealed" from a soft probability to a hard binary choice, ensuring the resulting circuit is sparse and interpretable.
  4. Causal Validation: The identified circuit is ablated to observe the impact on model performance, providing causal proof of its necessity.
Figure 1: Conceptual overview of Circuit Probing identifying subnetworks responsible for specific linguistic features across model updates.

Experimental Setup

The effectiveness of Circuit Probing was evaluated across three distinct domains:

  • Toy Arithmetic: Modular arithmetic tasks (e.g., $a^2 - b^2 \pmod P$) with known ground-truth algorithms.
  • Grokking Tasks: Investigating the transition from memorization to generalization.
  • Natural Language Processing: Testing subject-verb agreement and reflexive anaphora in GPT-2 Small and Medium using linguistic templates.

Key Insights and Results

Faithfulness vs. Expressivity

A critical finding is that high-powered nonlinear probes can "hallucinate" features that the model does not actually use. Circuit Probing is more "faithful"; if a variable is irrelevant to the task, the method fails to find a corresponding circuit, whereas standard probes may still report high accuracy.

Figure 6: Comparison of probe accuracies across different variable types. Note how nonlinear probes maintain high accuracy on 'Other' (irrelevant) variables, while Circuit Probing remains selective.

Tracking the "Grokking" Phenomenon

In models that undergo "grokking"—a sudden shift to generalization—Circuit Probing reveals that the internal circuits for rules form gradually and continuously, well before external performance metrics show improvement. This suggests that the model is learning the underlying algorithm long before it is reflected in the accuracy scores.

Modular Architecture and Localization

The method successfully identified shared versus free circuits in multitask models, demonstrating that Transformers can implement modular, reusable sub-algorithms. In GPT-2, syntactic number computation was localized to specific layers, such as the Attention block of Layer 6 in GPT2-Small.

Conclusion and Future Directions

While Circuit Probing is a powerful tool, it currently relies on researcher-defined hypotheses for intermediate variables. Future work may focus on discovering unknown variables from scratch and understanding how multiple circuits interact within the same layer. Despite these challenges, Circuit Probing represents a significant step toward opening the "black box" of modern language models.

Summary updated

BibTeX
@inproceedings{lepori2024uncovering,
  author = {Michael A. Lepori and Thomas Serre and Ellie Pavlick},
  title = {{Uncovering Intermediate Variables in Transformers using Circuit Probing}},
  booktitle = {COLM},
  year = {2024},
  url = {https://openreview.net/forum?id=gUNeyiLNxr},
}
Figure