An Inverse Scaling Law for CLIP Training

Xianhang Li, Zeyu Wang, Cihang Xie

TL;DR

This paper introduces an "inverse scaling law" for CLIP training: as model size increases, the number of image and text tokens required for effective training actually decreases. Leveraging this insight, the authors present CLIPA, a framework that achieves state-of-the-art performance (83.0% zero-shot ImageNet accuracy) while accelerating training by up to 33x compared to standard implementations.

What Problem Does This Paper Address?

Contrastive Language-Image Pre-training (CLIP) has revolutionized computer vision by enabling powerful zero-shot capabilities and robust visual representations. However, training these models is notoriously expensive. Replicating a standard CLIP-B/32 model typically requires hundreds of GPUs and thousands of GPU-hours, creating a "compute barrier" that excludes most academic researchers and smaller labs from the field.

While previous work like FLIP explored masking patches to speed up training, the community lacked a fundamental understanding of how token reduction interacts with model scaling. The authors set out to find a way to make high-performance CLIP training accessible on modest hardware (like a single 8-GPU node).

Methods

The core of the paper is the discovery of the inverse scaling law. The authors systematically ablated token reduction strategies across different model scales (ViT-S, B, L, H, and G).

Token Reduction Strategies

The authors compared several ways to reduce the computational load:

  • Image: They compared Random Masking (popularized by MAE), Grid Masking, Block Masking, and simple Resizing (bilinear interpolation).
  • Text: They compared Truncation, Random Masking, Block Masking, and a novel Syntax Masking strategy that prioritizes keeping nouns and adjectives.
Figure 2: Visual comparison of different strategies for reducing image token length.

The CLIPA Framework

Based on their findings, the authors proposed a two-stage training pipeline:

  1. Pre-training: Train the model using extremely short token sequences (e.g., resizing images to 112x112 or even 64x64, and using only 8-16 text tokens).
  2. Fine-tuning: A very short high-resolution fine-tuning stage (e.g., 0.36 epochs) on full-resolution images (224x224 or 336x336) to restore fine-grained details.

Datasets

The models were trained and evaluated on a variety of large-scale datasets:

  • Training: LAION-400M, LAION-2B, and DataComp-1B.
  • Evaluation: ImageNet-1k (zero-shot classification), COCO and Flickr30k (image/text retrieval), and robustness benchmarks like ImageNet-V2, ImageNet-R, ImageNet-A, and ImageNet-Sketch.
  • Downstream: The VTAB benchmark (19 diverse vision tasks) and the ARO benchmark (for relational understanding).

Key Insights and Ideas

  • The Inverse Scaling Law: The most striking finding is that larger models are more "token-efficient." While a small ViT-S model might see a massive performance drop when tokens are reduced, a ViT-L or ViT-G model maintains nearly full performance even with a fraction of the original tokens.
  • Resizing > Masking for CLIP: Unlike Masked Image Modeling (like MAE) which thrives on random masking to force reconstruction, CLIP is a discriminative task. The authors found that resizing (which preserves the global semantic structure, albeit at lower resolution) is significantly more effective for CLIP than masking (which deletes parts of the image).
  • Semantic Preservation is Key: In text, "Syntax Masking" (keeping nouns/adjectives) outperformed random truncation. This suggests that for contrastive learning, preserving the core semantic "anchors" of a sample is more important than seeing every high-frequency detail.
Figure 4: The inverse scaling law on image tokens. Compared to small models, larger models can utilize fewer image tokens to achieve the same performance drop to the full-resolution baseline.

Key Results

  • Democratizing CLIP: Using just 8 A100 GPUs, CLIPA achieves 69.3% zero-shot ImageNet accuracy in only 4 days. For context, the original OpenCLIP-B/32 requires 128 A100s to reach lower performance.
  • New State-of-the-Art: Scaling up to a G/14 model on DataComp-1B, CLIPA reached 83.0% zero-shot ImageNet accuracy. This sets a new record for open-source CLIP models.
  • Massive Speedups: CLIPA-G/14 is 33x faster to train than its OpenCLIP counterpart. Even at the Huge (H/14) scale, CLIPA is 25x more efficient than standard training while matching performance.

Limitations and Future Work

Despite the efficiency gains, the authors note that CLIP models (including CLIPA) still behave somewhat like "bags-of-words." They struggle with complex relational understanding (e.g., distinguishing "a dog chasing a cat" from "a cat chasing a dog").

While they showed that techniques like NegCLIP (hard negative mining) can be integrated into the fine-tuning stage to improve this, the fundamental limitation of the contrastive objective for fine-grained relational reasoning remains an open area for research. The authors also noted that absolute performance on the ARO benchmark remains somewhat limited for all models tested.

Summary updated

Abstract

CLIP, one of the pioneering foundation models that connect images and text, has enabled many recent breakthroughs in computer vision. However, its associated training cost is prohibitively high, imposing a significant barrier to its widespread exploration. In this paper, we present a surprising finding that there exists an inverse scaling law for CLIP training, whereby the larger the image/text encoders used, the shorter the sequence length of image/text tokens that can be applied in training. Moreover, we showcase that the strategy for reducing image/text token length plays a crucial role in determining the quality of this scaling law. As a result of this finding, we are able to successfully train CLIP even with limited computational resources. For example, using 8 A100 GPUs, our CLIP models achieve zero-shot top-1 ImageNet-1k accuracies of 63.2% in ~2 days, 67.8% in ~3 days, and 69.3% in ~4 days. Our method also works well when scaling up -- with G/14, we register a new record of 83.0% ImageNet-1k zero-shot accuracy, and meanwhile accelerate the training by ~33x compared to its OpenCLIP counterpart. By reducing the computation barrier associated with CLIP, we hope to inspire more research in this field, particularly from academics. Our code is available at https://github.com/UCSC-VLAA/CLIPA.
BibTeX
@inproceedings{li2023inverse,
  author = {Xianhang Li and Zeyu Wang and Cihang Xie},
  title = {{An Inverse Scaling Law for CLIP Training}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=LMU2RNwdh2},
}
Figure