C ONTINUAL DEEP LEARNING BY F UNCTIONAL R EGULARISATION OF M EMORABLE P AST
Anonymous authors
Paper under double-blind review
A BSTRACT
Continually learning new skills without forgetting old ones is an important quality for an intelligent system, yet most deep learning methods suffer from catastrophic forgetting of the past.
Recent works have addressed this by regularising the network weights, but it is challenging to identify weights crucial to avoid forgetting.
A better approach is to directly regularise the network outputs at past inputs, e.g., by using Gaussian processes (GPs), but this is usually computationally challenging.
In this paper, we propose a scalable functional-regularisation approach where we regularise only over a few memorable past examples that are crucial to avoid forgetting.
Our key idea is to use a GP formulation of deep networks, enabling us to both identify the memorable past and regularise over them.
Our method achieves state-of-the-art performance on standard benchmarks and opens a new direction for life-long learning where regularisation methods are naturally combined with memory-based methods.
I NTRODUCTION
The ability to quickly adapt to changing environments is an important quality of intelligent systems.
For such quick adaptation, it is important to be able to identify, memorise, and recall useful past experiences when acquiring new ones.
Unfortunately, standard deep-learning methods are not good at maintaining previously acquired skills, and can quickly forget them when learning new skills (Kirkpatrick et al., 2017).
Such catastrophic forgetting presents a big challenge when deploying deep-learning methods for applications, such as robotics, where new tasks can appear during the training, and data from the previous tasks might be unavailable for retraining.
In recent years, many methods have been proposed to address catastrophic forgetting in deep learning.
One of the most popular approaches is to regularise the network weights to keep them close to the weights obtained for the previous tasks/data (Kirkpatrick et al., 2017; Nguyen et al., 2018;
Zenke et al., 2017; Ebrahimi et al., 2019; Serra et al., 2018).
This is challenging due to the difﬁculty in identifying the weights that are relevant to past tasks.
The exact values of the weights in fact do not matter directly, but rather the network output (Benjamin et al., 2018).
Figuring out which weight affects the output is therefore usually difﬁcult.
Typically, the Fisher information matrix or covariance matrices over weights are used (Kirkpatrick et al., 2017; Nguyen et al., 2018), but they only partially address the issue.
A better approach is to directly regularise the network outputs, also referred to as functionalregularisation , requiring a memory of past examples (Benjamin et al., 2018; Lopez-Paz & Ranzato, 2017; Rebufﬁ et al., 2017).
However, such methods still lack a mechanism to automatically weight more relevant past memory in the context of the new task, and also do not take uncertainty of the output into account.
Methods based on Gaussian processes do this automatically (Titsias et al., 2019), but require optimisation over inducing points and speciﬁcation of a good kernel, both of which are difﬁcult tasks.
In summary, existing methods fall short in building scalable functional-regularisation methods for continual learning.
In this paper, we propose a new functional-regularisation method where we regularise over a few memorable past examples (see Fig. 1).
Our approach builds upon a recent method of Khan et al.
(2019) that expresses deep networks as Gaussian processes (GPs).
We show that the GP formulation not only enables the identiﬁcation of examples crucial to avoid forgetting, but also computes uncertainty over the network output to appropriately weight the past examples in the light of new
[Figure]
ones. Motivated by the GP perspective, we propose a new loss function for function-regularisation with deep networks.
A Laplace approximation of this objective enables scalable training.
Our work in this paper focusses on avoiding forgetting, but it opens a new direction for life-long learning methods where regularisation methods are naturally combined with memory-based methods.
Other related works.
Broadly, existing work on continual learning can be split into three approaches: inference based, memory/rehearsal based, and model based.
Inference based approaches have mostly focused on weight regularisation, with some recent efforts on functional regularisation.
Our work falls in the latter category.
Memory based approaches either maintain a memory of past data examples (Rebufﬁ et al., 2017) or train generative models on previous tasks to rehearse pseudo-inputs (Shin et al., 2017).
An advantage of our method compared to previous ones is that building memory does not require solving an optimisation problem: the computation simply involves a forward-pass through the network followed by sorting (see Section 3.2).
Similarly to our work, there have also been some efforts in combining the different ﬂavours of approaching continual learning, e.g., VCL plus coresets (Nguyen et al., 2018) and Gradient-Episodic
Memory (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2018).
Benjamin et al.
(2018) have proposed a similar combination for functional regularisation.
In these approaches, two separate methods are usually used for regularisation and memory-building.
Recent follow-up work (Aljundi et al., 2019;
Chaudhry et al., 2019) has focussed on improving memory-building methods, but this separation has remained the case.
In contrast, in our approach, both of these are done within the same GP framework by using the method of Khan et al.
Finally, model based approaches change the model architecture during training (Rusu et al., 2016), and this can be combined with other approaches (Schwarz et al., 2018).
It is possible to use similar features in our GP based framework, which is an interesting future direction to be pursued.
C ONTINUAL L EARNING WITH W EIGHT /F UNCTIONAL R EGULARISATION
In deep learning, we minimise loss functions to estimate network weights.
For example, in supervised multi-class classiﬁcation problems, we are given a dataset D of N input-output pairs with outputs y i , a vector of K classes, and inputs x i , a vector of length D , and our goal is to minimise a loss which takes the following form: ¯ (cid:96) ( w ) + δ R ( w ) ,
where ¯ (cid:96) ( w ) :
= 1 N (cid:205) N i = 1 (cid:96) ( y i , f w ( x i )) with deep neural network f w ( x ) ∈ R K and its weights w .
(cid:96) ( y , ˆ y ) denotes a differentiable loss function between an output y and its prediction ˆ y , R ( w ) is a regularisation function (usually an L 2 -regulariser
R ( w ) = w (cid:62) w ) and δ > 0 controls the regularisation strength.
Standard deep-learning approaches rely on an unbiased stochastic-gradient of the loss ¯ (cid:96) , which usually requires access to all of the data examples for all classes (Bottou, 2010).
It is this unbiased, minibatch setting where deep-learning excels and achieves state-of-the-art performance on many benchmark datasets.
In reality, we do not always have access to all the data at once, and it is not possible to obtain unbiased stochastic gradients.
New classes may appear during training and old classes may never be seen again.
For such settings, vanilla mini-batch stochastic-gradient methods lead to catastrophic forgetting of past information (Kirkpatrick et al., 2017).
Our goal in this paper is to design methods that can avoid such catastrophic forgetting.
We focus on a particular setting where the classiﬁcation task is divided into several tasks, e.g., a task may consist of a classiﬁcation problem over a subset of classes.
We assume that the tasks arrive sequentially one after the other.
Once the learning is over, we may never see that task again.
Such continual-learning settings have been considered in previous works (Kirkpatrick et al., 2017; Nguyen et al., 2018;
Zenke et al., 2017), and our goal is to avoid forgetting of old tasks in this setting.
Recent methods have proposed weight-regularisation as a way to combat catastrophic forgetting.
The main idea is to keep the new network weights close to the old ones, e.g., when training a task t while given network weights w t − 1 trained on task t − 1 , we can minimise the following loss: ¯ (cid:96) t ( w ) + δ ( w − w t − 1 ) (cid:62) F t ( w − w t − 1 ) , where ¯ (cid:96) t ( w ) is the loss deﬁned over all data examples from task t and F t is a preconditioning matrix that favors the weights relevant to the past tasks more than the rest.
The Elastic-Weight Consolidation (EWC) method (Kirkpatrick et al., 2017), for example, uses the Fisher information matrix as the pre-conditioner, while Ritter et al.
(2018) use the Hessian of the loss, and VCL (Nguyen et al., 2018) essentially employs the precision matrix of the variational approximation to do the same.
Such weight-space methods reduce forgetting but do not produce satisfactory results.
The challenge in using weight-regularisation lies in the fact that the exact values of the weights do not really matter due to parametric symmetries (Benjamin et al., 2018; Bishop, 2006).
Since only the network outputs matter, an alternative approach is to directly regularise these.
Benjamin et al.
(2018) propose to use an L 2 -regulariser over the function values on data examples from past tasks:
[Equation]
where M s is the set of small examples for task s stored in the working memory (Lopez-Paz &
Ranzato, 2017; Rebufﬁ et al., 2017).
One major issue with this approach is that the L 2 -regulariser weights all the data points equally.
In reality, some examples in the memory are more important than others to learn a given task.
In addition, the uncertainty of the prediction is also ignored.
As we will show, working with distributions over functions allows us to address these two issues.
Gaussian processes (GPs), for example, enable automatic reweighting of old tasks in light of a new one, which happens by using the posterior covariance.
Unfortunately, both scalability of GPs as well as the necessity to save many instances of the past makes them impractical.
A recent approach by
Titsias et al.
(2019) attempts to address these issue by employing sparse GP methods with inducing points and using a neural network feature map.
However, their approach has some difﬁculties.
Their approach heavily depends on a proper choice of inducing points, which are normally obtained via an ad-hoc procedure. Additionally, they propose using the last layer of the neural network as kernel features, which is limiting as it does not use the whole network’s weights in the kernel.
Ideally, we would want to perform functional regularisation with a deep learning optimiser while borrowing ideas from the GP methods.
Our work in this paper takes a step in this direction.
Our proposal is to use a GP formulation of neural networks to perform functional regularisation that still allows training with standard deep-learning methods.
We also show that the GP view helps in selecting an informative set of memory points.
F UNCTIONAL -R EGULARISATION OF M EMORABLE P AST (FROMP)
We will now describe our proposed method.
The ﬁrst step is to use the GP formulation of Khan et al.
(2019) to compute GP-like posteriors over functions.
Then, we propose a method to identify a set of memorable past examples for a task.
Finally, we describe our functional-regularisation and discuss approximations used to build a scalable method.
3. F ROM D EEP N ETWORKS TO G AUSSIAN P ROCESS P OSTERIORS
Khan et al.
(2019) propose an approach to convert deep networks into Gaussian processes.
Their main result (see Theorem 1 in their paper) states that, at a local minimiser w ∗ of ¯ (cid:96) ( w ) + δ 2 w (cid:62) w , a
Laplace approximation of the posterior over w is equivalent to the posterior distribution of a linear model.
Speciﬁcally, they use the following scalable variant of the Laplace approximation: p ( w |D)
≈ q ( w ) :
= N( w | µ , Σ ) , where µ = w ∗ and Σ − 1 =
[Equation]
where J ( x i ) :
= ∇ w f w ( x i ) (cid:62) is a K × P Jacobian matrix ( P being the number of parameters), and Λ ( x , y ) : = ∇ 2 ff (cid:96) ( y , f ) is the K × K Hessian of the loss with f = f w ( x ) , all evaluated at w = w ∗ .
They show that q ( w ) is equal to the posterior of the following linear model: ˜ y
[Equation]
, with (cid:15) ∼ N( 0 , ( Λ ( x , y )) −
[Equation] and w ∼ N( 0 , δ − 1 I P ) , (3) where the observations are deﬁned as ˜ y
i : =
J ( x i ) w ∗ − (cid:0) Λ ( x i , y i ) (cid:1) − 1 r
( x i , y i ) with the residual r ( x , y ) : = ∇ f (cid:96) ( y , f ) .
They also show that the predictive distribution of this linear model is equivalent to that of a GP regression model deﬁned with a K × K neural tangent kernel (NTK)
(Jacot et al., 2018):
[Equation]
The above result gives a posterior in the deﬁned observation space of ˜ y . In the case where we can ﬁnd a map from ˜ y to y , the above inference problem allows for reparameterisation into the original data space.
Therefore, we will obtain a GP that serves as an approximation to the neural network posterior.
Below, we demonstrate this for binary classiﬁcation with sigmoid link function and Bernoulli likelihood (see Appendix A for details and extension to multi-class classiﬁcation).
We parameterise the Bernoulli likelihood by p ( x ) :
= σ ( f w ∗ ( x )) where σ is the sigmoid function (note that we now have scalars { f , y , ... } as we are dealing with a single output). The residual and loss Hessian for this model are given by r ( x , y )
=
p ( x ) − y and Λ ( x , y ) = p ( x )( 1 − p ( x )) , respectively, where y ∈ { 0 , 1 } .
Because residuals are linear in y and the Hessian is independent of y, we can substitute the deﬁnitions of ˜ y and r ( x , y ) into Eq. 3, and rearrange for y,
[Equation]
(cid:123)(cid:122) (cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32)(cid:32) (cid:125) :
= f lin ( x ) + τ, with τ ∼ N( 0 , Λ ( x , y )) and w ∼ N( 0 , δ − 1 I P ) .
The Laplace approximation in Eq. 2 is the posterior of this model after observing data D .
We can equivalently write the posterior predictive as a GP (Rasmussen, 2003) with mean and covariance [Equation]
[Equation]
A GP deﬁned with the above mean and covariance function can be viewed as an approximation to the posterior process over network outputs.
Throughout the paper, we will denote the process obtained at a weight w ∗ by a distribution q w ∗ ( f ) where f is a vector of f ( x ) evaluated at many different inputs x .
We will use this GP posterior predictive for functional regularisation.
3. M EMORABLE PAST
In the previous section, we derived a GP posterior approximation over the network outputs.
Now, we propose a method to obtain a small set of examples that are crucial to avoid forgetting.
We ﬁrst note that the posterior GP mean in Eq. 4 corresponds to a kernel Ridge regression that requires the computation of ( δ − 1 K + Λ − 1 ) − 1 ˜ y where Λ is a block-diagonal matrix containing all Λ i : = Λ ( x i , y i ) and K is the NTK deﬁned in Eq. 4.
The predictions therefore strongly depend on the eigenvalues of the preconditioning matrix.
Selection of important data examples therefore boils down to selecting [Table] [Table] [Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
[Table]
[Table]
[Table]
[Table]
important columns of this matrix, such that the predictions remain unchanged.
The theory of leverage score sampling (Alaoui & Mahoney, 2015; Bach, 2013) suggests picking the points proportional to the leverage score deﬁned to be the diagonal of the following matrix:
K ( K + δ Λ − 1 ) − 1 .
Typically, this matrix is difﬁcult to compute and methods are employed to approximately obtain the leverage score (Alaoui & Mahoney, 2015).
For deep-learning applications too, exact computation of leverage score is very difﬁcult.
We instead propose a simple solution.
Since the eigenvalues of the previous matrix heavily depend on δ Λ − 1 i , we can pick the data examples by simply sorting Λ i .
For the inverse of K + δ Λ − 1 to have high eigenvalues, we should favour examples with smaller values of Λ − 1 i .
Therefore, we simply sort the Λ i and pick the top M examples as the most relevant ones.
This simple solution is very effective for our particular problem because Λ i are noise variances for the data examples, obtained by using an already trained network.
These are second derivatives of the loss for data examples, and so also reﬂect the sensitivity of the decision boundaries if a particular data point is perturbed.
Therefore, they tend to reﬂect the relevance of data examples.
An example is shown in Figure 1 where we clearly see that our solution picks the examples lying close to decision boundary.
Computation of Λ i requires us to run the forward pass to get the (cid:96) ( y i , ˆ y i ) and then compute its second derivative with respect to ˆ y i , both of which are cheap operations.
Throughout the paper, examples chosen by this method are referred to as the memorable past examples, and denoted M t for task t .
3. F UNCTIONAL -R EGULARISATION
So far, we described the construction of the GP posterior predictive over the function space, as well as the construction of a set of memorable-past examples.
We are now ready to describe our objective function where we employ these two to perform functional regularisation.
Suppose that we are given network weights w t − 1 that are obtained by training over data examples from task t − 1 .
Our goal then is to train a network with weights w such that its performance on memorable past M 1: t − 1 is unchanged.
We denote the vector of function outputs over these examples by a 1: t − 1 .
A straightforward idea is to directly optimise the weights w such that the predictions using q w ( f t ) are good on current tasks while the predictive distribution q w ( a 1: t − 1 ) is close to q w t − 1 ( a 1: t − 1 ) .
Since the number of tasks can be very large, we choose to regularise each task separately, i.e., we will match q w ( a s ) with q w t − 1 ( a s ) separately for all tasks s < t , in line with Titsias et al.
These choices give us the following objective function with trade-off parameter τ :
[Equation]
[Table]
A major issue with this objective is that computing gradients wrt.
the posterior predictive q w will be computationally heavy as it involves gradients of the Jacobian and Λ i [Table] which involve higher order derivatives.
During training on a task [Table] we have no distribution on parameters (cf.
Laplace approximation)
and can treat it as ﬁxed.
Therefore, taking the gradient wrt.
the parameter w of the above objective will only involve differentiating the mean function m ( x i ) formed by the neural network
[Table]
and we have equivalence to the following objective:
[Equation]
where m s , w t − 1 and K w t − 1 , s are the vector and matrices containing the corresponding mean and co- variance function of the network weights w t − 1 evaluated at the memorable past for task s .
Eqs 6 and 7 are used to calculate m s , w t − 1 and K w t − 1 , s respectively.
Essentially, this gives us something similar to Eq.
1 but instead of the L 2 distance, a kernel is used to improve weighting of examples.
The ﬁnal
FROMP algorithm is summarised in Algorithm 1.
Please see App.
B for details on scaling to the multi-class setting.
The additional time complexity of this algorithm above vanilla Adam is O( MPKt ) per optimisation step, and O([ MPK + M 3 ] t + NPK ) once per task.
O( NPK ) is for updating the Laplace approximation Σ at the end of training on a task, as the Jacobian for each input training point needs to be calculated (as in Eq. 2).
This is similar to EWC (Kirkpatrick et al., 2017).
Note that, as we use a diagonal approximation to Σ , inverting it is fast. O( MPKt ) is for calculating each of the t matrices K w t − 1 , s , and O( M 3 t ) is for inverting them. This is done once before training on each task (Eq. 7).
Finally, during optimisation of the objective function, we need O( MPK ) for differentiating the mean function m ( x i ) .
All of these additional costs are small for small M , except for O( NPK ) , which can be reduced by randomly sampling a subset of the task’s data.
Note that it is possible to be stochastic in sampling a subset of previous tasks’ memory during every update, removing the time complexity dependency on t .
Doing this gives the same overall complexity per step as in Adam (as M is usually of the same order as the mini-batch size).
E XPERIMENTS
We run the proposed method FROMP on toy datasets, permuted MNIST and split MNIST (LeCun et al., 1998; Goodfellow et al., 2013), and a split version of CIFAR-10 and CIFAR-100 (Krizhevsky et al., 2009).
We optimise the objective in Eq.
9 using Adam (Kingma & Ba, 2015) with parameter β 1 = 0 .
99 and further use gradient clipping to speed up training.
To identify the individual beneﬁts of the kernel in the loss (Eq. 9) as well as the selection of data points, we compare the following four methods: FROMP uses kernel and the proposed example selection, while FRORP instead uses randomly chosen examples.
Further, we replace the kernel by an identity matrix leading to functional L 2 regularisation and call the corresponding methods with and without our example selection technique FROMP-
L 2 and FRORP- L 2 .
4. T OY DATASET
We ﬁrst test FROMP on many variations of a toy 2D binary classiﬁcation dataset like that in Figure 1.
We want to test its performance when exposed to different datasets of varying difﬁculty.
We use a t 0 t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 tt 0 tt 2 tt 4 tt 6 tt 8 t [Figure] t 0 t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 tt 0 tt 2 tt 4 tt 6 tt 8 t [Figure]
10 40 70200 Number of examples 0 .0 .0 .
V a li d a t i o n a cc u r a c y
FRORP-L2FROMP-L
FRORPFROMP
[Figure]
2-hidden layer MLP (with 20 hidden units in each layer) for all experiments.
Appendix D.3 details hyperparameter selection.
In Appendix D.1 we show the brittleness and inconsistent behaviour of weight-space regularisation methods.
In contrast, FROMP performs extremely well across many variations, showing consistently good results (see Table 1 and Appendix D.2 for visualisations).
Additionally, as we reduce the number of points (Figure 3), FROMP gracefully reduces accuracy, due to the clever choice of memorable past and the use of kernels in the functional regularisation
[Table]
4. P ERMUTED AND S PLIT MNIST
Permuted MNIST consists of a series of tasks where each task is a ﬁxed permutation of pixels to the entire labelled MNIST dataset.
Like in previous work (Nguyen et al., 2018;
Kirkpatrick et al., 2017;
Zenke et al., 2017; Titsias et al., 2019), we implement a fully connected single-head network with two hidden layers, and report performance after 10 tasks.
Each hidden layer consists of 100 hidden units and ReLU activation functions.
We set the learning rate to 0 .
001 , batch size to 128 , and learn each task for 10 epochs.
We use τ = 1 for both FROMP and FROMP-
L 2 (see Eq. 9).
The Split MNIST experiment was introduced by Zenke et al.
and consists of ﬁve binary classiﬁcation tasks built from MNIST: 0/1, 2/3, 4/5, 6/7, and 8/9.
We use a fully connected multi-head neural network with two hidden layers, each with 256 hidden units and ReLU activation functions.
Following the settings of previous work, we select 40 memorable points per task.
The learning rate is set to 0 .
0001 , batch size to 128 , and we learn each task for 15 epochs.
We ﬁnd optimal parameters τ = 1 and τ = 10 for FROMP and FROMP- L 2 respectively. [Figure] We report the ﬁnal average accuracy for both benchmarks across all the tasks in Table 2.
The proposed method achieves better performance than the weight-space methods EWC and VCL, as well as compared to the function-space method FRCL that is based on a GP formulation.
Further, the benchmarks show superior performance of both the approach to select important examples (Sec. 3.2) and the functional regularisation using the kernel (Sec. 3.3).
Memorable examples improve performance of the naive and efﬁcient FRORP-
L 2 method by more than 6% on permuted MNIST and by 0.2% on the split MNIST.
Standard deviation is also reduced in both cases.
FROMP does not proﬁt much from memorable examples compared to FRORP, probably because the performance is already close to the maximum achievable.
Furthermore, Fig.
3c shows that our selection method greatly reduces the number of memorable points required: the L 2 algorithm with random points requires over 100 points to match the performance when using 20 carefully selected points, and 200 points to match performance with 40, respectively.
When combined with kernel-based functional regularisation, we obtain the best-performing method, particularly when memory size is small.
In line with the toy example in Fig. 1, Fig. 4 illustrates the memorable past examples compared to randomly selected examples.
The memorable past examples appear to be more special cases, and may therefore lie closer to the decision boundary.
Figs. 3a and 3b show the summed kernels across all the classes in permuted MNIST for a random and memorable set of points.
For visualisation purposes, the diagonal is suppressed.
Note that random points lead to less uniform weighting in the kernel, making it even more important in functional regularisation, leading to better performance (FRORP vs FROMP).
All memorable points are important and the kernel is more uniform.
In Fig.
3a, the kernel’s weighting of task 1 is very different from other tasks, leading to different magnitudes in the functional regularisation among tasks and therefore to eventual forgetting.
The kernel further tells us that the tasks are correlated, as expected.
4. S PLIT CIFAR
Split CIFAR is far more complex than the MNIST experiments and consists of 6 tasks.
The ﬁrst task is the full CIFAR-10 dataset, followed by 5 tasks, each consisting of 10 consecutive classes from CIFAR-100.
We follow the SI paper (Zenke et al., 2017) for our model architecture, using a multi-head CNN with 4 convolutional layers, followed by 2 dense layers with dropout.
We use learning rate 0 . 0001 and batch size 256 .
All tasks are learned for 80 epochs and we use a memory of 10–200 examples. We use τ = 0 . 1 and τ = 0 . 05 for FROMP and FROMP-L2 respectively.
In addition to continual learning baselines, we report the performance of networks trained from scratch [Figure] on each task.
These cannot proﬁt from forward/backward transfer.
We also report the performance of a network jointly trained on all tasks.
This is an upper bound on performance.
The experimental results in Fig. 5a show that FROMP outperforms other continual learning methods by a notable margin.
The weight-space methods employed as baselines either cannot learn later tasks to a high accuracy (EWC, SI), or forget previous tasks (VCL).
Interestingly, averaged over all tasks, FROMP also out-performs ‘from scratch’ training and achieves performance close to a jointly training on all tasks by a margin of less than 2%. Note that on tasks 4-6, FROMP achieves the same accuracy as the jointly trained model, showing no forgetting. We also calculate the backward transfer metric BWT from Lopez-Paz & Ranzato (2017). We ﬁnd that FROMP has a score of − 2 .
6 ± 0 .
9 , which is joint best with EWC’s score of − 2 .
3 ± 1 . 4 (VCL+coresets has − 9 . 2 ± 1 . 8 ). Although EWC performs well in backward transfer, it does so at the cost of forward transfer.
We calculate a forward transfer metric as the average of the improvement in accuracy on a new task over an independently trained model on that task (see App.
C for more precise deﬁnitions of these metrics).
FROMP achieves a forward transfer of 6 . 1 ± 0 .
7 , whereas EWC has 0 .
17 ± 0 .
9 and VCL+coresets has 1 . 8 ± 3 . 1 .
Although we only focussed on preventing catastrophic forgetting, we ﬁnd evidence of forward transfer, a key requirement in continual learning.
Overall, given ﬁnal average accuracy, backward transfer and forward transfer, FROMP clearly outperforms the other baselines.
In contrast to the rather simple MNIST benchmarks, both the beneﬁt of selecting memorable points as well as using the kernel are clearly visible in Fig. 5b.
If we only memorise a few examples, the performance gap due to using the kernel is around 4%.
The selection of memorable points according to our metric leads to an increase in performance of around 7%.
Applying both kernel and memorable point selection increases the performance by up to 11%.
Additionally, standard deviation is reduced when using memorable points or the kernel.
It is clear that both parts of the proposed algorithm are vital in achieving state-of-the-art performance on this benchmark.
D ISCUSSION
We propose FROMP, a scalable function-regularisation approach for continual learning.
FROMP uses a GP formulation of neural networks to select memorable past examples, regularising them using a kernel, and achieving state-of-the-art performance across benchmarks.
This work enables a new way of combining regularisation methods and memory-based methods in continual learning.
Future research could investigate other ways of selecting a memorable past (e.g. ﬁxed memory size), more efﬁcient ways of calculating kernel matrices, and the case where data does not arrive in tasks.
A D ETAILS ON D EEP N ETWORKS TO G AUSSIAN P ROCESSES
In this section, we detail the map that is presented in Sec.
3.1 to go from the posterior of a deep neural network to a Gaussian process.
The map for linear regression and logistic regression can be found in the appendix of Khan et al.
We recap the map for logistic regression and, in addition, walk through the case of softmax regression here.
Recall the linear model from Eq. 3:
Model:
[Equation]
, with
[Equation]
Inference in this model yields the deep neural network posterior q ( w ) in Eq.
Logistic regression: as mentioned in Sec.
3.1, the parameter of the Bernoulli likelihood is given by applying the sigmoid link function to f ( x ) and we deﬁned p ( x ) :
= σ ( f w ∗ ( x )) .
Further, the derivative and Hessian of loss were particularised as r ( x , y ) =
p ( x ) − y and Λ ( x , y ) = p ( x )( 1 − p ( x )) .
We write ε ∼ N( 0 , 1 ) for standard noise and plug the quantities model (Eq. 10):
[Equation]
which can be re-arranged to a new model that has an equivalent posterior, but where inference is done by observing original data points D :
[Equation]
, δ − 1 I P ) . [Equation]
[Equation]
Softmax regression is a simple extension to the logistic regression case: we have a categorical likelihood with parameter p ( x ) : = softmax ( f w ∗ ( x )) and labels y i that are standard one-hot encoded basis vectors, i.e. have a single 1 at some position and otherwise zeros.
Then we have r ( x , y ) =
p ( x ) − y and Λ ( x , y ) =
diag ( p ( x )) − p ( x ) p ( x ) (cid:62) .
Unfortunately, Λ ( x , y ) is of rank K − 1 and therefore we cannot uniquely invert it. The theory of Khan et al.
(2019) therefore does not allow this because it requires Λ ( x , y ) (cid:31) 0 . However, we can still write a model in line with Eq. 13 that we expect to have a posterior close to that of the deep neural network:
[Equation]
Conversion to GP can be achieved by taking the expectation and covariance of the linear model. To obtain the GP prior, we take the expectation of the linear model (10) over the prior p ( w ) .
To obtain the posterior, we take the expectation over q ( w ) . Since we are interested in the posterior process, the latter is of interest and calculated for the logistic case in Sec. 3.1.
The softmax regression case works equivalently but yields a K × K kernel, which can be represented as a symmetric tensor, or a NK × NK matrix over data set D with N examples.
To avoid growing complexity with more classes, we model the GPs for each class as being independent, as discussed in Appendix B.
B R EDUCING C OMPLEXITY IN THE M ULTICLASS S ETTING
For the softmax regression with K classes, we build an individual GP for each class, in order to avoid growing complexity with more classes.
We utilise y ( k ) to denote the k -th item of y in Eq.
Then y ( k ) will be:
[Equation]
Here Λ ( x , y ) ( k ) denotes the k -th row of the Hessian matrix.
We transform the K models to function space and treat them as independent. This allows us to split the KL-divergence in Eq. 8 into K individual divergences, and we obtain the simpliﬁed ﬁnal objective,
[Equation]
C F URTHER DETAIL ON CONTINUAL LEARNING METRICS REPORTED
We report a backward transfer metric and a forward transfer metric on split CIFAR. The backward transfer metric is exactly as deﬁned in Lopez-Paz & Ranzato (2017). The forward transfer metric is a measure of how well the method uses previously seen knowledge to improve classiﬁcation accuracy on newly seen tasks. Let there be a total of T tasks.
Let R i , j be the classiﬁcation accuracy of the model on task t j after observing the last sample from task t i .
Let R ind i be the classiﬁcation accuracy of an independent model trained only on task i . Then, Backward Transfer, BWT =
T −
T − 1 (cid:213) i = R T , i − R i , i , Forward Transfer =
T − T (cid:213) i = R i , i − R ind i .
D F URTHER TOY DATA EXPERIMENTS
This section provides further information and visualisations of toy 2D datasets, as well as hyperparameter settings for VCL.
D. W EIGHT - SPACE REGULARISATION ’ S INCONSISTENT BEHAVIOUR
[Table]
summarises the performance (measured by train accuracy) of FROMP and VCL+coresets on a toy dataset similar to that in Figure 1.
FROMP is very consistent, while VCL (with coresets) is extremely brittle: it can perform well sometimes (1 run out of 5), but usually does not (4 runs out of 5).
This is regardless of coreset points chosen for VCL.
Without coresets, VCL forgets many past tasks, with very low performance.
Previous work (Farquhar & Gal, 2019) has argued that this is inevitable for weight-regularisation-only methods such as VCL and EWC.
We now 3 runs with different random seeds of VCL-MP from Table 3: the coreset is chosen from an independent run of FROMP, with datapoints all on the task boundary.
This selection of coreset is intuitively better than a random coreset selection.
Please note that the results we show here are not speciﬁc to coreset selection. Any coreset selection (whether random or otherwise) all show the same inconsistency when VCL is run on them. This behaviour is not speciﬁc to coreset choice.
[Figure]
D. D ATASET VARIATIONS
This section visualises the different dataset variations presented in Table 1.
We pick the middle performing FROMP run (out of 5) and batch Adam run to show.
[Figure] [Figure]
[Figure] [Figure]
D. VCL AND FROMP HYPERPARAMETER SETTINGS FOR TOY DATASETS
FROMP.
We optimised the number of epochs, Adam learning rate, and batch size.
We optimised by running various settings for 5 runs and picking the settings with largest mean train accuracy on the toy dataset in Figure 1.
We found the best settings were: number of epochs=50, batch size=20, learning rate=0.01.
The hyperparameters were then ﬁxed across all toy data experimental runs, including across dataset variations (number of epochs was appropriately scaled by 10 if dataset size was scaled by 10).
VCL+coresets.
We optimised the number of epochs, the number of coreset epochs (because
VCL+coresets trains on non-coreset data ﬁrst, then on coreset data just before test-time: see Nguyen et al. (2018)), learning rate (we use Adam to optimise the means and standard deviations of each parameter), batch size, and prior variance.
We optimised by running various settings for 5 runs and picking the settings with largest mean train accuracy.
We found the best settings were: number of epochs=200, number of coreset epochs=200, a standard normal prior (variance=1), batch size=40, learning rate=0.01.
VCL is slow to run (an order of magnitude longer) compared to all other methods (FROMP and batch Adam).