arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2510.02161cs.MMcs.AIcs.LG
收藏

对比损失与三元组损失的比较:方差分析与优化行为

Comparing Contrastive and Triplet Loss: Variance Analysis and Optimization Behavior

KDDI Research, Inc., Japan(日本KDDI研究所)

Donghuo Zeng

AI总结:

本文通过理论与实验对比深度度量学习中的对比损失和三元组损失,分析二者的方差特性与优化行为差异,发现三元组损失在多数据集的分类、检索任务中性能更优,为不同场景的损失选择提供依据。

摘要:

对比损失和三元组损失是深度度量学习中广泛使用的目标函数,但它们对表示质量的影响仍未得到充分理解。本文对这两种损失进行了理论与实证比较,重点关注类内方差、类间方差以及优化行为(如贪心更新)。通过在合成数据与真实数据集MNIST、CIFAR-10上开展设置一致的任务专项实验,结果表明三元组损失能保留更大的类内和类间方差,有助于学习到的表示实现更细粒度的区分。相比之下,对比损失倾向于压缩类内嵌入,这可能会掩盖细微的语义差异。为更好地理解二者的优化动态,我们通过分析损失衰减率、激活率和梯度范数发现,对比损失在训练早期会产生大量小幅更新,而三元组损失产生的更新数量更少但强度更高,可持续对困难样本进行学习。最后,在MNIST、CIFAR-10、CUB-200和CARS196数据集的分类与检索任务中,我们的结果一致显示三元组损失的性能更优,这表明三元组损失适用于细节保留与困难样本聚焦,对比损失则适用于更平滑的广谱嵌入优化。

英文摘要:

Contrastive loss and triplet loss are widely used objectives in deep metric learning, yet their effects on representation quality remain insufficiently understood. We present a theoretical and empirical comparison of these losses, focusing on intra- and inter-class variance and optimization behavior (e.g., greedy updates). Through task-specific experiments with consistent settings on synthetic data and real datasets-MNIST, CIFAR-10-it is shown that triplet loss preserves greater variance within and across classes, supporting finer-grained distinctions in the learned representations. In contrast, contrastive loss tends to compact intra-class embeddings, which may obscure subtle semantic differences. To better understand their optimization dynamics, By examining loss-decay rate, active ratio, and gradient norm, we find that contrastive loss drives many small updates early on, while triplet loss produces fewer but stronger updates that sustain learning on hard examples. Finally, across both classification and retrieval tasks on MNIST, CIFAR-10, CUB-200, and CARS196 datasets, our results consistently show that triplet loss yields superior performance, which suggests using triplet loss for detail retention and hard-sample focus, and contrastive loss for smoother, broad-based embedding refinement.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