TL;DR
Weight Space Learning (WSL) usually requires training thousands of identical models in expensive, curated "model zoos." This paper shows you can ditch model zoos entirely: by training a single transformer autoencoder directly on arbitrary, "in-the-wild" models scraped from Hugging Face (~171 billion parameters), the resulting weight representation generates and initializes neural network weights across 25+ distinct architectures—and even transfers across data modalities to initialize language models.
What Problem Does This Paper Address?
Deep learning models are increasingly treated as a data modality in their own right. In Weight Space Learning (WSL), a meta-model learns representations of neural network weights to predict performance (discriminative WSL) or synthesize functional network weights (generative WSL).
Historically, WSL has been held back by a severe data bottleneck: backbones had to be trained on homogeneous "model zoos" (thousands of neural networks sharing the exact same architecture or dataset, trained under strict laboratory protocols). Training these zoos is computationally prohibitive, highly siloed, and restricts representations from scaling. While open hubs like Hugging Face (HF) offer millions of models, they are messy, heterogeneous (differing architectures, widths, and depths), and largely undocumented. Prior WSL architectures break when faced with this heterogeneity.
Methods
The authors build on the SANE (Sequential Autoencoder for Neural Embeddings) framework—an encoder-decoder transformer that compresses tokenized network weights—and adapt it to handle arbitrary public checkpoints:
- Masked Loss Normalization (MLN): Prior methods normalized weight matrices per-layer offline across a single zoo. Because layer shapes vary across arbitrary architectures, the authors instead normalize reconstruction loss per-token at runtime, calculating the mean and standard deviation over unmasked token values in the current batch.
- Dense Tokenization: SANE previously split layers along output channels, padding each slice to a fixed token length. When applied across varied models, this led to ~20% useless zero-padding. The authors flatten entire layers contiguously and chunk them into tokens, padding only the single final token per layer, which cuts padding down to 0.01% and saves 20% disk space.
- Sinusoidal Positional Encodings: Learned positional embeddings require allocating parameters for the maximum sequence length (which explodes when scaling to billion-parameter models). The authors replace them with fixed 3D sinusoidal encodings indexed by sequence, layer, and token position $[n, l, k]$.
Datasets
- Training Corpus: 2,000 training and 200 validation vision models scraped from Hugging Face across tags (
image-classification,image-segmentation,depth-estimation,object-detection), representing 171 billion individual parameters across Transformers (42%), ConvNets (21.8%), hybrids (5%), and unknown architectures (31.4%). - Downstream Target Datasets: ImageNet-1K, CIFAR-10, CIFAR-100, TinyImageNet (TIN), SVHN, EuroSAT, and OpenWebText.
- Baselines: ResNet-18 model zoos (CIFAR-10/100) and model instances from the PyTorch Image Models (
timm) library.
Key Insights and Ideas
- Scale and diversity trump architecture alignment: When generating ResNet-18 weights, training the backbone on a large pool of Vision Transformers (ViTs, 590M tokens) outperformed training on a smaller, architecture-matched set of ResNets (35M tokens). Weight diversity and token volume matter more than matching target architectures.
- Runtime loss normalization bridges structural gaps: Weight distributions differ wildly between convolutions, attention projections, and batch-norm layers. Per-token runtime normalization keeps gradient signals stable without requiring prior knowledge of network structure.
- Cross-modality weight transfer is possible: A backbone trained strictly on vision models produced weight initializations for a 125M-parameter GPT-2 transformer that converged faster and achieved lower validation perplexity on OpenWebText than standard random initialization.
Key Results
- Generation Across 25 Architectures on ImageNet-1K: Generated weights (sampled via Kernel Density Estimation from a single reference checkpoint) served as effective initialization seeds. Across 25 diverse architectures (including ResNets, ConvNeXts, DenseNets, ViTs, Swin, BeiT, and DeiT), fine-tuning generated models for 5 epochs achieved an average accuracy of 60.48%, compared to 40.43% when training from scratch and 30.72% using the zoo-trained baseline.
- Multi-Dataset Generation: Generating ResNet-18 weights across diverse datasets outperformed single-zoo models on almost all targets (e.g., TinyImageNet: 24.76% vs. 11.7%; CIFAR-100: 29.00% vs. 20.4%), falling short only on CIFAR-10.
- Token Efficiency: Dense tokenization delivered identical reconstruction quality ($R^2$) to sparse slicing while eliminating almost all padding overhead.
Limitations and Future Work
- Requires Short Fine-Tuning: Generated weights currently sit near random accuracy directly out of the decoder due to minor weight impurities. A few steps of standard SGD/Adam optimization are necessary to restore full functionality.
- Discriminative Degradation: Predicting model properties (like test accuracy) using linear probes on the learned embeddings showed lower explained variance ($R^2$) than backbones overfitted to single-zoo data, suggesting non-linear probes may be needed.
- Uncurated Hub Data: Because models were scraped using high-level tags, latent data contamination (such as vision-language models trained with text objectives like CLIP) cannot be fully ruled out. Future work will investigate scaling across multimodal repositories explicitly.
Summary updated