Towards Scalable and Versatile Weight Space Learning

Konstantin Schürholt, Michael W. Mahoney, Damian Borth

Introduction

SANE (Sequential Autoencoder for Neural Embeddings) is a new framework that treats neural network weights as a sequence of tokens rather than one giant, unwieldy vector. This shift allows the model to scale to large architectures like ResNet-101 and perform both discriminative tasks (predicting a model's accuracy) and generative tasks (sampling new, high-performing weights) within a single, task-agnostic representation space.

The Challenge of Weight-Space Learning

As neural networks become more complex, understanding their "inner workings" remains a grand challenge. One promising approach is weight-space learning: treating the millions of parameters of a trained model as data points to find patterns.

However, previous methods (often called "hyper-representations") hit a wall. They typically tried to compress the entire weight vector of a model into a single embedding. This approach doesn't scale—trying to process 12 million parameters of a ResNet-18 as a single input is computationally explosive. Furthermore, most existing methods were "one-trick ponies," designed either to predict model properties or to generate new weights, but rarely both.

The SANE Approach

The authors introduce SANE, which moves away from global embeddings toward a sequential approach.

SANE Pipeline Overview
  1. Tokenization: Instead of viewing a model as one long string of numbers, SANE breaks the weights down into subsets (tokens), typically by layer or channel.
  2. Sequential Autoencoder: Using a Transformer-based architecture, SANE learns to encode these sequences of weight tokens into a latent space and then decode them back.
  3. Self-Supervised Learning: The model is trained using a combination of reconstruction loss (making the output weights match the input) and contrastive loss (ensuring different versions of the same model have similar embeddings).
  4. Model Alignment: To handle the fact that neural network neurons can be permuted without changing the model's function, SANE uses "git re-basin" techniques to align all models in a "zoo" to a common reference before training.
  5. Haloing & BN-Conditioning: To maintain context between weight chunks, they use "haloing" (adding surrounding weight context to a window). They also use a "Batch-Norm Conditioning" step to calibrate non-trainable parameters like running means/variances after generating new weights.

Datasets and Evaluation

The researchers evaluated SANE on several "model zoos" (collections of thousands of trained models), including small CNN Zoos (MNIST, SVHN, CIFAR-10, STL) and large ResNet Zoos (ResNet-18 models trained on CIFAR-10, CIFAR-100, and Tiny-ImageNet). They also tested cross-architecture generalization on ResNet-34, ResNet-50, ResNet-101, and various VGG architectures.

Key Insights

  • The "Center of Gravity" works: Even though SANE produces a sequence of embeddings (one per token), simply taking the mean of these embeddings provides a powerful global representation of the entire model.
  • WeightWatcher Correlation: SANE’s learned embeddings naturally correlate with theoretical "quality metrics" (like those from the WeightWatcher tool), suggesting SANE captures fundamental truths about model convergence and generalization.
  • Architecture Agnosticism: Because SANE treats weights as a sequence, it can "prompt" a model trained on ResNet-18 weights to generate weights for a ResNet-34 by viewing the larger model simply as a longer sequence.
  • Zero-Shot Initialization: SANE can sample new weights that perform significantly better than random initialization, providing a "warm start" for training on new tasks without ever seeing the underlying image data during the weight-learning phase.

Key Results

SANE demonstrates remarkable versatility across both discriminative and generative tasks, matching or exceeding state-of-the-art performance.

Performance Radar Chart
  • Discriminative Performance: SANE matches or beats state-of-the-art (SOTA) methods in predicting a model's test accuracy and generalization gap across all tested datasets.
  • Generative Performance: In zero-shot initialization (generating weights for a task before any fine-tuning), SANE outperformed previous SOTA by 25% on small CNNs.
  • Scalability: SANE successfully processed ResNet-18 models, which are three orders of magnitude larger than the models handled by previous hyper-representation research.
  • Transfer Learning: When sampling weights for a new task (e.g., transferring from CIFAR-100 to Tiny-ImageNet), SANE-initialized models reached high accuracy much faster than training from scratch, achieving 39.4% accuracy on Tiny-ImageNet after just one epoch of fine-tuning.

Limitations and Future Work

Currently, SANE is pre-trained on "homogeneous" zoos (zoos where every model has the same architecture). While it can generalize to different sizes (ResNet-18 to ResNet-101), it hasn't yet been trained on a "universal" zoo of mixed architectures. Furthermore, the study focuses exclusively on Computer Vision tasks. Extending this to Transformers in NLP or Graph Neural Networks is a logical next step. Finally, for extremely large models, the sequential sampling process can become computationally expensive, suggesting a need for more efficient decoding strategies in the future.

Summary updated

BibTeX
@inproceedings{schurholt2024towards,
  author = {Konstantin Schürholt and Michael W. Mahoney and Damian Borth},
  title = {{Towards Scalable and Versatile Weight Space Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=ug2uoAZ9c2},
}
Figure