Continual Learning via Neural Pruning

1 INTRODUCTION . Continual learning , the ability of models to learn to solve new tasks beyond what has previously been trained , has garnered much attention from the machine learning community in recent years . This is driven in part by the practical advantages promised by continual learning schemes such as improved performance on subsequent tasks as well as a more efficient use of resources in machines with memory constraints . There is also great interest in continual learning from a longer-term perspective , in that any approach towards artificial general intelligence needs to be able to continuously build on top of prior experiences . As it stands today , the main obstacle in the path of effective continual learning is the problem of catastrophic forgetting : machines trained on new problems forget about the tasks that they were previously trained on . There are multiple approaches which seek to alleviate this problem , ranging from employing networks with many submodules Rusu et al . ( 2016 ) ; Fernando et al . ( 2017 ) ; Lee et al . ( 2017 ) to methods which penalize changing the weights of the network that are deemed important for previous tasks Kirkpatrick et al . ( 2016 ) ; Zenke et al . ( 2017 ) ; Hou & Kwok ( 2018 ) . These approaches either require specialized genetic algorithm training schemes or still suffer catastrophic forgetting , albeit at a smaller rate . In particular , to the best of our knowledge , there is no form of guarantee regarding the performance of previous tasks among the fixed capacity models which use standard SGD training schemes . In this work we introduce a simple continual learning algorithm for fixed capacity networks which can be trained using standard gradient descent methods and by construction suffers zero deterioration on previously learned problems during the training of new tasks . We take advantage of the over-parametrization of neural networks by using an activation based neural pruning scheme to train models which only use a fraction of their width . We then train subsequent tasks utilizing the unused capacity of the model . By cutting off certain connection in the network , we make sure that new tasks can take advantage of previously learned features but cause no interference in the pathways of the previously learned tasks . MAIN CONTRIBUTIONS • We introduce Continual Learning via Neural Pruning ( CLNP ) with the following properties : – Given a network with activation based sparsity , CLNP trains new tasks utilizing the unused weights of the network in a manner which prevents any catastrophic forgetting of the previous tasks while taking advantage of the already learned features . – CLNP provides simple diagnostics in the form of the number of remaining and reused neurons and filters . In particular , in experiments we see that CLNP automatically takes advantage of the fact that the features of earlier layers are more transferable . • We formalize the idea of graceful forgetting , the notion that it is preferable to suffer from forgetting in a controlled manner if it helps regain network capacity and prevents uncontrolled loss of performance . We use this idea to balance network sparsity and model accuracy . • We show empirically that using an activation based neural pruning sparsification scheme , we outperform previous approaches based on weight elasticity . We also demonstrate in one example that using a slightly more advanced variation of our sparsification method , the network suffers virtually no loss of performance , either from catastrophic forgetting or from sparsification . • In its single-head incarnation , CLNP provides one of the first viable single-head continual learning algorithms , and the first to avoid catastrophic forgetting by construction as far as we are aware . 2 RELATED WORK . Lifelong learning . Prior work addressing catastrophic forgetting generally fall under two categories . In the first category , the model is comprised of many individual modules at each layer and forgetting is prevented either by routing the data through different modules Fernando et al . ( 2017 ) or by successively adding new modules for each new task Rusu et al . ( 2016 ) ; Lee et al . ( 2017 ) . This approach often has the advantage of suffering zero forgetting , however , the structure of these networks is specialized . In the case of Rusu et al . ( 2016 ) ; Lee et al . ( 2017 ) the model architecture is not fixed , and in the case of Fernando et al . ( 2017 ) training is done using a tournament selection genetic algorithm . In contrast , algorithms in the second category do not require any specific network structures or training schemes . Here , forgetting is minimized by penalizing changes of weights which are deemed important Kirkpatrick et al . ( 2016 ) ; Zenke et al . ( 2017 ) ; Ritter et al . ( 2018 ) ; Hou & Kwok ( 2018 ) . These approaches , generally referred to as weight elasticity methods , have the advantage of simpler training schemes but still suffer catastrophic forgetting , albeit at a smaller rate than unconstrained training . Some approaches combine aspects from both categories , for instance Schwarz et al . ( 2018 ) utilizes weight elasticity methods to aid knowledge distillation into a fixed capacity knowledge base . The approach we take in this paper falls under the second category with standard network structure and training scheme , and forgetting is prevented by constraining certain weights from changing . However , it shares the main advantage of the first category approaches in that we suffer zero catastrophic forgetting during the training of subsequent tasks . In particular , our method can be thought of as following the spirit of the path based approach of Fernando et al . ( 2017 ) using activation based sparsification and the idea of graceful forgetting . Since our method is directly comparable to other second category approaches , we will provide quantitative comparisons with other methods in this category . Network superposition . Our algorithm can be thought of as a non-destructive way of superposing multiple instances of the same architecture using sparsification . Prior work in this direction ( e.g . Saxena & Verbeek ( 2016 ) ; Shazeer et al . ( 2017 ) ) are primarily concerned with neural architecture search and are not aimed at preventing forgetting . The most relevant work in this area is Cheung et al . ( 2019 ) , which can be thought of as an approximate Fourier space implementation of our approach . Sparsification . While sparsification is a crucial tool that we use , it is not in itself a focus of this work . For accessibility , we use a simple neuron/filter based sparsification scheme which can be thought of as a single iteration variation of Hu et al . ( 2016 ) . 3 METHODOLOGY . The core idea of our method is to take advantage of the fact that neural networks are generally over-parametrized ( Neyshabur et al. , 2018 ) . A manifestation of this over-parametrization is through the practice of sparsification , i.e . the compression of neural network with relatively little loss of performance ( LeCun et al. , 1989 ; Sun et al. , 2015 ; Gale et al. , 2019 ) . As an example , Luo et al . ( 2017 ) show that VGG-16 ( Simonyan & Zisserman , 2014 ) can be compressed by more than 16 times without significant loss of performance . In this section we first show that given an activation based sparse network , we can leverage the unused capacity of the model to develop a continual learning scheme which suffers no catastrophic forgetting . We then discuss the idea of graceful forgetting to address the tension between sparsification and model performance in the context of lifelong learning . In the next section , we will see empirically that even fairly small networks are sufficiently over-parametrized for our method to provide competitive results . It is important to differentiate activation based neuronal sparsity from parameter based weight sparsity . The former implies only a subset of the neurons or filters of each layer assume non-zero values on a given dataset whereas the latter means that many of the weights are zero but does not necessarily imply the existence of permanently inactive neurons . In the remainder of the paper , when we mention sparsity , we are referring to activation based neuronal sparsity . In what follows we will discuss sparsity for fully connected layers by looking at the individual neurons . The same argument goes through identically for individual channels of convolutional layers . 3.1 GENERALITIES . Let us assume that we have a trained network which is sparse in the sense that only a subset of the neurons of the network are active . Networks with this form of sparsity can be thought of as narrower networks embedded inside the original structure . There are many approaches that aim to train such sparse networks with little loss of performance ( e.g . Luo et al . ( 2017 ) ; Hu et al . ( 2016 ) ) . We will discuss our sparsification method in detail in §3.2 . Fig . 1 shows a cartoon of our approach , where we have a network with activation based neuronal sparsity , where the active and inactive neurons are respectively denoted by blue and grey nodes . Based on the connectivity structure , the weights of the network can also be split into three classes . First , denoted in blue in Fig . 2 , we have the active weightsW act which connect active nodes to active nodes . Next we have the weights which connect any node to inactive nodes , we call these the free weights W free , denoted in grey . Finally we have the weights which connect the inactive nodes to the active nodes , we call these the interference weightsW int , denoted in red dashed lines . A more precise definition of the active and inactive neurons and weights is given in §3.2 . The crux of our approach is the simple observation that if all the interference weightsW int are set to zero , the free weights W free can be changed arbitrarily without causing any change whatsoever to the output of the network . We can therefore utilize these weights to train new tasks without causing any harm to the performance of the previous tasks . We can further split the free weights into two groups . First , the weights which connect active nodes to inactive nodes . These are the weights that take advantage of previously learned features and are therefore responsible for transfer learning throughout the network . We also have the weights that connect inactive nodes to inactive nodes . These weights can form completely new pathways to the input and train new features . A complimentary diagnostic for the amount of transfer learning taking place is the number of new active neurons at each layer after the training of subsequent tasks . Given that an efficient sparse training scheme would not need to relearn the features that are already present in the network , the number of new neurons grown at each stage of training is an indicator of the sufficiency of the already learned features for the purposes of the new task . We will see more of this point in §4 . Output architecture . In order to fully flesh out a continual learning scheme , we need to specify the connectivity structure of the output nodes . Starting with a network trained on the first task with the interference weights severed ( Fig . 2 middle ) , there are two intuitive routes that we can take . In order to train a new task , one option is to use a new output layer ( i.e . a new head ) while saving the previous output layer . This option , demonstrated in Fig . 2 on the left , is known as the multi-head approach and is standard in continual learning . Because each new output layer comes with its own sets of weights which connect to the final hidden layer neurons , this method is not a fully fixed capacity method . In our approach to continual learning , training a multi-head network with a fully depleted core structure , i.e . a network where are no more free neurons left , is equivalent to final layer transfer learning . In scenarios where the output layer of the different tasks are structurally compatible , for example when all tasks are classification with the same number of classes , we can use a single-head approach . Demonstrated in Fig . 2 on the right , in this approach we use the same output layer for all tasks , but for each task , we mask out the neurons of the final hidden layer that were trained on other tasks . In the case of Fig . 2 , only green nodes in the final hidden layer are connected to the output for the second task and only blue nodes for the first task . This is equivalent to a dynamic partitioning of the final hidden layer into multiple unequal sized parts , one part for each task . In practice this is done using a multiplicative masking operation with a task dependent mask , denoted in Fig . 2 by dashed lines after the final hidden layer . This structure is truly fixed capacity , but is more restrictive to train than its multi-head counterpart . CLNP is among the first methods which provides a viable algorithm for single-head continual learning , and the first to avoid catastrophic forgetting by construction as far as we are aware .

Summary: This paper proposes a method for mitigating catastrophic forgetting in neural networks, which is an important and unsolved problem in the sequential training of multiple tasks.  The method works by (i) identifying an active subnetwork after training on one task that can perform the task to a sufficient degree of accuracy, (ii) freezing the subnetwork and pruning interfering connections to it from the rest of the network, and (iii) training the rest of the network on the next task and iterating. The contribution is a method that allows for training of sequential tasks in a fixed capacity architecture with zero catastrophic forgetting guaranteed, while still allowing for transfer between tasks via feature sharing. Additionally, it allows for controlled fine-tuning of the trade-off between accuracy and network capacity, which the authors refer to as ‘graceful forgetting’, by adjusting two hyperparameters that adjust the level of sparsity during the training of a task. The method is shown to outperform several other continual learning methods on permuted MNIST and one other method on split CIFAR-100, both standard evaluations in continual learning.