Home

Awesome

Decoupled Kullback-Leibler (DKL) Divergence Loss

This repository contains the implementation code for our arXiv paper Decoupled Kullback-Leibler (DKL) Divergence Loss, arXiv.

Overview

In this paper, we delve deeper into the KullbackLeibler (KL) Divergence loss and observe that it is equivalent to the Doupled Kullback-Leibler (DKL) Divergence loss that consists of 1) a weighted Mean Square Error (wMSE) loss and 2) a Cross4 Entropy loss incorporating soft labels. From our analysis of the DKL loss, we have identified two areas for improvement. Firstly, we address the limitation of DKL in scenarios like knowledge distillation by breaking its asymmetry property in training optimization. This modification ensures that the wMSE component is always effective during training, providing extra constructive cues. Secondly, we introduce global information into DKL for intra-class consistency regularization. With these two enhancements, we derive the Improved KullbackLeibler (IKL) Di11 vergence loss and evaluate its effectiveness by conducting experiments on CIFAR12 10/100 and ImageNet datasets, focusing on adversarial training and knowledge dis13 tillation tasks. The proposed approach achieves new state-of-the-art performance on both tasks, demonstrating the substantial practical merits.

image

Results and Pretrained Models for Knowledge Distillation

ImageNet

MethodModel-TeacherModel-StudentTraining SpeedTop-1 Acc(%)linklog
ReviewKDResNet-34ResNet180.319 s/iter71.61--
DKDResNet-34ResNet18-71.70--
IKL-KDResNet-34ResNet180.197 s/iter71.91--
MethodModel-TeacherModel-StudentTraining SpeedTop-1 Acc(%)linklog
ReviewKDResNet-50MobileNet0.526 s/iter72.56--
DKDResNet-50MobileNet-72.05--
IKL-KDResNet-50MobileNet0.252 s/iter72.84--

Results and Pretrained Models for Adversarial Robustness

By 2023/05/20, with IKL loss, we achieve new state-of-the-art adversarial robustness under settings that with/without augmentation strategies on auto-attack.

CIFAR-100 with autoaug

#MethodModelNatural AccRobust Acc (AutoAttack)linklog
1DAJATWRN-34-1068.7431.30--
2IKL-ATWRN-34-1065.9332.52modellog

CIFAR-100 with basic data preprocessing (random crop and random horizontal flip)

#MethodModelNatural AccRobust Acc (AutoAttack)linklog
1AWPWRN-34-1060.3828.86--
2LBGATWRN-34-1062.3129.33--
3LAS-ATWRN-34-1062.9930.77--
4ACATWRN-34-1065.7530.23--
5IKL-ATWRN-34-1066.5131.43modellog
6IKL-ATWRN-34-1063.4031.92modellog

CIFAR-100 with synthesized data

#MethodModelNatural AccRobust Acc (AutoAttack)linklog
1Wang et al. (better diffusion models) 1MWRN-28-1068.0635.65--
2Wang et al. (better diffusion models) 50MWRN-28-1072.5838.83--
3IKL-AT 1MWRN-28-1068.9935.89--
4IKL-AT 50MWRN-28-1073.8539.18modellog

CIFAR-10 with basic data preprocessing (random crop and random horizontal flip)

#MethodModelNatural AccRobust Acc (AutoAttack)linklog
1AWPWRN-34-1085.3656.17--
2LBGATWRN-34-2088.7053.57--
3LAS-ATWRN-34-1087.7455.52--
4ACATWRN-34-1082.4155.36--
5IKL-ATWRN-34-1085.3157.13modellog

CIFAR-10 with synthesized data

#MethodModelNatural AccRobust Acc (AutoAttack)linklog
1Wang et al. (better diffusion models) 1MWRN-28-1091.1263.35--
2Wang et al. (better diffusion models) 20MWRN-28-1092.4467.31--
3IKL-AT 1MWRN-28-1090.7563.54--
4IKL-AT 20MWRN-28-1092.1667.75modellog

Training

More training scripts will be provided soon to reproduce our results on knowledge distillation and adversarial training tasks.

For the adversarial training task:
cd adv_training
bash sh/train_dkl_cifar100.sh
bash sh/train_dkl_cifar100_autoaug.sh
bash sh/train_dkl_cifar10.sh

Evaluation

before running the evaluation with auto-attack, please download the pre-trained models.

cd adv_training/auto_attacks
bash sh/eval.sh

Contact

If you have any questions, feel free to contact us through email (jiequancui@gmail.com) or Github issues. Enjoy!

BibTex

If you find this code or idea useful, please consider citing our related work:

@article{cui2023decoupled,
  title={Decoupled Kullback-Leibler Divergence Loss},
  author={Cui, Jiequan and Tian, Zhuotao and Zhong, Zhisheng and Qi, Xiaojuan and Yu, Bei and Zhang, Hanwang},
  journal={arXiv preprint arXiv:2305.13948},
  year={2023}
}

@inproceedings{cui2021learnable,
  title={Learnable boundary guided adversarial training},
  author={Cui, Jiequan and Liu, Shu and Wang, Liwei and Jia, Jiaya},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={15721--15730},
  year={2021}
}