Improving CLIP Training with Language Rewrites

Lijie Fan,Dilip Krishnan,Phillip Isola,Dina Katabi,Yonglong Tian
2023-10-28
Abstract:Contrastive Language-Image Pre-training (CLIP) stands as one of the most effective and scalable methods for training transferable vision models using paired image and text data. CLIP models are trained using contrastive loss, which typically relies on data augmentations to prevent overfitting and shortcuts. However, in the CLIP training paradigm, data augmentations are exclusively applied to image inputs, while language inputs remain unchanged throughout the entire training process, limiting the exposure of diverse texts to the same image. In this paper, we introduce Language augmented CLIP (LaCLIP), a simple yet highly effective approach to enhance CLIP training through language rewrites. Leveraging the in-context learning capability of large language models, we rewrite the text descriptions associated with each image. These rewritten texts exhibit diversity in sentence structure and vocabulary while preserving the original key concepts and meanings. During training, LaCLIP randomly selects either the original texts or the rewritten versions as text augmentations for each image. Extensive experiments on CC3M, CC12M, RedCaps and LAION-400M datasets show that CLIP pre-training with language rewrites significantly improves the transfer performance without computation or memory overhead during training. Specifically for ImageNet zero-shot accuracy, LaCLIP outperforms CLIP by 8.2% on CC12M and 2.4% on LAION-400M. Code is available at <a class="link-external link-https" href="https://github.com/LijieFan/LaCLIP" rel="external noopener nofollow">this https URL</a>.
Computer Vision and Pattern Recognition,Computation and Language,Machine Learning
What problem does this paper attempt to address?
The problem that this paper attempts to solve is the lack of diversity in language input during the CLIP (Contrastive Language - Image Pre - training) training process. Specifically, the CLIP model uses contrastive loss during training, and this loss usually relies on data augmentation to prevent over - fitting and the learning of ineffective shortcuts. However, in the CLIP training paradigm, data augmentation is only applied to image inputs, while the language input remains unchanged throughout the training process, which limits the exposure of different text descriptions for the same image. This asymmetry leads to two main problems: 1. **The image encoder receives limited supervision from the language side**: Since the same image is always paired with the same text, there is less guidance from the language aspect, affecting the learning effect of the image encoder. 2. **The text encoder has a risk of over - fitting**: The text encoder encounters exactly the same text in each training cycle, increasing the risk of text over - fitting, thereby significantly affecting the zero - shot transfer ability. To overcome these problems, the paper proposes a new method - Language augmented CLIP (LaCLIP), which enhances CLIP training through language rewrites. Specifically, by leveraging the in - context learning ability (In - Context Learning, ICL) of large - language models (LLMs), the text descriptions of each image are rewritten to generate diverse text descriptions while retaining the original key concepts and meanings. During the training process, LaCLIP randomly selects either the original text or the rewritten text as text augmentation, thereby improving the transfer performance of the model without increasing computational or memory overhead. Through this method, LaCLIP has conducted extensive experiments on multiple datasets, and the results show that using language rewrites for CLIP pre - training can significantly improve the transfer performance of the model. For example, on the LAION - 400M dataset, the zero - shot accuracy of LaCLIP on ImageNet has increased from 62.0% to 64.4%, with a relative improvement of 2.4%. In addition, LaCLIP also demonstrates compatibility with other techniques for enhancing CLIP performance and shows good scalability on larger datasets.