System Design · OpenAI · Hard
Implement a function that computes the contrastive loss value (often referred to as InfoNCE, used in self‑supervised embedding training) for a given anchor, a positive, and a set of negative embedding vectors, along with a temperature hyperparameter. All vectors provided are already L2‑normalized, so the similarity between any two vectors is simply their dot product. The loss L is defined as: where S_pos = dot(anchor, positive) S_neg = dot(anchor, negative) for each vector…
Checking your access…