Aligning Logits Generatively for Principled Black-Box Knowledge Distillation
Abstract
Black-Box Knowledge Distillation (B2KD) is a formulated problem for cloud-to-edge model compression with invisible data and models hosted on the server. B2KD faces challenges such as limited Internet exchange and edge-cloud disparity of data distributions. In this paper, we formalize a two-step workflow consisting of deprivatization and distillation, and theoretically provide a new optimization direction from logits to cell boundary different from direct logits alignment. With its guidance, we propose a new method Mapping-Emulation KD (MEKD) that distills a black-box cumbersome model into a lightweight one. Our method does not differentiate between treating soft or hard responses, and consists of: 1) deprivatization: emulating the inverse mapping of the teacher function with a generator, and 2) distillation: aligning low-dimensional logits of the teacher and student models by reducing the distance of high-dimensional image points. For different teacher-student pairs, our method yields inspiring distillation performance on various benchmarks, and outperforms the previous state-of-the-art approaches.
1 Introduction
Knowledge Distillation (KD) is a widely accepted approach to the problem of model compression and acceleration, which has received sustained attention from both the academic and industrial research communities [15, 38, 47, 17]. The goal of KD is to extract knowledge from a cumbersome model or an ensemble of models, known as the teacher, and use it as supervision to guide the training of lightweight models, known as the student [5, 39, 1]. In the application of KD, privacy protection has always been a very concerning issue for researchers and users, which not only refers to the privacy of user data but also includes the model copyright of cloud service providers.
Black-Box Knowledge Distillation (B2KD) is a problem posed in the process of cloud-to-edge model compression [37, 51, 54]. The cloud server hosts a teacher model whose internal structure and composition, connections between layers, model parameters, and gradients used for back-propagation are all invisible and unavailable to edge devices, as shown in Fig. 1. Due to resource limitations, the edge device can only host a lightweight student model. At the same time, low-quality and unlabeled local data cannot be used to train a reliable deep neural network. As a result, it must rely on sending query samples to the APIs of cloud servers for heavy inference [49].
In practice, B2KD faces some key challenges. (a) Cloud servers and edge devices should maintain limited data exchange due to Internet latency and bandwidth constraints, as well as charges for the amount of queried data or API usage time. (b) In some cases, for query samples, these APIs only provide indexes or semantic tags for the category with the highest probability (i.e., hard responses), rather than probability vectors for all possible classes (i.e., soft responses). (c) Because users refuse to send sensitive data to cloud servers, the distribution gap between local and cloud data is difficult to measure, making the distilled student model inaccurate in the application.
Adversarial learning has been shown to be effective in generating pseudo samples, which is widely used in data augmentation and low-shot learning [8, 54]. A well-trained generator can overcome the mode collapse problem and align real and synthetic data distribution. In particular, we want to produce images relevant to training, whether or not they resemble real data [32]. Meanwhile, images generated to obtain high responses from the teacher model combine different patterns with highly generalized features instead of sample-specific idiosyncrasies [52]. Therefore, using a well-trained generator to synthesize pseudo images can automatically filter out privacy-related high-frequency information, this process is called deprivatization,
In this paper, we propose an approach to solve B2KD by mapping emulation. Our motivation is in accordance with the fact that it can drive alignment between low-dimensional logits by reducing the distance between two generated images in the high-dimensional space. In addition, we argue that an image contains a lot of fine-grained information, which can be treated as another type of knowledge to provide different gradient directions for updating the parameters of student model, as shown in Fig. 4. Combining image-level loss with coarse-grained logit-level loss can effectively improve the distillation effect. According to the Kolmogorov theorem [25, 6], a sufficiently complex neural network is capable of representing an arbitrary multivariate continuous function from any dimension to another. Thus, a well-trained generator can not only emulate the inverse mapping of the teacher function (Thm. 4) but also help update the logits of a student to converge to the logits of a teacher (Thm. 5), with reasonable generalizability (Thm. 6).
In practice, we derive using a generative adversarial network (GAN) for deprivatization and exploit it as an inverse mapping of the teacher function. The generator uses random variables as inputs that are sampled from a prior distribution with the same dimensionality as the logits. The well-trained generator is frozen and grafted behind the teacher and student model, whose output logits of the same examples are used as the inputs of the generator, as shown in Fig. 2. Experimental results show that MEKD can effectively protect the privacy of local data and models in the cloud, and it performs well under either soft or hard responses. At the same time, MEKD has robust results in the case of limited query samples and out-of-domain data.
Overall, the contributions of this paper are: 1) We formalize the problem of B2KD and provide a two-step workflow of deprivatization and distillation. 2) We theoretically provide a new optimization direction from logits to cell boundary different from direct logits alignment. 3) We propose a new method of Mapping-Emulation Knowledge Distillation (MEKD). The improved experimental performance has demonstrated the effectiveness of our approach.
2 Related Work
Knowledge Distillation (KD). Hinton et al. [19] propose an original teacher-student architecture that uses the logits of the teacher model as the knowledge. Since then, some KD methods regard knowledge as final responses to input samples [3, 31, 58], some regard knowledge as features extracted from different layers of neural networks [24, 23, 41], and some regard knowledge as relations between such layers [57, 40, 9]. The purpose of defining different types of knowledge is to efficiently extract the underlying representation learned by the teacher model from the large-scale data. If we consider a network as a mapping function of input distribution to output, then different knowledge types help to approximate such a function. Based on the type of knowledge transferred, KD can be divided into response-based, feature-based, and relation-based [15]. The first two aim to derive the student to mimic the responses of the output layer or the feature maps of the hidden layers of the teacher, and the last approach uses the relationships between the teacher’s different layers to guide the training of the student model. Feature-based and relation-based methods [24, 57], depending on the model utilized, may leak the information of structures and parameters through the intermediate layers’ data. For example, we can reconstruct a ResNet [18] based on the feature dimensions of different layers, and calculate each neuron’s parameter using specific images and their responses in the feature maps.
Black-Box Knowledge Distillation (B2KD). Response-based KD methods [19, 58, 3] have the natural property of hiding models. Hinton et al. [19] use Kullback-Leibler Divergence (KLD) between the softened logits of teacher and student models as the loss to align the output distribution, and Zhao et al. [58] decouple the KLD into two uncorrelated losses and combine them by weighted summation. These calculations do not take into account the details of the teacher model, which is exactly a black box. The recently proposed approaches for B2KD also address the issue of hiding the teacher model deployed in the cloud server [37, 51, 54]. Orekondy et al. [37] use a reinforcement learning approach to improve query sample efficiency. Wang et al. [51] blend mixup and activate learning to augment the few unlabeled images and choose hard examples for distillation. And Wang [54] proposes a decision-based black-box model and constructs the soft label for each training sample by computing its distances to the decision boundaries of the teacher model. These existing approaches partially address the challenges of cloud-to-edge black-box model distillation, but none of them take into account the privacy leak of user data when sending original local images to the cloud.
Generative Adversarial Networks (GANs) have the capacity to handle sharp estimated density functions and generate realistic-looking images efficiently. A typical GAN [14] comprises a discriminator distinguishing real images and generated images, and a generator synthesizing images to fool the discriminator. GANs are divided into architecture-variant and loss-variant. The former focuses on network architectures [42, 7] or latent space [34, 10], e.g., some specific architectures are proposed for specific tasks [59, 22]. The latter utilizes different loss types and regularization tools [2, 16] to enable more stable learning.
Adversarial Distillation (AD) exploits adversarial architecture to help the teacher and student model have a better understanding of the real data distribution [15, 55, 53, 4, 44]. The methods of AD can be divided into two types according to the generator-discriminator architecture, as shown in Fig. 2: (a) the generator is used to synthetic images to obey a real distribution, and these images are used to help distill models [8, 53]; (b) the teacher and student models are regarded as generators and another discriminator is drafted behind them to judge whether the distribution of features or logits is consistent [55, 56]. AD is also employed for low-shot knowledge distillation and received inspiring results [8]. Our method provides an alternative adversarial architecture, which utilizes a well-trained generator to guide the alignment between the outputs of models.
3 Theory for Mapping-Emulation KD
First, we propose two definitions. Def. 3 defines that two functions that map the same data distribution to the same latent distribution are equivalent. The ideal state of KD is to obtain a student function that is equivalent to the teacher function . Def. 4 defines that the mapping function of a generator , which can map a prior distribution to data manifold and guarantee that the generated image distribution is the same as the real image distribution , is considered to be the inverse mapping of the teacher function, i.e. . And we call it a well-trained generator. The mapping relationships are shown in Fig. 3.
Definition 1.
(Function Equivalence) Giving the student and teacher model and , for a data distribution in image space which is mapped to and in latent space. If the Wasserstein distance between and equals zero,
(1) |
the student and teacher model are equivalent, i.e., , where is the set of all joint distributions whose marginals are and , respectively.
Definition 2.
(Inverse Mapping) Giving a prior distribution , for a data distribution , if the Wasserstein distance between generated distribution and equals zero,
(2) |
then the generator is the inverse mapping of the teacher function , denoted as , where is the set of all joint distributions whose marginals are respectively and .
Fixing a decoding map for a well-trained generator , the latent space is partitioned as
(3) |
where is called the decomposition induced by the decoding map [29], and are called cells. As shown in Fig. 4, maps a cell decomposition in the latent space to a cell decomposition in the image space . Each cell is mapped to a sample by the decoding map [28]. In another word, pushes the prior distribution to the exact empirical distribution,
(4) |
Theorem 1.
(Empirical Approximation) For any and any integer , let be the mapping function of generator with . For two sets and , both of which have points in , if the empirical Wasserstein distance between and equals zero,
(5) |
then .
Thm. 4 (see Appendix for proof) provides a method to approximate the expected Wasserstein distance using the empirical Wasserstein distance . By reducing the distance between points and in high-dimensional space, an optimization direction different from is produced for logits and in low-dimensional space. The gradient update causes to move towards the boundary of the cell in which resides, as shown in Fig. 4.
Theorem 2.
(Optimization Direction) Let be any distribution. are the mapping functions of the student, teacher, and generator, respectively. is parameterized by . Then, when
(6) |
it holds that , and we have
(7) |
Thus, to achieve , it is sufficient to optimize in the parameter space . The global gradient of parameter can be replaced by the gradient calculated on the empirical distance of high-dimensional image points, refer to Appendix for proof.
Theorem 3.
(Generalization Bound) Let be a hypothesis set for -way classification task. For any and a sample of size drawn according to , let be a mapping function of generator with . Fix , for any , with probability at least , the following holds for all ,
(8) |
For any , the and for any , and the for where kernel is positive definite symmetric.
Thm. 6 (see Appendix for proof) gives the generalization bound of aligning low-dimensional logits by reducing the distance of high-dimensional image points, which guarantees generalizability to the unseen samples.
4 Algorithm of Mapping-Emulation KD
Hinton et al. [19] propose a simple but effective KD method that uses the softened logits of the teacher model as a supervision to guide student training. They use the Kullback-Leibler Divergence (KLD) to measure the discrepancy between the logits of the two models, where the student model is trained to minimize the gap in the hope of achieving the same output. The loss is defined as
(9) | ||||
where is the sample index and is the number of samples. Regardless of the method used, the essence of KD is to learn the mapping function of the teacher model from input to output, i.e., . However, it is hard to deduce the mapping function from the existing parameters of the teacher model. One can only guess the mapping process by using the responses to the input samples of different network layers or the relations between features and treat them as knowledge to guide the training of the student model [57]. However, in the black-box KD problem, the internal responses or relations between layers of the teacher model are not available, which makes effective distillation more challenging.
Deprivatization. For a -way classification problem, we first train a GAN using the random noise variable sampled from the prior distribution in latent space as input. Note that the dimensionality of is the same as the output logits of the teacher model, i.e. . The generator uses noise to synthesize images, and the discriminator minimizes the Wasserstein distance between the generated and the real distribution . The synthetic privacy-free images are simultaneously sent to the cloud server for inference responses, which can be soft (probability vectors for all possible classes) or hard (indexes or semantic tags for the category with the highest probability). We expect the synthetic images to match the high responses of the teacher model so that they can maximize the containment of patterns in real data. We adopt the information maximization (IM) loss [21, 45], which is formulated as
(10) |
where for in soft responses and in hard responses.
Suppose the discriminator is capable of completely blurring the discrepancy between synthetic and genuine images. In this case, the resulting generator represents a function from the latent space to the image space, defined as , with an inverse mapping of the teacher function. Note that the generator and the discriminator are trained simultaneously: we adjust parameters for the generator to minimize and adjust parameters for the discriminator to minimize . And their loss functions are
(11) |
(12) |
We introduce a trade-off hyperparameter to balance and , and all the losses in the first step of deprivatization constitute
(13) |
Method | Data Size | MNIST | CIFAR-10 | CIFAR-100 | Tiny ImageNet | ||||
---|---|---|---|---|---|---|---|---|---|
Teacher | 50K100K | ResNet32 | VGG13 | ResNet56 | ResNet56 | VGG13 | ResNet56 | ResNet110 | ResNet110 |
99.50 | 99.52 | 94.15 | 94.15 | 74.68 | 72.06 | 60.71 | 60.71 | ||
Student | 50K100K | ResNet8 | VGG11 | ResNet8 | VGG11 | VGG11 | VGG11 | ResNet32 | MobileNet |
99.24 | 99.41 | 87.74 | 91.81 | 69.12 | 69.12 | 55.47 | 56.07 | ||
KD [19] | 50K100K | 99.33 | 99.44 | 86.58 | 82.25 | 70.88 | 67.97 | 54.14 | 57.85 |
ML [3] | 50K100K | 99.49 | 99.40 | 87.89 | 91.91 | 67.78 | 70.18 | 56.56 | 60.07 |
AL [53] | 50K100K | 99.37 | 99.26 | 87.25 | 91.97 | 69.92 | 71.13 | 46.02 | 51.29 |
DKD [58] | 50K100K | 99.33 | 99.43 | 86.61 | 92.42 | 67.32 | 70.10 | 55.99 | 59.43 |
DAFL [8] | 0K | 96.42 | 97.00 | 60.67 | 66.03 | 43.78 | 48.32 | 38.44 | 40.93 |
KN [37] | 10K | 98.61 | 98.81 | 80.62 | 82.41 | 57.83 | 55.64 | 48.92 | 50.22 |
AM [51] | 10K | 99.33 | 99.47 | 74.89 | 74.26 | 62.17 | 63.20 | 47.72 | 51.54 |
DB3KD [54] | 10K | 98.94 | 99.16 | 78.47 | 85.84 | 63.48 | 62.76 | 47.95 | 50.49 |
MEKD (soft) | 10K | 99.40 | 99.43 | 85.36 | 87.27 | 64.76 | 64.83 | 50.87 | 54.93 |
MEKD (hard) | 10K | 99.40 | 99.45 | 84.45 | 87.25 | 64.72 | 65.32 | 49.89 | 54.71 |
Distillation. The well-trained generator contains the knowledge that the teacher uses to make inferences. It is equivalent to a teacher assistant transferring the teacher’s knowledge to the student. Fig. 2 illustrates the architecture of MEKD. We freeze the generator and graft it behind the teacher and student model in the same way, using the softened logits of both models as the generator input. A batch of synthetic images is fed into the embedded network to output high-dimensional points in the same image space, simultaneously. The distance between the output high-dimensional points from the logits of the teacher model and the others from the student are measured by the distance measurement formula . We minimize the distance to drive the student model to mimic the output logits of the teacher model, and use -norm () of and as the loss function to distill the student,
(14) |
where query sample is generated from noise and temperature is used to soften the output logits. Through the experiments, we found that -norm has a similar effect with -norm, refer to Tab. 5.
5 Experiments
5.1 Experiment Setup
In this section, we compare our method with response-based KD and black-box KD methods in an unsupervised environment. Experimental results show that when the cross-entropy loss based on ground-truth labels is removed, the distillation performance of these methods decreases.
Datasets Setup. We conduct experiments on MNIST [27], CIFAR [26], Tiny ImageNet [11], and ImageNet-1K [11], all of which are widely used for image classification. While training B2KD methods, we randomly select images ( for ImageNet-1K) from the training set, and all images in the test set (val set for ImageNet) are used as the benchmark to calculate accuracy. For other approaches, except DAFL [8] based on zero-shot learning, we use the whole training set. We mainly use top-1 classification accuracy as an evaluation metric to assess the distillation effect. To make a fair and intuitive comparison, we follow the same setup as previous B2KD methods in our main experiments. However, we find that the original settings in the B2KD experiments do not represent the challenges raised in practical applications, so we add extended experiments in Sec. 5.4 to illustrate the practicability of our proposed method.
Implementation. See also the project page111https://github.com/HAIV-Lab/MEKD. We use ResNet [18], VGG [46] and MobileNet [20] as the backbone, and adopt standard data augmentation techniques (random crop and horizontal flip) and an SGD optimizer in all experiments. We consistently train the teacher and student model for epochs, except for epochs for MNIST, and we adopt a multi-step LR scheduler following the paper [23]. After training the teacher, we train a DCGAN [42] with Gaussian noise in the same dimension as the category counts. The output logits of teacher or student for samples in the same class follow a Gaussian distribution, and the logits center is the mean of the Gaussian. Since the conversion between different Gaussian distributions is a linear process, using Gaussian as the prior distribution provides a smooth dual space for the student’s logits update.
Competing Methods. In order to verify the effectiveness of our method, we compare several methods of response-based KD and black-box KD. We select KD [19] proposed by Hinton et al. and ML [3] proposed by Ba and Caruana as the baselines, and we also compare the recently published DKD [58] based on decoupled KLD. For the two GAN-based KD frameworks summarized in Sec. 2, we choose AL [53] and DAFL [8] as comparison methods. Meanwhile, we compete with some black-box KD methods such as KN [37], AM [51] and DB3KD [54]. Of these methods, DB3KD and MEKD(hard) only utilize hard responses, while the other methods are based on soft responses.
T - S | KD | AL | AM | DB3KD | MEKD |
Pairs | (soft) | (soft) | (soft) | (hard) | (soft) |
RN50 - RN34 | 52.08 | 53.50 | 56.92 | 58.61 | 59.89 |
RX101 - RX50 | 54.90 | 50.88 | 55.64 | 59.90 | 61.21 |
5.2 Performance Evaluation
On MNIST, CIFAR, and Tiny ImageNet, we use ResNet32/56/110 and VGG13 as the teacher model and use ResNet8/32, VGG11, and MobileNet as the student model. We compare the top-1 classification accuracy (ACC) of different teacher-student pairs, the results are shown in Tab. 1.
On relatively easy tasks, such as MNIST and CIFAR-10, our proposed method has a small gap compared to response-baed KD methods that use the full training set. This makes sense in the applications of cloud-to-edge model compression because edge devices do not have a lot of capacity to store more than ten thousand pieces of data.
CIFAR-100 and Tiny ImageNet are more challenging. These tasks contain far more patterns than MNIST and CIFAR-10, and data distributions are so complex that it is difficult for a generator to capture all the patterns. However, as long as the mode collapse problem can be mitigated, it is possible to synthesize complex samples beneficial to distillation, so we exploit DCGAN [42] as our generator. DCGAN has a more stable training process and is more suitable for generating RGB images than a fully-connected GAN [42]. Experimental results show that MEKD can obtain an accuracy improvement of compared to other B2KD methods, and the accuracy of MEKD with soft or hard responses is similar, with a difference of less than .
We also conduct experiments on large-scale datasets and sophisticated networks. On ImageNet-1K, we use two teacher-student (T-S) pairs of ResNet50 (RN50) - ResNet34 (RN34) and ResNeXt101 (RX101) - ResNeXt50 (RX50). All methods are trained using a subset of samples. The experimental results are shown in Tab. 2.
Uniformly, we set the number of query samples to on CIFAR and MNIST, on ImageNet, and discuss the performance impact of limited query samples in Sec. 5.4.
5.3 Ablation Study
We choose an effective T-S pair [35] of ResNet56 - MobileNet for ablation studies unless otherwise stated.
Ablation Study of Data Size. We explore the performance with different data sizes, the results are shown in Tab. 3. In general, B2KD methods have higher robustness to small data sizes than traditional KD methods, and in which MEKD achieves the highest distillation performance.
Ablation Study of Deprivatization. The is a hyperparameter to balance and . The is used to maximize the responses of the teacher to the generated samples. Therefore, the training of the generator with or without will affect the quality of synthetic images. Fig. 5 (a) shows real images of CIFAR-10. Fig. 5 (b) shows synthetic images with and Fig. 5 (c) shows synthetic images without (i.e. ), both using the same noise vectors. The teacher of ResNet56 responds from to the synthetic image in Fig. 5 (b) and from to the one in Fig. 5 (c). The effect of is also reported in Tab. 4, which reflects that the utilization of can improve the performance of model distillation.
Response Type | ||
Soft | Hard | |
0.0 | 60.87 | 61.31 |
0.1 | 66.06 | 66.86 |
0.5 | 67.07 | 67.36 |
1.0 | 67.01 | 67.11 |
Response Type | ||
Soft | Hard | |
0.0 | 56.28 | 56.23 |
0.1 | 64.13 | 65.60 |
0.5 | 66.79 | 67.01 |
1.0 | 67.07 | 67.36 |
Ablation Study of Distillation. In Eqn. 4, the is a trade-off hyperparameter to balance and , which provide different gradient directions for . As shown in Tab. 4, the distillation performance can be improved by introducing KLD as an additional loss function.
The temperature is another important hyperparameter for MEKD since it softens the output logits of both the teacher and student models. The results are shown in Fig. 6. Its validity comes from the fact that softened logits can increase the probability of being sampled in a standard normal distribution. Since GANs use a standard Gaussian distribution as input, samples generated from out-of-distribution noises with low-sampling probability are usually fuzzy and incorporate few patterns [43], which are meaningless for distillation. Meanwhile, a high value of reduces the discrepancy between softened logits, and when they locate in the same cell. It reduces the performance of distillation, especially for challenging tasks, such as ImageNet.
Ablation Study of Different . In Eqn. 4, we use to calculate the distance between generated samples and . From the analysis of experimental results, as shown in Tab. 5, we argue that the effect on distillation is similar whether equals or . The reason is that is used to measure the distance between logits of the student and the boundary of cells, in which logits of the teacher reside, and different represent similar gradient directions.
Dataset | Method | Model | ACC (/) |
---|---|---|---|
CIFAR-10 | MEKD (soft) | MobileNet | 86.85 / 86.63 |
MEKD (hard) | MobileNet | 86.53 / 86.88 | |
CIFAR-100 | MEKD (soft) | MobileNet | 67.07 / 66.95 |
MEKD (hard) | MobileNet | 67.36 / 66.94 |
5.4 Extended Experiments
In the real-world application of cloud-to-edge model compression, there are some restrictions, such as the limitation of Internet data exchange and the domain shift in practical scenarios. We conduct additional experiments to explore the effect of MEKD under these constraints.
MEKD with Limited Query Samples. We distill a student MobileNet on CIFAR-10 and CIFAR-100 with a total query sample size ranging from to with an interval of . We report the ACC of MEKD with or without and . The curves in Fig. 7 show that with more query samples sent to the cloud server, the student model in the edge device can be trained more fully. We can also analyze from the curves that does not seem to be that useful without using KLD as an additional distillation loss function, and it gives a big boost to the overall MEKD due to the extra gradient direction of the mapping emulation.
MEKD with Out-of-Domain Data. We train a teacher (ResNet56 or VGG13) with vanilla supervised learning on Syn. Digits [13], which contains about software-synthesized images. We distill a student (MobileNet) on SVHN [36] consisting only of real-shooting photographs. Tab. 6 shows the ACC on the test set of SVHN. MEKD outperforms most methods in the task of out-of-domain distillation, while DB3KD achieves higher performance due to the use of robust labels [54]. However, DB3KD leads to a very high data exchange cost between the server and client, since it requires multiple queries to find a mixed image located in the decision boundary to compute robust labels. In contrast, the data exchange cost of MEKD is much lower.
Teacher | ResNet56 | VGG13 | Data
Exchange |
---|---|---|---|
74.37 | 79.86 | ||
Student | MobileNet | MobileNet | |
KD [19] | 76.27 | 80.67 | 175 MB |
ML [3] | 76.78 | 81.90 | 175 MB |
AL [53] | 77.09 | 80.98 | 175 MB |
DKD [58] | 75.47 | 80.64 | 175 MB |
DAFL [8] | 69.20 | 67.07 | 28.4 GB |
KN [37] | 79.65 | 83.37 | 145 MB |
AM [51] | 84.05 | 86.70 | 11.6 GB |
DB3KD [54] | 90.15 | 91.14 | 20.8 GB |
MEKD (soft) | 86.45 | 88.65 | 120 MB |
MEKD (hard) | 86.77 | 89.21 | 120 MB |
6 Conclusion
In this paper, we provide a two-step workflow of deprivatization and distillation for B2KD. Different from aligning logits directly, we theoretically provide a new optimization direction from logits to cell boundaries, and propose a new method of MEKD. Taking a generator as an inverse mapping of the teacher function does not leak information about the internal structure or parameters of the teacher, because it has a completely different network structure.
Limitation. A well-trained generator is critical in MEKD, and GANs are known to suffer from mode collapse, especially for challenging tasks. We alleviate this problem with DCGAN. Although the parameter size and structural limitations of the model prevent the student from fully mimicking the function of the teacher, MEKD can still improve distillation performance compared with other B2KD methods.
Acknowledgement. This research was supported by Natural Science Fund of Hubei Province (Grant # 2022CFB823), Alibaba Innovation Research program under Grant Contract # CRAQ7WHZ11220001-20978282, and HUST Independent Innovation Research Fund (Grant # 2021XXJS096).
References
- Aguilar et al. [2020] Gustavo Aguilar, Yuan Ling, Yu Zhang, Benjamin Yao, Xing Fan, and Chenlei Guo. Knowledge distillation from internal representations. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 7350–7357, 2020.
- Arjovsky et al. [2017] Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pages 214–223. PMLR, 2017.
- Ba and Caruana [2014] Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? Advances in Neural Information Processing Systems, 27, 2014.
- Belagiannis et al. [2018] Vasileios Belagiannis, Azade Farshad, and Fabio Galasso. Adversarial network compression. In Proceedings of the European Conference on Computer Vision Workshops, pages 0–0, 2018.
- Bergmann et al. [2020] Paul Bergmann, Michael Fauser, David Sattlegger, and Carsten Steger. Uninformed students: Student-teacher anomaly detection with discriminative latent embeddings. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4183–4192, 2020.
- Braun and Griebel [2009] Jürgen Braun and Michael Griebel. On a constructive proof of kolmogorov’s superposition theorem. Constructive Approximation, 30(3):653–675, 2009.
- Brock et al. [2018] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2018.
- Chen et al. [2019] Hanting Chen, Yunhe Wang, Chang Xu, Zhaohui Yang, Chuanjian Liu, Boxin Shi, Chunjing Xu, Chao Xu, and Qi Tian. Data-free learning of student networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3514–3522, 2019.
- Chen et al. [2020] Hanting Chen, Yunhe Wang, Chang Xu, Chao Xu, and Dacheng Tao. Learning student networks via feature embedding. IEEE Transactions on Neural Networks and Learning Systems, 32(1):25–35, 2020.
- Chen et al. [2016] Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. Advances in Neural Information Processing Systems, 29, 2016.
- Deng et al. [2009] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255, 2009.
- Frankl and Maehara [1988] Peter Frankl and Hiroshi Maehara. The johnson-lindenstrauss lemma and the sphericity of some graphs. Journal of Combinatorial Theory, Series B, 44(3):355–362, 1988.
- Ganin et al. [2016] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096–2030, 2016.
- Goodfellow et al. [2014] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Advances in Neural Information Processing Systems, 27, 2014.
- Gou et al. [2021] Jianping Gou, Baosheng Yu, Stephen J Maybank, and Dacheng Tao. Knowledge distillation: A survey. International Journal of Computer Vision, 129(6):1789–1819, 2021.
- Gulrajani et al. [2017] Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. Advances in Neural Information Processing Systems, 30, 2017.
- He et al. [2020] Chaoyang He, Murali Annavaram, and Salman Avestimehr. Group knowledge transfer: Federated learning of large cnns at the edge. Advances in Neural Information Processing Systems, 33:14068–14080, 2020.
- He et al. [2016] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 770–778, 2016.
- Hinton et al. [2015] Geoffrey Hinton, Oriol Vinyals, Jeff Dean, et al. Distilling the knowledge in a neural network. arXiv preprint:1503.02531, 2(7), 2015.
- Howard et al. [2017] Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
- Hu et al. [2017] Weihua Hu, Takeru Miyato, Seiya Tokui, Eiichi Matsumoto, and Masashi Sugiyama. Learning discrete representations via information maximizing self-augmented training. In International conference on machine learning, pages 1558–1567. PMLR, 2017.
- Karras et al. [2019] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4401–4410, 2019.
- Kim et al. [2018] Jangho Kim, SeongUk Park, and Nojun Kwak. Paraphrasing complex network: Network compression via factor transfer. Advances in Neural Information Processing Systems, 31, 2018.
- Komodakis and Zagoruyko [2017] Nikos Komodakis and Sergey Zagoruyko. Paying more attention to attention: improving the performance of convolutional neural networks via attention transfer. In ICLR, 2017.
- Köppen [2002] Mario Köppen. On the training of a kolmogorov network. In International Conference on Artificial Neural Networks, pages 474–479. Springer, 2002.
- Krizhevsky et al. [2009] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Unvieristy of Toronto: Technical Report, 2009.
- LeCun et al. [1998] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
- Lei et al. [2019] Na Lei, Kehua Su, Li Cui, Shing-Tung Yau, and Xianfeng Gu. A geometric view of optimal transportation and generative model. Computer Aided Geometric Design, 68:1–21, 2019.
- Lei et al. [2020] Na Lei, Dongsheng An, Yang Guo, Kehua Su, Shixia Liu, Zhongxuan Luo, Shing-Tung Yau, and Xianfeng Gu. A geometric understanding of deep learning. Engineering, 6(3):361–374, 2020.
- Lewis and Lucchetti [2000] Adrian Stephen Lewis and RE Lucchetti. Nonsmooth duality, sandwich, and squeeze theorems. SIAM Journal on Control and Optimization, 38(2):613–626, 2000.
- Meng et al. [2019] Zhong Meng, Jinyu Li, Yong Zhao, and Yifan Gong. Conditional teacher-student learning. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing, pages 6445–6449, 2019.
- Micaelli and Storkey [2019] Paul Micaelli and Amos J Storkey. Zero-shot knowledge transfer via adversarial belief matching. Advances in Neural Information Processing Systems, 32, 2019.
- Milgrom and Segal [2002] Paul Milgrom and Ilya Segal. Envelope theorems for arbitrary choice sets. Econometrica, 70(2):583–601, 2002.
- Mirza and Osindero [2014] Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint:1411.1784, 2014.
- Mirzadeh et al. [2020] Seyed Iman Mirzadeh, Mehrdad Farajtabar, Ang Li, Nir Levine, Akihiro Matsukawa, and Hassan Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI conference on artificial intelligence, pages 5191–5198, 2020.
- Netzer et al. [2011] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
- Orekondy et al. [2019] Tribhuvanesh Orekondy, Bernt Schiele, and Mario Fritz. Knockoff nets: Stealing functionality of black-box models. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 4954–4963, 2019.
- Ozkara et al. [2021] Kaan Ozkara, Navjot Singh, Deepesh Data, and Suhas Diggavi. Quped: Quantized personalization via distillation with applications to federated learning. Advances in Neural Information Processing Systems, 34, 2021.
- Pan et al. [2020] Boxiao Pan, Haoye Cai, De-An Huang, Kuan-Hui Lee, Adrien Gaidon, Ehsan Adeli, and Juan Carlos Niebles. Spatio-temporal graph for video captioning with knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10870–10879, 2020.
- Passalis et al. [2020] Nikolaos Passalis, Maria Tzelepi, and Anastasios Tefas. Heterogeneous knowledge distillation using information flow modeling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2339–2348, 2020.
- Passban et al. [2021] Peyman Passban, Yimeng Wu, Mehdi Rezagholizadeh, and Qun Liu. Alp-kd: Attention-based layer projection for knowledge distillation. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 13657–13665, 2021.
- Radford et al. [2015] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint:1511.06434, 2015.
- Schlegl et al. [2017] Thomas Schlegl, Philipp Seeböck, Sebastian M Waldstein, Ursula Schmidt-Erfurth, and Georg Langs. Unsupervised anomaly detection with generative adversarial networks to guide marker discovery. In International conference on information processing in medical imaging, pages 146–157. Springer, 2017.
- Shen et al. [2019] Zhiqiang Shen, Zhankui He, and Xiangyang Xue. Meal: Multi-model ensemble via adversarial learning. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 4886–4893, 2019.
- Shi and Sha [2012] Yuan Shi and Fei Sha. Information-theoretical learning of discriminative clusters for unsupervised domain adaptation. In ICML, 2012.
- Simonyan and Zisserman [2014] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
- Stanton et al. [2021] Samuel Stanton, Pavel Izmailov, Polina Kirichenko, Alexander A Alemi, and Andrew G Wilson. Does knowledge distillation really work? Advances in Neural Information Processing Systems, 34, 2021.
- Tenenbaum et al. [2000] Joshua B Tenenbaum, Vin de Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. Science, 290(5500):2319–2323, 2000.
- Tramèr et al. [2016] Florian Tramèr, Fan Zhang, Ari Juels, Michael K Reiter, and Thomas Ristenpart. Stealing machine learning models via prediction APIs. In 25th USENIX security symposium (USENIX Security 16), pages 601–618, 2016.
- Villani [2009] Cédric Villani. Optimal transport: old and new. Springer, 2009.
- Wang et al. [2020a] Dongdong Wang, Yandong Li, Liqiang Wang, and Boqing Gong. Neural networks are more productive teachers than human raters: Active mixup for data-efficient knowledge distillation from a blackbox model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1498–1507, 2020a.
- Wang et al. [2020b] Haohan Wang, Xindi Wu, Zeyi Huang, and Eric P Xing. High-frequency component helps explain the generalization of convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8684–8694, 2020b.
- Wang et al. [2018] Yunhe Wang, Chang Xu, Chao Xu, and Dacheng Tao. Adversarial learning of portable student networks. In Proceedings of the AAAI Conference on Artificial Intelligence, 2018.
- Wang [2021] Zi Wang. Zero-shot knowledge distillation from a decision-based black-box model. In International Conference on Machine Learning, pages 10675–10685. PMLR, 2021.
- Xu et al. [2017] Zheng Xu, Yen-Chang Hsu, and Jiawei Huang. Training shallow and thin networks for acceleration via knowledge distillation with conditional adversarial networks. arXiv preprint:1709.00513, 2017.
- Ye et al. [2020] Jingwen Ye, Yixin Ji, Xinchao Wang, Xin Gao, and Mingli Song. Data-free knowledge amalgamation via group-stack dual-gan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12516–12525, 2020.
- Yim et al. [2017] Junho Yim, Donggyu Joo, Jihoon Bae, and Junmo Kim. A gift from knowledge distillation: Fast optimization, network minimization and transfer learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4133–4141, 2017.
- Zhao et al. [2022] Borui Zhao, Quan Cui, Renjie Song, Yiyu Qiu, and Jiajun Liang. Decoupled knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11953–11962, 2022.
- Zhu et al. [2017] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pages 2223–2232, 2017.
Appendix
In the Appendix, we provide proof of theorems and more experimental results for MEKD. We also visualize the real and generated distributions of MEKD with DCGAN to verify the effectiveness of our method.
A. Proofs
The success of deep learning can be attributed to the discovery of intrinsic structures of data, which is defined as the manifold distribution hypothesis [48]. The data is concentrated on a manifold , which is embedded in the image space , and data distribution can be abstracted as a probability distribution over the data manifold. The encoding-map maps the data manifold to the label manifold in a label space which is also called latent space, while mapping the data distribution to latent distribution . Each sample is mapped from the image space into the latent space, and its result is called a latent code. The decoding-map remaps latent codes to the data manifold. Both and are strongly nonlinear functions, which can be simulated with different neural networks [28, 29]. Meanwhile, the well-known Kolmogorov Theorem [25, 6] indicates that any multivariate continuous function can be represented as the sum of continuous real-valued functions with continuous one-dimensional outer and inner functions and .
The teacher function can be considered as a kind of encoding map, and the generator function can be considered as a kind of decoding map. Let be the image space, where data is sampled from. For a -way classification task, let be the latent space, where . Defining the model as a complex mapping function from the image distribution to the latent distribution, we can consider the teacher model as parameterized by , whose outputs indicate the probabilities (e.g., logits) of what category the samples belong to. The same for the student model parameterized by .
Definition 3.
(Function Equivalence) Giving the student and teacher model and , for a data distribution in image space which is mapped to and in latent space. If the Wasserstein distance between and equals zero,
(15) |
the student and teacher model are equivalent, i.e., , where is the set of all joint distributions whose marginals are and , respectively.
Definition 4.
(Inverse Mapping) Giving a prior distribution , for a data distribution , if the Wasserstein distance between generated distribution and equals zero,
(16) |
then the generator is the inverse mapping of the teacher function , denoted as , where is the set of all joint distributions whose marginals are respectively and .
A.1. Proof of Theorem 1
Theorem 4.
(Empirical Approximation) For any and any integer , let be the mapping function of generator with . For two sets and , both of which have points in , if the empirical Wasserstein distance between and equals zero,
(17) |
then .
Proof.
According to Johnson-Lindenstrauss theorem, for and , we have
(18) |
For set and , we can get the empirical Wasserstein distance between them:
(19) |
Because the Wasserstein distance between and is the expectation of the empirical Wasserstein distance between and , i.e.,
(20) |
so we can get
(21) |
Since
(22) |
then the result is derived. ∎
A.2. Proof of Theorem 2
Theorem 5.
(Optimization Direction) Let be any distribution. are the mapping functions of the student, teacher, and generator, respectively. is parameterized by . Then, when
(23) |
it holds that , and we have
(24) |
Proof.
Let us define
(25) |
(26) |
where lies in and .
According to the Johnson-Lindenstrauss Lemma [12], for any and any integer , let , then for any set of points in , the generator mapping function for all holds that
(27) |
Using Squeeze Theorem [30], we know that the minimization of equation 25 and equation 26 converge to the same results, i.e.,
(28) |
We can rewrite the equation 15 using :
(29) | ||||
where and map distribution to and , respectively. So we can get
(30) |
According to Def. 3, when , then , and we can derive that .
The rest of the proof will be dedicated to show that the optimal solution of leads to reduce the Wasserstein distance of and , which drives to approximate .
We know by the Kantorovich-Rubinstein duality [50] that there is an that attains
(31) |
Let us define which is non-empty. We know by a simple envelope theorem [33] that
(32) |
for any when both terms are well-defined.
Let , which we knows exists since is non-empty for all . Then, we get
(33) | ||||
In practice, we use empirical distance between generated images of the student and teacher as loss to update by back-propagation, i.e.,
(34) |
when , the student function converges to the teacher function . ∎
A.3. Proof of Theorem 3
Theorem 6.
(Generalization Bound) Let be a hypothesis set for -way classification task. For any and a sample of size drawn according to , let be a mapping function of generator with . Fix , for any , with probability at least , the following holds for all ,
(35) |
For any , the and for any , and the for where kernel is positive definite symmetric.
Proof.
For the -way classification task, a hypothesis aims to get with the minimum distance, i.e. which is equivalent to by Johnson-Lindenstrauss theorem, as the result of . We define the margin of the hypothesis as
(36) |
where is the vector of and use the mean of which belong to class as input. is the mapping function of generator .
For any , we can define the empirical margin loss of hypothesis for multi-class classification as
(37) |
where is the margin loss function
(41) |
Thus, empirical margin loss is upper bounded by
(42) |
Let , consider the family of functions derived from , which take values in . By Rademacher theorem, with the probability at least , for all ,
(43) |
Since for all , the generalization error is a lower bound on the left-hand side by Johnson-Lindenstrauss theorem, , and we get
(44) |
Let , because the -Lipschitzness of , so that . Here, can be upper bounded as follows:
(45) |
where with independent uniform random variables taking values in , observing that and are distributed in the same way.
Let . By Johnson-Lindenstrauss theorem, we get
(46) |
Let be a positive definite symmetric kernel and let , where be a feature mapping associated to . We denote as . For any , the family of kernel-based hypotheses is
(47) |
where .
Observe that for all , we have .And for , . The Radmacher complexity of the hypotheses set can be expressed and bounded as follows:
(48) |
which concludes the proof.
∎
Method | Data Size | MNIST | CIFAR-10 | ||||||
---|---|---|---|---|---|---|---|---|---|
Teacher | 50K100K | ResNet32 | VGG13 | ResNet32 | ResNet32 | ResNet56 | VGG13 | ResNet56 | ResNet56 |
99.50 | 99.52 | 99.50 | 99.50 | 94.15 | 94.42 | 94.15 | 94.15 | ||
Student | 50K100K | ResNet8 | VGG11 | VGG11 | MobileNet | ResNet8 | VGG11 | VGG11 | MobileNet |
99.24 | 99.41 | 99.41 | 99.18 | 87.74 | 91.81 | 91.81 | 90.04 | ||
KD [19] | 50K100K | 99.33 | 99.44 | 99.31 | 99.30 | 86.58 | 92.16 | 92.25 | 90.43 |
ML [3] | 50K100K | 99.49 | 99.40 | 99.44 | 99.40 | 87.89 | 91.58 | 91.91 | 91.19 |
AL [53] | 50K100K | 99.37 | 99.26 | 99.26 | 99.21 | 87.25 | 91.96 | 91.97 | 90.54 |
DKD [58] | 50K100K | 99.33 | 99.43 | 99.48 | 99.42 | 86.61 | 92.06 | 92.42 | 90.50 |
DAFL [8] | 0K | 96.42 | 97.00 | 96.14 | 97.85 | 60.67 | 65.41 | 66.03 | 69.59 |
KN [37] | 10K | 98.61 | 98.81 | 98.07 | 98.54 | 80.62 | 81.83 | 82.41 | 85.07 |
AM [51] | 10K | 99.33 | 99.47 | 99.50 | 99.42 | 74.89 | 77.25 | 74.26 | 73.65 |
DB3KD [54] | 10K | 98.94 | 99.16 | 98.91 | 98.91 | 78.47 | 83.72 | 85.84 | 81.67 |
MEKD (soft) | 10K | 99.40 | 99.43 | 99.36 | 99.25 | 85.36 | 86.11 | 87.27 | 86.85 |
MEKD (hard) | 10K | 99.40 | 99.45 | 99.28 | 99.27 | 84.45 | 86.16 | 87.25 | 86.53 |
Method | Data Size | CIFAR-100 | Tiny ImageNet | ||||||
---|---|---|---|---|---|---|---|---|---|
Teacher | 50K100K | ResNet56 | VGG13 | ResNet56 | ResNet56 | ResNet110 | VGG13 | ResNet110 | ResNet110 |
72.06 | 74.68 | 72.06 | 72.06 | 60.71 | 59.89 | 60.71 | 60.71 | ||
Student | 50K100K | ResNet8 | VGG11 | VGG11 | MobileNet | ResNet32 | VGG11 | VGG11 | MobileNet |
59.92 | 69.12 | 69.12 | 68.14 | 55.47 | 54.14 | 54.14 | 56.07 | ||
KD [19] | 50K100K | 53.31 | 70.88 | 67.97 | 71.86 | 54.14 | 54.40 | 49.63 | 57.85 |
ML [3] | 50K100K | 54.44 | 67.78 | 70.18 | 73.08 | 56.56 | 57.46 | 56.78 | 60.07 |
AL [53] | 50K100K | 58.36 | 69.92 | 71.13 | 71.33 | 46.02 | 46.26 | 45.60 | 51.29 |
DKD [58] | 50K100K | 54.28 | 67.32 | 70.10 | 72.38 | 55.99 | 55.88 | 56.52 | 59.43 |
DAFL [8] | 0K | 42.44 | 43.78 | 48.32 | 54.10 | 38.44 | 31.93 | 34.13 | 40.93 |
KN [37] | 10K | 48.75 | 57.83 | 55.64 | 58.49 | 48.92 | 46.99 | 45.05 | 50.22 |
AM [51] | 10K | 50.69 | 62.17 | 63.20 | 65.58 | 47.72 | 49.26 | 47.32 | 51.54 |
DB3KD [54] | 10K | 50.49 | 63.48 | 62.76 | 63.67 | 47.95 | 48.46 | 46.93 | 50.49 |
MEKD (soft) | 10K | 51.87 | 64.76 | 64.83 | 67.07 | 50.87 | 51.85 | 49.95 | 54.93 |
MEKD (hard) | 10K | 51.67 | 64.72 | 65.32 | 67.36 | 49.89 | 51.33 | 49.36 | 54.71 |
Dataset | T - S | Data Size | KD | ML | AL | DKD | KN | AM | DB3KD | MEKD | MEKD |
---|---|---|---|---|---|---|---|---|---|---|---|
Pairs | (soft) | (soft) | (soft) | (soft) | (soft) | (soft) | (hard) | (soft) | (hard) | ||
ImageNet-1K | RN50 - RN34 | 100K | 52.08 | 54.97 | 53.50 | 53.57 | 56.77 | 56.92 | 58.61 | 59.89 | 59.32 |
RX101 - RX50 | 100K | 54.90 | 56.58 | 50.88 | 55.31 | 57.43 | 55.64 | 59.90 | 61.21 | 60.54 |
Dataset | T - S | Data Size | KD | ML | AL | DKD | KN | AM | DB3KD | MEKD | MEKD |
Pairs | (soft) | (soft) | (soft) | (soft) | (soft) | (soft) | (hard) | (soft) | (hard) | ||
CIFAR10 | T: ResNet56 | 0.1K | 16.74 | 17.78 | 12.97 | 20.66 | 27.67 | 48.31 | 43.05 | 49.04 | 47.12 |
(94.15%) | 1K | 31.25 | 31.57 | 32.05 | 31.09 | 58.65 | 62.05 | 64.28 | 69.84 | 68.66 | |
S: MobileNet | 10K | 70.90 | 73.06 | 68.61 | 75.44 | 85.07 | 73.65 | 81.67 | 86.85 | 86.53 | |
(90.04%) | 50K(full) | 90.43 | 91.19 | 90.54 | 90.50 | 92.19 | 86.33 | 92.46 | 93.48 | 93.09 | |
CIFAR100 | T: ResNet56 | 0.1K | 01.96 | 01.88 | 01.72 | 02.56 | 13.23 | 36.73 | 30.72 | 33.56 | 34.60 |
(72.06%) | 1K | 10.36 | 10.06 | 09.62 | 10.81 | 35.80 | 52.09 | 50.14 | 53.84 | 54.52 | |
S: MobileNet | 10K | 44.32 | 48.08 | 40.57 | 47.24 | 58.49 | 65.58 | 63.67 | 67.07 | 67.36 | |
(68.14%) | 50K(full) | 71.86 | 73.08 | 71.33 | 72.38 | 70.85 | 71.77 | 73.36 | 73.84 | 73.27 |
B. More Results
B.1. Complete Distillation Experiments
We conduct different teacher-student model pairs for distillation experiments, and use ResNet32 / ResNet56 / VGG13 / ResNet110 / ResNet50 / ResNeXt101 as teacher models and use ResNet8 / ResNet32 / VGG11 / MobileNet / ResNet34 / ResNeXt50 as student models. Distillation performance is tested on various datasets, such as MNIST, CIFAR-10, CIFAR-100, Tiny ImageNet, and ImageNet-1K, as top-1 classification accuracy is exploited as an evaluation metric. The experimental results are shown in Tab. 7, Tab. 8 and Tab. 9. For the training of teacher and student models, we adopt the same setting of hyperparameters, so as to verify the distillation effect of student models trained with different methods compared with the teacher model trained with vanilla supervised learning under the same conditions.
We also provide complete ablation results of different data sizes on CIFAR-10 and CIFAR-100, as shown in Tab. 10. We use an effective teacher-student pair of ResNet56 - MobileNet for experiments. The results show that B2KD methods are generally more robust than traditional KD methods for small data sizes, and they can utilize the information in available samples maximumly to model compression in extreme cases. In the comparison of all methods, MEKD achieves the best performance, which also validates the effectiveness and robustness of our proposed method.
In all experiments, teacher and student models are trained for epochs, except epochs for MNIST. We use Nesterov SGD with momentum and weight-decay for training and use a mini-batch size of images on a single NVIDIA GeForce RTX 3090 GPU. The initial learning rate is , except for MNIST, and we conduct a multi-step learning rate schedule which decreases the learning rate by 0.1 at the and epoch for the training of models, except no learning rate schedule is used for MNIST. For the training of student models, we follow the unsupervised setting and only use the soft or hard responses of teacher models for distillation. Note that for all experiments, we conduct three times experiments and report the mean accuracy.
For the training of DCGAN, we follow the hyperparameters’ settings of the work [42]. DCGAN composes of a generator realized by transposed convolution layer and a discriminator realized by an ordinary convolution layer, which greatly reduces the number of network parameters and improves the image generation effect. As an extension of our method, we believe that generative models of different architectures can also be used as emulators to learn the inverse mapping of the teacher function, by adding information maximization (IM) loss to alleviate the problem of mode collapse and achieve the purpose of deprivatization. This will be our research work in the future.
B.2. Visualization Results
We evaluate the training process of DCGAN in terms of whether the generated distribution is consistent with the real distribution, and visualize the synthetic and genuine images by t-SNE projection. As shown in Fig. 8 and Fig. 9, it can be observed that in the training process of DCGAN, the generated distribution is gradually closer to the real distribution. This verifies the effectiveness of using DCGAN as the emulator to learn the inverse mapping of the teacher function, and also proves that DCGAN can indeed alleviate the problem of mode collapse and generate images consistent with the distribution of real images. These synthetic images can not only effectively integrate various patterns in genuine images, but also serve as effective query samples to support the distillation of student models.