  Contrastive learning is a method of learning visual representations by
training Deep Neural Networks (DNNs) to increase the similarity between
representations of positive pairs (transformations of the same image) and
reduce the similarity between representations of negative pairs
(transformations of different images). Here we explore Energy-Based Contrastive
Learning (EBCLR) that leverages the power of generative learning by combining
contrastive learning with Energy-Based Models (EBMs). EBCLR can be
theoretically interpreted as learning the joint distribution of positive pairs,
and it shows promising results on small and medium-scale datasets such as
MNIST, Fashion-MNIST, CIFAR-10, and CIFAR-100. Specifically, we find EBCLR
demonstrates from X4 up to X20 acceleration compared to SimCLR and MoCo v2 in
terms of training epochs. Furthermore, in contrast to SimCLR, we observe EBCLR
achieves nearly the same performance with 254 negative pairs (batch size 128)
and 30 negative pairs (batch size 16) per positive pair, demonstrating the
robustness of EBCLR to small numbers of negative pairs. Hence, EBCLR provides a
novel avenue for improving contrastive learning methods that usually require
large datasets with a significant number of negative pairs per iteration to
achieve reasonable performance on downstream tasks. Code:
https://github.com/1202kbs/EBCLR
