• Contrastive loss penalizes proximity between dissimilar pairs pairs, and long distance between similar pairs
    • Does not enforce relative distances
    • Easy to implement for many problems
  • Triplet loss requires three observations for each training example (anchor, positive, negative)
    • Will establish an appropriate relative ordering
    • Can be complicated to select examples

In practice, most ranking tasks can use either one. For simple tasks, triplet loss may not improve performance and requires more engineering. For more complex tasks, triplet will provide a performance boost. In contrast, cross-modal learning models usually are going to need the relative distance ordering that comes with triplet loss.