Term
contrastive loss
Meaning
A loss defined over pairs of examples that pulls together pairs labelled similar and pushes apart pairs labelled dissimilar, measured in the distance induced by the learned representation.
How papers use it 13 papers
Deep metric learning using Triplet network
Use The training objective of the Siamese Network baseline in this paper. The authors apply it to pairs of samples in place of the triplet-based objective used by TripletNet.
Pre-Trained Image Processing Transformer
Use Defined as the contrastive term \(L_{constrastive}\) over the IPT decoder outputs \(f^{D}_{j i}\) for a batch of \(B\) training images, with \(N\) patches per image. It is weighted by \(\lambda\) and added to the supervised loss to form the final training objective \(L_{IPT}=\lambda\cdot L_{constrastive}+L_{supervised}\). The paper describes it as a way to use both supervised and self-supervised information during pre-training.
Meaning A contrastive objective over patch features that scores the similarity of decoder patch pairs with cosine similarity inside a softmax-style term, and averages the resulting negative log-ratios over patch pairs and images in a batch. For a patch from image j, the positive is the matching patch from the same image and the negatives are patches from the other images in the batch.
Oscar: Object-Semantics Aligned Pre-training for Vision-Language Tasks
Use Combined with the masked token loss as the full pre-training objective of Oscar. The object tags are replaced with a randomly sampled tag sequence with probability 50% to create the polluted image representations, and the classifier is a fully-connected layer on top of the [CLS] output.
Meaning A pre-training objective that trains a binary classifier on the fused [CLS] representation to tell whether an image modality (region features with object tags) matches the paired text. Negative examples are created by replacing the tags with tags sampled from another image.
wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations
Use Used as the main pre-training loss, Lm, which is combined with the diversity loss as a weighted sum. For each masked time step, the context vector must pick the true quantized latent out of K distractors plus the true target. The temperature is written as κ.
Meaning A contrastive objective that scores how well a context vector identifies its correct target among a set of candidates. It uses cosine similarity between the context vector and each candidate, divided by a temperature, and takes the negative log of the softmax probability assigned to the true target.
A Survey of Convolutional Neural Networks: Analysis, Applications, and Prospects
Use Presented as a loss that can support dimensionality reduction in CNNs, where originally similar samples stay similar and originally different samples stay different. It is also described as widely used for face recognition, first in SiameseNet and then in DeepID2, DeepID2+ and DeepID3.
Meaning A loss that pulls together the features of samples from the same category and pushes apart features of samples from different categories, so that similar pairs stay close and dissimilar pairs stay far apart in the embedding space.
Deep Learning for Person Re-identification: A Survey and Outlook
Use Presented in the review as one form of verification loss, alongside the binary verification loss, with a variant that compares pairs using ranking SVM. The review notes that verification loss is often combined with the identity loss to improve performance.
Meaning A pairwise loss that acts on two embeddings and a binary label showing whether they share an identity. Same-identity pairs are pulled together by penalising their squared distance, while different-identity pairs are pushed apart until their distance exceeds a margin.
SphereFace: Deep Hypersphere Embedding for Face Recognition
Use Discussed as a Euclidean margin loss that the paper contrasts with its angular margin. The paper notes that it cannot constrain each individual sample and needs careful pair mining, and it is combined with softmax loss as a baseline with the weight chosen by cross-validation on the training set.
Meaning A metric learning loss on pairs of samples that pulls same-identity pairs together and pushes different-identity pairs apart using a Euclidean margin. It is a generic background definition, not one the paper gives.
Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision
Use Used by ALIGN to learn its image and text encoders. Matched pairs in a training batch are positives and all other pairs in the batch are negatives. The paper implements it as the normalized softmax form, and the embeddings of all computing cores are concatenated so that the in-batch negatives come from a larger batch.
Meaning A training objective that pulls the embeddings of matched image-text pairs together and pushes the embeddings of non-matched pairs apart, so that the two modalities are aligned in a shared space.
VoxCeleb: a large-scale speaker identification dataset
Use Used to train a Siamese embedding network for speaker verification, after the classification network has been trained and most filter weights are frozen. The modified last fully connected layer outputs a 1024-dimensional embedding. The authors argue this suits verification better than a classification loss, and on VoxCeleb the embedding variant reaches a lower EER than the 1024-dimensional fc7 features with cosine distance. Training pairs are half randomly chosen negatives and half hard negatives drawn from the hardest 10% of negatives.
Meaning A pairwise loss for metric learning that trains an embedding so that similar pairs of inputs are mapped close together and dissimilar pairs are mapped farther apart. Its penalty depends on the distance between the two embeddings of each pair and on whether the pair is labelled similar or dissimilar.
Momentum Contrast for Unsupervised Visual Representation Learning
Use Used as the training objective that scores a query against one positive key and K negative keys.
Meaning A loss that is low when a query is close to its matching sample and far from other samples in a learned representation space.
Learning to Prompt for Vision-Language Models
Use This is the objective used to pre-train CLIP, which aligns its image and text embedding spaces. CoOp builds on the resulting encoders and does not itself train with this objective; it uses cross-entropy on the learnable context vectors.
Meaning A training objective that raises the similarity of matched pairs in a shared embedding space and lowers the similarity of unmatched pairs.
A Simple Framework for Contrastive Learning of Visual Representations
Use In this paper the contrastive loss is the NT-Xent form. Each positive pair is scored with cosine similarity divided by a temperature τ, and the other 2(N−1) augmented examples in the minibatch serve as negatives. The loss is applied to the projection outputs z rather than to the encoder representations h, and it is averaged over all positive pairs in both orders.
Meaning An objective that pulls together the embeddings of positive pairs and pushes apart the embeddings of negative pairs, usually computed over a set of candidate examples.
Recent Advances in Convolutional Neural Networks
Use Presented in the loss function section as the loss commonly used for Siamese networks, which the paper describes as a weakly supervised scheme. The paper notes that works using two identical CNNs feed the final-layer feature vectors of each pair into this loss, with a margin parameter that affects non-matching pairs. The loss is one of the four representative losses it reviews.
Meaning A pairwise loss for training Siamese networks, which learn a similarity measure from pairs labelled as matching or non-matching. Matching pairs are pulled together by penalizing their squared feature distance, and non-matching pairs are pushed apart until their distance exceeds a margin.