Collaborative Multi-Teacher Knowledge Distillation for Learning Low Bit-width Deep Neural Networks

Knowledge distillation which learns a lightweight student model by distilling knowledge from a cumbersome teacher model is an attractive approach for learning compact deep neural networks (DNNs). Recent works further improve student network performance by leveraging multiple teacher networks. However, most of the existing knowledge distillation-based multi-teacher methods use separately pretrained teachers. This limits the collaborative learning between teachers and the mutual learning between teachers and student. Network quantization is another attractive approach for learning compact DNNs. However, most existing network quantization methods are developed and evaluated without considering multi-teacher support to enhance the performance of quantized student model. In this paper, we propose a novel framework that leverages both multi-teacher knowledge distillation and network quantization for learning low bit-width DNNs. The proposed method encourages both collaborative learning between quantized teachers and mutual learning between quantized teachers and quantized student. During learning process, at corresponding layers, knowledge from teachers will form an importance-aware shared knowledge which will be used as input for teachers at subsequent layers and also be used to guide student. Our experimental results on CIFAR100 and ImageNet datasets show that the compact quantized student models trained with our method achieve competitive results compared to other state-of-the-art methods, and in some cases, indeed surpass the full precision models.


Introduction
Deep Convolutional Neural Networks (CNNs) have achieved tremendous successes in a variety of computer vision tasks, including image classification, object detection, segmentation, and image retrieval. However, CNNs generally require excessive memory and expensive computa-tional resources, limiting their usage in many applications. Therefore, a great number of researches have been devoted to making CNNs lightweight and to improving inference efficiency for practical applications.
An effective approach is to use low bit-width weights and/or low bit-width activations. This approach not only can reduce the memory footprint but also achieves a significant gain in speed, as the most computationally expensive convolutions can be done by bitwise operations [25]. Although existing quantization-based methods [4,24,25,32,34,36,37] achieved improvements, there are still noticeable accuracy gaps between the quantized CNNs and their full precision counterparts, especially in the challenging cases of 1 or 2 bit-width weights and activations.
Model compression using knowledge distillation is another attractive approach to reduce the computational cost of DNNs [10,11,15,20,26]. In knowledge distillation, a smaller student network is trained to mimic the behaviour of a cumbersome teacher network. To further enhance the performance of the student network, some works [19,22,33] propose to distill knowledge from multiple teachers. However, in those works, teacher models are separately pretrained, which would limit the collaborative learning between teachers. It also limits the mutual learning between student network and teacher networks.
To improve the compact low bit-width student network, in this paper, we propose a novel framework -Collaborative Multi-Teacher Knowledge Distillation (CMT-KD), which encourages the collaborative learning between teachers and the mutual learning between teachers and student.
In the collaborative learning process, knowledge at corresponding layers from teachers will be combined to form an importance-aware shared knowledge which will subsequently be used as input for the next layers of teachers. The collaborative learning between teachers is expected to form a valuable shared knowledge to be distilled to the corresponding layers in the student network. To our best knowledge, this paper is the first one that proposes this kind of collaborative learning for knowledge distillation.
It is worth noting that our novel framework design allows end-to-end training, in which not only the teachers and student networks but also the contributions (i.e., importance factors) of teachers to the shared knowledge are also learnable during the learning process. It is also worth noting that the proposed framework is flexible -different quantization functions and different knowledge distillation methods can be used in our framework.
To evaluate the effectiveness of the proposed framework, we conduct experiments on CIFAR-100 and Ima-geNet datasets with AlexNet and ResNet18 architectures. The results show that the compact student models trained with our framework achieve competitive results compared to previous works.

