Manuscript Offprint
arXiv:2610.18471Graph Metanetworks for Transformer Based Language Models
Abstract
Weight-space learning treats the weights of neural networks as data, processed by other models called metanetworks. A key challenge is that different weights can realize the same function, related by a group of symmetries the metanetwork should respect. While symmetry-aware metanetworks for simple architectures such as MLPs are well developed, a comprehensive treatment of transformers, and in particular transformer-based language models, is still missing. Importantly, their weight space has a richer symmetry group: beyond neuron permutations, attention introduces continuous general-linear symmetries of the attention matrices and permutations of entire heads. Existing methods for transformer weights either capture only part of these symmetries or are restricted to a single, fixed architecture, and none accounts for language-model-specific components such as the token embeddings. Building on graph metanetworks, we propose a graph-based approach that is both symmetry-aware and applicable across depths and widths. We formalize a weight-space symmetry group of complete decoder-only language models and provide a graph construction that is invariant to it. We further introduce two new transformer-population datasets with novel tasks, such as training-corpus prediction and fine-tuning detection, on which our approach notably outperforms existing baselines.
1 Introduction
The success of deep learning, together with the large number of publicly available trained models, has created a new data modality: the weights of neural networks themselves. The emerging field of weight-space learning [11, 40] treats these weights as data to train metanetworks that can process other networks' weights and predict model properties or edited weights with a single forward pass [21, 26, 36].
Two important challenges arise when designing effective metanetworks. First, input architectures may vary widely: an MLP, a CNN, and a transformer share no common parameterization, and even networks of the same family differ in architectural choices such as depth and width. Second, many different weight configurations realize the same function, related by a group of symmetries acting on the weight space, most prominently the permutations of hidden neurons [26, 44]. A metanetwork that is not invariant or equivariant to this group would need to use its capacity and data only to learn to treat such configurations as equivalent. These obstacles have motivated recent work on Graph metanetworks [18, 20], which address both challenges by representing a neural network as a graph (with neurons as nodes and parameters as edges) and by processing it with a graph neural network (GNN). Crucially, since GNNs are equivariant to node permutations, they respect the neuron-permutation symmetries of the encoded network.
Despite this progress, transformers [37] and, in particular, the decoder-only language models built from them, remain underexplored as a weight space, especially in terms of the underlying symmetry structure and graph representation. These architectures arguably represent the most important and widely used today, and their weight space is, in fact, also considerably richer in symmetries than that of other architectures. For example, within each attention head, the query and key projections enter the computation only through their product , and the value and output projections only through , so each pair admits a continuous general-linear symmetry, on top of which entire heads can be permuted. Existing approaches to transformer weights follow two lines, each capturing only part of this picture. The first Graph Metanetworks [18, 20] provide a preliminary, simplified construction for attention, but do not account for the general-linear symmetries and do not encode the head structure faithfully. Conversely, Tran et al. [35] design layers equivariant to the general-linear and head-permutation symmetries, but tie the metanetwork to a single, fixed transformer architecture. Moreover, none of these works treats the components specific to language models, such as the token embedding matrices, and the symmetries they induce. As a result, no existing approach respects the symmetries of a complete transformer language model while remaining agnostic to its depth, width, and number of heads.
Our approach. We begin by formalizing a weight-space symmetry group of a complete decoder-only transformer language model, from the token embedding, through the stack of transformer blocks with their normalization layers and residual connections, up to the unembedding layer. This group combines permutations of the feed-forward hidden neurons, a permutation of the residual-stream features shared across all blocks, per-head general-linear symmetries of the query-key and value-output pairs, permutations of the heads within each block, as well as a permutation of the vocabulary that couples the embedding and unembedding matrices together. We prove that these transformations leave the function computed by the model unchanged (up to a relabeling of the vocabulary). Our approach thus unifies a range of previous, independent subcomponent analyses [34], [18], [20] into a single, comprehensive framework, extending the attention symmetries by Tran et al. [35] to a complete language model, including its residual stream, normalization layers, embedding, and unembedding.
We then design tailored graph constructions for transformers whose symmetries match this group, which we call Graph Metanetworks for Transformers (GMT). As in prior graph metanetworks, parameters are placed on edges between layers of nodes, so that a single GNN can process transformers of any depth, width, and number of heads. Unlike prior constructions, though, GMT uses parameter-free coupling edges and auxiliary head nodes which we show tie together exactly those node permutations that correspond to symmetries of the network: the residual-stream permutation is shared across blocks, the dimensions of each head module are bound together within each head, and the embedding is linked to the unembedding. We prove that, under mild rank conditions, two weight configurations yield isomorphic graphs if and only if they are related by an element of the aforementioned group: processing these graphs with a GNN thus guarantees the metanetwork remains invariant (or equivariant), to the transformer weight space group by construction. We propose two variants that trade exactness for efficiency: GMT-GL captures the full group, including the general-linear symmetries, and GMT-P, which as we will show, restricts these symmetries to permutations, yielding a more compact graph.
Finally, as open-weight language models are increasingly released and modified by third parties, questions such as what data was a model trained on? and has it been altered, and where? become pressing, yet lie beyond existing weight-space benchmarks, which focus on implicit neural representations and small vision classifiers. As a first step, we introduce two datasets of transformer language models with tasks that serve as small-scale, controlled proxies for these questions: predicting a model's training-corpus mixture, detecting fine-tuning, and identifying which weights it modified.
GMT outperforms existing baselines on all three, e.g., reducing the KL divergence of corpus-mixture prediction by 25% and halving the error of weight-level fine-tuning detection relative to prior graph metanetworks.
Contributions. We (i) formalize a weight-space symmetry group of complete decoder-only language models; (ii) introduce GMT, architecture-agnostic graph constructions whose isomorphisms match this group; and (iii) release two transformer-population datasets with auditing-motivated tasks, on which GMT outperforms existing baselines.
3 Method
In this section, we formulate our approach. We first characterize the group of weight-space symmetries of a decoder-only transformer language model (Section 3.1). We then design a graph construction whose structure encodes this group, so that a graph metanetwork applied to it is invariant, or equivariant, to it by construction and describe the metanetwork we apply on it (Section 3.2).
3.1 Transformer Weight-Space and Symmetry Group
Transformer LM Computation and Weight Space. A transformer language model starts by mapping tokens in a length-N input sequence to vectors . This is performed by an embedding matrix , which we define to be the embedding weight space. The initial representation is then passed through transformer blocks stacked together, for . Each transformer block is composed of two sub-layers, a multi-head attention (MHA) mechanism followed by a feed-forward (FF) network, each wrapped in a normalization layer and a residual connection. A normalization layer is parameterized by a scale and a shift ; we define the normalization weight space as , so block holds a pre-attention pair and a pre-MLP pair . The MHA module [37] is defined as:
where , denotes concatenation across the heads, denotes head index, and the per-head query, key and value projections together with the output projection are its trainable parameters. We define the attention weight space to be . The FF sub-layer then processes each token's representation, typically through a two-layer MLP with a pointwise nonlinearity, and ; we define the FF weight space to be . Finally, after the blocks, a final normalization is applied, and an unembedding linear layer maps to a distribution over the vocabulary for the next token; we define the unembedding weight space as . Collecting these spaces gives the weight space of all transformers with blocks and heads:
where each point determines a function from token sequences to next-token distributions.
Transformer weight space symmetries. Two transformers with different weights may compute the same function, i.e., the same function admits many equivalent parameterizations. In most weight-space tasks, the target does not depend on which of these parameterizations is given, so a weight-space model should be invariant or equivariant to the weight transformations relating them. We formalize such transformations as a group acting on (Equation (1)), examining each component of the network in turn; Table 1 summarizes the result.
(1) The embedding matrix admits a row permutation — corresponding to permuting the vocabulary dictionary — and a column permutation — corresponding to reindexing the features of the embedded vectors. That is, . As we will show, all upcoming layers are equivariant under the action of , allowing us to perform this group action while carrying it through the network.
(2) The pre-attention normalization maps each token representation (a row of ) to , where is the all-ones vector and is the entrywise product. Note that are permutation invariant. In order for the norm to respect the column permutation , we need to transform the scale and shift parameters accordingly, i.e. , . This gives .
(3) Each attention head’s query and key projections enter the network only through the product ; substituting any invertible as , leaves this product, and hence the attention calculation, unchanged. Note that the output projection is likewise a stack of blocks , so concatenating the per-head values and multiplying by can be expressed as the following sum:
The value/output pair thus enter the network only through their product, imposing a second general-linear symmetry . Equation (2) only ever sums the heads, so they may in addition be permuted by any . Together, these give the wreath product [39] . Also the MHA input still carries , enforcing the attention weights matrices to also be transformed by on the left.
(4) The pre-MLP normalization applies the same Norm defined above to a seperate scale and shift, so again it is equivariant to .
Table 1: The symmetry group action over a weight space . The attention group is . The action column omits the layer index , which is left unchanged.
| Network Block | Weight Matrix | Group Action | Group Element |
|---|---|---|---|
| (1) Embed. | |||
| (2) Pre-attn. norm | |||
| (3) Attention | |||
| (4) Pre-MLP norm | |||
| (5) MLP | |||
| (6) Final norm | |||
| (7) Unembed. |
(5) In the feed-forward sub-layer, the pointwise nonlinearity is applied element-wise, so it commutes with permuting the columns of and undoing it with on the rows of . Also here the input carries (from the embedding column permutation), enforcing us to apply on each of the weight matrices.
(6) The final normalization, applied after the last block, is governed by the Norm computation: the same considerations as in (2) shows the same equivariance.
(7) For the unembedding matrix , we want to undo the permutation that we carry along the network. Additionally, since the embedding was permuted by , the unembedding must also be permuted by to match the token relabeling. The transformation to is hence defined as .
Full symmetry group. The per-block transformations are summarized in Table 1. Combining them gives the symmetry group of the full weight space:
We summarize the discussed transformer symmetries with the following theorem, proved in Section B.1.
Theorem 1 (the elements of are symmetries of the weight space). Let denote the function computed by a decoder-only transformer language model with weights . Then is invariant to the group with the action defined in Table 1. i.e., for , it holds that .
Additional symmetries. is not the maximal symmetry group of a transformer language model.
For example, each normalization layer admits a diagonal rescaling where is a linear map followed by it. In addition, some activation functions induce scaling or sign symmetries of the feed-forward neurons [10, 16, 34]. These symmetries are complementary to the ones we treat and can be handled on top of our constructions, e.g., by canonicalizing the weights; we leave this to future work.
3.2 Graph Construction
Having identified the symmetry group (Equation (3)), we seek a model that is invariant or equivariant to it. Architectures tailored to typically tie their input dimension to a single transformer architecture, and thus cannot be applied across depths , widths , or numbers of heads . Following Lim et al. [20] and Kofinas et al. [18], we instead represent a transformer as a graph whose edges carry the model's parameters, augmented with structural “gadgets” that encode its symmetries, and process it with a graph neural network (GNN). Since GNNs apply to graphs of any size and are equivariant to node permutations, invariance or equivariance to follows from the graph construction alone. Unlike ours, the earlier constructions of [18, 20] do not match : they do not model the general-linear symmetries and do not faithfully encode the head structure.
GL-Invariant Graph Construction (GMT-GL). We will now describe the GMT-GL graph construction for each model component, explaining which nodes are instantiated, which edges join them, and which parameter matrix, if any, sits on these edges. Throughout the construction, we use two recurring edge connectivity patterns. The first captures any parameter matrix representing fully-connected layers of neurons and . This is naturally instantiated as a full, bipartite weighted edge set between the set of neuron nodes and :
Under this setup, A, B can be independently permuted while maintaining the same graph structure, i.e. the permuted graph is isomorphic to the original. Such permutations correspond to row and column permutations of the matrix M, which in turn provides the permutation invariance we seek. The second pattern is a coupling edge set between two node-layers of equal size m, pairing same-index nodes without carrying any of the transformer's trainable parameters:
This fixes the two layers to the same permutation. This is what lets us realize the couplings between permutations that Table 1 requires, across a block's sub-layers, and between the embedding and unembedding. Moving forward, we now describe the graph construction for a single transformer block language model, which we also depict in Figure 3.
Embedding. The graph starts with the node-layer (one node per vocabulary token), and the node-layer (one node per feature), joined by the fully-connected edge set carrying the embedding matrix. Note that row and column permutation of correspond to permuting which leaves the graph unchanged.
Multi-head attention. first, to consider the pre-attention normalization, we introduce the node-layer , joined to by the fully-connected edge set . Now, to respect the general-linear symmetry relating and , as anticipated, we work directly with the matrix products and , where is the -th row-block of . Concretely, for every head we introduce a node-layer of nodes, joined to by the edge set . To additionally tie the column permutation of the embedding to the row permutation of , and , we add, for every head, the coupling edge set . However, these edges alone do not bind the nodes of a head together: the nodes of each index could be permuted across heads independently of the other indices, which introduce larger graph symmetry than the one of the corresponding transformer. To tie all nodes of a head to the same head permutation, we introduce for every head a single head node , joined to all nodes of that head by the parameter-free edge set . Next, each of these node-layers is joined to a shared node-layer of nodes by a fully-connected edge set , merging the heads back into the residual stream. Finally, to account for the residual connection, we add the coupling edge set between the sub-layer's input and output layers. As before, the pre-MLP normalization pair encoded with the node-layer joined to by the edge set
Feed-forward. We continue with a node-layer of nodes, joined to by , and a further node-layer of nodes, joined to by ; as above, coupling edge set accounts for residual connections. The node-layer plays the role of for the next block, and this pattern repeats for all blocks.
Unembedding. After the last block, a final node-layer is joined to the last by the fully-connected edge set carrying the unembedding matrix. To tie the row permutation of the embedding matrix to the column permutation of the unembedding matrix – both equal to the shared vocabulary permutation – we add the coupling edge set between the network's very first and very last node layers. The final normalization pair is attached to this last in the same way, via the node-layer joined to it by the fully-connected edge set .

