Accelerating Augmentation Invariance Pretraining

Jinhong Lin, Cheng-En Wu, Yibing Wei, Pedro Morgado

TL;DR

Pretraining Vision Transformers (ViTs) using self-supervised learning is notoriously slow and resource-intensive. This paper introduces an acceleration framework that uses randomized token dropout and flexible patch scaling to compress input sequences, achieving up to 4x speedups on ImageNet while maintaining downstream performance through an automated, gradient-error-aware training schedule.

What Problem Does This Paper Address?

Self-supervised learning (SSL) has revolutionized computer vision by allowing models to learn from unlabeled data. Methods like MoCo, SimCLR, and DINO rely on "augmentation invariance"—teaching a model that two different "views" (crops, color jitters) of the same image should have similar representations.

However, when applied to Vision Transformers (ViTs), these methods are computationally expensive. ViTs treat images as sequences of patches, and their training time scales linearly with the number of patches. Because ViTs have less "inductive bias" than traditional convolutional networks (CNNs), they often require much longer training schedules to reach peak performance. Existing acceleration tricks, like adjusting learning rates or adding more data augmentations, don't fully exploit the unique architectural flexibility of Transformers.

Methods

The authors propose reducing the computational cost by shortening the input sequence length during training. They employ two primary strategies:

Architecture of the proposed acceleration framework
  1. Randomized Token Dropout (TknDrop): Simply removing a random subset of tokens (patches) from the input. Since neighboring pixels in images are highly correlated, the model can often still infer the content from a partial view.
  2. Flexible Patch Scaling: Instead of dropping data, this method uses larger patches (e.g., 32x32 instead of the standard 16x16). This reduces the total number of tokens while keeping all pixels in the frame. They use a specialized projection method to adapt the ViT’s patch embedding layer to these varying sizes.

The "Secret Sauce": Asymmetric Acceleration and Dynamic Scheduling The researchers found that for contrastive learning, it is most effective to apply asymmetric acceleration: they compress the "query" (student) view to save time but keep the "key" (teacher/target) view at full resolution to ensure the learning signal remains high-quality.

Crucially, they don't just pick a compression rate and stick with it. They analyze the Cost-Adjusted Mean Squared Error (CA-MSE) of the gradients. Early in training, the model can tolerate "noisier," highly compressed inputs because the gradients are large. As the model converges, it needs finer detail. The authors developed an automated schedule that starts with aggressive compression and gradually shifts toward full-resolution sequences as training progresses.

Datasets

The study primarily utilizes:

  • ImageNet-100: A subset of 100 classes used for extensive ablation studies and hyperparameter tuning.
  • ImageNet-1k: The full-scale standard benchmark used to validate the final speedup results across different SSL algorithms (MoCo-v3, SimCLR, and DINO).

Key Insights and Ideas

  • The Bias-Variance Trade-off: Compression introduces "bias" (the gradients aren't perfectly accurate) but reduces "variance" because you can process significantly more samples within the same time budget. The paper proves that in the early stages of training, the benefit of seeing more samples far outweighs the noise introduced by compression.
  • ViTs are Naturally Elastic: Unlike CNNs, which are often tied to specific input resolutions, ViTs can process sequences of any length. This makes them uniquely suited for "on-the-fly" sequence compression.
  • Constant Compression is a Trap: The authors show that if you keep compression high throughout the entire training run, the model eventually overfits to the "blurry" or "incomplete" views and fails to reach peak accuracy. The dynamic schedule is essential to "finish" the training with high-fidelity data.

Key Results

The framework delivers massive efficiency gains across multiple popular SSL frameworks on ImageNet-1k:

Performance comparison showing massive speedups on ImageNet
  • MoCo-v3: Achieved a 4x speedup, matching the baseline performance using only 25% of the original computational budget.
  • SimCLR: Achieved a 3.3x speedup.
  • DINO: Achieved a 2.5x speedup.

On the smaller ImageNet-100 dataset, the results were even more dramatic, with the accelerated MoCo-v3 reaching standard performance levels using only 1/5th of the typical training budget.

Limitations and Future Work

While the results are impressive, the authors note a few areas for further exploration:

  • Algorithm Specificity: While the method is general, the "optimal" schedule varies slightly between algorithms (e.g., SimCLR required compressing both views, while MoCo preferred asymmetry).
  • Implementation Overhead: The speedups are calculated based on "sample cost" (computational complexity). In practice, actual wall-clock time can be influenced by data loading bottlenecks if the system isn't optimized to resize patches rapidly.
  • Expansion to MIM: The paper focuses on augmentation invariance (contrastive/distillation). Future work could explore how these dynamic schedules interact with Masked Image Modeling (MIM) tasks like MAE, which already use a form of token masking.

Summary updated

BibTeX
@inproceedings{lin2024accelerating,
  author = {Jinhong Lin and Cheng-En Wu and Yibing Wei and Pedro Morgado},
  title = {{Accelerating Augmentation Invariance Pretraining}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Wh9ssqlCNg},
}
Figure