Gap Preserving Distillation by Building Bidirectional Mappings with A Dynamic Teacher

📄 arXiv: 2410.04140v1 📥 PDF

作者: Yong Guo, Shulian Zhang, Haolin Pan, Jing Liu, Yulun Zhang, Jian Chen

分类: cs.CV

发布日期: 2024-10-05

备注: 10 pages for the main paper


💡 一句话要点

提出Gap Preserving Distillation,通过动态教师模型和双向映射缩小师生差距,提升知识蒸馏效果。

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

关键词: 知识蒸馏 模型压缩 动态教师 性能差距 逆重参数化 通道分支重参数化 参数共享

📋 核心要点

  1. 现有知识蒸馏方法在师生模型性能差距过大时,会影响学生模型的训练效果,导致知识迁移不充分。
  2. 提出Gap Preserving Distillation (GPD)方法,通过引入动态教师模型,缩小师生模型之间的性能差距,从而优化蒸馏过程。
  3. 实验结果表明,GPD在CNN和Transformer架构上均优于现有方法,且在无预训练教师的场景下也能取得显著提升。

📝 摘要(中文)

知识蒸馏旨在将知识从大型教师模型迁移到紧凑的学生模型,但两者之间通常存在显著的性能差距。过大的性能差距会阻碍训练过程。为了解决这个问题,我们提出了一种Gap Preserving Distillation (GPD)方法,该方法在训练学生模型的同时,从头开始训练一个额外的动态教师模型,以弥合这一差距。这样,在整个蒸馏过程中,教师和学生之间就能保持合理的性能差距。为了进一步加强从动态教师到学生的蒸馏,我们开发了一种硬策略,强制它们共享参数并鼓励参数继承。除了硬策略,我们还构建了它们之间的软双向映射,这些映射建立在逆重参数化(IR)方法和通道分支重参数化(CBR)策略之上。我们的IR能够以任意扩展比率初始化一个更大的动态教师,同时保持与给定学生模型完全相同的精度。这样可以保证动态教师和学生从同一起点开始,避免训练初期差距过大。至于我们的CBR,通过参数共享,它可以直接从训练良好的动态教师模型中提取有效的学生模型,而无需任何后训练,从而使我们的方法对于模型部署具有高度的灵活性。在实验中,GPD显著优于现有CNN和Transformer架构上的蒸馏方法,实现了高达1.58%的精度提升。有趣的是,GPD也很好地推广到没有预训练教师的场景,包括从头开始训练和微调,在ResNet18上分别产生了1.80%和0.89%的显著改进。

🔬 方法详解

问题定义:知识蒸馏旨在将大型教师模型的知识迁移到小型学生模型,但教师和学生之间的性能差距会阻碍知识的有效迁移。现有的知识蒸馏方法通常难以有效地处理这种性能差距,导致学生模型无法充分学习教师模型的知识。

核心思路:论文的核心思路是通过引入一个动态教师模型来弥合教师和学生之间的性能差距。动态教师模型与学生模型同时训练,并保持与学生模型相近的性能水平,从而使知识迁移过程更加平滑和有效。此外,论文还通过硬策略(参数共享)和软策略(双向映射)来加强动态教师模型和学生模型之间的知识传递。

技术框架:GPD方法的技术框架主要包括以下几个部分:1) 原始教师模型(可选,用于初始化动态教师模型);2) 动态教师模型,与学生模型同时训练,用于弥合性能差距;3) 学生模型,最终需要训练的模型;4) 逆重参数化(IR)方法,用于初始化动态教师模型,使其与学生模型具有相同的性能;5) 通道分支重参数化(CBR)策略,用于从动态教师模型中提取有效的学生模型;6) 损失函数,包括蒸馏损失、参数共享损失等。

关键创新:论文的关键创新在于:1) 提出了一种动态教师模型,能够与学生模型同步训练,从而保持合理的性能差距;2) 提出了一种逆重参数化(IR)方法,能够以任意扩展比率初始化动态教师模型,同时保持与学生模型相同的精度;3) 提出了一种通道分支重参数化(CBR)策略,能够直接从动态教师模型中提取有效的学生模型,无需任何后训练。

关键设计:IR方法通过特定的参数初始化方式,保证动态教师模型在初始状态下与学生模型具有相同的性能。CBR策略通过参数共享机制,将动态教师模型的知识迁移到学生模型。损失函数的设计包括传统的蒸馏损失,以及用于鼓励参数共享和参数继承的损失项。动态教师模型的扩展比例是一个重要的超参数,需要根据具体任务进行调整。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

GPD方法在多个数据集和模型架构上取得了显著的性能提升。例如,在CNN和Transformer架构上,GPD相比现有蒸馏方法实现了高达1.58%的精度提升。更重要的是,GPD在没有预训练教师的情况下,也能在ResNet18上分别实现1.80%(从头训练)和0.89%(微调)的显著改进,表明其具有良好的泛化能力。

🎯 应用场景

该研究成果可应用于各种需要模型压缩和加速的场景,例如移动设备上的图像识别、自动驾驶中的目标检测、以及边缘计算等。通过知识蒸馏,可以将大型复杂模型部署到资源受限的设备上,同时保持较高的性能水平。该方法在工业界具有广泛的应用前景。

📄 摘要(原文)

Knowledge distillation aims to transfer knowledge from a large teacher model to a compact student counterpart, often coming with a significant performance gap between them. We find that a too-large performance gap can hamper the training process, which is also verified in recent studies. To address this, we propose a Gap Preserving Distillation (GPD) method that trains an additional dynamic teacher model from scratch along with training the student to bridge this gap. In this way, it becomes possible to maintain a reasonable performance gap between teacher and student during the whole distillation process. To further strengthen distillation from the dynamic teacher to the student, we develop a hard strategy by enforcing them to share parameters and encouraging parameter inheritance. Besides hard strategy, we also build the soft bidirectional mappings between them which are built on an Inverse Reparameterization (IR) method and a Channel-Branch Reparameterization (CBR) strategy. We highlight that our IR is able to initialize a larger dynamic teacher with an arbitrary expansion ratio, while preserving exactly the same accuracy as the given student model. In this way, it guarantees that the dynamic teacher and student start from the same point and avoid a too large gap in early stage of training. As for our CBR, with parameter-sharing, it directly extracts an effective student model from the well-learned dynamic teacher without any post-training, making our method highly flexible for model deployment. In the experiments, GPD significantly outperforms existing distillation methods on top of both CNNs and transformers architectures, achieving up to 1.58% accuracy improvement. Interestingly, GPD also generalizes well to the scenarios without a pre-trained teacher, including training from scratch and fine-tuning, yielding a large improvement of 1.80% and 0.89% on ResNet18, respectively.