TL;DR
Ensembling self-supervised learning (SSL) models is challenging because their independently learned feature spaces are completely unaligned. This paper introduces a novel framework that ensembles SSL models by directly learning a unified representation space via gradient descent at inference time. This approach significantly improves nearest-neighbor representation quality across both in-domain and transfer learning tasks, and surprisingly, even boosts the performance of single models.
What Problem Does This Paper Address?
Model ensembling is a reliable, go-to technique in supervised learning to boost performance by averaging predictions. However, applying ensembling to self-supervised learning (SSL) isn't straightforward. SSL models (like SimCLR, SwAV, or Barlow Twins) generate feature representations rather than class predictions. Because these models are trained independently without labels, their intermediate feature spaces are unaligned.
Simply averaging or concatenating these features is suboptimal. While concatenation preserves information, it creates an unwieldy, high-dimensional feature space that doesn't inherently optimize how features relate to one another. This paper tackles a fundamental question: How can we optimally combine multiple self-supervised models to maximize the quality of the resulting image representations?
Methods
The authors propose a framework based on the concept of recoverability. The core idea is that a truly rich ensemble representation should contain enough information to reconstruct the individual features of every underlying model in the ensemble.
Instead of training a massive new neural network, the method optimizes the representations directly using gradient descent:
- Training Phase: Given an ensemble of $M$ frozen pretrained models and a dataset, the authors initialize a "memory bank" of representations (starting with the average feature). They also initialize $M$ small Multi-Layer Perceptrons (MLPs)—one for each model in the ensemble. They simultaneously train the MLPs and optimize the representations in the memory bank using a cosine loss. The goal is for each MLP to successfully map the unified representation back to its corresponding model's original feature vector.
- Inference Phase: When a new test image arrives, the MLPs are frozen. The ensemble features are extracted, and a new representation vector is initialized. This vector is then optimized via gradient descent over a few iterations to maximize the cosine similarity between the MLP outputs and the extracted features.
Crucially, this method requires no image augmentations and only a single forward pass through the large backbone networks, allowing the base features to be cached for efficiency.
Datasets
The models were pretrained on ImageNet (ILSVRC 2012). To evaluate transfer learning and generalization capability, the authors benchmarked their method on five diverse downstream datasets:
- CIFAR10 & CIFAR100 (Standard object classification)
- EuroSat (Satellite imagery)
- SVHN (Street View House Numbers - digit recognition)
- Food101 (Fine-grained food classification)
Key Insights and Ideas
- Optimization at Inference Time: Directly updating representation vectors via backpropagation at test time is an unconventional but powerful mechanism. It allows the representation to dynamically adapt to the consensus of the ensemble.
- Deep MLPs act as Regularizers: You might expect the mapping MLPs to simply learn an identity function. However, the authors discovered that deeper MLPs possess an implicit low-rank bias when trained with SGD. This prevents them from learning a trivial identity mapping, forcing the underlying representations to evolve into a more uniform, well-distributed feature space.
- The Single-Model "Self-Distillation" Effect: Remarkably, the method provides a performance boost even when the "ensemble" consists of just a single model. Because the MLP cannot perfectly fit the identity mapping during warmup, the representation is forced to move, resulting in a regularized feature space that outperforms the original model.
Key Results
The quality of the learned representations was evaluated using $k$-nearest neighbor ($k$-NN) classification accuracy, which serves as a pure, parameter-free metric of feature space quality.
- In-Domain Improvement: On the ImageNet validation set, ensembling 4 SimCLR models using this method improved $k$-NN accuracy by over 2% compared to standard concatenation or averaging baselines.
- Transfer Learning Gains: On downstream tasks, the framework achieved an average accuracy increase of 2.5% over feature averaging across all five datasets.
- Heterogeneous Ensembles: The method successfully combined entirely different SSL objectives (Barlow Twins, PIRL, RotNet, SwAV, SimCLR). It effectively captured the unique strengths of weaker models; for instance, incorporating RotNet significantly boosted the ensemble's performance on the symbolic SVHN dataset.
- Single Model Boost: When applied to a single Barlow Twins model, the method yielded a mean improvement of over a full percent across the transfer datasets without any new data or supervision.
Limitations and Future Work
The primary limitation acknowledged by the authors is that this method specifically optimizes the feature space for distance-based metrics like $k$-NN. When the representations were instead evaluated using a heavily optimized linear regression baseline (with extensive hyperparameter grid sweeps for L2 regularization), the proposed method did not consistently outperform simple feature averaging.
Additionally, performing gradient descent steps at inference time introduces computational overhead compared to simple mathematical averaging, which might limit its use in strict real-time applications. Future work could explore ways to achieve these regularized spaces without test-time optimization.
Summary updated