Supervised Contrastive (SupCon) is a contrastive loss function that uses labels to treat every example of the anchor's class as a positive and every example of other classes as a negative, comparing them with a softmax. Khosla et al. (2020, Google Research and others) proposed it as an extension of the contrastive loss used in self-supervised learning (the form of NT-Xent) to labeled classification.
In the self-supervised loss, the only positive is "another view made from the same image as the anchor," and other images of the same class are pushed away as negatives. SupCon uses labels to treat all images of the same class as positives, comparing many positives and many negatives against one anchor at once. The loss is as follows.
is an embedding normalized to unit length, is the temperature, is the set of all candidates other than anchor , and is the subset of those with the same label as the anchor. As in the figure at the top, the denominator (all candidates) is the same as in the self-supervised loss; only the candidates placed in the numerator as positives differ.
With a linear classifier on top of the learned representation, ResNet-200 on ImageNet reached 81.4% top-1 accuracy, 0.8 points above the best reported value for cross-entropy with the same architecture. The paper describes it as the first contrastive loss to consistently outperform cross-entropy on large-scale classification.

