-
Contrastive Learning Rivals Masked Image Modeling in Fine-tuning via Feature DistillationContribution 세미나 2024. 4. 18. 10:53
arXiv 2022, 101회 인용
Introduction
이전 까지 transformer fine-tuning의 경우 masked image modeling (MIM) 방식을 많이 사용하였음
MIM 방식(self supervised learning)으로 이미지의 semantic한 정보를 좀 더 반영하도록 하였다면
Feature distillation(FD)를 통해 이와 유사한 역할을 할 수 있지 않을까?

기존 KD와는 약간 목적이 다름, 더 가벼운 모델을 만드는 것 보단 downstream task에 얼마나 효과적으로 적용할 수 있을지에 초점
(어떻게 보면 transfer learning의 목적과 비슷해보이기도 함)실제 다양한 모델에 대해서 FD를 이용한 fine-tuning을 한경우 성능이 향상
해당 논문은 logit 보단 feature distillation에 초점을 둠
아이디어 보단 분석을 잘한 느낌
Proposed method

Teacher encoder의 결과를 normalization 해서 smooth l1 loss 사용함

teacher model과 student model의 channel dimension 차이는 student model에서 마지막에 1x1 conv로 맞춰줌
또한 position encoding에서 absolute position encoding(APE)보단 relative position bias(RPB)이 더 효과적이라고 함
(더 나아가 shared RPB도 비교)
해당 방식으로 FD를 한경우 feature representation이 어떻게 좋아지는지 설명
먼저 attention diversity of head 비교

일반적으로 ViT의 경우 layer가 깊이질수록 더 넓은 영역을 보게된다.
다만 diversity가 점점 감소 → multi head인데 서로 비슷한 visual cue를 보면서 학습 함 → model capacity 감소
FD를 쓴 경우 이러한 diversity를 좀 더 고려하게 됨

Average attention map도 분석하면
두가지 pattern이 보임 (diagonal and column)
diagonal 패턴은 이미지 패치들 사이에 relative position관계를 보여줌
column 패턴은 특정 absolution position의 영향을 보여줌
여기서는 diagonal 패턴의 중요성을 강조
column 패턴은 translation invariance에 부적합함
FD를 적용하면 이러한 column 패턴들이 감소

Loss/accuracy landscape 고려
학습된 모델 weight에 noise를 가하면서 loss와 accuracy 관계를 봄
(overfitting 정도를 판단하는 느낌)
FD를 적용했을때 더 flatten 해지는걸 볼 수 있음
그렇다면 MIM을 적용하고 거기다 추가적으로 FD를 적용하면?

변화폭이 크지 않음, 즉 MIM과 FD는 전부 하려고 하는 일은 비슷하다고 볼 수 있음
Experiment result

여기서는 logit distillation 보단 feature map 전부 distillation 하는게 성능이 좋다고 함
Feature distillation의 장점 중에 하나는 pretrained model이 classification 모델이 아니더라도 KD가 가능

teacher feature을 normalization하는 방식에 따른 성능 비교

position encoding 방식에 따른 성능 비교

drop path rate에 따른 성능 비교 (Deit에서 설명한 stochastic depth와 동일)
'Contribution 세미나' 카테고리의 다른 글
Better Teacher Better Student: Dynamic Prior Knowledge for Knowledge Distillation (0) 2024.04.18 Masked Generative Distillation (0) 2024.04.18 Training data-efficient image transformers & distillation through attention (0) 2024.04.18 Bridging the Gap between Object and Image-level Representations for Open-Vocabulary Detection (0) 2024.04.18 Learning to Segment Every Thing (0) 2024.04.17