Skip to content

Repository files navigation

Do Topological Characteristics Help in Knowledge Distillation?

Accepted in ICML 2024

Paper 💥

architecture (1)

Do Topological Characteristics Help in Knowledge Distillation?

International Conference on Machine Learning (ICML) 2024
Jungeun Kim*, Junwon You*, Dongjin Lee*, Ha Young Kim, Jae-Hun Jung
Yonsei University & POSTECH

Abstract

Knowledge distillation (KD) aims to transfer knowledge from larger (teacher) to smaller (student) networks. Previous studies focus on point-to-point or pairwise relationships in embedding features as knowledge and struggle to efficiently transfer relationships of complex latent spaces. To tackle this issue, we propose a novel KD method called TopKD, which considers the global topology of the latent spaces. We define global topology knowledge using the persistence diagram (PD) that captures comprehensive geometric structures such as shape of distribution, multiscale structure and connectivity, and the topology distillation loss for teaching this knowledge. To make the PD transferable within reasonable computational time, we employ approximated persistence images of PDs. Through experiments, we support the benefits of using global topology as knowledge and demonstrate the potential of TopKD.

Installation

Environment

conda env create -f environment.yml
conda activate topkd

Create data directory

mkdir data

Training

*** Please modify the shell script files to match your experimental environment. ***

Training teacher network

First, train teacher network to extract persistence diagram (PD) of teacher embedding features and distill the knowledge.

sh train_teacher.sh

Generate point cloud data (PCD) and persistence images (PI)

Next, generate PI from PCD to integrate PD to DNN. Here, PCD is embedding features of teacher network and PI is an vectorization of PD.

python generate_PCD_PI.py

Training RipsNet

During training student network, accurately calculating PDs and PIs for each batch requires heavy computational demands. Thus, we utilize RipsNet to approximate PI for rapid calculation.

To train RipsNet with generated PCD and PIs, run the following code:

python train_ripsnet.py

Training student network

Finally, to mimic PIs of the teacher, train student network with topology distillation loss, KD loss, and CE loss.

To train student network,

sh train_student.sh

Evaluation

Checkpoints

We included the weights and PI of some teacher networks, WRN-40-2 and ResNet56, in “save_t_models” and “ripsnet” folders, respectively. The remaining teacher networks will be uploaded later.

Comparison

Results on CIFAR-100:

Homogeneous architectures

스크린샷 2024-05-22 오전 11 25 15

Heterogeneous architectures

스크린샷 2024-05-22 오전 11 26 13

Results on ImageNet-1K:

Homogeneous architectures

스크린샷 2024-05-22 오전 11 26 23

Heterogeneous architectures

스크린샷 2024-05-22 오전 11 26 35

Visualization

Exact and approximated PIs

Teacher: VGG13, student: MobileNetV2

스크린샷 2024-05-22 오전 11 28 01

UMAP

CIFAR-100:

스크린샷 2024-05-22 오전 11 28 19

ImageNet-1K

스크린샷 2024-05-22 오후 2 14 11

Citation

@InProceedings{pmlr-v235-kim24aj,
  title = 	 {Do Topological Characteristics Help in Knowledge Distillation?},
  author =       {Kim, Jungeun and You, Junwon and Lee, Dongjin and Kim, Ha Young and Jung, Jae-Hun},
  booktitle = 	 {Proceedings of the 41st International Conference on Machine Learning},
  pages = 	 {24674--24693},
  year = 	 {2024}

Acknowledgement

This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (MSIT) (2023R1A2C200337911, RS-2023-00220762, 2021R1A2C3009648, NRF2021R1A6A1A1004294412, and RS-2023-00219980), and partly supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.RS-2020-II201361, Artificial Intelligence Graduate School Program (Yonsei University) and No.2019-0-01906, Artificial Intelligence Graduate School Program (POSTECH)).

About

Official code of "Do Topological Characteristics Help in Knowledge Distillation?"

Resources

Stars

11 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages