Saved in:
Bibliographic Details
Main Authors: Tian, Huiyuan, Xu, Bonan, Li, Shijian, Pan, Gang
Format: Preprint
Published: 2024
Subjects:
Online Access:https://arxiv.org/abs/2412.19055
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915129065472000
author Tian, Huiyuan
Xu, Bonan
Li, Shijian
Pan, Gang
author_facet Tian, Huiyuan
Xu, Bonan
Li, Shijian
Pan, Gang
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2412_19055
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle SpectralKD: A Unified Framework for Interpreting and Distilling Vision Transformers via Spectral Analysis
Tian, Huiyuan
Xu, Bonan
Li, Shijian
Pan, Gang
Computer Vision and Pattern Recognition
Machine Learning
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.
title SpectralKD: A Unified Framework for Interpreting and Distilling Vision Transformers via Spectral Analysis
topic Computer Vision and Pattern Recognition
Machine Learning
url https://arxiv.org/abs/2412.19055