Lune

CVPR2025顶会

Breaking the Memory Barrier of Contrastive Loss via Tile-Based Strategy

Zesen Cheng, Hang Zhang, Kehan Li, Sicong Leng, Zhiqiang Hu, Fei Wu, Deli Zhao, Xin Li, Lidong Bing

摘要

Contrastive loss is a powerful approach for representation learning, where larger batch sizes enhance performance by providing more negative samples to better distinguish between similar and dissimilar data. However, the full instantiation of the similarity matrix demands substantial GPU memory, making large batch training highly resourceintensive. To address this, we propose a tile-based computation strategy that partitions the contrastive loss calculation into small blocks, avoiding full materialization of the similarity matrix. Additionally, we introduce a multi-level tiling implementation to leverage the hierarchical structure of distributed systems, using ring-based communication at the GPU level to optimize synchronization and fused kernels at the CUDA core level to reduce I/O overhead. Experimental results show that the proposed method significantly reduces GPU memory usage in contrastive loss. For instance, it enables contrastive training of a CLIP-ViT-L/14 model with a batch size of 4M using only 8 A800 80GB GPUs, without sacrificing accuracy. Compared to state-ofthe-art memory-efficient solutions, it achieves a two-orderof-magnitude reduction in memory while maintaining comparable speed. The code will be made publicly available. 1

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

可以从这些问题问起

Lune 可以查阅

全文 · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision 引用了 Learning Transferable Visual Models From Natural Language Supervision
  • Sigmoid Loss for Language Image Pre-Training 引用了 A Simple Framework for Contrastive Learning of Visual Representations
  • Sigmoid Loss for Language Image Pre-Training 引用了 Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision
  • Sigmoid Loss for Language Image Pre-Training 引用了 Learning Transferable Visual Models From Natural Language Supervision
  • Learning Transferable Visual Models From Natural Language Supervision 引用了 A Simple Framework for Contrastive Learning of Visual Representations
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

它引用的 Paper18

  1. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh 等ICML 2021 · 47,906 次引用
  2. A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 次引用
  3. FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra 等NeurIPS 2022 · 5,493 次引用
  4. Scaling Up Visual and Vision-Language Representation Learning With Noisy Text SupervisionChao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen 等ICML 2021 · 5,401 次引用
  5. Sigmoid Loss for Language Image Pre-TrainingXiaohua Zhai, Basil Mustafa, Alexander Kolesnikov, Lucas BeyerICCV 2023 · 2,932 次引用

相关 Paper

  1. DisCo-CLIP: A Distributed Contrastive Loss for Memory Efficient CLIP TrainingYihao Chen, Xianbiao Qi, Jianan Wang, Lei ZhangCVPR 2023
  2. AmorLIP: Efficient Language-Image Pretraining via AmortizationHaotian Sun, Yitong Li, Yuchen Zhuang, Niao He 等NeurIPS 2025 · 2 次引用
  3. Provable Stochastic Optimization for Global Contrastive Learning: Small Batch Does Not Harm PerformanceZhuoning Yuan, Yuexin Wu, Zi-Hao Qiu, Xianzhi Du 等ICML 2022 · 43 次引用
  4. Contrastive Alignment of Vision to Language Through Parameter-Efficient Transfer LearningZaid Khan, Yun FuICLR 2023 · 2 次引用
  5. CLIP-KD: An Empirical Study of CLIP Model DistillationChuanguang Yang, Zhulin An, Libo Huang, Junyu Bi 等CVPR 2024 · 50 次引用
黄昏的海面,两侧是细线勾勒的悬崖