Contrastive Learning has recently achieved state-of-the-art performance in a wide range of tasks. Many contrastive learning approaches use mined hard negatives to make batches more informative during training but these approaches are inefficient as they increase epoch length proportional to the number of mined negatives and require frequent updates of nearest neighbor indices or mining from recent batches. In this work, we provide an alternative to hard negative mining in supervised contrastive learning, Tail Batch Sampling (TBS), an efficient approximation to the batch assignment problem that upper bounds the gap between the global and training losses, $\mathcal{L}^{Global} - \mathcal{L}^{Train}$. TBS \textbf{improves state-of-the-art performance} in sentence embedding (+0.37 Spearman) and code-search tasks (+2.2\% MRR), is easy to implement - requiring only a few additional lines of code, does not maintain external data structures such as nearest neighbor indices, is more computationally efficient when compared to the most minimal hard negative mining approaches, and makes no changes to the model being trained.
翻译:最近,在一系列广泛的任务中,许多对比鲜明的学习方法都取得了最先进的学习成绩。许多对比鲜明的学习方法使用挖掘的硬底片使培训期间批量信息更加丰富,但这些方法效率低下,因为它们增加了与埋设底片数量成比例的时速长度,需要经常更新最近的邻里指数或最近批量的采矿。在这项工作中,我们提供了一种替代硬式负面采矿的替代方法,即监督对比式学习、尾巴批量抽样(TBS)和代码搜索任务(+2.2 ⁇ MRR)中,我们提供了一种替代硬性负式采矿的替代方法,它有效地接近分批作业问题,使全球损失与培训损失之间的差距达到最高界限。 $\mathcal{L ⁇ Global} -\mathcal{L ⁇ Train} $。 TBS\ textbf{imprice state-statroduction (+0.37 Spearman)和代码搜索任务(+2.2 ⁇ MRRRRRR), 很容易执行----只需要再几条代码,并不维持最近的近邻里指数等外部数据结构,在计算上效率更高,与最起码的负面采矿方法相比,在计算上比较有效,没有改变模型。