GMT-GL (ours)

GMT-P (ours)

GMN
Figure 1: The multi-head attention subgraph under the three graph constructions, for an attention layer with and heads (); the rest of GMT-GL and GMT-P is identical. Left: GMT-GL places the products and on the edges, and the head nodes bind the nodes of each head together. Middle: GMT-P gives each projection matrix its own edge set. Right: [20] and [18] which share the same construction for MHA, noted as GMN.
Limitations of GMT-GL. Our construction GMT-GL, is equivariant to the whole group G, particularly including the general-linear symmetry of the attention mechanism. This exact equivariance is of course desirable, but it comes with two disadvantages. First, to respect the general-linear symmetry, and — each of shape — are multiplied together to form a single matrix of shape placed on the graph's edges. The size of this product is , and in the typical case where , this is much larger than the combined size of the two matrices it replaces, that is, . As a result, the graph has far more edges than the layer has parameters. The same holds for the general-linear symmetry relating and , with product . Second, since GMT-GL edges carry entries of matrix products rather than individual weights, model weights no longer correspond to graph edges, which make weight-level tasks, where a property of each weight must be predicted, more challenging.
Permutation-Invariant Graph Construction (GMT-P). To mitigate the aforementioned issues with GMT-GL, we propose a more efficient alternative, GMT-P, which restricts the symmetry group to permutation matrices alone, , and works directly with the weight matrices themselves, rather than the two products. Concretely, the GMT-P construction considers the subgroup defined by
The full construction of a single-block transformer language model under this second method is shown in Figure 4 (Section D.2), and we give its formal definition in Section D.1. Each parameter now corresponds directly to a single edge: GMT-P thus avoids both disadvantages of GMT-GL described above: it is more compact, and a weight-level task on the model is equivalent to an edge-level task on the resulting graph.
Node and edge features. For both constructions, each node is attributed with features encoding the index of the node-layer it belongs to (for instance, the graph of Figure 3 has 7 node-layers) together with its type, i.e. the network component it originates from: MHA head, MLP hidden unit etc. Each edge has features encoding its type, i.e., weight edge or a coupling edge, and its weight (if any). These encodings are necessary to break unwanted symmetries of the graph like permutation of nodes across different node-layers or types, which do not correspond to the symmetry of the original transformer.
Theorem 2 (Symmetries as graph isomorphisms). Let and denote the graphs that GMT-GL and GMT-P respectively produce from weights . Then for any ,
where and denote the orbits of under (Equation (3)) and (Equation (6)) respectively, and denotes isomorphism of attributed graphs (i.e. a bijection of nodes preserving node features, edges, and edge features). For , the implication ( ) assumes that the per-head matrices of have full column rank.
Theorem 2, which we prove in Section B.2, states that our graphs represent the weights faithfully up to symmetry. The ( ) direction establishes invariance: weights related by a symmetry yield
Not to be confused with the transformer layer index .
isomorphic graphs, so any message-passing GNN is automatically invariant to (respectively ). The ( ) direction establishes separation: weights not related by a symmetry yield non-isomorphic graphs, so the construction discards no information beyond the symmetry itself. Note that the theorem concerns the graph representation, not the GNN: whether a particular GNN separates two non-isomorphic graphs depends on its expressive power [42].
Metanetwork architecture In practice, We take our graphs and feed them to a GNN. As the backbone, we employ GINE layers [15], extension of GIN [42] that incorporates edge features into the message-passing procedure along with updates to the edge features. Details on the architecture are in Section C.2.
4 Experiments
We evaluate our approach on three tasks, instantiated over two new datasets of transformer language models. These gather populations differing in architecture, training mixture, and fine-tuned components (see Section C.1). To the best of our knowledge, this is the first systematic application of weight-space learning to models of this type and scale. We will release our dataset to support future research.
Baselines. We compare GMT-GL and GMT-P against three families of baselines: (i) the graph construction of Lim et al. [20] and Kofinas et al. [18], which treat multi-head attention identically and are thus reported as a single baseline, ‘GMN’; (ii) the equivariant metanetwork of Tran et al. [35], denoted ‘NFN-T’, which captures the general-linear symmetries but is tied to a single, fixed transformer architecture, so we compare against it only on a sub-population of models sharing one architecture; and (iii) two baselines that discard the transformer structure and operate on the flattened parameter vector: an MLP, also trained with data augmentations (MLP+Aug), and DeepSets [43], which treats the parameters as a permutation-invariant set. See Section C.2 for more details on architectures and baselines.
4.1 Corpus-Mixture Prediction
Setup. Our first task is to predict, from a model’s weights, the proportions of the corpora it was trained on. We use a population of small language models with 90K–150K parameters, each trained on a mixture of three corpora, Shakespeare [17], TinyStories [6], and Wikipedia [25], drawn at model-specific proportions, e.g., (80%, 15%, 5%). This constitutes the prediction target, and is a property of the whole model, invariant to the weight-space symmetry group (Equation (3)). We pose the task as a regression onto the probability simplex and report the KL divergence and MAE between the predicted and true mixtures.
Results in Table 2 show a wide gap between the flat-weight baselines and the graph-based models: DeepSets and MLP are largely outperformed, even when augmentations are used to compensate for the MLP's lack of invariance (see Section C.2). Among graph-based models, the two GMT variants perform similarly and clearly outperform GMN; this gap holds across metrics and quantity of available training data (see Figure 2 and paragraph below). On the fixed-architecture sub-population (Table 3), both variants also substantially outperform NFN-T.
Table 2: Performance of all methods on the corpus-mixture prediction task (Section 4.1).
| Method | KL | MAE |
|---|---|---|
| Flat weight vector baselines | ||
| DeepSets | ||
| MLP | ||
| MLP+Aug | ||
| Graph constructions | ||
| GMN | ||
| GMT-P (ours) | ||
| GMT-GL (ours) | ||
Table 3: Performance comparison against NFN-T [35] over a subset of 500 homogeneous architectures from the corpus-mixture dataset (Section 4.1).
| Method | KL | MAE |
|---|---|---|
| NFN-T | ||
| GMT-P (ours) | ||
| GMT-GL (ours) |

