Unified Probabilistic Deep Continual Learning through Generative Replay and Open Set Recognition

1 INTRODUCTION . Most machine learning systems make the closed world assumption and are predominantly trained according to the isolated learning paradigm , where data is available at all times and is independently and identically distributed . However , in the context of continual learning , where tasks and data arrive in sequence , neither of these two principles is desirable . A neural network that is trained exclusively on a new task ’ s data forgets past knowledge and suffers from an early identified phenomenon commonly referred to as catastrophic forgetting ( McCloskey & Cohen , 1989 ) . Moreover , to overcome the closed world assumption , inclusion of a ” background ” class is veritably insufficient as it is impossible to include all unseen concepts and classes explicitly in the loss function beforehand . Likewise , commonly applied thresholding of prediction values doesn ’ t prevent resulting large confidences for unseen classes if the data is far away from any known data ( Matan et al. , 1990 ) . Most of the existing continual learning literature concentrates efforts on either alleviating catastrophic forgetting , maximizing knowledge transfer or addressing ways in which to efficiently store subsets of past data . These works have identified weight regularization ( McCloskey & Cohen , 1989 ; Zenke et al. , 2017 ; Kirkpatrick et al. , 2017 ; Li & Hoiem , 2016 ; Nguyen et al. , 2018 ) and rehearsal techniques ( Ratcliff , 1990 ; Lopez-Paz & Ranzato , 2017 ; Rebuffi et al. , 2017 ; Bachem et al. , 2015 ) or have postulated methods based on complementary learning systems theory ( O ’ Reilly & Norman , 2003 ) through dual-model with generative memory approaches ( Gepperth & Karaoguz , 2016 ; Shin et al. , 2017 ; Wu et al. , 2018 ; Farquhar & Gal , 2018 ; Achille et al. , 2018 ) as mechanisms against catastrophic inference . On the one hand , regularization techniques can work well in principle , but come with the caveat of relying on a new task ’ s proximity to previous knowledge . On the other hand , training and storing separate models , including generative models for generative rehearsal , comes at increased memory cost and doesn ’ t allow for full knowledge sharing , particularly to already stored models . Specifically , the transfer of already attained knowledge to benefit new tasks , known as forward transfer , as well as the potential positive impact of learning new concepts to aid in existing tasks , known as backward transfer , are crucial to any continual learning system . Generally speak- ing , most current approaches include a set of simplifications , such as considering separate classifiers for each new task , referred to as multi-head classifiers . This scenario prevents ” cross-talk ” between classifier units by not sharing them , which would otherwise rapidly decay the accuracy ( Zenke et al. , 2017 ; Kirkpatrick et al. , 2017 ; Rusu et al. , 2016 ; Shin et al. , 2017 ; Gepperth & Karaoguz , 2016 ; Rebuffi et al. , 2017 ; Achille et al. , 2018 ; Nguyen et al. , 2018 ) as newly introduced classes directly impact and confuse existing concepts . In the multi-head scenario task ids thus need to be encoded or are often assumed to be given by humans in order to know which classifier to use for prediction . Correspondingly , in generative replay , generative and discriminative models are taken to be separate models ( Shin et al. , 2017 ; Farquhar & Gal , 2018 ; Nguyen et al. , 2018 ) . Similar to regularization of a classifier , a generative model can suffer from the learned approximate posterior distribution deviating further from the true posterior with each further task increment . In order to avoid catastrophic forgetting induced by learning to generate on previously generated data , previous works even store a separate generative model per task ( Farquhar & Gal , 2018 ) , in analogy to the multi-head classifier . An extended review of recent continual learning methods is provided by Parisi et al . ( 2019 ) . A parallel thread pursues a complementary component of identifying out-of-distribution and open set examples . While current continual learning approaches typically do not include this thread yet , it can be considered crucial to any system and a necessity in order to avoid encoding task labels and distinguishing seen from unknown data . Here , multiple methods rely on using confidence values as means of rejection through calibration ( Liang et al. , 2018 ; Lee et al. , 2018b ; a ) . Arguably this also includes Bayesian approaches using variational methods ( Farquhar & Gal , 2018 ; Achille et al. , 2018 ) or Monte-Carlo dropout ( Gal & Ghahramani , 2015 ) to estimate uncertainties . Since the closed world assumption also holds true for Bayesian methods as the approximated posterior probability can not be computed for unknown classes , misclassification still occurs , as the open space risk is unbounded ( Boult et al. , 2019 ) . Recently Thomas et al . ( 2014 ) ; Bendale & Boult ( 2016 ) ; Dhamija et al . ( 2018 ) have proposed extreme value theory ( EVT ) based open set recognition to bound the open-space risk and balance it with recognition errors in deep neural networks . In this work we propose a probabilistic approach to unify open set recognition with continual learning in a single deep model in order to remove or alleviate above mentioned common simplifications . Specifically , our contributions are : • We introduce a single model for continual learning that combines a joint probabilistic encoder with a generative model and a linear classifier . Inspired by EVT based open set recognition ( Bendale & Boult , 2016 ) for Softmax prediction layers , this model architecture gives rise to a natural way of open set recognition with statistical outlier rejection on the basis of the approximate posterior in Bayesian inference . The latter requires no upfront knowledge of open set data or corresponding modifications to loss or training procedure and can successfully prevent nonsensical predictions for unseen unknown data , a robustness feature that is currently not present in closed world continual learning systems . • We show how this EVT bound to the posterior can be used for both identification and rejection of statistically outlying unseen unknown data instances , as well as exclusion of generated samples from areas of low probability density . When used in generative replay this leads to significantly reduced catastrophic forgetting without storing real data . • We share our model across tasks and automatically expand a single linear classifier head with units for new classes , thus not requiring explicit task labels during inference . • We demonstrate that our approach can incrementally learn the classes of two image and one audio dataset , as well as cross-dataset scenarios across modalities , while allowing for forward and backward transfer due to weight-sharing . When presented with novel data our model is able to distinguish between unseen data from various datasets and data belonging to known tasks . We further show that our approach readily profits from recent model advances such as variational lossy auto-encoders ( Gulrajani et al. , 2017 ; Chen et al. , 2017 ) . 2 UNIFYING CONTINUAL LEARNING WITH OPEN SET RECOGNITION . In isolated supervised machine learning the core assumption is the presence of i.i.d . data at all times and training is conducted using a dataset D ≡ { ( x ( n ) , y ( n ) ) } N n=1 , consisting of N pairs of data instances x ( n ) and their corresponding labels y ( n ) ∈ { 1 . . . C } for C classes . In contrast , in continual learning task dataDt ≡ { ( x ( n ) t , y ( n ) t ) } Nt n=1 with t = 1 , . . . , T arrives sequentially for T disjoint datasets , each with number of classes Ct . In our work , we consider this class incremental scenario from a perspective of variational Bayesian inference in deep neural networks ( Kingma & Welling , 2013 ) that consist of a shared encoder with variational parameters θ , decoder and linear classifier with respective parameters φ and ξ . The joint probabilistic encoder learns an encoding to a latent variable z , over which a prior is placed , say a unit Gaussian . Using variational inference , its purpose is to approximate the true posterior to both pφ ( x , z ) and pξ ( y , z ) . The probabilistic decoder pφ ( x|z ) and probabilistic linear classifier pξ ( y|z ) then return the conditional probability density of the input x and target y under the respective generative model given a sample z from the approximate posterior qθ ( z|x ) . This yields a generative model p ( x , y , z ) , for which we assume a factorization and generative process of the form p ( x , y , z ) = p ( x|z ) p ( y|z ) p ( z ) . For variational inference with our model the following continual learning loss function thus needs to be optimized : LUBt ( θ , φ , ξ ) = t∑ τ=1 Nτ∑ n=1 [ E qθ , t ( z|x ( n ) τ ) [ log pφ , t ( x ( n ) τ |z ) + log pξ , t ( y ( n ) τ |z ) ] − βKL ( qθ , t ( z|x ( n ) τ ) || p ( z ) ) ] ( 1 ) Here , we have added a weight term β to the KL divergence to balance the individual loss terms , similar to the work of Zhou et al . ( 2012 ) and Higgins et al . ( 2017 ) . This factor regulates the tradeoff between the additional constraint imposed by the classifier , needing to be able to linearly separate the classes given z , and the quality of the approximation to the training data . To balance this tradeoff irrespective of input and latent dimensionality and number of classes , the losses are normalized according to dimensions . Note that in practice this changes the relative scale of the losses and thus the interpretation of specific β values with respect to the original authors Higgins et al . ( 2017 ) . We provide a more detailed discussion with empirical examples for the role of β in the supplementary section . However , equation 1 requires the presence of all data for all tasks and is thus generally not feasible for continual learning where only the most recent task ’ s data is assumed to be available . In context of variational inference , two potential approaches offer solutions to this challenge : a prior-based approach using the former approximate posterior qθ , t−1 as the new task ’ s prior ( Nguyen et al. , 2018 ) or estimating the likelihood of former data through generative replay or other forms of rehearsal ( Farquhar & Gal , 2018 ; Achille et al. , 2018 ) . For our proposed model , we follow the latter line of work and let the prior remain the same at all times . Making use of the generative nature of our model , we let the above upper-bound to task incremental continual learning become : Lt ( θ , φ , ξ ) = Ñt∑ n=1 [ E qθ , t ( z|x̃ ( n ) t ) [ log pφ , t ( x̃ ( n ) t |z ) + log pξ , t ( ỹ ( n ) t |z ) ] − βKL ( qθ , t ( z|x̃ ( n ) t ) || p ( z ) ) ] + Nt∑ n=1 [ E qθ , t ( z|x ( n ) t ) [ log pφ , t ( x ( n ) t |z ) + log pξ , t ( y ( n ) t |z ) ] − βKL ( qθ , t ( z|x ( n ) t ) || p ( z ) ) ] ( 2 ) Here , x̃t ∼ pφ , t−1 ( x|z ) and ỹt ∼ pξ , t−1 ( y|z ) with z ∼ p ( z ) is a sample from the generative model with the corresponding label obtained from the classifier . Ñt is the number of total data instances of all previously seen tasks or alternatively a hyper-parameter . This way the expectation of the log-likelihood for all previously seen tasks is estimated and the dataset at any point in time D̃t ≡ ( xt ∪ x̃t , yt ∪ ỹt ) is a combination of generations from seen past data distributions and the current task ’ s real data . For each newly arriving task with novel labels , the classifier is expanded with newly initialized units . We note that whereas the loss function with generative replay in equation 2 is used for continual training , equation 1 and thus real data is always used for testing . The model is further trained in a denoising fashion , where noise is added to each input x to avoid over-fitting . This is preferable to weight regularization as it doesn ’ t entail unrecoverable units that are needed to encode later stage concepts . We have accordingly coined our model Classifying Denoising Variational Auto-Encoder ( CDVAE ) . We optionally enhance the probabilistic decoder with an autoregressive variant , where generation of a pixel ’ s value is spatially conditioned on previous pixels ( van den Oord et al. , 2016 ; Gulrajani et al. , 2017 ; Chen et al. , 2017 ) . Here , the denoising plays an additional crucial role of de-quantization . Nonetheless , similar to existing dual-model approaches ( Shin et al. , 2017 ; Wu et al. , 2018 ; Farquhar & Gal , 2018 ) , by itself both CDVAE and PixCDVAE models accumulate errors as with each iteration of generative replay deviations of the approximate from the true posterior get amplified . However , in our joint model , the linear classifier directly affects the partitioning of the latent space by influencing the joint probabilistic encoder ’ s weights , resulting in class specific areas of large probability density . This is particularly noticeable for lossy VAEs ( Gulrajani et al. , 2017 ; Chen et al. , 2017 ) that leave the encoding of local structure to autoregressive layers and hence in our case attribute more influence on the latent space to the classifier . We note that these class specific areas in latent space are not necessarily encouraged for deeper classifiers , however would argue that with a sufficiently expressive probabilistic encoder such a classifier is not necessary . For visualization purposes , we have trained a CDVAE following the details of section 3 with a two-dimensional latent space on the class-incremental MNIST ( LeCun et al. , 1998 ) upper-bound and show the latent space embedding for the validation dataset at the end of continual learning in figure 1b . Corresponding intermediate visualizations for each task increment and PixCDVAE can be found in the supplementary material . We take advantage of the classifier ’ s impact on the latent space as the foundation for posterior based open set recognition and complementary generative replay with statistical outlier rejection . We refer to this extended model as Open-set Classifying Denoising Variational Auto-Encoder ( OCDVAE ) and PixOCDVAE respectively . An illustration of our joint probabilistic model is shown in figure 1a .

Summary: This paper tackles the problem of catastrophic forgetting when data is organized in a large number of batches of data (tasks) that are sequentially made available. To avoid catastrophic forgetting, the authors learn a VAE that generates the training data (both inputs and labels) and retrain it using samples from the new task combined with samples generated from the VAE trained in the previous tasks (generative replay). In this way, there's no need to store all past data and even the first learned batch keeps being refreshed and should not be forgotten.