A COMPREHENSIVE , APPLICATION - ORIENTED STUDY OF CATASTROPHIC FORGETTING IN DNN S
A BSTRACT
We present a large-scale empirical study of catastrophic forgetting (CF) in modern Deep Neural Network (DNN) models that perform sequential (or: incremental) learning.
A new experimental protocol is proposed that enforces typical constraints encountered in application scenarios.
As the investigation is empirical, we evaluate CF behavior on the hitherto largest number of visual classiﬁcation datasets, from each of which we construct a representative number of Sequential
Learning Tasks (SLTs) in close alignment to previous works on CF.
Our results clearly indicate that there is no model that avoids CF for all investigated datasets and SLTs under application conditions.
We conclude with a discussion of potential solutions and workarounds to CF, notably for the EWC and IMM models.
I NTRODUCTION
This article is in the context of sequential or incremental learning in Deep Neural Networks (DNNs).
Essentially, this means that a DNN is not trained once, on a single task D , but successively on two or more sub-tasks D 1 , . . .
, D n , one after another.
Learning tasks of this type, which we term Sequential
Learning Tasks (SLTs) (see Fig.
1a) are potentially very common in real-world applications.
They occur wherever DNNs need to update their capabilities on-site and over time: gesture recognition, network trafﬁc analysis or face and object recognition in mobile robots.
In such scenarios, neural networks have long been known to suffer from a problem termed “catastrophic forgetting”(CF)
(e.g.,
French (1999)) which denotes the abrupt and near-complete loss of knowledge from previous subtasks D 1 , . .
, D k − 1 after only a few training iterations on the current sub-task D k (see Fig.
1b compared to Fig. 1c).
We focus on SLTs from the visual domain with two sub-tasks each, as DNNs show pronounced CF behavior even when only two sub-tasks are involved.
[Figure]
1. D ISCUSSION OF RELATED WORK ON CF
The ﬁeld of incremental learning is large, e.g., Parisi et al.
and Gepperth & Hammer (2016).
Recent systematic comparisons between different DNN approaches to avoid CF are performed in, e.g., Serr`a et al.
(2018) or Kemker et al.
Principal recent approaches to avoid CF include ensemble methods (Ren et al., 2017; Fernando et al., 2017), dual-memory systems (Shin et al., 2017; Kemker & Kanan, 2017; Rebufﬁ et al., 2017; Gepperth & Karaoguz, 2015) and regularization approaches.
Whereas Goodfellow et al.
(2013) suggest Dropout for alleviating CF, the EWC method (Kirkpatrick et al., 2016) proposes to add a term to the energy function that protects weights that are important for the previous sub-task(s).
Importance is determined by approximating the
Fisher information matrix of the DNN.
A related approach is pursued by the Incremental Moment
Matching technique (IMM) (see Lee et al.
(2017)), where weights from DNNs trained on a current and a past sub-tasks are “merged” using the Fisher information matrix.
Other regularization-oriented approaches are proposed in Aljundi et al.
; Srivastava et al.
and Kim et al.
(2018) which focus on enforcing sparsity of neural activities by lateral interactions within a layer.
Number of tested datasets In general, most methods referenced here are evaluated only on a few datasets, usually on MNIST (LeCun et al., 1998) and various derivations thereof (permutation, rotation, class separation).
Some studies make limited use of CIFAR10, SVHN, the Amazon sentiment analysis problem, and non-visual problems such as data from Q-learning of Atari games.
A largescale evaluation on a huge number of qualitatively different datasets is still missing 1 .
Model selection and prescience Model selection (i.e., selecting DNN topology and hyperparameters) is addressed in some approaches (Goodfellow et al., 2013) but on the basis of a “prescient” evaluation where the best model is selected after all tasks have been processed, an approach which is replicated in Kirkpatrick et al. (2016).
This amounts to a knowledge of future sub-tasks which is problematic in applications.
Most approaches ignore model selection (Lee et al., 2017;
Srivastava et al., 2013; Aljundi et al., 2018; Kim et al., 2018), and thus implicitly violate causality.
Storage of data from previous sub-tasks From a technical point of view, DNNs can be retrained without storing training data from previous sub-tasks, which is done in Goodfellow et al.
and
Srivastava et al.
For regularization approaches, however, there are regularization parameters that control the retention of previous knowledge, and thus must be chosen with care.
In Kirkpatrick et al.
(2016), this is λ , whereas two such quantities occur in Lee et al.
(2017): the “balancing” parameter α and the regularization parameter λ for L2-transfer.
The only study where regularization parameters are obtained through cross-validation (which is avoided in other studies) is Aljundi et al.
(2018) (for λ SNI and λ Ω )
but this requires to store all previous training data.
This review shows that enormous progress has been made, but that there are shortcomings tied to applied scenarios which need to be addressed.
We will formalize this in Sec.
1.2 and propose an evaluation strategy that takes these formal constraints into account when testing CF in DNNs.
1. I NCREMENTAL LEARNING IN APPLIED SCENARIOS
When training a DNN model on SLTs, ﬁrst of all the model must be able to be retrained at any time by new classes (class-incremental learning).
Secondly, it must exhibit retention, or at least graceful decay, of performance on previously trained classes.
Some forgetting is probably unavoidable, but it should be gradual and not immediate, i.e., catastrophic.
However, if a DNN is operating in, e.g., embedded devices or autonomous robots, additional conditions may be applicable:
Low memory footprint Data from past sub-tasks cannot be stored and used for re-training, or else to determine when to stop re-training.
Causality Data from future sub-tasks, which are often known in academic studies but not in applications, must not be utilized in any way, especially not for DNN model selection.
This point might seem trivial, but a number of studies such as Kirkpatrick et al.
; Goodfellow et al.
and
Srivastava et al.
(2013) perform model selection in hindsight, after having processed all sub-tasks.
Constant update complexity Re-training complexity (time and memory) must not depend on the number of previous sub-tasks, thus more or less excluding replay-based schemes such as Shin et al.
Clearly, even if update complexity is constant w.r.t.
the number of previous sub-tasks, it should not be too high in absolute terms either.
1. C ONTRIBUTION AND PRINCIPAL CONCLUSIONS
The original contributions of our work can be summarized as follows:
• We propose a training and evaluation paradigm for incremental learning in DNNs that enforces typical application constraints, see Sec. 1.2.
The importance of such an applicationoriented paradigm is underlined by the fact that taking application constraints into account leads to radically different conclusions about CF than those obtained by other recent studies on CF (see Sec. 1.1).
• We investigate the incremental learning capacity of various DNN approaches (Dropout, LWTA, EWC and IMM) using the largest number of qualitatively different classiﬁcation datasets so far described.
We ﬁnd that all investigated models are afﬂicted by catastrophic forgetting, or else in violation of application constraints and discuss potential workarounds.
• We establish that the “permuted” type of SLTs (e
g., “permuted MNIST”) should be used with caution when testing for CF.
• We do not propose a method for avoiding CF in this article.
This is because avoiding CF requires a consensus on how to actually measure this effect: our novel contribution is a proposal how to do just that.
M ETHODS AND DNN MODELS
We collect a large number of visual classiﬁcation datasets, from each of which we construct SLTs according to a common scheme, and compare several recent DNN models using these SLTs.
The experimental protocol is such that application constraints, see Sec.
1.2, are enforced.
For all tested DNN models (see below), we use a TensorFlow (v1.7) implementation under Python (v3.4 and later).
The source code for all processed models, the experiment-generator and evaluation routine can be found on our public available repository 2 .
FC
A normal,
fully connected FC feed forward DNN with a variable number and size of hidden layers, each followed by ReLU, and a softmax readout layer minimizing cross-entropy.
CONV A convolutional neural network CNN) based on the work of Cirean et al.
It is optimized to perform well on image classiﬁcation problems like MNIST.
We use a ﬁxed topology: two conv-layers with 32 and 64 ﬁlters of size 5 × 5 plus ReLU and 2 × 2 max-pooling, followed by a fc-layer with 1024 neurons and softmax readout layer minimizing a cross-entropy energy function.
EWC The Elastic Weight Consolidation (EWC) model presented by Kirkpatrick et al.
LWTA
A fully-connected DNN with a variable number and size of hidden layers, each followed by a Local Winner Takes All (LWTA) transfer function as proposed in Srivastava et al.
IMM
The Incremental Moment Matching model as presented by Lee et al.
We examine the weight-transfer techniques in our experiments, using the provided implementation.
D-FC and D-CONV Motivated by Goodfellow et al.
we combine the FC and CONV models with Dropout as an approach to solve the CF problem.
Only FC and CONV are eligible for this, as
EWC and IMM include dropout by default, and LWTA is incompatible with Dropout.
2. H YPER - PARAMETERS AND MODEL SELECTION
We perform model selection in all our experiments by a combinatorial hyper-parameter optimization, whose limits are imposed by the computational resources available for this study.
In particular, we vary the number of hidden layers L ∈ { 2 , 3 } and their size S ∈ { 200 , 400 , 800 } (CNNs excluded), the learning rate (cid:15) 1 ∈ { 0 . 01 , 0 . 001 } for sub-task D 1 , and the re-training learning rate (cid:15) 2 ∈ { 0 . 001 , 0 . 0001 , 0 . 00001 } for sub-task D 2 .
The batch size (batch size ) is ﬁxed to 100 for all experiments, and is used for both training and testing.
As in other studies, we do not use a ﬁxed number of training iterations, but specify the number of training epochs (i.e., passes through the whole dataset) as E = 10 for each processed dataset (see Sec. 2.2), which allows an approximate comparison of different datasets.
The number of training/testing batches per epoch, B , can be calculated from the batch size and the currently used dataset size.
The set of all hyper-parameters for a certain model, denoted P , is formed as a Cartesian product from the allowed values of the hyperparameters L , S , (cid:15) 1 , (cid:15) 2 and complemented by hyper-parameters that remain ﬁxed ( E , batch size ) or are particular to a certain model.
For all models that use dropout, the dropout rate for the input layer is ﬁxed to 0 . 2 , and to 0 .
5 for all hidden layers.
For CNNs, the dropout rate is set to 0 .
5 for both input and hidden layers.
All other hyper-parameters for CNNs are ﬁxed, e.g., number and size of layers, the max-pooling and ﬁlter sizes and the strides ( 2 × 2 ) for each channel.
These decisions were made based on the work of Goodfellow et al.
The LWTA block size is ﬁxed to 2 , based on the work of Srivastava et al.
The model parameter λ for EWC is set to λ 1 /(cid:15) 2 (set but not described in the source code of Kirkpatrick et al.
For all models except IMM, the momentum parameter for the optimizer is set to µ = 0 .
(Sutskever et al., 2013).
For the IMM models, the SGD optimizer is used, and the regularizer value for the L2-regularization is set to 0 .for
L2-transfer and to 0 .
for weight transfer.
D ATASETS
We select the following datasets (see Tab. 1).
In order to construct SLTs uniformly across datasets, we choose the 10 best-represented classes (or random classes if balanced) if more are present.
MNIST (LeCun et al., 1998) is the common benchmark for computer vision systems and classiﬁcation problems.
It consist of gray scale images of handwritten digits (0-9).
EMNIST (Cohen et al., 2017) is an extended version of MNIST with additional classes of handwritten letters.
There are different variations of this dataset: we extract the ten best-represented classes from the By Class variation containing 62 classes.
Fruits 360 (Murean & Oltean, 2017) is a dataset comprising fruit color images from different rotation angles spread over 75 classes, from which we extract the ten best-represented ones.
Devanagari (Acharya, 2015) contains gray scale images of Devanagari handwritten letters.
From the 46 character classes (1.700 images per class) we extract 10 random classes.
FashionMNIST (Xiao et al., 2017) consists of images of clothes in 10 classes and is structured like the MNIST dataset.
We use this dataset for our investigations because it is a “more challenging classiﬁcation task than the simple MNIST digits data (Xiao et al., 2017)”.
SVHN (Netzer & Wang, 2011) is a 10-class dataset based on photos of house numbers (0-9).
We use the cropped digit format, where the number is centered in the color image.
CIFAR10 (Krizhevsky, 2009) contains color images of real-world objects e.g, dogs, airplanes etc.
NotMNIST (Bulatov Yaroslav) contains grayscale images of the 10 letter classes from “A” to “J”, taken from different publicly available fonts.
MADBase (Abdelazeem Sherif & El-Sherif Ezzat) is a modiﬁed version of the “Arabic Digits dataBase”, containing grayscale images of handwritten digits written by 700 different persons.
[Table]
2. S EQUENTIAL L EARNING T ASKS (SLT S )
As described in Sec. [Table] each SLT consists of two sub-tasks D 1 and D 2 .
For each dataset (see
Sec. 2.2) [Table] these are deﬁned by either applying different spatial permutations to all image data (DP10- 10 type SLTs), or by subdividing classes into disjunct groups (see Tab. 2).
For the latter case, we include SLTs where the second sub-task adds only 1 class (D9-1 type SLTs) or 5 classes (D5-5 type SLTs)
, since CF may be tied to how much newness is introduced. We include permutations (DP1010) since we suspected that this type of SLT is somehow much easier than others, and therefore not a good incremental learning benchmark.
As there are far more ways to create D5-5 type SLTs than
D9-1 type SLTs, we create more of the former (8-vs-3) in order to avoid misleading results due to a particular choice of subdivision, whereas we create only a single permutation-type SLT.
[Table]
E XPERIMENTS
This study presents just one, albeit very large, experiment, whose experimental protocol implements the constraints from Sec. 1.2.
Every DNN model from Sec. 2 is applied to each SLT as deﬁned in Sec.
2.3 while taking into account model selection, see Sec. 2.1.
A precise deﬁnition of our application-oriented experimental protocol is given in Alg.
For a given model m and an SLT ( D 1 and D 2 ), the ﬁrst step is to determine the best hyper-parameter vector (cid:126)p ∗ for sub-task D 1 only (see lines 1-4), which determines the model m (cid:126)p ∗ used for re-training.
In a second step, m (cid:126)p ∗ (from line 5) is used for re-training on D 2 , with a different learning rate (cid:15) 2 which is varied separately.
We introduce two criteria for determining the ( (cid:15) 2 -dependent) quality of a re-training phase (lines 6-10): “best”, deﬁned by the highest test accuracy on D 1 ∪ D 2 , and “last”, deﬁned by the test accuracy on D 1 ∪ D 2 at the end of re-training.
Although the “best” criterion violates the application constraints of Sec. 1.2 (requires D 1 ), we include it for comparison purposes.
Finally, the result is computed as the highest (cid:15) 2 -dependent quality (line 11).
Independently of the second step, another training of m (cid:126)p ∗ is conducted using D 1 ∪ D 2 , resulting in what we term baseline accuracy .
Evaluation for IMM differs slightly: in line 5, a copy of m (cid:126)p ∗ is kept, termed m 1 (cid:126)p ∗ , and the weights of m (cid:126)p ∗ are re-initialized.
After selecting the best re-trained model m 2 (cid:126)p ∗ as a function of (cid:15) 2 , ﬁnal performance q (cid:126)p ∗ is obtained by ”merging” the models m 1 (cid:126)p ∗ and m 2 (cid:126)p ∗ and testing the result.
Algorithm 1: The application-oriented evaluation strategy used in this study.
Data: model m , SLT with sub-tasks D 1 , D 2 , hyper-parameter value set P
Result: incremental learning quality for model with hyper-parameters (cid:126)p ∗ : q (cid:126)p ∗ 1 forall (cid:126)p ∈ P do // determine accuracy for all hyper-parameters when training on D 1for t ← 0 to E · B do train( m (cid:126)p , D train, (cid:15) 1 ) (cid:126)p,t , D ∗ do
m
∗ train( (cid:126)p ∗ ,(cid:15) 2 , train, (cid:15) 2 ) q ∗
F INDINGS
The results of the experiment described in Sec. 3 are summarized in Tab. 3, and in Tab. 4 for IMM.
They lead us to the following principal conclusions:
Permutation-based SLTs should be used with caution We ﬁnd that DP10-10, the SLT based on permutation, does not show CF for any model and dataset, which is exemplary visualized for the
FC model in Fig.
2 which fails completely for all other SLTs.
While we show this only for SLTs with two sub-tasks, and it is unknown how experiments with more sub-tasks would turn out, we nevertheless suggest caution when intepreting results on permutation-based SLTs.
[Figure]
All examined models exhibit CF While this is not surprising for FC and CONV, D-FC as proposed in Goodfellow et al.
(2013) performs poorly (see Fig. 3), as does LWTA (Srivastava et al., 2013) [Figure]
For EWC and IMM
[Figure]
the story is slightly more complex and will be discussed below
[Figure]
EWC is mildly effective against CF for simple SLTs.
Our experiments shows that EWC is effective against CF for D9-1 type SLTs, at least when the “best” evaluation criterion is used, which makes use of D 1 .
This, in turn, violates the application requirements of Sec. 1.2.
For the “last” criterion not making use of D 1 , EWC performance, though still signiﬁcant, is much less impressive.
We can see the origins of this difference illustrated in Fig.
[Figure]
EWC is ineffective against CF for more complex problems.
Tab.
3 shows that EWC cannot prevent CF for D5-5 type SLTs, see Fig.
Apparently, the EWC mechanism cannot protect all the weights relevant for D 1 here, which is likely to be connected to the fact that the number of samples in both sub-tasks is similar.
This is not the case for D9-1 type tasks where EWC does better and where D 2 has about 10% of the samples in D 1 .
[Figure] [Figure]
[Equation] -CONV
LWTA
[Table]
[Table] [Table] [Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
a
[Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
[Table] [Table]
[Table]
[Table] [Table]
[Table]
F r u it s
D5- .
D9- .
DP101 . 0 / .1 .
M AD B a s e
D5- .
D9- .
DP10- .
M N I S T
D5- .
D9- .
DP10- .
N o t M N
I S T
D5- .
D9- .
DP [Table]
S
[Table]
D
[Table]
DP
[Table]
DP
[Table] [Table] [Table]
[Table]
IMM is effective for all SLTs but unfeasible in practice.
As we can see from Tab. 4, wtIMM clearly outperforms all other models compared in Tab. 3.
Especially for the D5-5 type SLTs, a modest incremental learning quality is attained, which is however quite far away from the baseline accuracy, even for MNIST-derived SLTs.
This is in contrast to the results reported in Lee et al.
(2017) for MNIST: we attribute this discrepancy to the application-oriented model selection procedure using only D 1 that we perform.
In contrast, in Lee et al.
(2017), a model with 800/800/800 neurons, for which good results on MNIST are well-established, is chosen beforehand, thus arguably making implicit use of D 2 .
A signiﬁcant problem of IMM is the determination of the balancing parameter α , exemplarily illustrated in Fig.
Our results show that the optimal value cannot simply be guessed from the relative sizes of D 1 and D 2 , as it is done in Lee et al.
(2017), but must be determined by cross-validation, thereby requiring knowledge of D 1 (violates constraints).
Apart from these conceptual issues, we ﬁnd that the repeated calculation of the Fisher matrices is quite time and memory-consuming ( > 4h and > 8GB), to the point that the treatment of SLTs from certain datasets becomes impossible even on high-end machine/GPU combinations when using complex models.
This is why we can evaluate IMM only for a few datasets.
It is possible that this is an artifact of the TensorFlow implementation, but in the present state IMM nevertheless violates not one but two application constraints from Sec. 1.2.
Fig.
7 and Fig.
8 give a visual impression of training an IMM model on D9-1 and D5-5 type SLTs, again illustrating basic feasibility, but also the variability of the “tuning curves” we use to determine the optimal balancing parameter α .
[Figure]
epoch
[Figure] [Figure]
C ONCLUSIONS
The primary conclusion from the results in Sec. 4 is that CF still represents a major problem when training DNNs.
This is particularly true if DNN training happens under application constraints as outlined in Sec. 1.2.
Some of these constraints may be relaxed depending on the concrete application: if some prior knowledge about future sub-task exists, it can be used to simplify model selection
e p o c h
[Figure]
d a t a s e t C I F A R 10 F r u i t s S V H N D e v a n a g a r
i M N I S T
F a s h
i o n M N I S T M A D B a s e a cc u r a c y 0.
[Figure]
[Table]
and improve results.
If sufﬁcient resources are available, a subset of previously seen data may be kept in memory and thus allow a “best” type evaluation/stopping criterion for re-training, see Alg. 1.
Our evaluation approach is similar to Kemker et al.
and we adopt some measures for CF proposed there.
A difference is the setting of up to 10 sub-tasks, whereas we consider only two of them since we focus less on the degree but mainly on presence or absence of CF.
Although comparable both in the number of tested models and benchmarks, Serr`a et al.
(2018) uses a different evaluation methodology imposing softer constraints than ours, which is strongly focused on application scenarios.
This is, to our mind, the reason why those results differ signiﬁcantly from ours and underscores the need for a consensus of how to measure CF.
In general application scenarios without prior knowledge or extra resources, however, an essential conclusion we draw from Sec.
4 is that model selection must form an integral part of training a
DNN on SLTs.
Thus, a wrong choice of hyper-parameters based on D 1 can be disastrous for the remaining sub-tasks, which is why application scenarios require DNN variants that do not have extreme dependencies on hyper-parameters such as layer number and layer sizes.
Lastly, our ﬁndings indicate workarounds that would make EWC or IMM practicable in at least some application scenarios.
If model selection is addressed, a small subset of D 1 may be kept in memory for both methods: to determine optimal values of α for IMM and to determine when to stop re-training for EWC.
Fig.
6 shows that small changes to α do not dramatically impact ﬁnal accuracy for IMM, and Fig.
4 indicates that accuracy loss as a function of re-training time is gradual in most cases for EWC.
The inaccuracies introduced by using only a subset of D 1 would therefore not be very large for both algorithms.
To conclude, this study shows that the consideration of applied scenarios signiﬁcantly changes the procedures to determine CF behavior, as well as the conclusions as to its presence in latestgeneration DNN models.
We propose and implement such a procedure, and as a consequence claim that CF is still very much of a problem for DNNs.
More research, either on generic solutions, or on workarounds for speciﬁc situations, needs to be conducted before the CF problem can be said to be solved.
A minor but important conclusion is that results obtained on permutation-type SLTs should be treated with caution in future studies on CF.
A CKNOWLEDGMENTS
We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Titan Xp
GPU used for this research.
A A DDITIONAL EVALUATION METRICS
[Table]
D
[Table]
DP
[Table]
E
[Table]
S
[Table]
D
[Table]
[Table]
[Table]
D
[Table]
DP
[Table]
[Table]
D
[Table] [Table]
DP
[Table]
[Table] e
D
[Table]
D
[Table]
DP10- . 99 / 1 .. 99 / 1 .. 99 / 1 .. 99 / 1 .. 98 / 1 .1 . M
[Table]
[Table] [Table]
[Table]
[Table]
[Table]
[Table] [Table] [Table]
[Table]
DP10- . 80 / 1 .. 52 / 0 .. 20 / 1 .. 20 / 4 .. 80 / 1 .. 44 / .100%
[Table]
B S ELECTED EXPERIMENTAL RESULTS AS 2D PLOTS
Here, we present the best results of all algorithms on the MNIST, EMNIST and Devanagari datasets (according to the “best” criterion) for the D9-1b SLT, and the best EWC results on the D5-5d SLT (qualitatively identical to the other D5-5 type SLTs).
Such 2D representations of some experimental results, to be just as Fig.
4, may give more clear insights into the details of each experiment.
Here we can observe CF behavior for all algorithms except EWC and IMM for D9-1b.
We can infer that there was no discernible dependency between the occurrence of CF and particular hyperparameter settings (number and size of layers, in particular) since these are already the best experiments for each algorithm and dataset: if these show CF, this means that non of the settings we sampled were able to prevent CF.
EWC shows clear CF for the Devanagari dataset, but might conceivably do better on EMNIST given a little more time for learning D 2 (this will be investigated).
For D5-5d, clear CF occurs even for EWC.
IMM does not exhibit CF for D9-1b (at enormous computations cost, though), and we observe that the value for the balancing parameter cannot simply be set to 0.9 respectively 0.1, as it has its argmax elsewhere.
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] [Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
e s t a cc u r a c y
[Figure]
e s t a cc u r a c y
[Figure]
[Table]
alpha
[Table]
[Figure]
[Table] [Figure] [Table]
[Figure]
[Table]
[Figure]
a cc
[Table]
a c y
[Figure]