NT-Xent, or Normalized Temperature-scaled Cross Entropy Loss, is a loss function. Let sim(u,v)=uTv/∣∣u∣∣∣∣v∣∣ denote the cosine similarity between two vectors u and v. Then the loss function for a positive pair of examples (i,j) is :
l_i,j=−log∑2N_k=11_[k=i]exp(sim(z_i,z_k)/τ)exp(sim(z_i,z_j)/τ)
where 1_[k=i]∈{0,1} is an indicator function evaluating to 1 iff k=i and τ denotes a temperature parameter. The final loss is computed across all positive pairs, both (i,j) and (j,i), in a mini-batch.
Source: SimCLR