Related work
Our work is closely related to two main research topics in the literature: network quantization and knowledge distillation (KD).
Network quantization. Earlier works in network quantization have applied the basic form of weight quantization to directly constrain the weight values into the binary/ternary space without or with a scaling factor, i.e., {−1, 1} [6], {−α, α} [25], or {−α, 0, α} [18]. Since quantization of activations can substantially reduce complexity further [25,30,34,36], this research topic attracts more and more attention [25,34,36]. In [25,30], the authors propose to binarize both weights and activations to {−1, 1}. However, there are considerable accuracy drops compared to full precision networks. To address this problem, the generalized low bit-width quantization [21,36] is studied. In half-wave Gaussian quantization (HWGQ) [4], the authors propose a practical and simple uniform quantization method that exploits the statistics of network activations and batch normalization. In LQ-Nets [34], the authors propose to train a quantized CNN and its associated non-uniform quantizers jointly. The approach in Learned Step Size Quantization (LSQ) [7] learns uniform quantizers using trainable interval values. In quantization-interval-learning (QIL) [14], the authors introduce a trainable quantizer that additionally performs both pruning and clipping.
Knowledge Distillation (KD) is a common method in training smaller networks by distilling knowledge from a large teacher model [11]. The rationale behind this is to use extra supervision in the forms of classification probabilities [11], intermediate feature representations [1,3,10,26], attention maps [28]. Knowledge distillation approaches transfer the knowledge of a teacher network to a student network in two different settings: offline and online. In the offline learning, KD uses a fixed pre-trained teacher network to transfer the knowledge to the student network. Deep mutual learning [35] mitigates this limitation by conducting online distillation in one-phase training between two peer student models.
Multi-Teacher Knowledge Distillation. The approach in [29] applies multi-teacher learning into multi-task learning where each teacher corresponds to a task. Similarly, the approach in [31] trains a classifier in each source and unifies their classifications on an integrated label space. The approach in [33] considers knowledge from multiple teachers equally by averaging the soft targets from different pretrained teacher networks. In [19], the authors propose to learn a weighted combination of pretrained teacher representations. Different from [33,19], in this work, we propose a novel online distillation method that captures importanceaware knowledge from different teachers before distilling the captured knowledge to the student network. In [22], the last feature map of student network is fed through different non-linear layers; each non-linear layer is for each teacher. The student network and the non-linear transformations are trained such that the output of those non-linear transformations mimic the last feature maps of the corresponding teacher networks. The previous works [19,22,33] mainly learn full precision student models from a set of full precision pretrained teacher models, while we focus on learning quantized models. Specifically, we aim to learn a quantized student model with guidance from a set of quantized teacher models with different precisions. In addition, different from previous works [33,19,22] in which teachers are fixed when training student, our method simultaneously trains student and teachers using the collaborative and mutual learning.
Quantization + Knowledge distillation. Some works have tried to adopt knowledge distillation methods to assist the training process of low precision networks [2,15,20,23,38]. In Apprentice (AP) [20], the teacher and student networks are initialized with the corresponding pre-trained full precision networks. After lowering the precision of the student network, the student is then fine-tuned using distillation. Due to AP's initialization of the student, AP might get stuck in a local minimum in the case of very low bitwidth quantized student networks. Because of the inherent differences between the feature distributions of the fullprecision teacher and low-precision student network, using a fixed teacher as in [20] can limit the knowledge transfer. QKD [15] and Guided-Quantization [38] mitigate the issue of AP by jointly training the teacher and student models, which makes a teacher adaptable to the student model. In our work, to further mitigate the problem of different feature distributions between teacher and student models, instead of using a full-precision teacher model, we propose to use a set of quantized teacher models. Using quantized models would help the teachers obtain more suitable knowledge for a quantized student model to mimic.

The proposed framework
We propose a novel framework -Collaborative Multi-Teacher Knowledge Distillation (CMT-KD) as illustrated in Figure 1, which encourages collaborative learning between teachers and mutual learning between teachers and student.
First, we propose a novel collaborative learning of multiple teachers. During the training process, the collaborative learning among a set of quantized teachers forms useful importance-aware shared knowledge at certain layers, which is distilled to the corresponding layers in the student network. Second, the learning process between the student and the teachers is performed in a mutual-learning manner [35] via ensemble logits z from teachers logits z T and student logits z S . Furthermore, our framework design allows end-to-end training, in which not only the teachers and student networks but also the contributions (i.e., importance factors) of teachers to the shared knowledge are also learnable during the learning process. It is also worth noting that the proposed framework is flexible -different quantization functions [4,5,7,12,14,34] and different knowledge distillation methods [1,3,10,26,28] can be used in our framework.

