Towards Democratizing Joint-Embedding Self-Supervised Learning

Florian Bordes, Randall Balestriero, Pascal VincentarXiv 2023 · DOI

Abstract

Joint-Embedding Self-Supervised Learning (JE-SSL) methods like SimCLR and BYOL are often considered "compute-hungry," requiring massive batch sizes and expensive multi-GPU setups. This paper challenges this "common wisdom" by demonstrating that high-quality representations can be learned on a single GPU within a reasonable timeframe. By introducing FFCV-SSL, an optimized library, and performing rigorous hyperparameter tuning, the authors show that the perceived need for massive resources is largely due to suboptimal hyperparameter choices rather than fundamental algorithmic constraints.

Introduction

Self-Supervised Learning has revolutionized the use of unlabeled data, but the high computational cost of methods like SimCLR, BYOL, and VICReg has historically limited research to well-funded labs. Conventional wisdom dictates that these methods require mini-batches as large as 4096 images and complex, hand-crafted data augmentations. This "compute wall" effectively gatekeeps the field. This work investigates whether these requirements are fundamental to the algorithms or merely artifacts of unexamined "best practices."

Methods

The authors adopted a "back-to-basics" empirical approach to identify and remove bottlenecks:

  1. Hyperparameter Grid Search: Instead of keeping parameters fixed while varying batch sizes, they performed extensive searches on learning rates, temperature parameters, and projector network depths.
  2. FFCV-SSL Library: They developed an optimized PyTorch library using a specialized data format and ahead-of-time compilation (Numba) to minimize data-loading overhead, which is often the primary bottleneck in SSL.
  3. Ablation and Simplification: They systematically reduced batch sizes and stripped away complex augmentations (e.g., color jittering, solarization) to identify true performance drivers.

Results and Key Insights

The study reveals several critical findings that lower the barrier to entry for SSL research.

The Batch Size Myth and Hyperparameter Tuning

The perceived necessity for huge batches in SimCLR is primarily a hyperparameter issue. By specifically tuning the learning rate and temperature for smaller batches, the performance gap between a batch size of 256 and 8192 is significantly reduced. Furthermore, increasing the depth of the projector MLP helps bridge this gap by acting as a buffer for suboptimal training settings.

Accuracy across various datasets for different batch sizes shows that performance is remarkably stable even with smaller batches.

Efficiency and Speedup

Using the FFCV-SSL library, the authors achieved a 3x speedup in training time per epoch compared to standard torchvision dataloaders. This optimization allowed for training SimCLR on a single A100 GPU in just 35 hours, reaching 65.58% linear probing accuracy on ImageNet—a result previously thought to require an 8-GPU setup.

ImageNet accuracy vs. training time demonstrates the significant speedup achieved by FFCV-SSL compared to standard torchvision.

Augmentation and Evaluation

While complex augmentations provide some benefit, simple cropping + grayscaling is often sufficient for competitive performance across various tasks. Evaluation on a diverse set of benchmarks (CIFAR10, CLEVR, Eurosat, iNaturalist, Places205) showed that models trained with "weaker" settings often generalize as well as (or better than) those trained with standard, expensive recipes.

Conclusion

This work successfully demonstrates that JE-SSL can be democratized. By focusing on proper optimization and efficient data handling, high-quality self-supervised models can be trained without massive hardware resources. While a small performance gap remains between small and large batch sizes on ImageNet, the findings suggest that SSL is far more accessible than previously believed. Future work will focus on further optimizing slow augmentations and exploring the limits of minimal inductive bias in training.

Summary updated

Abstract

Joint Embedding Self-Supervised Learning (JE-SSL) has seen rapid developments in recent years, due to its promise to effectively leverage large unlabeled data. The development of JE-SSL methods was driven primarily by the search for ever increasing downstream classification accuracies, using huge computational resources, and typically built upon insights and intuitions inherited from a close parent JE-SSL method. This has led unwittingly to numerous pre-conceived ideas that carried over across methods e.g. that SimCLR requires very large mini batches to yield competitive accuracies; that strong and computationally slow data augmentations are required. In this work, we debunk several such ill-formed a priori ideas in the hope to unleash the full potential of JE-SSL free of unnecessary limitations. In fact, when carefully evaluating performances across different downstream tasks and properly optimizing hyper-parameters of the methods, we most often -- if not always -- see that these widespread misconceptions do not hold. For example we show that it is possible to train SimCLR to learn useful representations, while using a single image patch as negative example, and simple Gaussian noise as the only data augmentation for the positive pair. Along these lines, in the hope to democratize JE-SSL and to allow researchers to easily make more extensive evaluations of their methods, we introduce an optimized PyTorch library for SSL.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
ImageNet-1K · ImageNetInstance-based SimCLR (SimCLR denoising)accuracy40%negative-sampling=single small crop · positive-pair-augmentation=Gaussian noise only
Source quote
L152: Specifically we attempt to train SimCLR only using a single random patch as negative examples while using only Gaussian noise as data augmentation to define the positive pair. This set-up deliberately defies most current guidelines, which favor aggressive data-augmentations and hard-negative sampling. However, despite that fact that we will leverage the same instance to define the positive and negative pair, it shouldn't be too surprising that different crops can produce relatively different images. In \cref{fig:instance_simclr} we show the accuracy across diverse downstream tasks obtained with such an instance based SimCLR model. Surprisingly this somewhat extreme approach can nevertheless learn good representations useful for several downstream tasks. We get high accuracy on CIFAR10 or Eurosat, but only 40% on ImageNet. The performance drop on ImageNet is not surprising given we reduced a lot the amount of inductive bias in the augmentations. However, the high performances on transfer on CIFAR10 is still surprising. We hope that our work will motivate further the exploration of such extreme scenario.
ImageNet-1K · ImageNet validationSimCLRonline linear probing accuracy65.58split: val · linear-probe · hardware=single GPU · batch-size=256 · temperature=0.15 · learning-rate=1.0
Source quote
L192: \caption{Imagenet validation accuracy on a wide cross validation performed on a single gpu with SimCLR. For this experiment, we performed a grid search on the temperature with the values 0.10, 0.15, 0.25, 0.5 and the learning rate with the following values: 0.3, 0.5, 0.7, 1.0, 1.2, 1.5, 2.0, 2.5, 3.0. We found that the best hyper-parameters for a Single GPU training, using a batch size of 256, are a temperature of 0.15 and a learning rate of 1.0, this lead to a 65.58 accuracy in online linear probing and 68.5% in non linear probing.}
ImageNet-1K · ImageNet validationSimCLRnon linear probing accuracy68.5%split: val · non-linear-probe · hardware=single GPU · batch-size=256 · temperature=0.15 · learning-rate=1.0
Source quote
L192: \caption{Imagenet validation accuracy on a wide cross validation performed on a single gpu with SimCLR. For this experiment, we performed a grid search on the temperature with the values 0.10, 0.15, 0.25, 0.5 and the learning rate with the following values: 0.3, 0.5, 0.7, 1.0, 1.2, 1.5, 2.0, 2.5, 3.0. We found that the best hyper-parameters for a Single GPU training, using a batch size of 256, are a temperature of 0.15 and a learning rate of 1.0, this lead to a 65.58 accuracy in online linear probing and 68.5% in non linear probing.}
BibTeX
@misc{bordes2023towards,
  author = {Florian Bordes and Randall Balestriero and Pascal Vincent},
  title = {{Towards Democratizing Joint-Embedding Self-Supervised Learning}},
  year = {2023},
  eprint = {2303.01986},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.01986},
}
Figure