Data-Efficient Contrastive Language-Image Pretraining: Prioritizing Data Quality over Quantity

Siddharth Joshi, Arnav Jain, Ali Payani, Baharan Mirzasoleiman

Abstract

Contrastive Language-Image Pre-training (CLIP) on large-scale image-caption datasets learns representations that can achieve remarkable zero-shot generalization. However, such models require a massive amount of pre-training data. Improving the quality of the pre-training data has been shown to be much more effective in improving CLIP’s performance than increasing its volume. Nevertheless, finding small subsets of training data that provably generalize best has remained an open question. In this work, we propose the first theoretically rigorous data selection method for CLIP. We show that subsets that closely preserve the cross-covariance of the images and captions of the full data provably achieve a superior generalization performance. Our extensive experiments on ConceptualCaptions3M and ConceptualCaptions12M demonstrate that subsets found by ClipCov achieve over 2.7x and 1.4x the accuracy of the next best baseline on ImageNet and its shifted versions. Moreover, we show that our subsets obtain 1.5x the average accuracy across 11 downstream datasets, of the next best baseline.

The Challenge of Data-Hungry Models

Models like CLIP have revolutionized computer vision by enabling "zero-shot" recognition—the ability to identify objects the model wasn't explicitly trained on. However, this success usually requires staggering amounts of data, often hundreds of millions or even billions of image-caption pairs crawled from the web.

While recent research suggests that data quality matters more than quantity, most existing data selection methods rely on heuristics, such as keeping pairs with high similarity scores (e.g., CLIP Score). There is a significant lack of theoretical understanding regarding which small subsets of data guarantee strong generalization. Furthermore, standard supervised data selection techniques are often inapplicable to CLIP because the contrastive loss depends on the entire batch or dataset distribution, rather than individual examples.

Methodology: The ClipCov Algorithm

The authors introduce ClipCov, an algorithm designed to find a subset that "mimics" the statistical properties of the full dataset. The core idea is that CLIP representations are primarily determined by the cross-covariance matrix of the image-caption data. If a subset preserves this matrix, the resulting model should perform similarly to one trained on the full set.

Conceptual diagram of latent classes and subgroups. ClipCov selects diverse 'Selected' points (triangles) to represent the structure of the full data, avoiding the redundancy of 'Not Selected' points (crosses).

ClipCov optimizes a multi-part objective function designed for submodular maximization:

  • $F_{cov}$: Preserves the centers and diversity of "latent classes" (groups of similar objects) to maintain the overall data structure.
  • $F_{label}$: Ensures selected captions are close to actual class labels, which is critical for zero-shot tasks.
  • $F_{inter}$: Penalizes similarity between different classes to ensure the model learns distinguishable representations.

Since finding the perfect subset is NP-hard, the method employs efficient greedy and double-greedy algorithms, allowing it to scale to millions of samples. To calculate similarities, a pre-trained CLIP model is used as a "proxy" to extract initial features.

Key Results and Performance

The authors evaluated zero-shot performance on ImageNet-1k, its "shifted" versions (ImageNet-V2, Sketch, A, and R), and 11 diverse downstream datasets (e.g., Caltech101, Food101).

Performance comparison of ClipCov ('Our Method') against baselines across (a) ImageNet, (b) ImageNet Distribution Shift, and (c) an average of 11 downstream datasets. ClipCov consistently outperforms other methods, especially at smaller subset sizes.
  • Massive Accuracy Gains: On ImageNet, a 10% subset selected by ClipCov achieved 11.33% accuracy, compared to just 6.48% for the next best baseline (CLIP Score) and 3.95% for random selection.
  • Superiority at Small Scales: At very small subset sizes (5%), ClipCov achieved over 2.7x the accuracy of the next best baseline on ImageNet.
  • Robustness to Distribution Shift: Subsets chosen by ClipCov showed even greater relative gains on out-of-distribution datasets (like sketches or adversarial images), suggesting the selected data captures more "fundamental" features.

Insights and Future Directions

A key takeaway is that covariance matters more than individual similarity. Most filters just pick the "best" individual pairs, which often leads to high redundancy. ClipCov naturally encourages diversity by representing the distribution and relationships of the original data. Additionally, explicitly selecting captions that are "central" to labels significantly boosts zero-shot performance.

While highly effective, ClipCov currently depends on proxy models for feature extraction and uses ImageNet-1k labels to approximate "latent classes." Future work could explore unsupervised clustering to define these classes and investigate scaling the greedy selection process to billions of samples, such as the LAION dataset.

The code is available at: https://github.com/BigML-CS-UCLA/clipcov-data-efficient-clip

Summary updated

BibTeX
@inproceedings{joshi2024data,
  author = {Siddharth Joshi and Arnav Jain and Ali Payani and Baharan Mirzasoleiman},
  title = {{Data-Efficient Contrastive Language-Image Pretraining: Prioritizing Data Quality over Quantity}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=dnfa9LTjmE},
}
Figure