The pre-training contrastive loss for a phrase representation h and its positive partner h+ across a mini-batch of N instances using in-batch negatives is defined as:
lpre=−log∑i=1Nexp(sim(h,hi)/τ)exp(sim(h,h+)/τ)
where sim(h1,h2)=∥h1∥∥h2∥h1⊤h2 is the cosine similarity, τ is the temperature hyperparameter (0.05), and hi is the i-th instance embedding in the mini-batch.
For Cluster-Assisted Contrastive Learning (CCL) finetuning, given a topic cluster set C, an anchor instance representation hci with a positive instance hci+ from topic cluster ci∈C, and negative instances hcj− sampled from topics cj∈C∖{ci}, the objective is:
lCCL=−logexp(sim(hci,hci+)/τ)+∑cj∈C,cj=ciexp(sim(hci,hcj−)/τ)exp(sim(hci,hci+)/τ)