When Are Two Networks the Same? Tensor Similarity for Mechanistic Interpretability
ML Nissen Gonzalez, Melwina Albuquerque, Laurence Wroe, Jacob Meyer Cohen, Logan Riggs Smith, Thomas Dooms · 2026
Read When Are Two Networks the Same? Tensor Similarity for Mechanistic Interpretability by ML Nissen Gonzalez, Melwina Albuquerque, Laurence Wroe, Jacob Meyer Cohen, Logan Riggs Smith, Thomas Dooms (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-15183.txt.
Introduction
ML Nissen Gonzalez and five others offer tensor similarity, a weight-based metric for judging when two neural network parts implement the same computation. Action tests miss out-of-distribution gears, while weight tests ignore weight-space mirror rules. Tensor similarity is invariant under those rules, captures global functional match and cross-layer mechanisms, and runs through an efficient recursive algorithm. In tests it tracks training dynamics like grokking and backdoor planting more truly than old metrics.
Catalog record
| CREATOR | ML Nissen Gonzalez, Melwina Albuquerque, Laurence Wroe, Jacob Meyer Cohen, Logan Riggs Smith, Thomas Dooms |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 63305 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.15183
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
When Are Two Networks the Same? Tensor Similarity for Mechanistic Interpretability ML Nissen Gonzalez, Melwina Albuquerque, Laurence Wroe, Jacob Meyer Cohen, Logan Riggs Smith, Thomas Dooms Abstract Mechanistic interpretability aims to break models into meaningful parts; verifying that two such parts implement the same computation is a prerequisite. Existing similarity measures evaluate either empirical behaviour, leaving them blind to out-of-distribution mechanisms, or basis-dependent parameters, meaning they disregard weight-space symmetries. To address these issues for the class of tensor-based models, we introduce a weight-based metric, tensor similarity , that is invariant to such symmetries. This metric captures global functional equivalence and accounts for cross-layer mechanisms using an efficient recursive algorithm. Empirically, tensor similarity tracks functional training dynamics, such as grokking and backdoor insertion, with higher fidelity than existing metrics. This reduces measuring similarity and verifying faithfulness into a solved algebraic problem rather than one of empirical approximation. Figure 1 : Overview of our method. The model learns a backdoor that existing similarity metrics miss when given only clean data or weights. Tensor similarity flags the change and localises it to the attacked class. \Delta measures how sharply similarity shifts from pre- to post-backdoor ( subsection 3.3 ). 1 Introduction A central bottleneck to interpreting neural networks is validating whether the decomposed ( 7 ) or extracted ( 17 ; 2 ) components preserve or capture the functional computation implemented by the original model. This is especially important for mechanistic interpretability, which aims to faithfully decompose models into constituent parts ( 34 ) . Such a decomposition must preserve not only the behaviour of the original network but also its internal functions. Yet current evaluations often rely entirely on input-based similarity such as comparing outputs or activations ( 6 ; 21 ; 15 ) . This is insufficient: a decomposition can near-perfectly reconstruct activations by relying on approximate heuristics rather than the true underlying function ( 28 ; 1 ) . The implication is that the resulting decomposition is not simply capturing an incomplete mechanism, but a different algorithm altogether. The root of this problem is the absence of a rigorous metric for mechanistic similarity. While defining such a metric is a matter of philosophical debate (when are two systems truly equal?) ( 23 ) , we argue a sensible similarity metric should satisfy three criteria: • Dataset independence : The metric should depend on the model, not on the sampled data. We can make stronger robustness claims when they apply to the full distribution, such as ruling out backdoors ( 22 ) , which by design trigger only on particular inputs. • Symmetry invariance : The metric should be invariant under transformations that leave the function unchanged. Whether a mechanism is implemented in one neuron or spread across many, or distributed across layers rather than concentrated in one ( 1 ) , should have no effect on the score. • Tractable scalability : The metric should be efficiently computable at scale, without exponential or quadratic convergence bounds (as Monte Carlo sampling incurs). Only then can it serve as an optimisation target for the largest networks. Current methods fail at least one criterion. For instance, behavioural similarity ( 18 ; 31 ; 19 ) measures outputs or activations empirically by comparing input-output pairs, but is not guaranteed to generalise out of distribution. It will therefore fail to detect backdoors, which are designed precisely to resist such measurements. Another common metric, matrix similarity , uses the existing parametrisation as a comparison point, making it highly susceptible to model permutations. It might succeed at studying training dynamics (where an update doesn’t arbitrarily reshuffle weights) but fail across differently trained models. Figure 2 : Matrix similarity computes the direct cosine similarity between (flattened) weight matrices, but is sensitive to weight-space symmetries such as permutation and scaling, severely limiting it as an accurate proxy for functional equivalence, especially for models that are trained differently. Behavioural similarity (or output similarity) mitigates this by comparing model outputs directly, making it invariant to weight-space symmetries. It depends, however, on an input distribution and is consequently blind to out-of-distribution artifacts. (Activation-based similarity, a tempting alternative, is sensitive to both the distribution and weight symmetries like cross-layer structure.) Tensor similarity is a closed-form, data-free measure of functional similarity between two models. It computes the cosine angle between their weight tensors in L^{2}(\mathcal{N}(0,\mathbf{I})) ; the function space under the Gaussian metric. Tensor similarity satisfies all criteria at the cost of requiring a modified architecture. In this paper, we propose a weight-based similarity that satisfies all three criteria ( Figure 2 ), at the cost of using tensor-based neural networks ( 30 ; 10 ; 33 ; 36 ) . These networks train and function equivalently to ordinary deep networks like transformers, but use different activation functions. This trade-off is fundamental: contemporary neural networks do not appear to admit a similarity metric that tractably satisfies all three criteria. Our metric extends cosine similarity from vectors to tensor-based models, formally verifying whether two sub-networks execute identical internal logic regardless of differences in parametrisation. It decays gracefully under minor structural perturbations and, because it is rooted in linear algebra, we can attribute the contribution of each component to the total. The remainder of this paper has two parts: discussing the theory and implementation of tensor-based similarity, and validating its discriminative power empirically across a spectrum of domains. Theoretically, we cover the architectural changes required for the metric to be computable and the construction that makes it invariant under weight symmetries. Empirically, we show that tensor-based similarity exposes functional changes that other methods miss: catastrophic forgetting in vision, grokking-like phase transitions in modular arithmetic ( 25 ) , and training dynamics in language ( 16 ; 29 ) . Together, this positions tensor similarity as a foundational tool for mechanistic interpretability 1 1 1 Our code is available at https://github.com/tdooms/tensor-similarity . 2 Theory This paper studies polynomial (or multilinear) variants of standard neural components that use multiplicative gating rather than ordinary non-linear activation functions ( 8 ) . In this section, we first review relevant prior work and introduce the underlying architectures, then demonstrate how the proposed similarity measure handles various architectural symmetries. The discussion assumes a fundamental familiarity with tensor algebra and the symmetric group; additional details and derivations are provided in Appendix A . 2.1 Defining multilinear transformer models We build on literature that uses bilinear and tensor-based architectures as intrinsically interpretable models. These works show that polynomial models enable formal weight-based analysis via the learned weight tensors using bilinear MLPs ( 30 ; 34 ) (or stacks thereof ( 10 ) ) while remaining competitive with standard architectures ( 30 ; 33 ; 36 ) . More broadly, this line of work sits within a longer tradition of using tensor decompositions to study expressiveness of deep learning ( 4 ) . Bilinear layers. The core building block of our architecture is a GLU ( 36 ; 8 ) without gate, called a bilinear layer. It maps a lifted input, i.e. \tilde{\mathbf{x}}=(1,\mathbf{x})\in\mathbb{R}^{d+1} to an output in \mathbb{R}^{K} as \mathcal{A}(\mathbf{x})\;=\;\mathbf{D}\bigl((\mathbf{L}\tilde{\mathbf{x}})\odot(\mathbf{R}\tilde{\mathbf{x}})\bigr), (1) where \mathbf{L},\mathbf{R}\in\mathbb{R}^{r\times(d+1)} and \mathbf{D}\in\mathbb{R}^{K\times r} are weight matrices, r is the hidden dimension, and \odot denotes the element-wise (Hadamard) product. The above computation can