An Inverse Scaling Law for CLIP Training

Xianhang Li, Zeyu Wang, Cihang Xie · OpenReview

TL;DR

This paper discovers an "inverse scaling law" for training CLIP models: larger model architectures can achieve competitive performance with significantly shorter input sequences (fewer image/text tokens). This allows for dramatically faster and more resource-efficient CLIP training, making it accessible to researchers with limited computational budgets.

What Problem Does This Paper Address?

Training large-scale vision-language models like CLIP is incredibly computationally expensive, creating a significant barrier to entry for many researchers and institutions. While established scaling laws suggest performance improves with model size and data, they also imply ever-increasing computational demands. This paper aims to democratize CLIP training by finding a way to achieve high performance without proportionally increasing computational cost, specifically by exploring how input sequence length interacts with model size.

Methods

The core of this work is the discovery and exploitation of an "inverse scaling law." The authors systematically investigate various strategies for reducing the number of image and text tokens fed into the CLIP model during training. These strategies include:

  • Image Token Reduction: Random masking, grid masking, block masking, and image resizing.
  • Text Token Reduction: Truncation, random masking, block masking, and syntax masking (prioritizing nouns and adjectives).

They then analyze how these reductions affect performance across different model sizes (S/16, B/16, L/16, H/14, G/14). The key insight is that larger models are more resilient to token reduction, meaning they can tolerate fewer tokens without a significant performance drop. This allows for the development of the CLIPA framework, which leverages larger models with reduced input sequences for efficient training.

Datasets

  • Training: LAION-400M, LAION-2B, DataComp-1B.
  • Evaluation: ImageNet-1k, COCO (for retrieval), ImageNet-V2, ImageNet-R, ImageNet-A, ImageNet-Sketch (for robustness), VTAB benchmark, ARO benchmark.

Key Insights and Ideas

  • The Inverse Scaling Law: This is the central finding. Contrary to traditional scaling laws, larger CLIP models benefit from shorter input sequences, not longer ones, for efficient training. This means you can use a bigger, more powerful model but feed it less data per sample.
  • Semantic Preservation is Key: The strategy for reducing tokens matters. Methods that preserve more semantic information (like image resizing or syntax masking for text) yield better results and enable more aggressive token reduction.
  • Democratizing CLIP: By enabling efficient training with fewer resources, this work makes CLIP training accessible to a wider range of researchers, potentially accelerating innovation in the field.
  • Faster, Cheaper, Better: The CLIPA framework demonstrates that training larger models with reduced token lengths can achieve state-of-the-art performance with significantly less compute and time compared to previous methods.

Key Results

  • Significant Speedups: CLIPA models achieve substantial training acceleration. For example, CLIPA-L/16 can train in ~3 days on 8 A100 GPUs, achieving 67.8% ImageNet-1k zero-shot accuracy, compared to OpenCLIP-B/16 which takes ~61 hours on 176 A100 GPUs for 67.1% accuracy.
  • State-of-the-Art Performance: CLIPA-G/14 achieves a record-high 83.0% ImageNet-1k zero-shot accuracy, with ~33x less computation than its OpenCLIP counterpart.
  • Effective Token Reduction Strategies: Image resizing and syntax masking were found to be particularly effective for reducing image and text tokens, respectively.
  • Robustness: The inverse scaling law holds for zero-shot retrieval and robustness benchmarks, with larger models showing smaller performance drops when using fewer tokens.

Limitations and Future Work

  • ARO Benchmark Performance: The paper notes that while CLIPA performs comparably to OpenCLIP on the ARO benchmark (which tests relational understanding), both models still show limited absolute performance in this area. This suggests further work is needed to improve CLIP's ability to capture relationships, attributes, and order information.
  • Bias in Datasets: The authors acknowledge that models trained on publicly available web-scale datasets may inherit biases present in those datasets, and care should be taken when deploying these models.
  • Future Work: The paper suggests that the findings could pave the way for training even larger models on even larger datasets, particularly for those with substantial access to GPU/TPU resources. The exploration of the inverse scaling law for other foundation models is also a natural extension.

Summary updated

Abstract

CLIP, the first foundation model that connects 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 by using academic resources. For example, on an A100 eight-GPU server, our CLIP models achieve zero-shot top-1 ImageNet accuracies of 63.2% in ~2 days, 67.8% in ~3 days, and 69.3% in ~4 days. 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