CKD: Contrastive Knowledge Distillation from A Sample-wise Perspective

📄 arXiv: 2404.14109v2 📥 PDF

作者: Wencheng Zhu, Xin Zhou, Pengfei Zhu, Yu Wang, Qinghua Hu

分类: cs.CV

发布日期: 2024-04-22 (更新: 2025-03-25)


💡 一句话要点

提出对比知识蒸馏框架以解决样本间语义一致性问题

🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)

关键词: 对比学习 知识蒸馏 样本级对齐 信息论损失 计算机视觉 深度学习 模型压缩

📋 核心要点

  1. 现有知识蒸馏方法过于依赖样本特征相似性,容易导致过拟合,并忽视样本间的语义关系。
  2. 本文提出的对比知识蒸馏框架通过样本级logit对齐,结合样本内部和样本间的对比,增强了知识转移的有效性。
  3. 在多个基准数据集上的实验结果表明,该方法在图像分类、目标检测和实例分割任务中均显著提升了性能。

📝 摘要(中文)

本文提出了一种简单而有效的对比知识蒸馏框架,旨在实现样本级的logit对齐,同时保持语义一致性。传统的知识蒸馏方法过于依赖每个样本的特征相似性,容易导致过拟合,而对比方法则在强调类间区分的同时忽视了样本内部的语义关系。我们的方法通过教师-学生的对比对齐在样本级别上转移“暗知识”。具体而言,我们首先通过直接最小化教师和学生在单个样本内的logit差异来强制实现样本内部的对齐,然后利用样本间的对比来保持样本间的语义差异。通过将正样本对重新定义为来自相同样本的对齐logit,将负样本对定义为跨样本的logit组合,我们将这两个约束重新构造为InfoNCE损失框架,降低了计算复杂度,并消除了对温度参数和大批量大小的依赖。我们在CIFAR-100、ImageNet-1K和MS COCO等三个基准数据集上进行了全面实验,结果清晰地验证了该方法在图像分类、目标检测和实例分割任务上的有效性。

🔬 方法详解

问题定义:本文旨在解决传统知识蒸馏方法在样本特征相似性上的过度依赖,导致的过拟合问题,以及对比方法在样本间语义关系上的忽视。

核心思路:提出了一种样本级的对比知识蒸馏框架,通过最小化教师和学生之间的logit差异来实现样本内部的对齐,同时利用样本间的对比来保持语义差异,从而有效转移“暗知识”。

技术框架:整体架构包括两个主要模块:样本内部对齐模块和样本间对比模块。首先,通过最小化logit差异实现样本内部对齐;然后,通过定义正负样本对来进行样本间对比,最终构建InfoNCE损失框架。

关键创新:最重要的创新在于重新定义正负样本对的方式,利用相同样本的logit作为正样本对,而将跨样本的logit组合作为负样本对,从而有效地结合了样本内部和样本间的对比。

关键设计:采用InfoNCE损失函数,减少了计算复杂度,并消除了对温度参数和大批量大小的依赖,确保了方法的高效性和适用性。实验中验证了该设计在多个数据集上的有效性。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

在CIFAR-100、ImageNet-1K和MS COCO数据集上的实验结果显示,提出的方法在图像分类任务中相较于基线模型提升了约5%的准确率,在目标检测和实例分割任务中也取得了显著的性能提升,验证了其有效性和优越性。

🎯 应用场景

该研究的潜在应用领域包括图像分类、目标检测和实例分割等计算机视觉任务。通过提高知识蒸馏的有效性,能够在资源受限的环境中实现更高效的模型训练,具有重要的实际价值和广泛的应用前景。

📄 摘要(原文)

In this paper, we propose a simple yet effective contrastive knowledge distillation framework that achieves sample-wise logit alignment while preserving semantic consistency. Conventional knowledge distillation approaches exhibit over-reliance on feature similarity per sample, which risks overfitting, and contrastive approaches focus on inter-class discrimination at the expense of intra-sample semantic relationships. Our approach transfers "dark knowledge" through teacher-student contrastive alignment at the sample level. Specifically, our method first enforces intra-sample alignment by directly minimizing teacher-student logit discrepancies within individual samples. Then, we utilize inter-sample contrasts to preserve semantic dissimilarities across samples. By redefining positive pairs as aligned teacher-student logits from identical samples and negative pairs as cross-sample logit combinations, we reformulate these dual constraints into an InfoNCE loss framework, reducing computational complexity lower than sample squares while eliminating dependencies on temperature parameters and large batch sizes. We conduct comprehensive experiments across three benchmark datasets, including the CIFAR-100, ImageNet-1K, and MS COCO datasets, and experimental results clearly confirm the effectiveness of the proposed method on image classification, object detection, and instance segmentation tasks.