Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup

By Luyu Gao, Yunyi Zhang, Jiawei Han, Jamie Callan. 2021

167 citations recorded by the source corpus.

Contrastive learning has been applied successfully to learn vector representations of text. Previous research demonstrated that learning high-quality representations benefits from batch-wise contrastive loss with a large number of negatives. In practice, the technique of in-batch negative is used, where for each example in a batch, other batch examples’ positives will be taken as its negatives, avoiding encoding extra negatives. This, however, still conditions each example’s loss on all batch examples and requires fitting the entire large batch into GPU memory. This paper introduces a gradient caching technique that decouples backpropagation between contrastive loss and the encoder, removing encoder backward pass data dependency along the batch dimension. As a result, gradients can be computed for one subset of the batch at a time, leading to almost constant memory usage.

Subfields: Representation & Self-Supervised Learning, Optimization & Training

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Representation & Self-Supervised Learning

  1. Jianfeng Gao
  2. Niklas Muennighoff
  3. Jianwei Yang
  4. Shitao Xiao
  5. Peitian Zhang
  6. Zheng Liu
  7. Jamie Callan
  8. Luyu Gao

In Optimization & Training

  1. Niklas Muennighoff
  2. Jamie Callan
  3. Luyu Gao
  4. Jianwei Yang
  5. Xuedong Huang
  6. Lu Yuan
  7. Ji-rong Wen
  8. Ce Liu

Citations in the corpus