Global Selection of Contrastive Batches via Optimization on Sample Permutations
Vin Sachidananda, Ziyi Yang, Chenguang Zhu
Abstract
Contrastive Learning has recently achieved stateof-the-art performance in a wide range of unimodal and multimodal tasks. Many contrastive learning approaches use mined hard negatives to make batches more informative during training but these approaches are inefficient as they increase epoch length proportional to the number of mined negatives and require frequent updates of nearest neighbor indices or mining from recent batches. In this work, we provide an alternative to hard negative mining, Global Contrastive Batch Sampling (GCBS), an efficient approximation to the batch assignment problem that upper bounds the gap between the global and training losses, L Global -L T rain , in contrastive learning settings. Through experimentation we find GCBS improves state-of-the-art performance in sentence embedding and code-search tasks. Additionally, GCBS is easy to implement as it requires only a few additional lines of code, does not maintain external data structures such as nearest neighbor indices, is more computationally efficient than the most minimal hard negative mining approaches, and makes no changes to the model being trained. Code is available at https://github.com/vinayak1/GCBS .
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
6 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- LogiCoL: Logically-Informed Contrastive Learning for Set-based Dense Retrieval cites Contextual Document Embeddings
- LogiCoL: Logically-Informed Contrastive Learning for Set-based Dense Retrieval cites MoDE: CLIP Data Experts via Clustering
- HOBIT: Hardness Optimized Batch Sampling for InfoNCE Training cites Contextual Document Embeddings
- HOBIT: Hardness Optimized Batch Sampling for InfoNCE Training cites Breaking the Batch Barrier (B3) of Contrastive Learning via Smart Batch Mining
- Contextual Document Embeddings cites A Simple Framework for Contrastive Learning of Visual Representations
- Zero-Shot Text-to-Image Generation cites Learning Transferable Visual Models From Natural Language Supervision
- MoDE: CLIP Data Experts via Clustering cites A Simple Framework for Contrastive Learning of Visual Representations
- MoDE: CLIP Data Experts via Clustering cites Learning Transferable Visual Models From Natural Language Supervision
- Learning Transferable Visual Models From Natural Language Supervision cites A Simple Framework for Contrastive Learning of Visual Representations
- Breaking the Batch Barrier (B3) of Contrastive Learning via Smart Batch Mining cites A Simple Framework for Contrastive Learning of Visual Representations
- Breaking the Batch Barrier (B3) of Contrastive Learning via Smart Batch Mining cites Contextual Document Embeddings
- Breaking the Batch Barrier (B3) of Contrastive Learning via Smart Batch Mining cites Learning Transferable Visual Models From Natural Language Supervision
Cited by top-tier papers6
- Breaking the Batch Barrier (B3) of Contrastive Learning via Smart Batch MiningRaghuveer Thirukovalluru, Rui Meng, Ye Liu, Karthikeyan K et al.NeurIPS 2025 · 30 citations
- MoDE: CLIP Data Experts via ClusteringJiawei Ma, Po-Yao Huang, Saining Xie, Shang-Wen Li et al.CVPR 2024 · 8 citations
- LogiCoL: Logically-Informed Contrastive Learning for Set-based Dense RetrievalYanzhen Shen, Sihao Chen, Xueqiang Xu, Yunyi Zhang et al.EMNLP 2025 · 1 citation
- HOBIT: Hardness Optimized Batch Sampling for InfoNCE TrainingHimanshu Dutta, Lokesh Nagalapatti, Yashoteja PrabhuICML 2026
- Contextual Document EmbeddingsJohn Xavier Morris, Alexander M. RushICLR 2025
Builds on16
- Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
- A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
- Zero-Shot Text-to-Image GenerationAditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray et al.ICML 2021 · 6,356 citations
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
- GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
Related papers
- BatchSampler: Sampling Mini-Batches for Contrastive Learning in Vision, Language, and GraphsZhen Yang, Tinglin Huang, Ming Ding, Yuxiao Dong et al.KDD 2023 · 13 citations
- Contrastive Learning with Hard Negative SamplesJoshua David Robinson, Ching-Yao Chuang, Suvrit Sra, Stefanie JegelkaICLR 2021 · 999 citations
- Clustering-Aware Negative Sampling for Unsupervised Sentence RepresentationJinghao Deng, Fanqi Wan, Tao Yang, Xiaojun Quan et al.ACL Findings 2023 · 10 citations
- Unsupervised Sentence Representation via Contrastive Learning with Mixing NegativesYanzhao Zhang, Richong Zhang, Samuel Mensah, Xudong Liu et al.AAAI 2022 · 71 citations
- B2-Sampling: Fusing Balanced and Biased Sampling for Graph Contrastive LearningMengyue Liu, Yun Lin, Jun Liu, Bohao Liu et al.KDD 2023 · 5 citations