Figure 2: Test KL divergence on corpus-mixture prediction, evaluated as a function of training set size and across ablations of the (un)embedding components.
Ablating embedding and unembedding. GMN encodes the final transformer classification layer but, unlike GMT, not the token embedding. To test whether this explains the performance gap, and to what extent the embedding and unembedding modules are predictive for the pretraining mix, here, we ablate both this two components from all inputs. We additionally vary the training set size to assess sample efficiency and report resultst in Figure 2. The ablation degrades all models, confirming that (un)embedding components carry a non-negligible part of the predictive signal. GMT still clearly outperforms GMN in both settings and across data regimes; in fact, without the
Table 4: Results on fine-tuning detection (Section 4.2).
| Method | ROC-AUC | Macro-F1 | Accuracy |
|---|---|---|---|
| MLP | 0.6237 | 0.3333 | 0.5 |
| MLP+Aug | 0.5891 | 0.3333 | 0.5 |
| DeepSets | 0.5777 | 0.3333 | 0.5 |
| GMN | 0.9359 | 0.8370 | 0.8374 |
| GMT-P (ours) | 0.9495 | 0.8473 | 0.8475 |
| GMT-GL (ours) | 0.9557 | 0.8611 | 0.8613 |
unembedding, GMN no longer benefits from more training data (dashed blue line). This confirms the importance of the additional inductive biases captured by our constructions.
4.2 Fine-tuning Detection
Setup. Our task deals with detecting whether a model has been finetuned. We construct a second dataset consisting of 4,000 transformer language models with 3M–5M parameters, all trained on TinyShakespeare [17]; half are subsequently LoRA fine-tuned on Wikipedia [25]. To make the problem harder and the population more diverse, fine-tuning adapts only a random subset of each model's weight matrices. Here the label is attached to the whole model, so this is again an invariant task. As customary, the embedding and unembedding modules are not fine-tuned, so we omit their parameters and corresponding graph components in these experiments.
Results are reported in Table 4 in terms of accuracy, macro-F1 and ROC-AUC. The MLP and DeepSets baselines still largely underperform. On the contrary, the graph-aware models generally obtain strong performance, with our GMT models outperforming GMN. Best performance is obtained, in particular, by the GMT-GL variant.
4.3 Weight-level Fine-tuning Detection
Setup. Our third task asks not only whether a model was fine-tuned, but which of its weights were updated. We reuse the fine-tuned models of Section 4.2: since only a random subset of their weight matrices was adapted, each contains both updated and untouched weights. The target is now attached to each parameter rather than to the whole model, making this an equivariant task. In GMT-P every weight is a single edge, so the task becomes edge-level binary classification, and GMT-GL is excluded, as its edges do not always correspond to individual weights. Flat-weight baselines are adapted to predict one label per parameter. As most weights are untouched, we report macro-F1 as primary metric, alongside accuracy and ROC-AUC.
Results are reported in Table 5, and show that our GMT-P model outperforms all other baselines, marking an absolute gap of 5% in terms of Macro-F1 w.r.t. the GMN runnerup. The flat-weight baselines again trail the graph-based models by a wide margin.
5 Conclusions
We proposed GMT, a graph metanetwork for transformer language models. We formalized a symmetry group of a complete decoder-only model, combining residual-stream, feed-forward, head, vocabulary permutations and general-linear symmetries of attention. We proposed a graph construc-
Table 5: Weight-lv fine-tuning detection (Section 4.3).
| Method | Macro-F1 | ROC-AUC | Accuracy |
|---|---|---|---|
| MLP | 0.4314 | 0.5606 | 0.7587 |
| MLP+Aug | 0.5260 | 0.7797 | 0.7593 |
| DeepSets | 0.4313 | 0.5502 | 0.7586 |
| GMN | 0.9043 | 0.9743 | 0.9043 |
| GMT-P (ours) | 0.9520 | 0.9926 | 0.9520 |
tion which, unlike earlier approaches, uses parameter-free coupling edges and head nodes so that its isomorphisms match the aforementioned group: we showed that, under mild rank conditions, two models yield isomorphic graphs iff they are related by one such group element. A standard GNN is thus invariant to it by construction, for any depth, width, and number of heads. We proposed two variants: GMT-GL captures the full group, while GMT-P restricts the general-linear symmetries to permutations in exchange for a more compact graph with one edge per parameter, also enabling weight-level tasks. On two new populations of language models, GMT outperforms existing baselines on corpus-mixture prediction and on model- and weight-level fine-tuning detection, and its advantage over prior graph metanetworks persists across training set sizes.
Limitations and future work. is not maximal: e.g. scaling and sign symmetries of some activations are left untreated and could be handled. Our experiments are limited to models of a few million parameters; scaling to much larger models will likely require tailored graph learning approaches. Finally, our tasks are small-scale proxies for auditing questions; we hope our datasets encourage progress towards provenance and modification analysis of real-world open-weight models, as well as other equivariant applications such as weight editing.
Acknowledgements
Fabrizio Frasca conducted this work supported by an Aly Kaufman Post-Doctoral Fellowship. Haggai Maron is supported by the Israel Science Foundation through a personal grant (ISF 264/23) and an equipment grant (ISF 532/23), and by the Career Advancement Chairs in Artificial Intelligence - Schmidt Futures.
References
[1] Samuel K Ainsworth, Jonathan Hayase, and Siddhartha Srinivasa. Git re-basin: Merging models modulo permutation symmetries. arXiv preprint arXiv:2209.04836, 2022.
[2] Michael M Bronstein, Joan Bruna, Taco Cohen, and Petar Veličković. Geometric deep learning: Grids, groups, graphs, geodesics, and gauges. arXiv preprint arXiv:2104.13478, 2021.
[3] Taco Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning, pages 2990–2999. PMLR, 2016.
[4] Taco S Cohen, Mario Geiger, Jonas Köhler, and Max Welling. Spherical cnns. arXiv preprint arXiv:1801.10130, 2018.
[5] Gabriel Eilertsen, Daniel Jönsson, Timo Ropinski, Jonas Unger, and Anders Ynnerman. Classifying the classifier: dissecting the weight space of neural networks. In ECAI 2020: 24th European Conference on Artificial Intelligence, 29 August–8 September 2020, Santiago de Compostela, Spain–Including 10th Conference on Prestigious Applications of Artificial Intelligence (PAIS 2020), pages 1119–1126. SAGE Publications 1 Oliver's Yard, 55 City Road, London, EC1Y 1SP, 2020.
[6] Ronen Eldan and Yuanzhi Li. Tinystories: How small can language models be and still speak coherent english? arXiv preprint arXiv:2305.07759, 2023.
[7] Rahim Entezari, Hanie Sedghi, Olga Saukh, and Behnam Neyshabur. The role of permutation invariance in linear mode connectivity of neural networks. arXiv preprint arXiv:2110.06296, 2021.
[8] Carlos Esteves, Christine Allen-Blanchette, Ameesh Makadia, and Kostas Daniilidis. Learning so (3) equivariant representations with spherical cnns. In Proceedings of the european conference on computer vision (ECCV), pages 52–68, 2018.
[9] Marc Finzi, Max Welling, and Andrew Gordon Wilson. A practical method for constructing equivariant multilayer perceptrons for arbitrary matrix groups. In International conference on machine learning, pages 3318–3328. PMLR, 2021.
[10] Charles Godfrey, Davis Brown, Tegan Emerson, and Henry Kvinge. On the symmetries of deep learning models and their internal representations. Advances in Neural Information Processing Systems, 35:11893–11905, 2022.
[11] Xiaolong Han, Zehong Wang, Bo Zhao, Binchi Zhang, Jundong Li, Damian Borth, Rose Yu, Haggai Maron, Yanfang Ye, Lu Yin, et al. A survey of weight space learning: Understanding, representation, and generation. arXiv preprint arXiv:2603.10090, 2026.
[12] Jason Hartford, Devon Graham, Kevin Leyton-Brown, and Siamak Ravanbakhsh. Deep models of interactions across sets. In International Conference on Machine Learning, pages 1909–1918. PMLR, 2018.
[13] Robert Hecht-Nielsen. On the algebraic structure of feedforward network weight spaces. In Advanced Neural Computers, pages 129–135. Elsevier, 1990.
[14] Edward J. Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=nZeVKeeFYf9.
[15] Weihua Hu, Bowen Liu, Joseph Gomes, Marinka Zitnik, Percy Liang, Vijay Pande, and Jure Leskovec. Strategies for pre-training graph neural networks. arXiv preprint arXiv:1905.12265, 2019.
[16] Ioannis Kalogeropoulos, Giorgos Bouritsas, and Yannis Panagakis. Scale equivariant graph metanetworks. In A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang, editors, Advances in Neural Information Processing Systems, volume 37, pages 106800–106840. Curran Associates, Inc., 2024. doi: 10.52202/079017-3391. URL https://proceedings.neurips.cc/paper_files/paper/2024/file/c13d5a10028586fdc15ee7da97b7563f-Paper-Conference.pdf.
[17] Andrej Karpathy. char-rnn. https://github.com/karpathy/char-rnn, 2015.
[18] Miltiadis Miltos Kofinas, Boris Knyazev, Yan Zhang, Yunlu Chen, Gertjan J Burghouts, Efstratios Gavves, Cees G Snoek, and David Zhang. Graph neural networks for learning equivariant representations of neural networks. In International Conference on Learning Representations, volume 2024, pages 45363–45381, 2024.
[19] Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. In International conference on machine learning, pages 2747–2755. PMLR, 2018.
[20] Derek Lim, Haggai Maron, Marc T Law, Jonathan Lorraine, and James Lucas. Graph metanetworks for processing diverse neural architectures. In B. Kim, Y. Yue, S. Chaudhuri, K. Fragkiadaki, M. Khan, and Y. Sun, editors, International Conference on Learning Representations, volume 2024, pages 11430–11458, 2024. URL https://proceedings.iclr.cc/paper_files/paper/2024/file/2feafd84b23a52b3fa434bc6d7682256-Paper-Conference.pdf.
[21] Yewei Liu, Xiyuan Wang, and Muhan Zhang. Meta pruning via graph metanetworks: A meta learning framework for network pruning. arXiv preprint arXiv:2506.12041, 2025. URL https://arxiv.org/abs/2506.12041.
[22] Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks. Advances in neural information processing systems, 32, 2019.
[23] Haggai Maron, Heli Ben-Hamu, Nadav Shamir, and Yaron Lipman. Invariant and equivariant graph networks. In International Conference on Learning Representations, 2019.
[24] Haggai Maron, Or Litany, Gal Chechik, and Ethan Fetaya. On learning sets of symmetric elements. In International conference on machine learning, pages 6734–6744. PMLR, 2020.
[25] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In ICLR, 2017.
[26] Aviv Navon, Aviv Shamsian, Idan Achituve, Ethan Fetaya, Gal Chechik, and Haggai Maron. Equivariant architectures for learning in deep weight spaces. In International Conference on Machine Learning, pages 25790–25816. PMLR, 2023.
[27] Theo Putterman, Derek Lim, Yoav Gelberg, Stefanie Jegelka, and Haggai Maron. Learning on loras: Gl-equivariant processing of low-rank weight spaces for large finetuned models. arXiv preprint arXiv:2410.04207, 2024.
[28] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652–660, 2017.
[29] Siamak Ravanbakhsh, Jeff Schneider, and Barnabas Poczos. Equivariance through parameter-sharing. In International conference on machine learning, pages 2892–2901. PMLR, 2017.
[30] Konstantin Schürholt, Dimche Kostadinov, and Damian Borth. Self-supervised representation learning on neural network weights for model characteristic prediction. In Advances in Neural Information Processing Systems, volume 34, 2021.
[31] Konstantin Schürholt, Michael W. Mahoney, and Damian Borth. Towards scalable and versatile weight space learning. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 43947–43966, 2024.
[32] Alexander Theus, Alessandro Cabodi, Sotiris Anagnostidis, Antonio Orvieto, Sidak Pal Singh, and Valentina Boeva. Generalized linear mode connectivity for transformers. arXiv preprint arXiv:2506.22712, 2025.
[33] Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018.
[34] Viet-Hoang Tran, Thieu N. Vo, Tho Tran-Huu, An T. Nguyen, and Tan M. Nguyen. Monomial matrix group equivariant neural functional networks. In Advances in Neural Information Processing Systems, volume 37, 2024.
[35] Viet-Hoang Tran, Thieu N. Vo, An Nguyen, Tho-Huu Tran, Minh-Khoi Nguyen-Nhat, Thanh Tran, Duy-Tung Pham, and Tan Nguyen. Equivariant neural functional networks for transformers. In International Conference on Learning Representations, 2025.
[36] Thomas Unterthiner, Daniel Keysers, Sylvain Gelly, Olivier Bousquet, and Ilya Tolstikhin. Predicting neural network accuracy from weights. arXiv preprint arXiv:2002.11448, 2020.
[37] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in Neural Information Processing Systems, 30, 2017.
[38] Thieu Vo, Hoang V. Tran, Tho Tran Huu, An Nguyen The, Thanh Tran, Minh-Khoi Nguyen-Nhat, Duy-Tung Pham, and Tan Minh Nguyen. Equivariant polynomial functional networks. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pages 61689–61744, 2025.
[39] Renhao Wang, Marjan Albooyeh, and Siamak Ravanbakhsh. Equivariant networks for hierarchical structures. Advances in Neural Information Processing Systems, 33:13806–13817, 2020.
[40] Zhangyang Wang, Peihao Wang, and Kai Wang. Position: Weight space should be a first-class generative ai modality. arXiv preprint arXiv:2605.18632, 2026.
[41] Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. Advances in Neural information processing systems, 31, 2018.
[42] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
[43] Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan Salakhutdinov, and Alexander Smola. Deep sets. Advances in Neural Information Processing Systems, 30, 2017.
[44] Allan Zhou, Kaien Yang, Kaylee Burns, Adriano Cardace, Yiding Jiang, Samuel Sokota, J. Zico Kolter, and Chelsea Finn. Permutation equivariant neural functionals. In Advances in Neural Information Processing Systems, volume 36, 2023.
[45] Allan Zhou, Kaien Yang, Yiding Jiang, Kaylee Burns, Winnie Xu, Samuel Sokota, J. Zico Kolter, and Chelsea Finn. Neural functional transformers. In Advances in Neural Information Processing Systems, volume 36, 2023.
[46] Allan Zhou, Chelsea Finn, and James Harrison. Universal neural functionals. In Advances in Neural Information Processing Systems, volume 37, 2024.
A Extended related work
Equivariant neural networks. Designing neural architectures that are invariant or equivariant to input symmetries is a central theme of geometric deep learning [2], with examples ranging from group-equivariant and steerable CNNs [3, 41] and rotation-equivariant models [4, 8, 33] to general constructions [9, 19, 29]. Most relevant to weight spaces are permutation-equivariant models for sets [12, 24, 28, 43] and graphs [22, 23].
Weight-space learning. Neural network weights have long been known to admit symmetries [10, 13], which have been exploited for model alignment and merging [1, 7]. Following early symmetry-agnostic methods [5, 30, 31, 36], equivariant metanetworks were designed for the neuron permutations of MLPs and CNNs [26, 44, 45], and extended to arbitrary permutation-symmetric weight spaces [46] and to scaling and sign symmetries [16, 34, 38]; see Han et al. [11] for a survey. Graph metanetworks [18, 20], which we build on, encode networks as graphs processed by GNNs.
Transformer weight spaces. The general-linear symmetries of attention have been studied for linear mode connectivity [32], and analogous symmetries for processing low-rank adapters [27]. Tran et al. [35] design layers equivariant to the attention symmetries, but for a single, fixed architecture. Previously proposed graph metanetworks encode attention layers without the general-linear symmetries and without a faithful head structure. Lim et al. [20] suggest, but do not use, head-index features, which would, either way, violate the head-permutation symmetry; Kofinas et al. [18] share nodes across the query, key, and value projections of all heads, tying the query-key and value-output permutations and admitting spurious exchanges of dimensions across heads. None of these works addresses the symmetries of a complete language model, including its embedding and unembedding.
B Theorems proofs
B.1 Proof of Theorem 1
Throughout this section we fix the architecture of Section 3.1: decoder-only transformer with L blocks, H heads per block, embedding dimension d, head dimensions , , feed-forward hidden width and vocabulary size V.
Notation and conventions. For we write , we identify a permutation with the permutation matrix and we write for the set of such matrices. We denote as the all-ones vector. We write for the entrywise product, for the pointwise nonlinearity of the feed-forward sub-layer.
The forward pass. Let be a sequence of tokens and let be its one-hot matrix, where . Given weights , the network computes the following sequence of activations. Defining the norm applied to each row as
Norm(x; , ) = , we have
(1) embedding:
(2) pre-attn. norm:
(3a) attention scores:
(3b) attention:
(4) pre-FF norm:
(5) feed-forward:
(6) final norm:
(7) unembedding:
for , where Equations (8) to (12) are iterated in this order, softmax is applied to each row separately. Thus maps a token sequence to the next-token distributions it induces, one per position; the usual next-token distribution is its last row.
Proof of the theorem
Let , and let with the group action given by Table 1. Fix a token sequence of arbitrary length and let , be the same sequence read in the relabeled dictionary according to the embedding row permutation of the embedding matrix . We denote unprimed symbols as the activations Equations (7) to (14) produced by on , and primed symbols those produced by on . We walk through the forward pass produced by and show it outputs the same next-token distributions as , up to the permutation of the vocabulary dictionary.
(1) Embedding. Notice the embedded vectors produced by equals the embedded vectors produced by w after applying the column permutation , which will be used as input to the next sub-layer:
(2) Pre-attention normalization. Since Norm acts on each row separately, we get:
Which is true since are permutation invariant, therefore unchanged when computed on rather than .
(3a) Attention scores. We write (the head permutation of ) and abbreviate , . We get for each head that the attention logits are:
(17)
Meaning the attention pattern of slot h in the transformed network is thus, entry for entry, that of head in the original one.
(3b) Attention. Here we have the exact same cancellation between the and matrices, and between the and matrices, which gives , therefore we get that the output of the attention sub-layer is exactly:
(4) Pre-feed-forward normalization. Identical to step (2), applied now to the output of Equation (18):
(5) Feed-forward. since (the pointwise non-linearity) commutes with we can substitute the attention output into Equation (12) to get:
(20)
(6) Final normalization. We have step (2) once more, with and , gives .
(7) Unembedding. The unembedding simply gives:
hence:
B.2 Proof of Theorem 2
Proof overview. The proof is constructed as follows. We start by formally defining an isomorphism and an automorphism of a directed attributed multigraph, the kind of graph produced by our constructions, and the graph of a transformer without the weights on its edges, which is exactly the same for all transformers. Next, in (Lemma 1) we describe the set of all automorphisms of a transformer's graph in which the model's weights are excluded from the edge attributes, i.e. every edge keeps its type but not its weight. Intuitively, these automorphisms describe how elements such as coupling edges, node heads, and node attributes, limit a bijection from being an automorphism of our graph construction. Then, in (Lemma 2) we describe how such an automorphism acts on the weight matrices sitting on the edges of the graph: it is an isomorphism from the graph of one transformer to the graph of another if and only if the weight matrices of the second are those of the first, with their rows and columns permuted according to the automorphism. Once all the above is established, we move on to prove the theorem itself. Starting with two weight configurations of the same orbit, we build from the group element relating them an automorphism of the weightless graph, and show by Lemma 2 that it is an isomorphism between the two graphs they generate, proving these are isomorphic. Then, given two isomorphic transformers' graphs, we first note that any isomorphism between them must also be an automorphism of the transformer's graph without the weights on the edges, since two transformers' graphs are entirely identical except for the weights on their edges. By Lemmas 1 and 2, the weight matrices of the two transformers are then related by the node permutations of this automorphism, from which we build a group element relating the two transformers, i.e. they belong to the same orbit (for GMT-GL, the general-linear components of this element are recovered from the products of the attention matrices, under a full-rank assumption on these matrices). We carry out this plan for GMT-GL (Section B.2.1), and then describe the modifications each step requires for GMT-P (Section B.2.2). Both constructions share the preliminaries below.
Directed attributed multigraphs. The graphs produced by our constructions are directed, carry attributes on both their nodes and their edges, and may join the same pair of nodes by more than one edge (e.g. a weight edge and a coupling edge), though there are no two edges with the same source, target, and attributes. We therefore define isomorphisms and automorphisms for this kind of graph.
Definition 1 (Isomorphism of directed attributed multigraphs). A directed attributed multigraph consists of a finite set of nodes , a map assigning to every node a tuple of node attributes , and a set of edges , where every edge is a triple of its source node , its target node , and the tuple of its edge attributes; several edges may join the same ordered pair of nodes, provided they carry different attributes. Let and be directed attributed multigraphs. An isomorphism from to is a bijection of the nodes such that
-
for every node , the nodes and have exactly the same node attributes, ;
-
for all nodes and every tuple of edge attributes , the edge exists in if and only if the edge exists in .
G and are isomorphic, written , if there is an isomorphism from G to .
Definition 2 (Automorphism of a directed attributed multigraph). Let be a directed attributed multigraph. An automorphism of is an isomorphism from to itself (Definition 1), i.e. a permutation of the nodes that preserves the node attributes and the edges of , together with their directions and attributes.
Conventions. Throughout the proof, the architecture, i.e. and , is fixed, as it is in the definition of (Equation (1)), and we use the notation of Section B.1. Given , we mark the parameters of a second weight configuration with a prime, e.g. or , and write for the orbit of . The permutation matrix of is .
Encodings. We write for either or when a statement holds for both. Their nodes and edges carry the encodings of Section 3.2:
(i) Every node v carries the encoding . All nodes of a node layer share their layer index and type, and different node layers have different layer indices, except that the H per-head copies of a node layer within one block share their layer index and type. The scale node g and the shift node s of a normalization layer have different types.
(ii) Every edge carries the encoding . The edges of a fully-connected edge set (Equation (4)), which we call weight edges, share a type corresponding to the weight matrix they represent, and their weights are the corresponding entries of . This type does not depend on the head, so the corresponding edge sets of different heads in one block have the same type. The edges of a coupling edge set (Equation (5)) have type coupling, and the edges joining a head node to its head (GMT-GL only) have type head; these parameter-free edges carry a fixed weight.
The graph without the weights.
Definition 3 (Weightless graph). Given , the weightless graph of is the graph obtained from by excluding the weights from the edge attributes: it has the same nodes and node encodings as , and an edge for every edge of . By the graph construction (Section 3.2), the nodes of , their encodings, and the endpoints and types of its edges are determined by the architecture alone, and only the weights on its edges depend on . Hence, the weightless graphs of all are exactly the same graph, an importantly, not up to a permutation of the nodes, i.e. they have exactly the same list of node encodings and exactly the same adjacency matrix for every edge type. From now on, we denote this weightless graph by , and by or when referring to a specific construction. Consequently, every graph is the weightless graph with a weight attached to each of its edges.
B.2.1 GMT-GL
The graph . We first characterize all nodes and edges of this construction compactly in Table 6.
Table 6: Node layers and edge sets of , for every block and head , grouped by the network component they represent and numbered as in Table 1. The residual layers are the layers of block in Section 3.2, which we denote here differently to conveniently account for the nodes of different blocks. The nodes are named and , with the head node of head . The attention products are and , and is the matrix with rows and . Fully-connected edge sets consist of weight edges, coupling edge sets have type coupling, and the edges joining to its head have type head.
| Component | Node layers | Weight edges | Parameter-free edges |
|---|---|---|---|
| (1) Embedding | |||
| (2) Pre-attn. norm | |||
| (3) Attention | |||
| (4) Pre-MLP norm | |||
| (5) Feed-forward | |||
| (6) Final norm | |||
| (7) Unembedding |
Automorphisms of the graph without the weights. We first describe the set of all automorphisms of the weightless graph . By Definitions 1 and 2, these are the bijections that preserve the node encodings and the typed edges: for every edge type , there is an edge of type from u to v if and only if there is an edge of type from to .
Lemma 1. A bijection is an automorphism of the weightless graph if and only if there are permutations , and, for every block , and , such that fixes every normalization node and, for all blocks , heads , and indices ,
(23)
We denote this map by , where .
That is, an automorphism of the weightless graph consists of one vocabulary permutation shared by both embedding and unembedding layers, one feature permutation shared by all residual and per-head layers, and, in every block, a permutation of the heads and a permutation of the hidden neurons.
Proof. We first show that every automorphism of has this form, and then that every map of this form is an automorphism of . Let be an automorphism of ; we go over the graph layer by layer, following the components of Table 6.
Before investigation every layer, describe how node types limits the automorphism and how different connectivity patterns constrain the action of an automorphism on the nodes.
Encodings. Since preserves the node encodings, it maps every set of nodes sharing one encoding into itself, and hence onto itself, as is injective and the set is finite. By (i), these sets are , , every , every , every normalization node by itself, and, for every block , the union of its per-head layers and the set of its head nodes. When maps a node layer onto a node layer , we call the permutation with the index permutation of on . Fully-connected edge sets join every node of one layer to every node of another, so they impose no constraint beyond the encodings; the constraints come from the coupling and head edges.
Coupled layers share their index permutation. Let be a coupling edge set, and suppose that maps and onto node layers and that are joined by the coupling edge set , with index permutations and . The coupling edge is mapped to , which must be a coupling edge as well. Since the only coupling edges from to are those of , which join nodes of equal index, for all , i.e. .
We now determine F on every component of the graph.
(1) Embedding. By the encodings, maps and onto themselves; let and be its index permutations on these node layers. Since there is only a fully connected edge set joining to , there are no constraints on and beyond the encodings. Later on, we show that these two permutations are shared by the unembedding layer and all residual and per-head layers.
(2) Pre-attention normalization. Each of and is the only node with its encoding, so F fixes both.
We treat the blocks in order, , assuming that the index permutation of on the input layer of block is and prove it via induction. For , this is the definition of , then for any we assume it is true, and later prove it also holds for .
(3) Attention. By the encodings, permutes the head nodes of block , for some . The head node is connected to the nodes of and only to them. Hence, for every , the head edge is mapped to , which must be a head edge as well, so . Thus maps onto, ; that is, the head node forces the nodes of its head to move together to a single head, rather than each of them being moved to a head of its own. Next, is coupled to , and maps these two layers onto and , which are coupled as well. Hence the index permutation of on is that on , namely , i.e. . Finally, the attention output is coupled to by the residual connection, so its index permutation is as well.
(4) Pre-MLP normalization. As in (2), and are fixed.
(5) Feed-forward. Let be the index permutation of on ; only fully-connected edge sets are incident to , so it is not constrained further. The layer is coupled to by the residual connection, so its index permutation is . As is the input layer of block , this completes the induction that states that for each , .
(6) Final normalization. As in (2), and are fixed.
(7) Unembedding. The layer is coupled to , so its index permutation is .
We have now determined F on every node of the graph, and it acts as in Equation (23), i.e. .
Conversely, let be as in Equation (23). It clearly maps every node to a node with the same encoding (which is constructed of type and layer), which is the first condition of Definition 1. Moving on to the edges, we first note that maps every node layer to a node layer of the same layer and type, then since a weight edge is part of a fully connected edge set, clearly the mapped edge also exists and of the same type. Next, for coupling edges, we have already shown that the index permutation of is the same on both layers joined by a coupling edge set, hence the mapped edge also exists and of the same type. Finally, for head edges, the head node of a head is mapped to the head node of another head, together with all nodes associated with that head, so again the mapped edge also exists and of the same type. After considering all nodes and edges, we see that by definition is indeed an automorphism of .
The action of an automorphism on the weights. Next, we describe how an automorphism of the weightless graph acts on the weight matrices, and consequently, under what conditions it is an isomorphism between the graphs of two transformers. sitting on the edges of the graph.
From now, we sometimes use the shorthand and for the query-key and value-output products of head in block of .
Lemma 2. Let , and let be as in Lemma 1. Then is an isomorphism from to if and only if
(24)
for every block and head .
Proof. By Lemma 1, is an automorphism of , which by Definition 3 is the weightless graph of both and . Hence maps every node to a node with the same encoding, which is the first condition of Definition 1, and it maps the edges of one-to-one onto the edges of , each to an edge of the same type. The second condition of Definition 1 therefore holds if and only if every edge of is mapped to an edge of that carries the same weight. The parameter-free edges carry the same fixed weight in both graphs, so it remains to consider the weight edges. Consider a fully-connected edge set of , let map onto and onto , with index permutations and , and let be the matrix carried by the edge set from to in . The edge , which carries the weight , is mapped to the edge , which carries the weight . Hence the weights on this edge set are preserved if and only if for all , that is:
We apply Equation (25) to every weight edge set of Table 6, reading the index permutations off Equation (23):
(1) Embedding. E sits between and , giving . Concretely, the edge , which carries , is mapped to the edge , which carries .
(2) Pre-attention normalization. sits between , whose two nodes are fixed (permutation matrix ), and , giving .
(3) Attention. sits between and , which maps onto with index permutation . In , the edge set from to carries , giving , i.e. for . Likewise, sits between (mapped onto , ) and , giving .
(4) Pre-MLP normalization. As in (2), with .
(5) Feed-forward. sits between and , and between and , giving and .
(6) Final normalization. As in (2), with .
(7) Unembedding. F sits between and , giving .
These are exactly the equations of Equation (24), so is an isomorphism from to if and only if they hold.
Proof of Theorem 2 for GMT-GL. We now prove the two directions of the theorem for GMT-GL.
First direction: transformers from the same orbit generate isomorphic graphs. Let and , and write ; we build an isomorphism from to . Let , , , and , be the components of (Table 1), and let , and be permutations such that , and . We define
i.e. in Lemma 1, so that the matrices , , and the head permutations associated with in Lemma 2 are exactly the permutation components of . By Lemma 1, is an automorphism of , and we now verify that and satisfy Equation (24). By rows (1), (2) and (4)-(7) of Table 1, , , for every normalization layer, and , which are the first two lines of Equation (24). For the attention, fix and , let , and abbreviate and . By row (3) of Table 1, the products of head in block of are
(\mathbf{M}^{h,\ell})^{\prime}=(\mathbf{W}^{q,h,\ell})^{\prime}(\mathbf{W}^{k,h,\ell})^{\prime}^{\top}=(P_{d}^{\top}\mathbf{W}^{q,j,\ell}G_{q k})(G_{q k}^{-1}(\mathbf{W}^{k,j,\ell})^{\top}P_{d})=P_{d}^{\top}\mathbf{M}^{j,\ell}P_{d},since the general-linear factors cancel; this is the last line of Equation (24). Hence, by Lemma 2, is an isomorphism from to , and . Note that the general-linear components of play no role in : they cancel in the products of the attention matrices, which is all that the graph carries.
Recovering the attention matrices from their products. For the second direction, we need to account for the general-linear symmetry, and recover the individual attention matrices from their products, up to this symmetry. This is possible under the following full-rank assumption on w, which makes the assumption of Theorem 2 precise:
i.e. have full column rank and has full row rank. This requires , as in standard architectures.
Lemma 3. Let have rank , and satisfy . Then there is such that and .
Proof. Since has rank , the matrix is invertible. Multiplying on the right by gives
\mathbf{A}^{\prime}=\mathbf{A}G,\qquad G=\mathbf{B}^{\top}\mathbf{B}^{\prime}(\mathbf{B}^{\prime}^{\top}\mathbf{B}^{\prime})^{-1}\in\mathbb{R}^{r\times r},and is invertible, since . Substituting back gives . Since has rank , the matrix is invertible, and multiplying on the left by gives , i.e. .
Second direction: isomorphic graphs are generated by transformers from the same orbit. Let , where satisfies Equation (26) and ; we prove that . Let be an isomorphism from to .
First, by Definition 3, the weightless graphs of and are exactly the same graph , and not merely up to a permutation of the nodes. Therefore, it must be that is an automorphism of the weightless graph , since are just the graph with additional weight attribute over the edges.
Now, by Lemma 1, for some , and by Lemma 2, and satisfy Equation (24), with , , and . It remains to build from a group element with . We take the permutation components of to be , and, for every block, and . Then the first two lines of Equation (24) are rows (1), (2) and (4)–(7) of Table 1, and it remains to find general-linear components of for which row (3) holds; these are recovered from the last line of Equation (24) using Lemma 3.
Fix and , and let . For the query-key pair, apply Lemma 3 with and
Here A and B have rank by Equation (26), as is invertible, and
\mathbf{A}^{\prime}\mathbf{B}^{\prime}^{\top}=(\mathbf{M}^{h,\ell})^{\prime}=P_{d}^{\top}\mathbf{M}^{j,\ell}P_{d}=\mathbf{A}\mathbf{B}^{\top}.The latter product has rank , and since , also and have rank ; that is, the full-rank assumption on carries over to . The lemma yields with
For the value–output pair, apply Lemma 3 with and , , and , for which again , and all four matrices have rank by the same argument. It yields with
As ranges over , so does , exactly once; hence every and is defined exactly once. These equations are row (3) of Table 1. Hence for the element with components , and, for every block, , and , i.e. and belong to the same orbit. This completes the proof of the GMT-GL part of Theorem 2.
B.2.2 GMT-P
We follow the same plan used with GMT-GL, and describe the modifications each step requires.
The graph . The graph coincides with in components (1), (2) and (4)–(7) of Table 6, i.e. outside the attention sub-layers. In the attention of block there are no head nodes and no product matrices. Instead, every head has three node layers, , and , and every attention matrix sits on its own weight edge set:
where an arrow denotes the fully-connected edge set . The coupling edge sets and are as in GMT-GL. By (i), the encoding classes inside the attention of block are , and ; all other encoding classes are as in GMT-GL. As in GMT-GL, every ordered pair of nodes is joined by at most one edge of every type, and the preliminaries, including Definition 3, apply; the weightless graph of this construction is .
Automorphisms of the graph without the weights
Lemma 4. A bijection is an automorphism of the weightless graph if and only if there are permutations , and, for every block , , and, for every head , and , such that fixes every normalization node, acts on the nodes as in Equation (23), and
We denote this map by , where .
Compared to GMT-GL, the only additional freedom is an independent permutation of the query-key nodes per head, and of the value-output nodes per head.
Proof. We follow the proof of Lemma 1. Steps (1), (2) and (4)–(7), as well as the part of step (3) concerning , only involve the encodings and the coupling edge sets between vocabulary and residual layers, which are unchanged. It remains to redo the per-head layers of step (3), where the head nodes are now absent; their role is played by the weight edges inside each head.
Fix a block . The three kinds of per-head layers have different layer indices, so by the encodings, maps each of the unions , and onto itself, and it remains to show that it does not split heads apart. The edges from to are exactly those of the fully-connected edge sets , : a node of has an edge to every node of , and to no node of for . Likewise, the edges from to are exactly those of the edge sets . Now fix a head , let , and let be the head with . For every , is an edge, so is an edge from to , i.e. ; hence maps into . Then, for every other and , the edge ends in , so ; and for every , the edge starts in , so . Thus maps the three layers of head into the corresponding layers of a single head, which we denote . Since is injective and the corresponding layers of all heads have equal sizes, is injective, hence , and maps every layer of head onto the corresponding layer of head . Let and be the index permutations of on and ; only fully-connected edge sets are incident to these layers, so they are not constrained further, independently for every head and block. On , the coupling edge set forces the index permutation , exactly as in GMT-GL. Hence has the structure of Equation (27), i.e. .
The converse is shown as in Lemma 1. Inside the attention, maps the four fully-connected edge sets of head onto those of head , which have the same types by (ii), and the coupling edge set onto , as both coupled layers have index permutation ; all other edges are treated as in Lemma 1.
The action of an automorphism on the weights. Given as in Lemma 4, we write , , and as for GMT-GL, and and .
Lemma 5. Let , and let be as in Lemma 4. Then is an isomorphism from to if and only if the first two lines of Equation (24) hold and, for every block and head , with ,
(28)
Proof. As in the proof of Lemma 2, is an isomorphism from to if and only if every weight edge set of , carrying a matrix between two layers on which has the index permutations and , is mapped onto an edge set of carrying (Equation (25)). Outside the attention sub-layers, the weight edge sets and the index permutations on their layers are as in GMT-GL, giving the first two lines of Equation (24). In the attention of block , maps the four weight edge sets of head onto those of head , with the following index permutations:
• , between ( ) and ( ): ;
• , between ( ) and ( ): (\mathbf{W}^{k,h,\ell})^\prime^\top = K_{j,\ell}^\top(\mathbf{W}^{k,j,\ell})^\top P_d, i.e. ;
• , between ( ) and ( ): ;
• , between ( ) and ( ): .
Since , these are the equations of Equation (28).
Proof of Theorem 2 for GMT-P. We now prove the two directions of the theorem for GMT-P, following the proof for GMT-GL.
First direction: transformers from the same orbit generate isomorphic graphs. Let and , and write ; we build an isomorphism from to . We name the components of as for GMT-GL. Since , its general-linear components are permutation matrices, and for unique and . We define
so that the matrices associated with in Lemma 5 are the components of , with and . By Lemma 4, is an automorphism of . By rows (1), (2) and (4)–(7) of Table 1, and satisfy the first two lines of Equation (24), exactly as for GMT-GL. For the attention, fix and , let , and abbreviate and . By row (3) of Table 1,
since permutation matrices are orthogonal, and ; this is Equation (28). Hence, by Lemma 5, is an isomorphism from to , and . In contrast to GMT-GL, the isomorphism now depends on the general-linear components of : their restriction to permutation matrices is realized by permuting the nodes of and .
Second direction: isomorphic graphs are generated by transformers from the same orbit. Let with ; we prove that . Let be an isomorphism from to . Since, by Definition 3, and have exactly the same weightless graph , the argument given for GMT-GL shows that is an automorphism of . By Lemma 4, for some , and by Lemma 5, and satisfy the first two lines of Equation (24) and Equation (28). It remains to build from a group element with . Let be the element with components , and, for every block, , , and ; its general-linear components are permutation matrices, so . The first two lines of Equation (24) are rows (1), (2) and (4)–(7) of Table 1, and since and , Equation (28) is row (3). Hence . In contrast to GMT-GL, every attention matrix sits on its own edge set, so the general-linear components are read off the node permutations directly, and no rank assumption is needed.
The two directions above prove that , for all . Together with the GMT-GL part, this completes the proof of Theorem 2.
C Experimental details
This section collects the details of our experiments (Section 4) that are not covered in the main text: the two transformer-population datasets, the architectures of all compared metanetworks, and the training and model-selection protocol.
C.1 Datasets
Both datasets are populations of small character-level, decoder-only transformer language models. All models are of the architecture of Section 3.1. Table 7 summarizes the two populations; we describe each in turn.
Table 7: Summary of the two transformer-population datasets.
| Corpus-mixture dataset | Fine-tuning dataset | |
|---|---|---|
| Number of models | 3,000 | 4,000 |
| Parameters per model | 91K–150K (mean 121K) | 3.8M–5.1M (mean 4.4M) |
| Vocabulary (characters) | 64 | 65 |
| Embedding dim. | 64 | 320 |
| Blocks | \{3, 5\} | 6 |
| Heads | \{1, 2, 4\} | \{1, 2, 4\} |
| FFN width | 64 | \{320, 640\} |
| Dropout | 0.05 | \{0.05, 0.1, 0.2\} |
| Training data | Shakespeare, TinyStories, Wikipedia | TinyShakespeare, then Wikipedia (LoRA) |
| Label(s) | corpus proportions | fine-tuned or not; per-weight matrix “moved” mask |
Corpus-mixture dataset. This dataset contains 3,000 transformers trained from scratch on mixtures of three text corpora: Shakespeare (the TinyShakespeare corpus; 17), TinyStories [6], and Wikipedia (WikiText-103; 25). Before training, we ensure that all corpora have the same size by the entire dataset of the smallest of the 3 (Shakespeare), and match the number of character in the other 2 dataset (wiki + stories). All three corpora are tokenized with a single, shared character-level vocabulary, consisting of the characters that occur in all three corpora. Each corpus is first divided into disjoint train, validation, and test segments (85%/7%/8% of the characters), and models only ever see the train segments of the corpora in their mixture.
Mixtures. For each model we draw a vector of corpus proportions uniformly over the simplex, and assemble the model's training text by sampling from the three corpora according to distribution vector. Hence models differ in what they were trained on but not in how much data they see. The resulting proportions are close to balanced on average (0.33 per corpus, ranging from below to above 0.97), and the dominant corpus is nearly uniformly distributed over the population.
Architectures. The population is architecturally diverse. The embedding dimension and the feedforward width are fixed, each model independently draws its number of blocks , its number of attention heads (so ). Models contain between 91,456 and 149,568 parameters ( on average).
Training. Every model is trained with next-character prediction (cross-entropy) using Adam with learning rate , weight decay , batch size 128, and a cosine learning-rate schedule, for at most 30 epochs with early stopping on the validation loss (patience 12); the random seed of each model is distinct (so models of identical architecture are initialized differently).
Fine-tuning dataset. This dataset contains 4,000 transformers, built from a population of 4,000 base models that are first trained on the TinyShakespeare corpus. Exactly half of the population (2,000 models, chosen uniformly at random) is then LoRA fine-tuned on Wikipedia; the other half is left as-is, so each base model appears exactly once, either fine-tuned or not.
Base models. All base models have blocks and , and each independently draws , , context length in , and dropout in , along with its own optimization hyperparameters: learning rate in , weight decay in , batch size in , and a training length in epochs. The models have between 3.78M and 5.05M parameters. Training uses Adam with a cosine schedule and early stopping on validation loss (patience 12). Distinct random seeds are used for initialization and training, so models are initialized and trained with different random states.
LoRA fine-tuning. Fine-tuned models are adapted with LoRA [14] of rank and scaling (the update is ). The adaptable matrices are the 4 matrices of each block (fused query-key-value projection, attention output projection, and the two feed-forward matrices), the embeddings, and unembedding are never adapted. Each candidate matrix is independently selected for adaptation with probability 0.5 (with at least one selected matrix). Training uses AdamW with learning rate , no weight decay, batch size 64, and a cosine schedule, for a number of epochs drawn per model from with early stopping on validation loss (patience 5). After fine-tuning, the low-rank updates are merged into the base matrices, so a fine-tuned model has exactly the same parameterization and architecture as a base one, and no trace of the adapters remains in its weights beyond the change they induced.
Labels. The model-level label is whether the model was fine-tuned (2,000 positives and 2,000 negatives). The weight-level label of the third experiment marks, for every weight of a fine-tuned model, whether its value differs from the value in the base model it was derived from.
C.2 Architectures
The details of the GNN used by all graph constructions (GMT-P, GMT-GL, and the construction of Kofinas et al. [18], Lim et al. [20]), together with Tran et al. [35] (NFN-T) and three flat-weight baselines (DeepSets, MLP, and MLP+Aug), are summarized in Table 8 and described below.
Table 8: Metanetwork architectures. denotes the number of parameters of the input transformer (padded to the largest model in the population for the flat baselines). All baselines are trained with the same optimizer and protocol as the graph metanetworks (Section C.3).
| Method | Input | Architecture |
|---|---|---|
| GNN (all constructions) | graph | 3 bidirectional GINE layers, hidden size 64, no dropout, trainable Fourier weight encoder, MLP readout |
| NFN-T [35] | weight tensors | one equivariant layer (1 channel) + invariant pooling + MLP; fixed architecture only |
| DeepSets | set of scalars | weight embedding (128), 3 equivariant layers, mean-pool, MLP [128], dropout 0.05 |
| MLP | vector in | hidden layers [512, 256], dropout 0.1 (reduced on the fine-tuning dataset, see text) |
| MLP+Aug | vector in | same as MLP, with symmetry-group augmentation of the training weights |
Graph metanetworks (GNN). All graph constructions (GMT-P, GMT-GL, their SVD variants, and the baseline construction of Kofinas et al. [18], Lim et al. [20], each with and without the embedding and unembedding layers) are processed by the same GNN within each experiment, so that the only difference between two graph-based methods is the graph they are given. The network follows the GINE-based design of Section 3.2 and consists of an input encoder, 3 message-passing layers, and a readout, all with hidden size ; depending on the construction and the task, it has 240K–350K parameters.
Input encoder. A graph has node features and edge features . Each raw feature column is embedded to according to its nature: categorical types by a learned embedding table; ordered integer indices by a linear map followed by ; and the continuous parameter value by a Fourier feature encoder followed by a linear map. The embedded parts are concatenated, layer-normalized, and linearly projected to , yielding initial node states and edge states .
GINE layer. Since transformer graphs are directed (from inputs of a parameter matrix to its outputs), each layer propagates messages both along and against the edge directions. Writing and for the in- and out-neighbors of , layer computes
Each consists of two Linear LayerNorm ReLU blocks of width 64, LN is layer normalization, and denotes concatenation.
Readout. For the two model-level tasks (corpus-mixture prediction and fine-tuning detection), the readout pools the final node states with mean and max, and the final edge states with mean, max, and standard deviation, and concatenates the five pooled vectors. The result is passed to a prediction MLP (with LayerNorm and ReLU), where for the corpus-mixture task, and for fine-tuning detection. For the weight-level task, each edge is scored independently by an MLP applied to the concatenation of the final state of the edge and of its two endpoints, yielding per-edge logits. We use gradient checkpointing across the message-passing layers to fit the multi-million-edge graphs in memory for the finetune related tasks.
NFN-T [35]. We use the architecture proposed by Tran et al. [35], which is equivariant to the attention symmetries directly in weight space, with their official implementation. The network consists of three branches, all trained end-to-end: an equivariant branch over the attention and feed-forward weights of the blocks, followed by an invariant pooling layer; an MLP branch over the token embedding together with the LayerNorm parameters; and a classifier branch over the unembedding. We use an equivariant layer with 1 channel, a classifier branch with channels [10, 10], and an output width of 16 for each of the three branches; the branch outputs are concatenated and passed to a final MLP head.
DeepSets. The DeepSets baseline [43] reads the flattened parameter vector of a model as an unordered set of scalars, discarding all structure. Each scalar is embedded to , and processed by 3 permutation-equivariant layers of width 128, a mean-pooling over the set, and an MLP head with one hidden layer of width 128, ReLU, and dropout 0.05. For the weight-level task, the pooling and head are replaced by a shared per-element head that outputs class logits for every weight.
MLP. The MLP baseline operates on the flattened parameter vector of each model, padded with zeros to the size of the largest model in the population. For the corpus mixture task, each scalar is first encoded to 8 features, and the resulting features are flattened and processed by an MLP with hidden layers [512, 256], ReLU activations, and dropout 0.1. For the finetune tasks we need a smaller model since the inup is much larger, making the previous selection unsuitable in memory. Therefore each scalar is encoded to a single feature, and use hidden layers [128, 128].
MLP+Aug. MLP+Aug has the same architecture as the MLP, but during training the input weights are transformed by a random element of the symmetry group G of Equation (3). In every epoch and for every training model we independently sample a group element and apply it on the weights as in Table 1. Augmentation is applied during training to the training set only.
C.3 Training schema
Common protocol. All methods and all three experiments share the same optimization protocol. Models are trained with Adam and a cosine learning-rate schedule for at most 400 epochs, and early stopping with patience of 25 epochs: training stops when the monitored validation metric has not improved for 25 consecutive epochs, and the checkpoint with the best validation value is retained. One exception for the number of epochs is the GMT-GL variant experiment over the fine-tune detection task, where the generated graphs are particularly very large, and so for this experiment and variant we ran for up to 130 epochs. The monitored metric is the validation loss (the KL divergence) for the corpus-mixture experiment, and the validation ROC-AUC for both fine-tuning experiments. For the corpus mixture experiment, we use a batch size of 32 models, and for the fine-tuning experiments we use a batch size of 8 models (with gradient accumulation), and 16 models for the flat baselines.
Hyperparameter search and model selection. For every method and experiment, we perform a grid search over the learning rate in and the weight decay in ; all methods share the same grid. For each grid point, we train a model, and select the configuration(by its mean over seeds, where repeated) with the best value of the monitored validation metric (lowest validation KL for the corpus-mixture experiment, highest validation ROC-AUC for the fine-tuning experiments). The numbers we report in Section 4 are the test-set metrics of this selected configuration which was never used for any selection. For the corpus-mixture experiment, each grid point is repeated with 3 random seeds (which control the initialization and the order of training batches, with the data split fixed), and we report mean ± standard deviation over them.
Experiments were conducted on a compute node with 8 NVIDIA L40 GPUs, each equipped with approximately 48 GB of memory
D Graph Construction
D.1 GMT-P Formal graph construction
As previously mentioned, the only part where the construction GMT-P differ from GMT-GL is the MHA construction, therefore we now define exactly which edges represent the MHA weights of the model, how are they are connected, and on which edge sets corresponds to which weight matrix.
Since GMT-P restricts the symmetry to permutation matrices alone, we no longer need to fuse each pair of projections into a single product matrix; instead, every projection matrix corresponds directly to its own edge set. As before, we start from the node-layer that concludes the embedding construction (with the pre-attention normalization pair attached exactly as in GMT-GL). For every head , we introduce a node-layer of nodes, joined to by the fully-connected edge set , and a further node-layer of nodes, joined to by the fully-connected edge set . As with the GMT-GL, and for the same reasons, we tie the permutation of to that of with the coupling edge set . Each per-head layer is then joined to a node-layer of nodes by the fully-connected edge set , which in turn is joined to a single shared node-layer of nodes by the fully-connected edge set , writing for the -th row-block of , and merging the heads back into the residual stream. Finally, we add the coupling edge set to account for the residual connection wrapped around the MHA sub-layer. The remainder of the construction is identical to that of GMT-GL.
D.2 Complete 1 block LM graph constructions
To better understand how the full graphs are constructed from a model, let us present also the full construction of a language model with 1 transformer block, for both constructions GMT-GL Figure 3 and GMT-P Figure 4.
Input Embedding Unembedding Output

Figure 3: Full construction of a single-block transformer, containing a 2-head attention mechanism. We omit the coupling between the first and last layers, as well as the normalization nodes and edges, to keep the plot intuitive and readable.
Input Embedding Unembedding Output

Figure 4: Full construction of a single-block transformer, containing a 2-head attention mechanism. Attention construction is invariant to permutations only. We omit the coupling between the first and last layers, as well as the normalization nodes and edges, to keep the plot intuitive and readable.