Aligning in a Compact Space: Contrastive Knowledge Distillation between Heterogeneous Architectures

📄 arXiv: 2405.18524v1 📥 PDF

作者: Hongjun Wu, Li Xiao, Xingkuo Zhang, Yining Miao

分类: cs.CV

发布日期: 2024-05-28

备注: 12 pages, 3 figures, conference paper


💡 一句话要点

提出LFCC框架,通过对比学习实现异构网络间的知识蒸馏。

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

关键词: 知识蒸馏 异构网络 低频分量 对比学习 模型压缩 特征对齐 深度学习

📋 核心要点

  1. 异构网络知识蒸馏中,特征表示差异导致传统基于特征的方法性能下降,是核心问题。
  2. LFCC框架提取并对齐教师和学生模型中间特征的低频分量,缩小架构差异。
  3. LFCC在ImageNet-1K和CIFAR-100上,使用CNN、Transformer和MLP等架构验证了有效性。

📝 摘要(中文)

知识蒸馏常用于压缩神经网络,以降低推理成本和内存占用。在同构架构场景中,基于特征的方法已被广泛验证其有效性。然而,在教师和学生模型具有异构架构的场景中,特征表示的固有差异会显著降低这些方法的性能。最近的研究强调,低频分量构成了图像特征的大部分。受此启发,我们提出了一种基于低频分量的对比知识蒸馏(LFCC)框架,该框架显著提高了异构架构之间基于特征的蒸馏性能。具体来说,我们设计了一组多尺度低通滤波器,用于提取教师和学生模型中间特征的低频分量,并在一个紧凑的空间中对齐它们,以克服架构差异。此外,利用教师-学生框架的内在配对特性,我们设计了一个创新的样本级对比学习框架,巧妙地将样本内特征相似性和样本间特征差异的约束重构为对比学习任务。这种策略使学生模型能够利用样本内特征的一致性,同时增强不同样本之间特征的区分度。因此,我们的LFCC框架准确地捕捉了异构架构中特征表示的共性。在三种架构(CNN、Transformer和MLP)上的广泛评估和实证分析表明,LFCC在具有挑战性的ImageNet-1K和CIFAR-100基准测试中取得了优异的性能。所有代码将公开发布。

🔬 方法详解

问题定义:论文旨在解决异构神经网络架构之间的知识蒸馏问题。现有的基于特征的知识蒸馏方法在同构网络中表现良好,但当教师和学生模型采用不同的架构时,由于特征表示的差异,性能会显著下降。这种差异使得学生模型难以有效地学习教师模型的知识。

核心思路:论文的核心思路是关注图像特征中的低频分量,因为低频分量被认为包含了图像的主要信息,并且在不同架构之间具有更强的共性。通过提取和对齐教师和学生模型特征的低频分量,可以有效地缩小架构差异,从而提高知识蒸馏的性能。此外,利用对比学习,增强学生模型对样本内相似性和样本间差异性的学习。

技术框架:LFCC框架主要包含以下几个模块:1) 多尺度低通滤波器:用于提取教师和学生模型中间特征的低频分量。2) 特征对齐模块:将提取的低频分量在紧凑的空间中对齐,减小架构差异带来的影响。3) 对比学习模块:利用教师-学生框架的配对特性,构建样本级的对比学习任务,增强学生模型对特征相似性和差异性的学习。

关键创新:论文的关键创新在于:1) 提出了基于低频分量的知识蒸馏方法,有效解决了异构架构之间的特征表示差异问题。2) 设计了样本级的对比学习框架,充分利用了教师-学生框架的配对信息,增强了学生模型的学习能力。

关键设计:1) 多尺度低通滤波器的具体实现方式,例如采用不同大小的卷积核进行滤波。2) 特征对齐模块的具体实现方式,例如采用均方误差损失函数或余弦相似度损失函数。3) 对比学习模块中正负样本的选择策略,以及对比损失函数的具体形式,例如InfoNCE损失函数。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

LFCC框架在ImageNet-1K和CIFAR-100数据集上进行了广泛的实验验证,结果表明,LFCC在CNN、Transformer和MLP等多种异构架构之间均取得了优异的性能。相较于现有的知识蒸馏方法,LFCC能够显著提高学生模型的准确率,尤其是在异构架构差异较大的情况下。

🎯 应用场景

该研究成果可应用于模型压缩、边缘计算、移动设备等资源受限的场景,通过知识蒸馏将大型模型的知识迁移到小型模型,实现高性能和低功耗的平衡。此外,该方法在异构模型集成、迁移学习等领域也具有潜在的应用价值。

📄 摘要(原文)

Knowledge distillation is commonly employed to compress neural networks, reducing the inference costs and memory footprint. In the scenario of homogenous architecture, feature-based methods have been widely validated for their effectiveness. However, in scenarios where the teacher and student models are of heterogeneous architectures, the inherent differences in feature representation significantly degrade the performance of these methods. Recent studies have highlighted that low-frequency components constitute the majority of image features. Motivated by this, we propose a Low-Frequency Components-based Contrastive Knowledge Distillation (LFCC) framework that significantly enhances the performance of feature-based distillation between heterogeneous architectures. Specifically, we designe a set of multi-scale low-pass filters to extract the low-frequency components of intermediate features from both the teacher and student models, aligning them in a compact space to overcome architectural disparities. Moreover, leveraging the intrinsic pairing characteristic of the teacher-student framework, we design an innovative sample-level contrastive learning framework that adeptly restructures the constraints of within-sample feature similarity and between-sample feature divergence into a contrastive learning task. This strategy enables the student model to capitalize on intra-sample feature congruence while simultaneously enhancing the discrimination of features among disparate samples. Consequently, our LFCC framework accurately captures the commonalities in feature representation across heterogeneous architectures. Extensive evaluations and empirical analyses across three architectures (CNNs, Transformers, and MLPs) demonstrate that LFCC achieves superior performance on the challenging benchmarks of ImageNet-1K and CIFAR-100. All codes will be publicly available.