Abstract
Mechanistic interpretability aims to reverse engineer the computation performed by a neural network in terms of its internal components. Although there is a growing body of research on mechanistic interpretation of neural networks, the notion of a mechanistic interpretation itself is often ad-hoc. Inspired by the notion of abstract interpretation from the program analysis literature that aims to develop approximate semantics for programs, we give a set of axioms that formally characterize a mechanistic interpretation as a description that approximately captures the semantics of the neural network under analysis in a compositional manner. We use these axioms to guide the mechanistic interpretability analysis of a Transformer-based model trained to solve the well-known 2-SAT problem. We are able to reverse engineer the algorithm learned by the model -- the model first parses the input formulas and then evaluates their satisfiability via enumeration of different possible valuations of the Boolean input variables. We also present evidence to support that the mechanistic interpretation of the analyzed model indeed satisfies the stated axioms.
Introduction
Mechanistic interpretability (MI) seeks to transform neural networks into human-understandable algorithms or "circuits." While the field has successfully explained how models solve tasks like modular addition, these interpretations are frequently justified in an ad-hoc manner. A significant gap exists in current validation methods, such as causal scrubbing, which often focus on input-output behavior or isolated components. These methods frequently overlook compositionality—the way small interpretability errors in early layers can compound into significant misunderstandings in later stages of the computation chain. Without a formal framework to quantify accuracy across the entire model, MI remains more of an art than a rigorous engineering discipline.
The Axiomatic Framework
To address these gaps, we propose an axiomatic framework for MI, drawing inspiration from "Abstract Interpretation" in program analysis. This framework utilizes two primary functions: Abstraction ($\alpha$) and Concretization ($\gamma$), which map high-dimensional real-valued vectors to discrete, human-interpretable symbols and vice versa.
The framework is built upon four core axioms:
- Prefix Equivalence: Ensures the abstract state after $i$ steps matches the model's concrete state.
- Component Equivalence: Verifies that an individual abstract component behaves like its concrete counterpart.
- Prefix Replaceability: Tests if replacing the first $i$ layers with the interpretation preserves the final output.
- Component Replaceability: Checks if swapping a single model layer for its interpreted version maintains output integrity.
By measuring the error rate ($\epsilon$) for these axioms using statistical methods, we can quantitatively score the fidelity of an interpretation.
Case Study: The 2-SAT Solver
We applied this framework to a two-layer Transformer trained to solve the 2-Satisfiability (2-SAT) problem. The model, trained on formulas with ten clauses and five variables, achieved 99.76% accuracy. Our analysis revealed a clear division of labor between the blocks.
The first Transformer block functions as a parser, organizing clause information. The second block acts as an evaluator, where specific MLP neurons effectively "brute-force" different variable assignments to check for satisfiability. Interestingly, the model exhibits significant sparsity; only 34 out of 512 MLP neurons were relevant to the final "SAT" prediction.
To map these neuron activations to Boolean functions, we employed decision tree learning. This approach highlights an interpretability-fidelity trade-off: while smaller trees are more readable, larger trees satisfy the axioms with lower error rates.
Results and Validation
The proposed interpretation of the 2-SAT solver achieved near-perfect scores on the first block ($\epsilon \approx 0.0000374$ for prefix equivalence). While the second block was more challenging to interpret perfectly, the framework allowed us to quantify the "truth" lost when simplifying the MLP logic.
Furthermore, we re-validated the classic modular addition task. While our framework confirmed the validity of existing "circular holomorphy" interpretations, it also highlighted that previous studies lacked the prefix-based evidence necessary to guarantee the interpretation holds up across the entire model depth.
Discussion and Future Work
While the axiomatic approach provides a rigorous foundation for MI, challenges remain. Scalability to billion-parameter LLMs is difficult because defining the human-interpretable language and mapping functions becomes exponentially complex. Additionally, the choice of "human-understandable" features remains somewhat subjective. Future research could focus on using this framework as an objective function to automatically discover valid interpretations, reducing the reliance on human intuition.
Summary updated