Collaborative learning of multiple teachers
Teacher model selection is important in knowledge distillation. In [15], the authors show that if there is a large gap in the capacity between teacher and student, the knowledge from teacher may not be well transferred to student. To control the power of teacher, in our work, we consider teacher and student models that have the same architecture. However, teachers are quantized with higher different bitwidths. The knowledge at corresponding layers from teachers will be fused to form a shared knowledge which will subsequently be used as input for the next layers of teachers. This forms collaborative learning between teachers. It is expected that different teachers have different capacities, and therefore, they should have different contributions to the shared knowledge. To this end, for each teacher, an importance factor that controls how much knowledge the teacher will contribute to the shared knowledge will also be learned. It is worth noting that the learning of importance factors will encourage the collaborative learning between teachers to produce a suitable shared knowledge that the student can effectively mimic.
Formally, given a quantization function Q(x, b), the i th teacher is quantized using Q(W i , b i ) and Q(A i , b i ), in which W i and A i represent for weights and activations, respectively; b i is the bit-width. The shared knowledge F k of corresponding layers of n teachers at k th layer index is formulated as follows where π k i represents the importance of teacher i th . To handle the constraint over π in (1), in the implementation, a softmax function is applied to π k i values before they are used to compute F k . The importance parameters π and the model weights of teachers and student are optimized simultaneously via end-to-end training.

Other components 3.3.1 Quantization function
Quantization function maps a value x ∈ R to a quantized value x ∈ {q 1 , q 2 , ..., q n } using a quantization function Q with a precision bit-width b. The quantized value is defined as Different quantization methods have been proposed [4,7,14,25,34,36]. In this paper, we consider the halfwave Gaussian quantization (HWGQ) [4] as a quantizer to be used in our framework, which is an effective and simple uniform quantization approach. To quantize weights and activations, they first pre-compute the optimal value q i by using uniform quantization for unit Gaussian distribution. Depending on variance σ of weights and activations, the quantized value of x is expressed as

Intermediate features-based distillation
The shared knowledge from teachers will be used to guide the learning of student. Let F T k and F S k be the shared feature map of teachers and the feature map of the student at k th layers of models, respectively. Let I be the selected layer indices for intermediate features-based distillation. The intermediate features-based knowledge distillation loss is defined as follows where D is the distance loss measuring the similarity between features F T k and F S k . Different forms of D can be applied in our framework. In this work, we consider two widely used distance losses, i.e., the attention loss [28] and the FitNet loss [26].  Figure 1: The framework of our proposed collaborative multi-teacher knowledge distillation for low bit-width DNNs. The collaborative learning among a set of quantized teachers forms useful shared knowledge at certain layers through importance parameters (π). L T KL and L S KL are for mutual learning between teachers and student via ensemble logits z, where z is calculated from teachers logits z T and student logits z S . CE means Cross Entropy, and KL means Kullback-Leibler divergence. D(.) denotes the loss for intermediate features-based distillation that could be attention loss or hint loss (FitNet).
The attention loss [28] is defined as follows where Q S k and Q S k are the attention maps of features F S k and F S k , respectively. ∥.∥ p is the l p norm function that could be a l 1 or l 2 normalization. The attention map for a feature map F ∈ R c×h×w that has c channels is defined as Q = c j=1 |A j | p , where A j = F (j, :, :) is the j th channel of F ; |.| is the element-wise absolute function. In our implementation we use p = 2. The FitNet loss [26] is defined as follows where r(.) is a convolutional layer that adapts the student feature map F S k before comparing it to the shared knowledge teacher feature map F T k . In our method, we follow existing works [10,26] in which r(.) a convolutional layer with a kernel size of 1 × 1.

Mutual learning between teachers and student
In addition to the intermediate features-based distillation, we also leverage the mutual learning [35] defined on the logits from networks for learning. The mutual learning allows student to give feedback about its learning to teachers. This learning mechanism encourages both teachers and student to simultaneously adjust their parameters to achieve an overall learning objective, e.g., minimizing a total loss function.
The mutual learning [35] applies KL losses on the softmax outputs of networks. However, due to the diversity of the output logits from different networks, this method may hurt the performance of models. To overcome this issue, we adopt KDCL-MinLogit [8], which is a simple and effective method to ensemble logits from teachers and student. In particular, this method selects the minimum logit value of each category.
Let z T and z S be the logit outputs of the combined teacher model T and a student model S, z T,c and z S,c be the elements of z T and z S corresponding to the target class c, 1 be the vector with all 1s elements, we denote z T,c = z T − z T,c 1 and z S,c = z S − z S,c 1. The element z i of the ensemble logits z is computed as follows where z T,c i , z S,c i are the i th elements of z T,c and z S,c , and m is the number of classes.
The mutual learning is defined as follows where KL means the Kullback-Leibler divergence and T is the temperature parameter. p, p S , and p T are the soft logits of z, z S , and z T , respectively. The soft logit p is defined as p = sof tmax( z T ). Finally, the overall loss of our proposed collaborative and mutual learning in classification task is defined as where α, β, and γ are the hyper-parameters of total loss for optimization and L CE is the standard cross-entropy loss calculated using the corresponding soft logits and the ground-truth labels. During the training process, both the model weights of teachers, student and the importance factors of teachers, i.e., π k i ∀i, k, will be updated by minimizing L, using gradient descent.

Experimental setup
Datasets. We conduct experiments on CIFAR-100 [16] and ImageNet (ILSVRC-2012) [27] datasets. CIFAR-100 dataset consists of 100 classes with the total of 60, 000 images, where 50, 000 and 10, 000 images are used for training and testing set, respectively. ImageNet is a large scale dataset with 1, 000 classes in total. This dataset contains 1.2 million images for training and 50, 000 images for validation, which is used as test set in our experiments. Implementation details. We evaluate our proposed method on two common deep neural networks AlexNet [17] and ResNet18 [9]. Regarding AlexNet, batch normalization layers are added after each convolutional layer and each fully connected layer, which are similar to works done by [4,36]. In all experiments, similar to previous works [34,38], in the training, we use the basic augmentation including horizontal flips, resizing and randomly cropping that crops images to 227 × 227 and 224 × 224 pixels for ResNet18 and AlexNet, respectively. We use Stochastic Gradient Descents with a momentum of 0.9 and a minibatch size of 256. The learning rate lr for network models is set to 0.1 and 0.01 for ResNet and AlexNet, respectively. The learning rate for the importance factors (π) in teacher models is set to lr/10. When training ResNet18 model on CIFAR-100, we train the model with 120 epochs. The learning rate is decreased by a factor of 10 after 50 and 100 epochs. When training ResNet18 model on ImageNet, we train the model with 100 epochs. The learning rate is decreased by a factor of 10 after 30, 60, and 90 epochs. When training AlexNet model, for both CIFAR-100 and ImageNet, we train the model with 100 epochs and we adopt cosine learning rate decay.

Models
Bit-width We set the weight decay to 25e-6 for the 1 or 2-bit precision and set it to 1e-4 for higher precisions. Regarding hyper-parameters of the total loss (10), we empirically set α = 1, β = 0.5. In our experiments, the shared knowledge is formed at certain layers of teachers and is distilled to the correspondence layers of student. Specifically, the shared knowledge is formed at the last convolutional layers of each convolution block, i.e., layers 2, 5, and 7 of AlexNet teachers and from layers 5, 9, 13, and 17 of ResNet18 teachers. Meanwhile, we set γ to 100 or 1 when attention loss or FitNet loss is used in L f eat . We do not quantize the first and last layers.

Ablation studies
We conduct several ablation studies on CIFAR-100 with ResNet18 and AlexNet to demonstrate the effectiveness of our proposed method. For ablation studies, we use HWGQ quantizer [4] for the proposed CMT-KD. In addition, for the intermediate features-based distillation (L f eat ) in the final loss (eq. (10)), the attention loss is used. We consider the following settings.
Single model. We evaluate single models with different precisions (i.e., full precision, 8-bit, 6-bit, 4-bit, and 2-bit precisions) without any distillation methods. The results for AlexNet and ResNet18 architectures are presented in Table  1 and Table 2, respectively. With the AlexNet architecture, the results show that the 4-bit, 6-bit, 8-bit models achieve comparable results. There are considerable large gaps between these models and the full precision model. There are also large gaps between those models and the 2-bit model. With the ResNet18 architecture, the 8-bit model achieves comparable results to the full precision model. There is a small gap between the 6-bit, 4  a large gap between the 2-bit model and the full precision model.

Knowledge distillation from the full precision teacher.
In this setting, we train a 2-bit student model with the knowledge distillation from the full precision teacher, i.e., the KD (from FP teacher) setting in Table 1 and Table 2.
For this setting, we follow [11], i.e., when training the student, in addition to the cross-entropy loss, the softmax outputs from the teacher will be distilled to the student. When AlexNet is used, this setting achieves better performance than quantized single models. When ResNet18 is used, this setting achieves comparable results to the 8-bit single quantized model.
Knowledge distillation from an ensemble of multiple quantized teachers. In this setting, we separately train three teachers with different precisions, i.e., 4-bit, 6-bit, and 8-bit teachers. The averaged softmax outputs of teachers are distilled to the 2-bit student. This setting is noted as "Average teacher" in Table 1 and Table 2. It is worth noting that this setting is also used in the previous work [33]. When AlexNet is used, at the top-1 accuracy, this setting produces the 2-bit student that achieves comparable performance with the quantized single teachers. However, its performance (71.0%) is still lower than the full precision model (72.4%). When ResNet18 is used, this setting improves the performance over the full precision model, i.e., the gain is 0.7% for both top-1 and top-5 accuracy.
Effectiveness of collaborative and mutual learning. We consider different settings of the proposed framework. For the results in Table 1 and Table 2, when training CMT-KD models, we use 3 teachers, i.e., 4-bit, 6-bit, and 8-bit teachers. In those tables, CMT-KD means that the mod-   When AlexNet is used, the full precision (FP) model slightly outperforms the proposed CMT-KD at top-1 accuracy. When ResNet18 is used, CMT-KD outperforms the FP model at both top-1 and top-5 accuracy. A significant gain is achieved, i.e., 3%, at top-1 accuracy. It is worth noting that when ResNet18 is used, the CMT-KD significantly outperforms the 2-bit single model, the 2-bit model when using the average teacher, and the 2-bit model when distilling from the FP model. Those results confirm the effectiveness of the proposed method.
Combined teacher. We also evaluate the performance of the combined teacher in the collaborative learning in our proposed method, i.e., the predictions which are made by the classifier corresponding to the L T CE loss in Figure 1. Overall, this setting produces the best results, except for top-1 accuracy with AlexNet architecture. It achieves better performance than the "Average teacher" setting. With ResNet18, this setting significantly outperforms the full precision model. Those results confirm the effectiveness of the proposed collaborative learning between teachers.
Impact of the number of teachers. The results in Table  3 show the impact of the number of teachers on the performance of the 2-bit CMT-KD student models. The results show that using 3 teachers (4-bit, 6-bit, and 8-bit) slightly improves the performance when using 2 teachers (4-bit and 8-bit).

