둔비의 공부공간
Curriculum Temperature for Knowledge Distillation 본문
Zheng Li et al. (AAAI 2023)
https://arxiv.org/abs/2211.16231
Curriculum Temperature for Knowledge Distillation
Most existing distillation methods ignore the flexible role of the temperature in the loss function and fix it as a hyper-parameter that can be decided by an inefficient grid search. In general, the temperature controls the discrepancy between two distribu
arxiv.org
https://github.com/zhengli97/CTKD
GitHub - zhengli97/CTKD: [AAAI 2023] Code for "Curriculum Temperature for Knowledge Distillation"
[AAAI 2023] Code for "Curriculum Temperature for Knowledge Distillation" - GitHub - zhengli97/CTKD: [AAAI 2023] Code for "Curriculum Temperature for Knowledge Distillation"
github.com
Motivation
"In human education, teachers always train students with simple curricula, which start from easier knowledge and gradually present more abstract and complex concepts when students grow up."
위의 내용처럼, deep learning도 쉬운 내용부터, 어려운 내용으로 학습하면 성능이 오를 수 있다는 것을 knowledge distillation에 적용했다.
Prior Knowledge
학습된 모델은 대부분 overconfidence한 경향이 있다.
이를 피하기 위해 최근의 KD에서는 저 temperature scaling으로 확률 분포를 soft하게 만들고 distillation을 한다.
temperature value는 방법마다 다른데, 2~6정도의 값을 사용한다.
Method
이 논문에서는 "점차 어려워지는 Knowledge distillation"을 위해 temperature value를 학습하여 사용한다.
논문에서는 "어려운 knowledge distillation"를 위해 아래와 같은 방법을 사용한다.
간단하게 말해서, distillation loss를 일반 모델은 gradient descent를 사용하여 update하고, temperature parameter는 gradient ascent를 사용해서 update한다.
위와 같은 과정으로, temperature parameter는 distillation이 어려워지는 방향으로 학습이 된다.
이제 "점차 어려운 knowledge distillation"를 도입한다.
초기값은 0으로 두고, max값은 1로 두어서 distillation이 어려워지는 정도를 조절한다.
이를 특정epoch (10epoch) 마다 반복적으로 적용했다고 한다.
논문에서 temperature를 학습하는 방법을 Global temperature와 Instance-wise Temperature로 총 두가지를 제안했다.
Global Temperature의 경우, nn.Parameter(torch.ones(1), require_grad=True) 를 사용하고
Instance-wise Temperature의 경우, Teacher와 Student의 확률분포를 concat해서, 2layer MLP를 통해 prediction하여 사용한다.
Instance-wise가 2Layer 모듈을 추가로 사용하다보니, 약간의 overhead가 존재하지만, 성능은 global보다 좋다고 한다.
Experiments
사견
Motivation에서의 '사람의 학습방법을 모방하는 것이, 인공지능을 학습하는 것에도 좋다'라는 전제하에 논문이 시작된다.
하지만, 정말 점차 어려운 loss를 흐르게 하는 것이 인공지능을 학습하는 것에 도움이 되는가?에 대한 의문이 남는다.
내가 생각했더라면, KD loss를 더욱 잘 흐르게 하기 위해, gradient descent로 temperature value를 학습했을 것 같다.
curriculum의 경우에도, loss scaling을 통해서 점차 loss가 잘 떨어지도록 학습하는 방법을 사용했을 것 같다.
내가 생각한 접근법과 정반대의 개념인데, 성능이 올랐다고 하니, 할말은 없다.
또한, DKD에서의 cifar100 성능이 이상한데, cross entropy에 대한 lambda를 0.1의 10배인 1.0을 주었다.
이러면 당연히 distillation 성능이 낮게 나오는데, 왜 dkd만 이런 lambda를 주었는지 궁금하다.
'Papers > Compression' 카테고리의 다른 글
One-for-All: Bridge the Gap Between Heterogeneous Architectures in Knowledge Distillation (0) | 2024.04.07 |
---|---|
Class Attention Transfer Based Knowledge Distillation (0) | 2024.02.25 |
Multi-level Logit Distillation (1) | 2023.12.08 |
DOT: A Distillation-Oriented Trainer (1) | 2023.11.23 |
Toward domain generalized pruning by scoring out-of-distribution importance (0) | 2023.09.26 |