← Questions

CLIP contrastive loss

0
UberML designLast asked Apr 2026

Implement the CLIP-style contrastive loss for a batch of matching image and text embeddings.

Build the image-text similarity matrix, take the cross-entropy against the diagonal (each image's match is its own text) in both directions, images to texts and texts to images, and average the two. Discuss normalizing the embeddings and the temperature.

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing