Title: KNOWLEDGE FLOW: IMPROVE UPON YOUR TEACH-ERS

Abstract: A zoo of deep nets is available these days for almost any given task, and it is increasingly unclear which net to start with when addressing a new task, or which net to use as an initialization for fine-tuning a new model. To address this issue, in this paper, we develop knowledge flow which moves 'knowledge' from multiple deep nets, referred to as teachers, to a new deep net model, called the student. The structure of the teachers and the student can differ arbitrarily and they can be trained on entirely different tasks with different output spaces too. Upon training with knowledge flow the student is independent of the teachers. We demonstrate our approach on a variety of supervised and reinforcement learning tasks, outperforming fine-tuning and other 'knowledge exchange' methods. ' % (( % % )) % (( % % ) *(( % % ) *(( & % ) ℎ(( & % ) *(( % # ) ' % (( & % )

1. INTRODUCTION:

Research communities have amassed a sizable number of deep net architectures for different tasks, and new ones are added almost daily. Some of those architectures are trained from scratch while others are fine-tuned, i.e., before training, their weights are initialized using a structurally similar deep net which was trained on different data.

Beyond fine-tuning, particularly in reinforcement learning, teachers have also been considered in one way or another by Rusu et al. (2016b) ; Fernando et al. (2017) ; Wang et al. (2017) ; Li & Hoiem (2016) ; Bengio et al. (2009) ; Patel et al. (2015) ; Chen & Liu (2016) ; Teh et al. (2017) ; Parisotto et al. (2016) . For instance, progressive neural net (Rusu et al., 2016b) keeps multiple teachers during both training and inference, and learns to extract useful features from the teachers for a new target task. PathNet (Fernando et al., 2017) uses genetic algorithms to choose pathways from a giant network for learning new tasks. 'Growing a Brain' (Wang et al., 2017) fine-tunes a neural network while growing the network's capacity (wider or deeper layers). Actor-mimic (Parisotto et al., 2016) pre-trains a big model on multiple source tasks, then the big model is used as a weight initialization for a new model which will be trained on a new target task. Knowledge distillation (Hinton et al., 2015) distills knowledge from a large ensemble of models to a smaller student model. However, all the aforementioned techniques have limitations. For example, progressive neural net models (Rusu et al., 2016b) grow with the number of teachers. This large number of parameters limits the number of teachers a progressive neural net can handle, and largely increases the training and testing time. In PathNet (Fernando et al., 2017) , searching over a big network for pathways is computationally intensive. For fine-tuning based methods such as 'Growing a Brain' (Wang et al., 2017) and actor-mimic (Parisotto et al., 2016) , only one pretrained model can be used at a time. Hence, their performance heavily relies on the chosen pretrained model.

To address these shortcomings, we develop knowledge flow which moves 'knowledge' of multiple teachers when training a student. Irrespective of how many teachers we use, the student is guaranteed to become independent at the final stage of training and the size of the resulting student net remains constant. In addition, our framework makes no restrictions on the deep net size of the teacher and student, which provides flexibility in choosing teacher models. Importantly, our approach is applicable to a variety of tasks from reinforcement learning to fully-supervised training.

We evaluate knowledge flow on a variety of tasks from reinforcement learning to fully-supervised learning. In particular, we follow Rusu et al. (2016b) ; Fernando et al. (2017) and compare on the same Atari games. In addition, we also observed significant top-1 error rate improvements on supervised learning datasets, i.e., CIFAR-10, and CIFAR-100.

2. BACKGROUND:

Knowledge flow is applicable to a variety of settings from supervised learning to reinforcement learning, which we briefly review to introduce notation.

Supervised Learning recovers the parameters θ of a mapping f θ : X → Y from data space X to output space Y. To this end, a dataset D = {(x i , y i )} n i=1 containing n pairs (x i , y i ) (assumed to be sampled i.i.d.) is used, where x i ∈ X and y i ∈ Y. Given this dataset, the parameters θ of the mapping f θ are learned by minimizing a loss function (x,y) (θ) composed of a regularization term R(θ) and an empirical risk (y, f θ (x)) which compares groundtruth label y and prediction f θ (x). The parameters θ are obtained by optimizing the following program: min θ E (x,y)∼D [ (x,y) (θ)] := E (x,y)∼D [ (y, f θ (x))] + R(θ).

(1)

Hereby, the mapping f θ is obtained by maximizing the logits or a corresponding probability distribution fθ (y|x), i.e., f θ = arg max y∈Y fθ (y|x). Here and below let the hat ('•') indicate probability distributions over appropriate domains.

Reinforcement Learning considers an agent interacting with an environment according to a policy π θπ : X → A which maps a state x t ∈ X to an action a t ∈ A at time t. The policy depends on the parameters θ π . After performing action a t , the agent observes the next state x t+1 and receives a scalar reward r t . The discounted return at time t is defined as R t = ∞ k=0 γ k r t+k , where γ is the discount factor. The expected future reward when observing state x and when following policy π θπ is defined as

V π θπ (x t ) = E τ ∼π θπ [R t |x t ]

, where τ = {(x t , a t , r t ), (x t+1 , a t+1 , r t+1 ), . . .} is a trajectory generated by following π θπ from state x t .

The goal of reinforcement learning is to find a policy that maximizes the expected future reward from each state x t . Without loss of generality, in this paper, we follow the asynchronous advantage actor-critic (A3C) formulation (Mnih et al., 2016) . In A3C, the policy mapping π θπ (x) = arg max a∈A πθπ (a|x) is obtained from a probability distribution over states, where πθπ (a|x) is modeled by a deep net with parameters θ π . The value function is also approximated by a deep net V θv (x), having parameters θ v .

To optimize the policy parameters θ π given a state x t , a loss function based on a scaled negative log-likelihood and a negative entropy regularizer is common:

τ π (θ π ) = 1 |τ | t∈τ [-log πθπ (a t |x t )(R t -V θv (x t )) -βH(π θπ (•|x t ))] . Hereby, R t = k-1 i=0 γ i r t+i + γ k V θv (x t+k )

is the empirical k-step return obtained when starting in state x t , and |τ | is the length of the trajectory τ generated by following π θπ . The scalar β ≥ 0 is a user-specified constant, and H(π θπ (•|x t )) is the entropy function, which encourages exploration by favoring a uniform probability distribution πθπ (a|x). To optimize the value function V θv , it is common to use the squared loss

τ v (θ v ) = 1 2|τ | t∈τ (R t -V θv (x t )) 2

. By minimizing the empirical expectation of τ π (θ π ) and τ v (θ v ), i.e., by addressing

EQUATION

EQUATION

alternatingly, we learn a policy and a value function that maximize expected return.

3. KNOWLEDGE FLOW:

Instead of optimizing the programs given in Eq. ( 1) and Eq. ( 2) from scratch, the aforementioned warm-start techniques (see Sec. 5 for more) are applicable. To address their mentioned shortcomings, we propose knowledge flow, a framework that moves 'knowledge' from an arbitrary number of deep nets, henceforth referred to as 'teachers' to a deep net under training, called the 'student.' 

Teacher2(! (#) ) Teacher1(! (%) ) Student (! (&) )

3.1. OVERVIEW:

Knowledge flow is outlined on example deep nets in Fig. 1 (a, b ). We train the parameters of the student net which are randomly initialized. To this end we take advantage of teachers, whose parameters are fixed and obtained from pre-trained models on different source tasks by different algorithms. For example, for reinforcement learning, we may consider teachers trained by A3C (Mnih et al., 2016) , A2C (Dhariwal et al., 2017) or DQN (Mnih et al., 2015) .

'Knowledge' of multiple teachers is transferred to a student by adding transformed and scaled intermediate representations from the teacher deep nets to the student net. To achieve this, we modify the student net, i.e., f θ in the supervised setting and π θπ (a|x), V θv (x) in the reinforcement learning case. We add teacher representations which are transformed by multiplication with a trainable matrix Q and scaled via a weight p w that is normalized to sum to one for each student layer and parameterized via trainable parameters w. The normalized weights encode which of the teachers' or the student's representation to trust at every layer of the student net. Note that a teacher can help the student at different levels of abstraction with input from different levels of its net.

Importantly, after training, the student model should perform well on the target task without relying on teachers. To achieve this, as training progresses, we increasingly encourage a high normalized weight on the student representation, which forces the student to eventually capture all the 'knowledge.' Due to the trainable scaling, at an early stage of training, we observe the student to rely heavily on the 'knowledge' of the teacher to quickly obtain better performance. However, as training proceeds, the student is encouraged to become more and more independent. During final stages of training, the student will no longer be able to rely on teachers, which ensures that the student has learned to master the desired task on its own. This is observed in Fig. 1 (c ).

To formally encourage this successive transfer we introduce two additional loss functions. The first, referred to as the dependency loss dep (w), captures how much a student relies on teachers. It depends on the weight vector w which encodes the strength of the coupling. The second one ensures that a student's behavior doesn't change rapidly when the teachers' influence decreases. We use loss KL (•, •) to capture the change. By combining student net modifications and additional loss terms, for the supervised task we obtain

EQUATION

and for reinforcement learning the transformed program reads as follows:

EQUATION

) Loss ˜ • • (θ, w, Q) originates from the original loss • • (θ) (Eqs.

(1)-( 2)) by transforming the deep net to include cross-connections, hence its dependence on w, Q. The tilde ('•') denotes this dependence, also for probability distribution f and policy distribution π. Parameters from the current and a previous iteration are referred to via θ and θ old respectively.

For both supervised and reinforcement learning, λ 1 and λ 2 control the strength which is used to decrease the influence of the teacher. A low λ 1 allows the student to rely on teachers. Close to the end of training, the student should be independent. Therefore, we set λ 1 to a small value at the beginning, and gradually increase its value as training progresses.

Note that we don't make any assumptions about teachers and student's objective. If a teacher's and student's objective differ, negative transfer may occur initially. However, the proposed method quickly decreases the weight for teacher layers to reduce this effect. Despite differences, students could potentially still benefit from the low level representation of the teachers. We do observe this low level knowledge transfer in our experiments.

In the following we first describe how to modify the deep nets, before we detail the loss functions dep and KL , which are used to successively decrease the influence of the teachers. Let index m = 0 denote the student model and let θ (0) refer to its parameters. Further, let θ (m) , m ∈ {1, . . . , M } denote teacher models. We use l i m to refer to deep net layer i of teacher m, with i ∈ {1, . . . , L m } and L m the number of layers in teacher m. We define layer j of the student model to be l j 0 , where j ∈ {1, . . . , L 0 } and L 0 the number of deep net layers in the student model. The output of layer l k m right before and after an activation unit is denoted z(l k m ) and h(l k m ) respectively. To align a teacher's layer l i m with a student's layer l j 0 , we introduce a learnable transformation matrix

Q j (l i m ) ∈ R dim(l j 0 )×dim(l i m )

, where dim(•) gives the number of elements in the corresponding layer. The matrix multiplication Q j (l i m )z(l i m ) aligns the representation from layer i of teacher m with the representation of layer j of the student.

For each layer j in the student model, we define a candidate set L j , which contains l j 0 and all the teachers' layers to be considered. For example, in Fig. 1 (a) , layer one of the student model is combined with layer one of teacher one and layer two of teacher two. Therefore, the candidate set of layer one of the student model is given by L 1 = {l 1 0 , l 1 1 , l 2 2 }. To decide which teachers' or the student's representation to trust at every layer of the student net, we introduce a normalized weight p j w (l) for all j ∈ {1, . . . , L 0 }, where l ∈ L j , summing to one for each layer j in the student deep net, i.e.,

l∈L j p j w (l) = 1, ∀j ∈ {1, . . . , L 0 }.

To obtain the combined intermediate representation of layer j for the student model, we use

h(l j 0 ) = σ   l∈L j \l j 0 p j w (l)Q j (l)z(l) + p j w (l j 0 )z(l j 0 )   ,

where p j w (l i m ) determines how much the student layer j relies on transformed representations of layer i from the m-th teacher. Intuitively, if the transformed representation of the m-th teacher layer i is helpful, p j w (l i m ) will be close to one. We visualize the deep net transformation in Fig. 1 (b ). Note that the intermediate representations of teachers are not changed in our framework. To obtain the output of layer l k m we apply the original activation unit to the original representation z(

l i m ), i.e., h(l i m ) = σ(z(l i m )), ∀m ∈ {1, . . . , M }, j ∈ {1, . . . L m }.

The maximal number of introduced matrices Q in our framework is

M i=1 L i L 0 .

In practice, we don't link a student's layer to every layer of a teacher network. Intuitively, a teachers' bottom layer Table 1 : Comparison with PathNet (Fernando et al., 2017) and progressive neural network (PNN) (Rusu et al., 2016b) . Since PathNet and PNN don't report exact scores we obtain their numbers from their plots and indicate that with a ∼ symbol. The results of the state-of-the-art methods: A3C (Mnih et al., 2016) , PPO (Schulman et al., 2017) , and ACKTR (Wu et al., 2017) features are very likely irrelevant to a student's top layer features. Indeed, we observed that linking a teachers' bottom layer to a student's top layer generally doesn't yield improvements. Therefore, in practice, we recommend to link one teacher layer to one or two student layers, in which case we introduce on the order of M L 0 matrices Q. Also note that while additional trainable parameters Q and w are introduced in our framework, Q and w are not part of the resulting student network since we ensure p j w (l) ≡ 0 ∀l ∈ L j \l j 0 at the end of training as discussed next. Hence, the additional parameters function as auxiliary knobs that help the student learn faster. In the final stage of training, the student will be independent (see Fig. 1 (c )) and does no longer rely on Q, w, or any transformed representations from teachers.

Decreasing Teachers' Influence: We successively decrease the influence of the teachers during training by gradually encouraging the normalized weight p j w (l j 0 ) to increase to a value of 1 ∀j ∈ {1, 2, . . . , L 0 }. To capture how much the student relies on teachers, we introduce the dependence cost as the negative log probability:

dep (w) = - 1 L 0 j∈{1,2,...,L0}

log p j w (l j 0 ).

(5)

By minimizing dep (w), we encourage weights for the layers of the student to increase. Hence we encourage the student to become more and more independent. During the final stage of training, p j w (l j 0 ) approaches one for all j ∈ {1, . . . , L 0 }, making the student independent of the transformed representation obtained from teachers.

Empirically, we found that a fast decrease of the influence of the teacher can degrade the performance. This is intuitive as it requires some time to find good transformations Q. Moreover, decreasing the influence of a teacher too fast may change the output distribution over labels or actions of the student model too much, and thus lead to performance loss. To prevent changing a student's output distribution too fast, we found a Kullback-Leibler (KL) regularizer to yield good results. More specifically, in the case of supervised learning we use

EQUATION

Hereby, θ is the set of current parameters, and θ old are the previous ones. In the reinforcement learning case we use

D KL [ πθ (•|x t )|| πθold (•|x t )].

4. EXPERIMENTAL RESULTS:

In the following we evaluate knowledge flow on reinforcement and supervised learning tasks. Results are reported by using only the student model to avoid even the smallest influence from any teacher nets.

4.1. REINFORCEMENT LEARNING:

We evaluate knowledge flow on reinforcement learning using Atari games that were used by Rusu et al. (2016b) ; Fernando et al. (2017) . Following existing work, the input to our agent are raw images from the environment. The agent learns to predict actions only based on the rewards and the input images from the environment. The agent chooses an action every four frames, and the last action is repeated on the skipped four frames. For all teacher models and the student model, we use the fully forward architecture of A3C (Mnih et al., 2016) . The model has three hidden layers. The first layer is a convolutional layer with 16 filters of size 8x8 and stride 4. The second layer is a convolutional layer with 32 filters of size 4x4 and stride 2. The third layer is a fully connected layer with 256 hidden units. Following the third hidden layer are two sets of output. One is a softmax output that provides a probability distribution over all valid actions. The other one is a scalar output that provides the estimated value function. We use the same hyper-parameter settings as Mnih et al. (2016) except for the learning rate. Mnih et al. (2016) use RMSProp with shared statistics while we use Adam with shared statistics, which we found to give better results when training the baselines. The learning rate is set to 10 -4 and gradually decreased to zero for all experiments. To select λ 1 and λ 2 in our framework, we follow progressive neural net (Rusu et al., 2016b) : randomly sample λ 1 ∈ {0.05, 0.1, 0.5} and λ 2 ∈ {0.001, 0.01, 0.05}. Note that λ 1 is set to zero at the beginning of training, and linearly increased to the sampled value at the end of training. Following Rusu et al. (2016b) , we repeat each experiment 25 times with different random seeds and randomly sampled λ 1 and λ 2 . The results of the top three out of 25 runs are reported. As A3C, we run 16 agents on 16 CPU cores in parallel.

Evaluation Metrics: We follow the evaluation procedure of Mnih et al. (2015) . The trained student models are evaluated by playing each game for 30 episodes. We also follow the 'no-op' procedure: at the beginning of each testing episode, the agents perform up to 30 'no-op' actions.

Results: We first compare our framework with PathNet (Fernando et al., 2017) and progressive neural net (PNN) (Rusu et al., 2016b) , which are state-of-the-art transfer reinforcement learning frameworks, using their experimental settings. The comparison is summarized in Table 1 . The state-of-the-art results (Mnih et al., 2016; Schulman et al., 2017; Wu et al., 2017) on Atari games are also included in Table 1 for reference. Compared to PathNet, a student model trained using our transfer framework with one teacher achieves higher scores in 11 out of 14 experiments. Compared with PNN, for a two-teacher framework, our trained student model has only 0.7M parameters and PNN has 16M parameters. Nonetheless we observe higher scores in five out of the seven experiments. The results demonstrate that knowledge flow effectively transfers knowledge from teachers to the student. Table 1 also indicates that, in our framework, when the number of teachers increases from one to two, the student's performance improves significantly across all experiments. The training curves for the experiments are shown in Fig. 2 . The curve is the average of the top three out of 25 runs. We observe our approach to generally perform very well. To further evaluate knowledge flow, we experiment with different combinations of environment/teacher settings. These settings are not used by PathNet and progressive neural network.

The results are summarized in Table 2 , where "ours w/ expert" represents that one teacher is expert for the target game; "ours w/ non-expert" represents that both teachers are not experts for the target game; "Fine-tune" represents fine-tuning from a non-expert on a new target game; "A3C baseline" represents our implementation of the A3C baseline; "A3C" represents the scores reported originally (Mnih et al., 2016) . Note that our A3C implementation achieves better scores than those reported by Mnih et al. (2016) for most of the games. As shown in Table 2 , knowledge flow with expert teacher performs better than the baseline across all experiments, which we interpret as evidence that knowledge flow successfully transfers 'knowledge' from an expert teacher to the student. In addition, knowledge flow with non-expert teachers also outperforms fine-tuning on a non-expert teacher. The reasons are twofold: First, a student model in knowledge flow can learn from multiple teachers while the fine-tuning method can only start from one setting. Second, in knowledge flow, the student can avoid the negative impact from insufficiently pretrained teachers, while fine-tuning from an insufficiently pretrained model slows down the training process and may degrade the overall performance. The training curves for the experiments are shown in Fig. 3 . More training curves are in the Appendix (Fig. 6 ). Note that in knowledge flow, the student can benefit from the intermediate representations of the teacher, even if input space, output space and objectives differ. For example, in Fig. 3 (a), the two teachers are Chopper Command and Space Invaders, which are quite different from the target game Seaquest. The student model still benefits from learning from the teachers and achieves scores ten times larger than learning without teacher and fine-tuning from a teacher.

4.2. SUPERVISED LEARNING:

For supervised learning, we use a variety of image classification benchmarks, including CIFAR-10 (Krizhevsky, 2009), CIFAR-100 (Krizhevsky, 2009) , STL-10 (Coates et al., 2011) , and EM-NIST (Cohen et al., 2017) . The parameters λ 1 for the dependent cost and λ 2 for the KL cost are determined using the validation set of each dataset.

Evaluation Metrics: To evaluate the trained student model we report top-1 error rate on the test set of each dataset. All plots and reported numbers are the average of three runs obtained using different random seeds. (b) CIFAR-10/CIFAR-100: CIFAR-10 and CIFAR-100 datasets consist of colored images of size 32 × 32. CIFAR-10 (C10) has 10 classes and CIFAR-100 (C100) has 100 classes. For both dataset, the training and test sets contain 50,000 and 10,000 images respectively. We perform all experiments on CIFAR-10 and CIFAR-100 with standard data augmentation (Huang et al., 2017) .

We use Densenet (Huang et al., 2017) (depth 100, growth rate 24) as a baseline and follow their hyper-parameter settings to train our baseline, teacher and student models. For our approach, we first train teachers on CIFAR-10, CIFAR-100, and SVHN (Netzer et al., 2011) . We then train the student model using a different combination of teachers. We compare our results to fine-tuning and the baseline model. As shown in Table 3 (a), for the CIFAR-10 target task, fine-tuning from the CIFAR-100 expert improves 4% over the baseline. Fine-tuning from the SVHN expert performs worse than the baseline model. Intuitively, for the CIFAR-10 target task, the CIFAR-100 deep net is a good teacher while a deep net trained with SVHN isn't. Presented with both good and inadequate teachers, knowledge flow improves by 13% over the baseline. This demonstrates that knowledge flow can not only leverage a good teacher's 'knowledge,' but it can also avoid misleading influence. As detailed in Table 3 (b), the results are similar on the CIFAR-100 dataset.

To further demonstrate the properties of knowledge flow, additional results are in the appendix.

5. RELATED WORK:

As mentioned before, 'knowledge' transfer has been considered using a variety of techniques. We briefly discuss related work in contrast to our approach in the following and defer details to Sec. 8. PathNet (Fernando et al., 2017) enables multiple agents to train the same deep net while reusing parameters and avoiding catastrophic forgetting. In contrast to this formulation we consider availability of multiple pre-trained teacher nets. Progressive Net (Rusu et al., 2016b) leverages transfer and avoids catastrophic forgetting by introducing lateral connections to previously learned features. Our discussed method uses similar lateral connections. However, in contrast to Rusu et al. (2016b) , our method ensures independence of the student upon training, addressing a limitation in (Rusu et al., 2016b) where only a fraction of the capacity of the student is eventually utilized. Distral a neologism combining 'distill & transfer learning' (Teh et al., 2017) considers joint training of multiple tasks. Multiple tasks share a 'distilled' policy which encodes common behavior between different tasks. While each worker addresses its own task, a shared policy encourages consistency between the policies. Different from Distral, which is a multi-task learning framework, knowledge flow addresses a single task, while in multi-task learning, multiple tasks are addressed at the same time. Hence, common for multi-task learning and knowledge flow is a transfer of information. However, in multi-task learning, information extracted from different tasks are shared to boost performance, while, in knowledge flow, the information of multiple teachers is leveraged to help a student learn better a single, new, previously unseen task.

Other related work includes actor-mimic (Parisotto et al., 2016) , learning without forgetting (Li & Hoiem, 2016) , growing a brain (Wang et al., 2017) , policy distillation (Rusu et al., 2016a) , domain adaptation (Pan & Yang, 2010; Long et al., 2015; Tzeng et al., 2015) , knowledge distillation (Hinton et al., 2015) or lifelong learning (Chen & Liu, 2016) . A more detailed discussion on related work is provided in Sec. 8 of the supplementary material.

6. CONCLUSION:

We developed a general knowledge flow approach that permits to train a deep net from any number of teachers. We showed results for reinforcement learning and supervised learning, demonstrating improvements compared to training from scratch and to fine-tuning. In the future we plan to learn when to use which teacher and how to actively swap teachers during training of a student. (Hinton et al., 2015) to distill knowledge from a larger model (teacher) to a smaller model (student). The student models have 50% -5% parameters of the teacher models. Following their setup, we conduct experiments on MNIST, MNIST with digit '3' missing in the training set, CIFAR-100, and ImageNet.

For MNIST and MNIST with digit '3' missing, following KD, the teacher model is an MLP with two hidden layers of 1200 hidden units, and the student model is an MLP with two hidden layers of 800 hidden units. For CIFAR-100, we use the model from Chen (2017) as teacher model. The student model follows the structure of the teacher, but the number of output channels of each convolutional layer is halved. For ImageNet, the teacher model is a 50-layer ResNet (He et al., 2016) , and the student model is a 18-layer ResNet. The test error of the distilled student model are summarize in Table 4 . Our framework has consistently better performance than KD, because the student model in our framework benefits not only from the output layer behavior of the teacher but also from intermediate layer representations of the teacher.

EMNIST::

The 'EMNIST Letters' dataset consists of images of size 28 × 28 pixels showing handwritten letters. It has 26 balanced classes. Each class contains lower and upper case letters. The training and test sets contain 124,800 and 20,800 images respectively. The 'EMNIST Digits' dataset consists of images of size 28 × 28 pixels showing handwritten digits. It has 10 balanced classes. The training and test sets contain 240,000 and 40,000 images respectively.

In this case we use the MNIST model from Chen (2017) as a baseline, teacher and student model. We trained teachers on EMNIST Digits, EMNIST Letters, and EMNIST Letters with only 13 classes.

Our target task is EMNIST Letters. The student model is trained with different teachers and the results are compared to fine-tuning, the baseline model, and the state-of-the-art results on EMNIST.

The results are summarized in Table 5 . Compared to the baseline and fine-tuning, student learning in our framework with expert teacher (EMNIST Letters), semi-expert teacher (Half EMNIST Letters), and non-expert teacher (EMNIST Digits) all have better performance. In Fig. 4 we illustrate the accuracy over epochs for training of different models.

STL-10::

The STL-10 dataset consist of colored images of size 96 × 96 pixels. It has 10 balanced classes. The training set contains 5,000 labeled images and 100,000 unlabeled images. The test set contains 8,000 images. In our experiment, we only use the 5,000 labeled images for training.

We use the STL-10 model from Chen (2017) as our baseline, teacher and student model. We trained teachers on CIFAR-10 and CIFAR-100. We compare our results to fine-tuning and the baseline in Table 6 . Note that STL-10 is very similar to CIFAR-10 and CIFAR-100. Therefore, both CIFAR-10 and CIFAR-100 are very good teachers. As shown in Table 6 , compared to the baseline, fine-tuning a Note that we only train on the labeled data while other approaches use this data for testing of semi-supervised approaches. Hence our results are obtained using fewer data and may not be directly comparable. We still list their results in Table 6 for reference. In Fig. 5 we illustrate the accuracy over the epochs of training.

We also compare to Distral (Teh et al., 2017) , which is the state-of-the-art multi-task reinforcement learning framework. We used 'KL + ent 1 col', which has a central model (m 0 ), and a task model (m i ) for each task. We perform the experiments on Atari games. In the experiments, we have three tasks (task 1, task 2, task 3). The teachers of task 2 (m 2 ) and task 3 (m 3 ) are provided for our framework. Distral is trained for 120M steps (40M steps/task), and our model is trained for 40M steps. For fair comparison, we report results of Distral's task 1 model (m 1 ), which is better than its center model (m 0 ). The results are summarized in Table 7 . Distral is suboptimal, because it aims to learn a multi-task agent. In addition, identical action and state space is assumed. When the target task is very different from the source tasks, Distral cannot decrease the teacher influence. In contrast, our framework can decrease a teacher's influence, and thus reduce negative transfer.

7.3. VISUALIZATION OF NORMALIZED WEIGHTS OF TEACHERS AND STUDENT:

Following the reviewer's suggestion, we plot the averaged normalized weight (p w ) for teachers and the student in the C10 experiment, where C100 and SVHN experts are teachers. Intuitively, the C100 teacher should have a higher p w value than the SVHN teacher, because C100 is more relevant to C10. The plot verifies this intuition. As shown in Fig. 7 , p w of the C100 teacher is higher than that of the SVHN teacher over the entire training. Note, both teachers' normalized weights approach zero at the end of training. To verify that the student really benefits from the knowledge of teachers, we conduct an ablation study suggested by a reviewer. We use teacher models that haven't been trained at all. Intuitively, learning with untrained teachers should have worse performance than learning with knowledgeable teachers. Our experiments verify this intuition. In Fig. 8 (a), where the target task is hero, learning with untrained teachers ('w/ untrained teachers') achieves an average reward of 15934. Learning with knowledgeable teachers ('Ours with seaquest and riverraid teacher') achieves an average reward of 30928. More results are presented in Figs. 8 (b, c ). The results show that knowledge flow achieves higher rewards than training with untrained teachers in different environments and teacher-student settings. 

7.6. AVERAGE NETWORK AS θ old:

For the parameters θ old an average network can be used. To investigate how usage of an average network to obtain the parameters θ old affects the performance, we conduct an experiment where θ old is computed using the exponential running average of the model weight. More specifically, θ old is updated as follows: θ old ← α • θ old + (1 -α) • θ, where α = 0.9. The results are summarized in Fig. 11 . We observe that using an exponential average to compute θ old results in very similar performance as using a single model. Consider Fig. 11 (a) , where the target task is Boxing and the teacher is a Riverraid expert. At the end of training, using an average network to obtain θ old achieves an average reward of 96.2 and using a single network to obtain θ old achieves an average reward of 96.0. More results on using an average network are shown in Fig. 11 (b, c ).

As mentioned before, variants of 'knowledge' transfer have been considered using a variety of techniques, for instance, fine-tuning, progressive neural nets (Rusu et al., 2016b) , PathNet (Fernando et al., 2017) , 'Growing a Brain' (Wang et al., 2017) , actor-mimic (Parisotto et al., 2016) , learning without forgetting (Li & Hoiem, 2016) . Also related are techniques on transfer learning and lifelong learning. We discuss those methods and contrast them to our approach in the following.

PathNet (Fernando et al., 2017) enables multiple agents to train the same giant deep net while reusing parameters and avoiding catastrophic forgetting. To this end, agents embedded in the neural net discover which weights can be reused for new tasks and restrict application of gradients to those parameters. In contrast to this formulation we consider availability of multiple teacher nets, which are trained.

Progressive Net (Rusu et al., 2016b) leverages transfer and avoids catastrophic forgetting by introducing lateral connections to previously learned features. Our discussed method uses similar lateral connections. However, in contrast to Rusu et al. (2016b) , we introduce scaling with normalized weights. This ensures independence of the student upon training, addressing a limitation in (Rusu et al., 2016b) where only a fraction of the capacity of the student is eventually utilized. Distral a neologism combining 'distill & transfer learning' (Teh et al., 2017) considers joint training of multiple tasks. Multiple tasks share a 'distilled' policy which encodes common behavior between different tasks. While each worker addresses its own task, a shared policy encourages consistency between the policies. Different from Distral, which is a multi-task learning framework, knowledge flow addresses a single task, while in multi-task learning, multiple tasks are addressed at the same time.

Hence, common for multi-task learning and knowledge flow is a transfer of information. However, in multi-task learning, information extracted from different tasks are shared to boost performance, while, in knowledge flow, the information of multiple teachers is leveraged to help a student learn better a single, new, previously unseen task.

Knowledge distillation (Hinton et al., 2015) distills information form a larger deep net into a smaller one. It assumes both nets are trained on the same dataset. In contrast, our technique allows knowledge transfer between different source and target domains.

Actor-mimic (Parisotto et al., 2016) enables an agent to learn how to address multiple tasks simultaneously and generalize the extracted knowledge to new domains. A single policy net learns how to act in a set of tasks following the guidance of several expert teachers. A combination of feature regression and cross entropy loss is used to encourage the student to produce similar actions and representations. Our proposed technique differs in that we take advantage of a teachers representation at the beginning of training, Learning without forgetting (Li & Hoiem, 2016) permits to add a new task to a deep net without forgetting the original capabilities. Importantly, only data from the new task is used and the old capabilities are retained by first recording the old networks output on the new data. Similar techniques have been developed by Furlanello et al. (2016) ; Jung et al. (2016) . In contrast, we transfer 'knowledge' from teacher networks more explicitly.

:



Figures and Tables:

Figure 1: (a) Example of a two-teacher knowledge flow. (b) Deep net transformation of knowledge flow. (c) Average normalized weights for teachers' and the student's layers. At the beginning of training, the student heavily relies on teacher one. As training progresses, teacher one's weight decreases, and the student's weight increases until the student is eventually independent.

Figure 2: Comparison with progressive neural network and PathNet.

Figure 3: Comparison with fine-tuning and baseline A3C on different combinations of environment/teacher settings.

Figure 4: Comparison of top-1 accuracy of our approach, fine-tuning and baseline on the EMNIST Letters test dataset.

Figure 5: Comparison of top-1 accuracy of our approach, fine-tuning and baseline on the STL-10 test dataset.

Figure 8: Ablation study: using untrained teachers.

Figure 10: Teachers' architecture differs from the student's architecture. Seaquest and Riverraid experts are used as teachers for all experiments.

Figure 11: Average network to compute θ old . Riverraid expert is used as teacher for all experiments.

Knowledge flow enhances the student by adding transformed and scaled intermediate representations from teacher models. To perform the transformation, intermediate representations from teachers are first multiplied by transformation matrices Q. Then the transformed representations from teachers and representations from the student are linearly combined. The weights for this linear combination are determined by a weight p w which is normalized to sum to one for each student layer.

Table content: <table><tr><td>3.2 DEEP NET TRANSFORMATION AND LOSS TERMS</td></tr><tr><td>Deep Net Transformation:</td></tr></table>

on Atari games are also listed for reference.

Table content: <table><tr><td/><td colspan="2">w/ Seaquest teacher</td><td colspan="2">w/ Riverraid teacher</td><td colspan="2">w/ Sea. and River. teachers</td><td/><td>No teachers</td><td/></tr><tr><td/><td colspan="2">Ours PathNet</td><td colspan="2">Ours PathNet</td><td>Ours</td><td>PNN</td><td colspan="3">A3C PPO ACKTR</td></tr><tr><td>Alien</td><td>1254</td><td>∼1700</td><td>1259</td><td>∼1800</td><td>1911</td><td>∼2000</td><td colspan="2">182 1850</td><td>3197</td></tr><tr><td>Asterix</td><td>3982</td><td>∼2000</td><td>3823</td><td>∼2000</td><td>6012</td><td>∼9000</td><td colspan="2">6723 4533</td><td>31583</td></tr><tr><td>Boxing</td><td>96</td><td>∼70</td><td>96</td><td>∼80</td><td>99</td><td>∼99</td><td>34</td><td>95</td><td>1</td></tr><tr><td>Gopher</td><td colspan="2">4152 ∼ 3900</td><td>3820</td><td>∼2100</td><td>5233</td><td>∼4500</td><td colspan="2">8443 2933</td><td>47730</td></tr><tr><td>Hero</td><td colspan="5">21250 ∼12500 29343 ∼12500 30928</td><td colspan="2">∼30000 28766</td><td>n/a</td><td>n/a</td></tr><tr><td>James.</td><td>857</td><td>∼600</td><td>832</td><td>∼600</td><td>1245</td><td>∼850</td><td>352</td><td>561</td><td>512</td></tr><tr><td>Krull</td><td>8193</td><td>∼7800</td><td>6890</td><td colspan="2">∼7500 10000</td><td>∼9954</td><td colspan="2">8067 7942</td><td>9689</td></tr></table>

Comparison with fine-tuning and baseline A3C on different environment/teacher settings. The subscript following each number indicate the teachers being used. E.g., (alien, space I.) indicates that one teacher is an alien expert and the other is a space invaders expert.

Table content: <table><tr><td/><td/><td/><td/><td/><td/><td/><td/><td colspan="2">Ours w/ expert</td><td/><td colspan="4">Ours w/ non-expert</td><td/><td/><td>Fine-tune</td><td colspan="2">A3C baseline</td><td/><td colspan="2">A3C</td><td/><td/><td/><td/></tr><tr><td/><td/><td colspan="3">Alien(teachers)</td><td/><td/><td/><td colspan="2">1705 (alien, space I.)</td><td/><td colspan="4">1923(bank., space I.)</td><td/><td/><td>996(bank.)</td><td colspan="2">1303(n/a)</td><td/><td colspan="2">182(n/a)</td><td/><td/><td/><td/></tr><tr><td/><td/><td colspan="4">Breakout(teachers)</td><td/><td/><td colspan="2">400(breakout, space I.)</td><td/><td colspan="4">306(pong, space I.)</td><td/><td/><td>261(space I.)</td><td colspan="2">99(n/a)</td><td/><td colspan="2">552 (n/a)</td><td/><td/><td/><td/></tr><tr><td colspan="10">ChopperCommand(teachers) 8120 (chopper., space I.)</td><td/><td colspan="4">6013(sea., space I.)</td><td/><td/><td>3789(sea.)</td><td colspan="2">4513(n/a)</td><td/><td colspan="2">4669(n/a)</td><td/><td/><td/><td/></tr><tr><td/><td colspan="5">KungFuMaster(teachers)</td><td/><td/><td colspan="2">29458(kungfu., sea)</td><td/><td colspan="4">35103 (sea. hero)</td><td/><td colspan="2">26752(hero)</td><td colspan="5">29446(n/a) 3046(n/a)</td><td/><td/><td/><td/></tr><tr><td/><td colspan="5">MsPacman(teachers)</td><td/><td/><td colspan="2">2411(mspac., alien)</td><td/><td colspan="4">2450 (alien, space I.)</td><td/><td/><td>1324(alien)</td><td colspan="2">1628(n/a)</td><td/><td colspan="2">594(n/a)</td><td/><td/><td/><td/></tr><tr><td/><td/><td colspan="4">Seaquest(teachers)</td><td/><td/><td colspan="2">1873(sea., chopper.)</td><td/><td colspan="5">32103 (chopper., space I.)</td><td colspan="2">1590(chopper.)</td><td colspan="2">1670(n/a)</td><td/><td colspan="2">2300(n/a)</td><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td>Seaquest</td><td/><td/><td/><td/><td/><td/><td/><td colspan="3">KungFuMaster</td><td/><td/><td/><td/><td/><td/><td/><td>Alien</td><td/><td/><td/><td/></tr><tr><td/><td/><td/><td colspan="6">Ours w/ Seaquest and ChopperCommand Ours w/ ChooperCommand and SpaceInvaders</td><td>40000</td><td/><td/><td/><td/><td/><td/><td/><td/><td>2000</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td/><td colspan="4">Finutune from ChopperCOmmand Baseline</td><td/><td/><td>35000</td><td/><td/><td/><td/><td/><td/><td/><td/><td>1750</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td/><td>30000</td><td/><td/><td/><td/><td/><td/><td/><td/><td>1500</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>Rewards</td><td/><td/><td/><td/><td/><td/><td/><td>Rewards</td><td>20000 25000</td><td/><td/><td/><td/><td/><td/><td/><td>Rewards</td><td>1000 1250</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td/><td>15000</td><td/><td/><td/><td/><td/><td/><td/><td/><td>750</td><td/><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td/><td>10000</td><td/><td/><td/><td colspan="5">Ours w/ KungFuMaster and Seaquest</td><td>500</td><td/><td/><td/><td colspan="4">Ours w/ Alien and SpaceInvaders</td><td/></tr><tr><td/><td/><td/><td/><td/><td/><td/><td/><td/><td>5000</td><td/><td/><td/><td colspan="4">Ours w/ Seaquest and Hero Finutune from Hero</td><td/><td>250</td><td/><td/><td/><td colspan="5">Ours w/ BankHeist and SpaceInvaders Finutune from BankHeist</td></tr><tr><td>0</td><td/><td/><td/><td/><td/><td/><td/><td/><td>0</td><td/><td/><td/><td>Baseline</td><td/><td/><td/><td/><td>0</td><td/><td/><td/><td>Baseline</td><td/><td/><td/><td/></tr><tr><td>0.0</td><td>0.5</td><td>1.0</td><td>1.5</td><td>2.0</td><td>2.5</td><td>3.0</td><td>3.5</td><td>4.0</td><td>0.0</td><td>0.5</td><td>1.0</td><td>1.5</td><td>2.0</td><td>2.5</td><td>3.0</td><td>3.5</td><td>4.0</td><td>0.0</td><td>0.5</td><td>1.0</td><td>1.5</td><td>2.0</td><td>2.5</td><td>3.0</td><td>3.5</td><td>4.0</td></tr><tr><td/><td/><td/><td/><td># of Steps</td><td/><td/><td/><td>1e7</td><td/><td/><td/><td/><td># of Steps</td><td/><td/><td/><td>1e7</td><td/><td/><td/><td/><td># of Steps</td><td/><td/><td/><td>1e7</td></tr></table>

Test Error (%) on CIFAR-10/100. The parentheses following "Ours" indicates the teachers we use. I.e., 'Ours (SVHN, C100)' indicates that we use an SVHN expert and a C100 expert as teachers.

Table content: <table><tr><td>Baseline</td><td>Fine-tune</td><td>Fine-tune</td><td>Ours</td><td>Baseline</td><td>Fine-tune</td><td>Fine-tune</td><td>Ours</td></tr><tr><td>Densenet</td><td>from C100</td><td>from SVHN</td><td>(C100, SVHN)</td><td>Densenet</td><td>from C10</td><td>from SVHN</td><td>(C10, SVHN)</td></tr><tr><td>C10 4.44</td><td>4.27</td><td>4.58</td><td>3.88</td><td>C100 21.64</td><td>20.83</td><td>21.02</td><td>20.78</td></tr><tr><td/><td colspan="2">(a)</td><td/><td/><td/><td/><td/></tr></table>

Test error (%) of distilled student net.

Table content: <table><tr><td/><td colspan="4">MNIST MNIST w/o digit '3' C100 Imagenet</td></tr><tr><td>Student alone</td><td>1.46</td><td>11.06</td><td>31.87</td><td>30.24</td></tr><tr><td>KD Hinton et al. (2015)</td><td>0.74</td><td>2.06</td><td>30.28</td><td>30.04</td></tr><tr><td>Ours</td><td>0.73</td><td>1.05</td><td>30.07</td><td>29.05</td></tr></table>

Our approach on the EMNIST Letters dataset.

Table content: <table><tr><td>Model (Teacher)</td><td>Test error(%)</td></tr><tr><td>Cohen et al. (2017)</td><td>14.85</td></tr><tr><td>Fine-tune from EMNIST digits</td><td>9.04</td></tr><tr><td>Baseline</td><td>9.20</td></tr><tr><td>Ours (EMNIST letters)</td><td>7.13</td></tr><tr><td>Ours (EMNIST half letters)</td><td>8.13</td></tr><tr><td>Ours (EMNIST digit)</td><td>8.11</td></tr><tr><td>7 APPENDIX</td><td/></tr><tr><td>7.1 SUPERVISED LEARNING</td><td/></tr><tr><td colspan="2">Comparison with Knowledge Distillation: We follow knowledge Distillation (KD)</td></tr></table>

Our approach on the STL-10 dataset (fully supervised).

Table content: <table><tr><td/><td>Test error (%)</td></tr><tr><td>Zhao et al. (2015)</td><td>25.20</td></tr><tr><td>Thoma (2017)</td><td>21.34</td></tr><tr><td>Baseline</td><td>25.50</td></tr><tr><td>Fine-tune from C10</td><td>14.32</td></tr><tr><td>Fine-tune from C100</td><td>14.38</td></tr><tr><td>Ours (C100)</td><td>12.35</td></tr><tr><td>Ours (C10, C100)</td><td>11.09</td></tr><tr><td colspan="2">model using weights pretrained on CIFAR-10 and CIFAR-100 reduce test errors by more than 10%.</td></tr><tr><td colspan="2">Compared with fine-tuning, student model training in our framework further reduces the test error by</td></tr><tr><td>3%.</td><td/></tr></table>

Peer review (iclr2019):
 This paper proposes to feed the representations of various external "teacher" neural networks of a particular example as inputs to various layers of a student network. The idea is quite intriguing and performs very well empirically, and the paper is also well written. While I view the performance experiments as extremely thorough, I believe the paper could possibly use some additional ablation-style experiments just to verify the method actually operates as one intuitively thinks it should. Other Comments: - Did you verify that in Table 3, the p_w values for the teachers trained on the more-relevant C10/C100 dataset are higher than the p_w value for the teacher trained on the SVHN data? It would be interesting to see the plots of these p_w over the course of training (similar to Fig 1c) to verify this method actually operates as one intuitively believes it should. - Integrating the teacher-network representations into various hidden layers of the student network might also be considered some form of neural architecture search (NAS) (by including parts of the teacher network into the student architecture). See for example the DARTS paper: https://arxiv.org/abs/1806.09055 which similarly employs mixtures of potential connections. Under this NAS perspective, the dependence loss subsequently distills the optimal architecture network back into the student network architecture. Have you verified that this method is not just doing NAS, by for example, providing a small student network with a few teacher networks that haven*t been trained at all? (i.e. should not permit any knowledge flow) - Have the authors considered training the teacher networks jointly with the student? This could be viewed as teachers learning how to improve their knowledge flow (although might require large amounts of memory depending on the size of the teacher networks). - Suppose we have an L-layer student network and T M-layer teacher networks. Does this imply we have to consider O(L*M*T) additional weight matrices Q? Can you comment on the memory requirements? - The teacher-student setup should be made more clear in Tables 1 and 2 captions (took me some time to comprehend). - The second and third paragraphs are redundant given the Related Work section that appears later on. I would like to see these redundancies minimized and the freed up space used to include more results from the Appendix in the main text.