Comparison with the state of the art
In this section, we compare our proposed method CMT-KD against state-of-the-art network quantization methods,  including LQ-Net [34], LQW+CAQ [12], HWGQ [4], and DoReFa-Net [36]. We also make a comparison between our approach and methods that apply both distillation and quantization consisting of PQ+TS+Guided [38], QKD [15], SPEQ [2]. For CMT-KD, we use three teachers (4-bit, 6bit, and 8-bit teachers) to guide the learning of compact quantized 2-bit weights (K w = 2) and 2-bit activations (K a = 2) students. Meanwhile, we use 2-bit, 4-bit, and 8bit teachers to guide the learning of compact quantized 1-bit weights (K w = 1) and 2-bit activations (K a = 2) students. We do not consider 1-bit activations because the previous [4,13,25,36] show that 1-bit quantization for activations is not sufficient for good performance.
Comparative results on CIFAR-100. Table 4 presents the top-1 and top-5 classification accuracy on CIFAR-100 dataset of different network quantization methods for AlexNet and ResNet18. The results of competitors are cited from [12,38]. We report the results of our CMT-KD when FitNet loss or attention loss is used for L f eat in Eq. (10). Those models are denoted as CMT-KD-FitNet or CMT-KD-Att. The quantizer HWGQ [4] is used to quantize teachers and student networks when training CMT-KD models. Overall, the best CMT-KD models outperform most of the competitor quantization methods. When AlexNet is used, the CMT-KD (for both FitNet and Att) models outperform the compared quantization methods at top-1 accuracy.   [4] and LSQ [7] quantizers are used in our framework, respectively. We report experimental results for LSQ (please refer to footnote 1) without distillation in LSQ* row.
However, the proposed models achieve lower performance than the FP model at top-1 accuracy. This may be due to the limit in the capacity of the AlexNet model, which consists of only 5 convolutional layers. When ResNet18 is used, our CMT-KD models outperform the full precision model. Especially when using 2bit weights and 2-bit activations, the improvements of the CMT-KD-FitNet over the FP model are 3.4% and 1.5% for top-1 and top-5 accuracy, respectively. It is also worth noting that the proposed models significantly improve over the HWGQ method [4] which uses HWGQ quantizer to quantize FP models, i.e., with K w = 2, K a = 2, CMT-KD-FitNet outperforms HWGQ [4] 5.8% at top-1 accuracy.
Comparative results on ImageNet. Table 5 presents the top-1 and top-5 classification accuracy on ImageNet dataset of different network quantization methods for AlexNet and ResNet18. The results of competitors are cited from the corresponding papers. At K w = 1 and K a = 2, when using AlexNet, the proposed CMT-KD significantly outperforms HWGQ [4]. The gain is 4.5% and 2.8% for top-1 and top-5 accuracy, respectively. For ResNet18, we also achieved an improvement of 1% compared to HWGQ at top-1 accuracy. With K w = 2 and K a = 2, the CMT-KD (HWGQ) outperforms the HWGQ [4] method by 0.6%, and 0.5% on top-1 accuracy for AlexNet and ResNet18, respectively. As the proposed framework is flexible to quantizers, we also report in Table 5 the results when LSQ [7] quantizer is used to quantize teacher and student networks in our framework, i.e., CMT-KD (LSQ). LSQ is a quantization method in which the step size is learned during training. When ResNet18 is used, given the same LSQ quantizer implementation 1 , our method CMT-KD (LSQ) can boost the top-1 accuracy of LSQ* by 1.1%. However, we note that the results reported in LSQ [7] slightly outperforms CMT-KD (LSQ). It is worth noting that in order to achieve the reported results (67.9% top-1 and 88.1% top-5), LSQ [7] also uses knowledge distillation to distill knowledge from the full precision model to the quantized model 2 . Our best method CMT-KD (LSQ) compares favorably to the recent method SPEQ [2] for both AlexNet and ResNet18 models.
Visualization of the importance factors (π) of teachers. Figure 2 visualizes the importance factors of three teachers (4-bit, 6-bit, 8-bit) when using ResNet18 architecture for the teachers and student. The experiment is conducted on CIFAR-100 dataset. The visualized importance factors are at the last convolutional layers in each block of ResNet18 during training, i.e., layers 5, 9, 13, 17. They are also the layers in which the shared knowledge is formed. Figure 2b shows that the highest precision teacher (8-bit) does not always give the highest contributions to the shared knowledge at all layers. For example, at layer 9, the importance factor of the 6-bit teacher is higher than the importance factor of the 8-bit teacher. At the last convolutional layer (i.e., layer 17), the 8-bit teacher dominates other teachers and gives most of the contributions to the shared knowledge. In addition, the importance factors are mainly updated at the early training stage of the framework.

Conclusion
In this paper, we propose a novel approach for learning low bit-width DNNs models by distilling knowledge from multiple quantized teachers. We introduce the idea of collaborative learning that allows teachers to form importanceaware shared knowledge, which will be used to guide the student. The proposed framework also leverages the idea of mutual learning that allows both teachers and student to adjust their parameters to achieve an overall object function. The proposed framework allows end-to-end training in which not only network parameters but also the importance factors indicating the contributions of teachers to the shared knowledge are updated simultaneously. The experimental results on CIFAR-100 and ImageNet datasets with AlexNet and ResNet18 architectures demonstrate that the low bit-width models trained with the proposed approach achieve competitive results compared to the state-of-the-art methods.