arXiv:2412.19055cs.CVcs.LG2024-12

通过频谱分析统一解读视觉Transformer并优化知识蒸馏

SpectralKD: A Unified Framework for Interpreting and Distilling Vision Transformers via Spectral Analysis

  • 基于频谱分析揭示ViT各层信息分布规律
  • 无需参数训练即提升准确率,DeiT-Tiny+5.2%,Swin-Tiny+1.4%
  • 发现蒸馏后学生模型可复现教师频谱特征

知识蒸馏(KD)在压缩视觉Transformer(ViTs)方面取得广泛应用,但针对ViTs与KD的统一理论框架仍缺失。本文提出SpectralKD,一种基于频谱分析的统一分析框架,深入理解ViT结构并优化蒸馏过程。模型级分析发现CaiT将信息集中于首尾少数层,为蒸馏层选择提供依据;层级分析揭示Swin Transformer与CaiT虽架构不同,却具有相似的频谱编码模式,由此提出特征图对齐准则。基于此,设计一种简单有效的频谱对齐蒸馏方法。得益于上述分析洞察,该策略在不引入任何可训练参数的情况下,在ImageNet-1K上达到顶尖性能,使DeiT-Tiny的顶1准确率提升5.2%,Swin-Tiny提升1.4%。此外,后训练分析表明,蒸馏后的学生模型可复现教师的频谱模式,开启名为“蒸馏动力学”的新研究方向。代码与实验日志见https://github.com/thy960112/SpectralKD。

原文摘要 · Abstract (English)

Knowledge Distillation (KD) has achieved widespread success in compressing large Vision Transformers (ViTs), but a unified theoretical framework for both ViTs and KD is still lacking. In this paper, we propose SpectralKD, a novel unified analytical framework that offers deeper insights into ViTs and optimizes KD via spectral analysis. Our model-wise analysis reveals that CaiT concentrates information in their first and last few layers, informing optimal layer selection for KD. Surprisingly, our layer-wise analysis discovers that Swin Transformer and CaiT exhibit similar spectral encoding patterns despite their architectural differences, leading to feature map alignment guideline. Building on these insights, we propose a simple yet effective spectral alignment method for KD. Benefiting from the deeper understanding by above analysis results, even such a simple strategy achieves state-of-the-art performance on ImageNet-1K without introducing any trainable parameters, improving DeiT-Tiny by $+5.2\%$ and Swin-Tiny by $+1.4\%$ in top-1 accuracy. Furthermore, our post-training analysis reveals that distilled students can reproduce spectral patterns similar to their teachers, opening a new area we term ``distillation dynamics". Code and experimental logs are available in https://github.com/thy960112/SpectralKD.

知识蒸馏视觉Transformer频谱分析模型压缩

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。