The emerging field of weight space learning has demonstrated the potential to enable metanetworks, i.e. models that process neural network (NN) data, to support several steps of the machine learning lifecycle, from model optimisation to evaluation and adaptation. However, this potential has yet to materialise beyond small-scale MLPs or CNNs: most current models, including message-passing based graph metanetworks (GMNs), operate exclusively at the finest level of granularity, processing every neuron and weight of the input model. Their cost therefore scales with the number of parameters. Yet NNs are inherently organised hierarchically, with neurons forming layers and layers forming blocks and modules. Additionally, several of their properties, such as Lipschitz upper bounds and generalisation measures, are compositions of layer- and block-level quantities. To incorporate this inductive bias, we introduce Hierarchical Graph Metanetworks (H-GMNs), which leverage the input architecture's hierarchy to coarsen and refine the graph using permutation-symmetry-preserving pooling and un-pooling layers. Further, we extend H-GMNs to Transformers by introducing a graph construction that preserves permutation symmetries and enables multi-level pooling. Our evaluation includes new ResNet-18, ViT and varying ViT model zoos of up to 86M parameters, on tasks spanning model evaluation (an analytic Lipschitz bound proxy, generalisation and robustness prediction), testing (backdoor detection) and editing (pruning). Experimental results show that, compared to non-equivariant alternatives and flat GMNs, H-GMNs are markedly more sample-efficient, and their cost remains nearly constant as metanetwork depth grows, allowing deeper and more expressive processing where flat GMNs run out of memory, without compromising accuracy, which in certain cases considerably improves.
Figures & tables
Figure 1: Top : Pooling on ResNet basic block. Red arrow indicates pooling across the width of each layer, resulting in the coarsened layer graph. Bottom : Pooling on an MHSA block. Pooling across the width leaves head vertex sets visible. Further pooling across heads leads to the layer graph level.
ResNet18 ( ∼ 11M)
MNIST ViT ( ∼ 20k)
CIFAR100 ViT ( ∼ 21M)
Graph Type
∣V∣
∣E∣
Diameter
∣V∣
∣E∣
Diameter
∣V∣
∣E∣
Diameter
Parameter Graph
10,125
1,405,184
18
619
16,896
16
46,951
19,817,472
27
Head Graph
–
–
–
23
28
16
208
363
27
Layer Graph
43
50
18
19
20
16
88
123
27
ResBlock Graph
10
9
9
–
–
–
–
–
–
Table 1: Fixed zoos graph size in different hierarchy levels. Number of checkpoints: ResNet18 8,000; MNIST ViT 15,689; CIFAR100 ViT 3,640.
Figure 3
Method
ResNet18-0.1
ResNet18-0.5
ResNet18
MNIST ViT
CIFAR100 ViT
Varying ViT
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
StatNN
0.677
0.684
92
0.824
0.884
78
0.837
0.890
82
0.879
0.989
181
0.877
0.811
94
0.795
0.554
77
Transformer-NFN
–
–
–
–
–
–
–
–
–
0.906
0.987
102
–
–
–
–
–
–
GMN
0.744
0.840
93
0.886
0.943
94
0.900
0.953
97
0.916
0.996
190
0.804
0.673
84
0.577
0.491
85
GMN (GRIT)
0.764
0.862
96
0.874
0.924
82
0.889
0.942
91
0.863
0.996
105
–
–
–
–
–
–
SANE
0.584
0.477
-
0.614
0.566
–
0.633
0.604
–
–
–
–
–
–
–
–
–
–
Table 2: Generalisation prediction. We report Kendall’s rank correlation ( τ↑ ), coefficient of determination ( R2↑ ), and convergence epoch (Ep.). “–”: architecturally inapplicable baseline.
Method
ResNet18-0.1
ResNet18-0.5
ResNet18
CIFAR100 ViT
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
StatNN
0.847
0.913
77
0.864
0.927
92
0.864
0.934
82
0.899
0.959
86
GMN
0.808
0.898
87
0.858
0.930
90
0.867
0.934
87
0.873
0.918
94
SANE
0.586
0.487
–
0.614
0.583
–
0.632
0.617
–
–
–
–
2-lvl-H-GMN(Ours)
0.798
0.867
83
0.861
0.929
81
0.870
0.942
82
0.925
0.982
98
2-lvl-H-GMN-RC(Ours)
0.783
0.858
97
0.835
0.918
80
0.865
0.936
85
0.938
0.973
95
Table 3: mCE prediction. We report Kendall’s τ(↑) , R2(↑) , and convergence epoch (Ep.).
BadNets
Blended
WaNet
Multiclass
Method
AUROC
Acc
F1
Recall
AUROC
Acc
F1
Recall
AUROC
Acc
F1
Recall
AUROC
Acc
F1
Recall
StatNN
0.986
0.971
0.830
0.775
0.999
0.991
0.951
0.978
0.997
0.981
0.896
0.894
0.994
0.959
0.923
0.899
GMN
0.977
0.954
0.767
0.832
0.454
0.092
0.170
1.000
0.553
0.503
0.180
0.566
0.959
0.891
0.791
0.783
GMN (GRIT)
0.978
0.947
0.748
0.845
0.430
0.818
0.000
0.000
0.578
0.365
0.180
0.748
0.968
0.917
0.827
0.794
2-lvl-H-GMN (Ours)
0.896
0.913
0.598
0.664
1.000
0.995
0.974
0.970
0.970
0.959
0.775
0.753
0.999
0.983
0.950
0.948
2-lvl-H-GMN (GRIT) (Ours)
1.000
0.999
0.996
0.992
0.999
0.999
0.981
1.000
1.000
0.999
0.992
0.995
0.999
0.984
0.956
0.955
Table 4: Backdoor model detection (averaged over 3 seeds - except GMN (GRIT)) on ResNet18.
Figure 4: Fine-tuning after pruning: relative accuracy loss of the 1,200 test networks when fine-tuning from the magnitude-pruned weights (Magnitude + FT) or from the H-GMN edit (H-GMN + FT), at 80%, 50% and 20% remaining weights. Step 0 is the one-shot result of fig. 3 .
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 5: ResNet18 Left: inference time per network ( B=1 ). Middle and right: time and peak GPU memory of one training step ( B=4 ). The x-axis counts all GNN layers. Dashed curves are the RC variants. The dotted line marks where GMN runs out of memory, the dashed grey line is the GPU capacity (64 GB).
Figure 6: CIFAR100 ViT Left: inference time per network. Middle and right: time and peak GPU memory of one training step. B=1 throughout. Dashed curves are the RC variants. The dotted line marks where GMN runs out of memory, the dashed grey line is the GPU capacity (64 GB).
Figure 7: Input network size (ViT) Left: inference time per network. Middle and right: time and peak GPU memory of one training step, for randomly initialised ViTs of depth 12 and width 192–768. B=1 throughout; all metanetworks have ∼ 0.66M parameters and one layer per level. Dotted lines mark, in each model’s colour, where it runs out of memory; the dashed grey line is the GPU capacity (64 GB).
Figure 8: Left : Parameter count distribution of the Varying ViT zoo. Right : Validation accuracy at the last epoch (50)
Figure 9: Distribution of the Lipschitz constant upper-bound proxy across the ResNet18 zoo.
Figure 10: Distributions of (a) test accuracy and (b) mean corruption error (mCE) across the ResNet18 zoo.
Figure 11: Distributions of (a) validation accuracy and (b) mean corruption error (mCE) across the CIFAR100 ViT Zoo.
Figure 12: Distribution of the validation accuracy across the Varying ViT zoo.
Figure 13: Confusion matrices of 2-lvl-H-GMN (GRIT) predictions on each backdoor detection task.
Method
CIFAR100 ViT
τ
R2
# Params
StatNN
0.877
0.811
444,417
GMN
0.804
0.673
665,177
3-lvl-H-GMN(GMN-GMN-GMN)
0.936
0.967
663,817
3-lvl-H-GMN(GMN-GMN-GRIT)
0.924
0.926
663,479
Appendix
Table 5: Generalisation prediction. We evaluate H-GMN using both GMN and GRIT in the coarser levels, adhering to the parameter budget dictated by the best-performing GMN baseline. Rest of the baselines are reported same as in table 2 We report Kendall’s rank correlation ( τ↑ ) and coefficient of determination ( R2↑ ).
Figure 14: Flat GMN of increasing depth on the MNIST ViT zoo. Test Kendall’s τ of flat GMNs with k1 layers on the Parameter Graph, all trained with the configuration of the MNIST H-GMN, so that only the depth changes. Dashed: 3-lvl-H-GMN of Table 2 . Eight layers suffice to match H-GMN; 16 layers, enough to span the diameter of the Parameter Graph, bring no further gain.
Method
In-distribution Unseen
Beyond ≤1.5×
Beyond
τ
R2
τ
R2
τ
R2
StatNN
0.795
0.554
0.481
−0.481
0.445
−1.112
GMN
0.577
0.491
0.223
−1.286
0.079
−2.444
H-GMN(Ours)
0.849
0.941
0.324
0.497
0.207
0.046
Appendix
Table 6: Generalisation prediction on the Varying ViT zoo. We evaluate both on an in-distribution ( ≤48M ) test split and on a Beyond test split ( 60.3M≤NN≤85.9M ). Beyond ≤1.5× keeps the Beyond architectures with at most 1.5× the size of the largest training network.
Method
test_id — overall
test_id — in1k
test_id — in21k
test_id — in21k_ft_in1k
test_id — cl
test — held-out sl
τ
R2
τwb
Rwb2
τ
R2
τ
R2
τ
R2
τ
R2
τ
R2
StatNN
0.855
0.790
0.600
0.804
0.882
0.964
0.785
0.928
0.825
0.891
−0.092
−0.235
0.003
−0.048
GMN
0.821
0.783
0.627
0.767
0.826
0.931
0.739
0.978
0.785
0.977
0.160
−0.359
0.109
−0.384
H-GMN
0.885
0.908
0.802
0.886
0.835
0.968
0.829
0.985
0.765
0.989
0.777
0.438
0.203
−0.109
Appendix
Table 7: Leave-one-backbone-out evaluation on the ViT-S/16 zoo: methods are trained on all backbones except sl. test_id : held-out checkpoints from the training backbones; held-out sl : all checkpoints from the unseen sl backbone. We report Kendall’s τ and R2 (both ↑ ); wb denotes within-backbone metrics ( τwb : mean per-backbone τ ; Rwb2 : R2 after removing each backbone’s mean). Best results in bold.
Method
ResNet18-0.1
ResNet18-0.5
ResNet18
τ
R2
Ep.
τ
R2
Ep.
τ
R2
Ep.
StatNN
0.677
0.684
92
0.824
0.884
78
0.837
0.890
82
GMN
0.744
0.840
93
0.886
0.943
94
0.900
0.953
97
GMN (GRIT)
0.764
0.862
96
0.874
0.924
82
0.889
0.942
91
2-lvl-H-GMN(Ours)
0.846
0.927
80
0.892
0.941
74
0.902
0.951
82
2-lvl-H-GMN-RC(Ours)
0.837
0.900
81
0.886
0.938
86
0.900
0.952
85
Appendix
Table 8: Generalisation prediction. We report Kendall’s rank correlation ( τ↑ ), coefficient of determination ( R2↑ ), and convergence epoch (Ep.). “–”: architecturally inapplicable baseline.
A weight space network (or metanetwork) takes the weights of another neural network as input and predicts properties of it. Most prior work trains such models on input networks of one or a few fixed sizes and evaluates them in-distribution. The few attempts at out-of-distribution size generalization remain limited in scope and have achieved only modest success. Consequently, the potential efficiency gains of training on small networks and evaluating on much larger ones remain largely unrealized. We propose Transferable Graph Metanetworks, which extend the graph metanetwork paradigm with a set of modifications that make performance transferable across input networks of different widths. The modifications follow two principles: invariance to the ways in which networks of different widths represent the same function, and continuity, such that weights representing similar functions receive similar predictions. We further study whether size generalization is possible for input networks trained independently from random initialization. Empirically, our modifications significantly improve size generalization on every task we consider. Performance is strongest on input networks trained under the maximal-update parameterization (μP), where it remains robust up to 42× the training width. Theoretically, we explain these observations with infinite-width limit theory: we prove size-generalization guarantees for our model on μP-trained inputs, and explain why it can fail under other parameterizations.
Yuxin Ma, Adir Dayan, Yam Eitan +2
Department of Applied Mathematics and Statistics, Johns Hopkins University · Technion · NVIDIA
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.
Yonathan Wolanowsky, Guy Bar-Shalom, Fabrizio Frasca +1
Technion – Israel Institute of Technology · NVIDIA Research
Weight-space networks operate directly on parameters of other neural networks, enabling tasks such as predicting model properties, editing trained models, and generating weights. Weight-space symmetries such as neuron permutations make equivariance a key design principle. However, existing equivariant weight-space architectures have primarily been studied for transformations that preserve the network architecture. In contrast, many practical transformations, including model compression and upscaling, map a trained source network into a target network with a different architecture. In this setting, the source and target permutation symmetries act on different parameter spaces, making equivariance less straightforward to formulate. Our key idea for addressing this mismatch is to reformulate cross-architecture operators with two inputs: a trained source network and an initialization of the target network. This lets us define equivariant cross-architecture operators that refine the initialization of the target network using information from the source network, while being invariant to source-network permutations and equivariant to target-network permutations. Based on this formulation, we introduce CrossGMN, a graph metanetwork that jointly processes both networks through symmetry-preserving cross-network message passing. We prove CrossGMN is universal for continuous cross-architecture operators on compact sets under a general-position assumption. We evaluate CrossGMN for model compression, predicting a smaller network's parameters to accelerate subsequent knowledge distillation. Across 2-D and 3-D INRs and image classification with MLPs, CNNs, and Vision Transformers, CrossGMN speeds up distillation by up to 8.89x, transfers across datasets without retraining (3.78x), and a single model can accelerate compression from heterogeneous source architectures into a common target architecture.
Adir Dayan, Yam Eitan, Haggai Maron
Technion – Israel Institute of Technology · NVIDIA Research