O NLINE C ORESET S ELECTION FOR R EHEARSAL - BASED C ONTINUAL L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
A dataset is a shred of crucial evidence to describe a task.
However, each data point in the dataset does not have the same potential, as some of the data points can be more representative or informative than others.
This unequal importance among the data points may have a large impact in rehearsal-based continual learning, where we store a subset of the training examples (coreset) to be replayed later to alleviate catastrophic forgetting.
In continual learning, the quality of the samples stored in the coreset directly affects the model’s effectiveness and efﬁciency.
The coreset selection problem becomes even more important under realistic settings, such as imbalanced continual learning or noisy data scenarios.
To tackle this problem, we propose Online Coreset Selection (OCS) , a simple yet effective method that selects the most representative and informative coreset at each iteration and trains them in an online manner.
Our proposed method maximizes the model’s adaptation to a current dataset while selecting high-afﬁnity samples to past tasks, which directly inhibits catastrophic forgetting.
We validate the effectiveness of our coreset selection mechanism over various standard, imbalanced, and noisy datasets against strong continual learning baselines, demonstrating that it improves task adaptation and prevents catastrophic forgetting in a sample-efﬁcient manner.
I NTRODUCTION
Humans possess the ability to learn a large number of tasks by accumulating knowledge and skills over time.
Building a system resembling human learning abilities is a deep-rooted desire since sustainable learning over a long-term period is essential for general artiﬁcial intelligence.
In light of this need, continual learning (CL) (Thrun, 1995), or lifelong learning , tackles a learning scenario where a model continuously learns over a sequence of tasks (Kumar & Daume III, 2012; Li & Hoiem, 2016) within a broad research area, such as classiﬁcation (Kirkpatrick et al., 2017; Chaudhry et al., 2019a), image generation (Zhai et al., 2019), language learning (Li et al., 2019b; Biesialska et al., 2020), clinical application (Lee & Lee, 2020; Lenga et al., 2020), speech recognition (Sadhu &
Hermansky, 2020), and federated learning (Yoon et al., 2021).
A well-known challenge for continual learning is catastrophic forgetting (McCloskey & Cohen, 1989), where the continual learner loses the ﬁdelity for past tasks after adapting the previously learned knowledge to future tasks.
Recent rehearsal-based continual learning methods adapt the continual model to the previous tasks by maintaining and revisiting a small replay buffer (Chaudhry et al., 2019a; Titsias et al., 2020;
Mirzadeh et al., 2020).
However, the majority of these methods store random-sampled instances as a proxy set to mitigate catastrophic forgetting, limiting their practicality to real-world applications (see Figure 1a) when all the training instances are not equally useful, as some of them can be more representative or informative for the current task, and others can lead to performance degeneration for previous tasks.
Furthermore, these unequal potentials could be more severe under practical scenarios containing imbalanced, streaming, or noisy instances (see Figure 2).
This leads to an essential question in continual learning:
How can we obtain a coreset to promote task adaptation for the current task while minimizing catastrophic forgetting on previously seen tasks?
To address this question, we propose Online Coreset Selection (OCS) , a novel method for continual learning that selects representative training instances for the current and previous tasks from arriving
[Figure] [Figure]
streaming data in an online fashion based on our following three selection strategies: (1) Minibatch similarity selects samples that are representative to the current task T t .
(2) Cross-batch diversity encourages minimal redundancy among the samples of current task T t .
(3) Coreset afﬁnity promotes minimum interference between the selected samples and knowledge of the previous tasks T k , ∀ k < t .
To this end, OCS minimizes the catastrophic forgetting on the previous tasks by utilizing the obtained coreset for future training, and also encourages the current task adaptation by updating the model parameters on the top- κ selected data instances.
The overall concept is illustrated in Figure 1b.
Our method is simple, intuitive [Figure] and is generally applicable to any rehearsal-based continual learning method.
We evaluate the performance of OCS on various continual learning scenarios and show that it outperforms state-of-the-art rehearsal-based techniques on balanced, imbalanced, and noisy continual learning benchmarks of varying complexity.
We also show that OCS is general and exhibits collaborative learning with the existing rehearsal-based methods, leading to increased task adaptation and inhibiting catastrophic forgetting.
To summarize, our contributions are threefold:
• We address the problem of coreset selection for realistic and challenging continual learning scenarios, where the data continuum is composed of class-imbalanced or noisy instances that deteriorate the performance of the continual learner during training.
• We propose Online Coreset Selection (OCS) , a simple yet effective online coreset selection method to obtain a representative and diverse subset that has a high afﬁnity to the previous tasks from each minibatch during continual learning.
Speciﬁcally, we present three gradient-based selection criteria to select the coreset for current task adaptation while mitigating catastrophic forgetting.
• We demonstrate that OCS is applicable to any rehearsal-based continual learning method and experimentally validate it on multiple benchmark scenarios, where it largely improves the performance of the base algorithms across various performance metrics.
R ELATED W ORK
Continual learning.
In the past few years, there has been signiﬁcant progress in continual learning to alleviate catastrophic forgetting (McCloskey & Cohen, 1989).
The regularization approaches (Kirkpatrick et al., 2017; Lee et al., 2017; Serrà et al., 2018) modify the model parameters with additional regularization constraints to prevent catastrophic forgetting.
The architecture approaches (Rusu et al., 2016;
Yoon et al., 2018; Xu & Zhu, 2018; Li et al., 2019a; Yoon et al., 2020) utilize network isolation or expansion during continual learning to improve network performance.
Another line of research uses rehearsal approaches , which memorize or generate a small fraction of data points for previous tasks and utilizes them to retain the task knowledge (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a; Aljundi et al., 2019b; Borsos et al., 2020).
For example, Gradient-based Sample Selection
(GSS) (Aljundi et al., 2019b) formulates the selection of the replay buffer as a constraint selection problem to maximize the variance of gradient direction.
ER-MIR (Aljundi et al., 2019a) iteratively constructs the replay buffer using a loss-based criterion, where the model selects the top- κ instances that increase the loss between the current and previous iteration.
However, the existing rehearsalbased methods (Rebufﬁ et al., 2017; Aljundi et al., 2019b;a; Chaudhry et al., 2019a;b) do not select the coreset before the current task adaptation and update the model on all the arriving data streams, which makes them susceptible to real-world applications that include noisy and imbalanced data distributions.
In contrast, OCS selects the instances before updating the model using our proposed selection criteria, which makes it robust to past and current task training across various CL scenarios.
Coreset selection.
There exist various directions to obtain a coreset from a large dataset.
Importance sampling (Johnson & Guestrin, 2018; Katharopoulos & Fleuret, 2018; Sinha et al., 2020) strengthens the loss/gradients of important samples based on inﬂuence functions.
Kool et al.
(2019) connect stochastic Gumbel - top - k trick and beam search to hierarchically sample sequences without replacement.
Rebufﬁ et al.
(2017) propose a herding based strategy for coreset selection.
Nguyen et al.
(2018) formulate the coreset summarization in continual learning using online variational inference (Sato, 2001; Broderick et al., 2013).
Aljundi et al.
(2019b) select the replay buffer to maximize the variance in the gradient-space.
Contrary to these methods, OCS considers the diversity, task informativity and relevancy to the past tasks.
Recently, Borsos et al.
(2020) propose a bilevel optimization framework with cardinality constraints for coreset selection.
However, their method is extremely limited in practice and inapplicable in large-scale settings due to the excessive computational cost incurred during training.
In contrast, our method is simple, and scalable since it can construct the coreset in the online streaming data continuum without additional optimization constraints.
R EHEARSAL - BASED C ONTINUAL L EARNING
We consider learning a model over a sequence of tasks {T 1 , . . .
, T T } = T , where each task is composed of independently and identically distributed datapoints and their labels, such that task
T t includes D t = { x t,n , y t,n } N t n =1 ∼ X t × Y t , where N t is the total number of data instances, and
X t × Y t is an unknown data generating distribution.
We assume that an arbitrary set of labels for task T t , y t = { y t,n } N t n =1 has unique classes, y t ∩ y k = ∅ , ∀ t (cid:54) =
k .
In a standard continual learning scenario, the model learns a corresponding task at each step and t -th task is accessible at step t only.
Let neural network f Θ : X 1: T → Y 1: T be parameterized by a set of weights
Θ = { θ l } Ll =1 , where L is the number of layers in the neural network.
We deﬁne the training objective at step t as follows:
[Equation]
where (cid:96) ( · ) is any standard loss function (e.g., cross-entropy loss).
The naive CL design where a simple sequential training on multiple tasks without any means for tackling catastrophic forgetting cannot retain the knowledge of previous tasks and thus results in catastrophic forgetting.
To tackle this problem, rehearsal-based methods (Nguyen et al., 2018; Chaudhry et al., 2019a; Titsias et al., 2020) update the model on a randomly sampled replay buffer C k constructed from the previously observed tasks, where C k = { x k,j , y k,j } J k j =1 ∼ D k , ∀ k < t and J k (cid:28) N k .
Consequently, the quality of the selected instances is essential for rehearsal-based continual learning.
For example, some data instances can be more informative and representative than others to describe a task and improve model performance.
In contrast, some data instances can degrade the model’s memorization of previous tasks’ knowledge.
Therefore, obtaining the most beneﬁcial examples for the current task is crucial for the success of rehearsal-based CL methods.
[Figure]
when a model trained on MNIST ( T 1 ) is updated on a single data point at class c on CIFAR-10 ( T 2 ).
To validate our hypothesis, we design a learning scenario with a sequence of two tasks, MNIST ( T 1 ) → CIFAR-10 ( T 2 ) using ResNet-18.
After the standard single epoch training on T 1 , we update the model weights through a single backpropagation step using a randomly selected data point from T 2 , and measure test accuracy of its corresponding class c and forgetting of the entire dataset of a past task T 1 .
Results for indi- vidual impacts on 1000 data points from T 2 are described in Section 3.
The inﬂuence of each data point from T 2 has a large disparity not only on the corresponding class accuracy but also on past task’s forgetting that results in a very high standard deviation.
We emphasize that each data point has a different potential impact in terms of forgetting past tasks.
Few data points are much more robust to catastrophic forgetting than others, and this can be severe when the inﬂuences are accumulated during training.
Based on this motivation, our objective is to select the data instances that can promote current task adaptation while minimizing catastrophic forgetting on the previous tasks.
We propose a selection criterion that selects the subset that maximizes the gradient similarity between the representative instances and the current task dataset.
More formally:
[Equation] [Equation]
u = { n : n ∈ N <N t } ,
[Equation] [Equation]
where S is any arbitrary similarity function and u ∗ is an index set that selects top-
κ informative samples without replacement.
However, obtaining a representative subset from the entire dataset is computationally expensive and intractable for online continual learning; therefore, we consider a minibatch as an approximation of the dataset and select few representative data instances at each minibatch iteration.
We empirically validate that our approximation generally holds across various datasets, network structures, and minibatch sizes in Appendix B and Figure B.9.
Consequently, the model iteratively updates the parameters to ﬁnd the optimal local minima of the loss using informative data points, which obtain similar gradient directions with the averaged gradients of the dataset.
In the next section, we propose OCS which consists of a simple similarity criterion to achieve this objective.
However, similarity criterion is not sufﬁcient to select the representative coreset for online continual learning; hence, we propose diversity and coreset afﬁnity criteria to mitigate catastrophic forgetting.
O NLINE C ORESET S ELECTION
In this section, we introduce our selection strategies and propose Online Coreset Selection (OCS) to strengthen current task adaptation and mitigate catastrophic forgetting.
Thus far, the rehearsal-based continual learning methods (Rebufﬁ et al., 2017; Aljundi et al., 2019b;a; Chaudhry et al., 2019a;b) populate the replay buffer to preserve the knowledge on the previous tasks.
However, we argue that some instances may be non-informative and inappropriate to construct the replay buffer under realistic setups (such as video streaming or imbalanced continual learning scenarios), leading to the degradation of the model’s performance.
Moreover, it is critical to select the valuable samples for current task training since the model can easily overﬁt to the biased and noisy data stream, which negatively affects the model generalization.
To satisfy these desiderata, we propose minibatch similarity ( S ) and cross-batch diversity ( V ) criteria based on our aforementioned assumption to adaptively select the useful instances without the inﬂuence of outliers.
Deﬁnition 1 ( Minibatch similarity).
Let b t,n = { x t,n , y t,n } ∈ B t denote n -th pair of data point with gradient ∇ f Θ ( b t,n ) and its corresponding label at task T t .
Let ¯ ∇ f Θ ( B t ) denote the averaged gradient vector of B t .
The minibatch similarity S ( b t,n | B t ) between b t,n and B t is given by
[Equation]
Deﬁnition 2 ( Cross-batch diversity).
Let b t,n = { x t,n , y t,n } ∈ B t denote n -th pair of a data point with gradient ∇ f Θ ( b t,n ) and its corresponding label at task T t .
The cross-batch diversity
V (cid:0) b t,n | B t \ b t,n (cid:1) between b t,n and all other instances in B t ( B t \ b t,n ) is given by
[Equation]
[Equation]
In particular, minibatch similarity considers a minibatch as an approximation of the current task dataset and compares the minibatch-level similarity between the gradient vector of a data point b and its minibatch B .
It measures how well a given data instance describes the current task at each
[Table]
[Table]
[Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
training step.
Note that selecting examples with the largest minibatch similarity is reasonable when the variance of task instances is low; otherwise, it increases the redundancy among coreset items.
In contrast, we formulate the sample diversity of each data point b ∈ B as an averaged dissimilarity (i.e., an average of negative similarities) between a data point itself and other samples in the same minibatch B , and not as an average similarity.
Thus, the measure of sample diversity in Equation (4) is negative and the range is [ − 1 , 0] .
4. O NLINE C ORESET S ELECTION FOR C URRENT T ASK A DAPTATION
The model receives a data continuum during training, including noisy or redundant data instances in real-world scenarios.
Consequently, the arriving data instances can interrupt and hurt the performance of the model.
To tackle this problem, we consider an amalgamation of minibatch similarity and cross-batch diversity to select the most helpful instances for current task training.
More formally, our online coreset selection for the current task adaptation can be deﬁned as follows:
[Equation]
We emphasize that we can obtain the top- κ valuable instances for the current task by computing
Equation 5 in an online manner.
Once the representative coreset is selected, we optimize the following objective for the current task training at each iteration:
[Equation]
B t
[Equation]
B t [ u
[Equation] [Equation]
We consider a selected coreset at each iteration as a candidate for the replay buffer.
After the completion of each task training, we choose a coreset C t among the collected candidates, or we may also iteratively update C t to maintain the bounded buffer size for continual learning.
4. O NLINE C ORESET S ELECTION FOR C ONTINUAL L EARNING
We now formulate OCS for online continual learning, where our objective is to obtain the coreset to retain the knowledge of the previous tasks using our proposed similarity and diversity selection criteria.
However, continual learning is more challenging as the model suffers from catastrophic forgetting and coreset size is smaller than the size of the arriving data streams.
Thus, inspired by our observation in Section 3, we aim to train the continual learner on the selected instances that are representative of the current task and prevent the performance degeneration of previous tasks.
We achieve our goal by introducing our Coreset afﬁnity criterion A to Equation 5.
In particular, A computes the gradient vector similarity between a training sample and the coreset for previous tasks ( C ) .
More formally, A can be deﬁned as follows:
Deﬁnition 3 ( Coreset afﬁnity).
Let b t,n = { x t,n , y t,n } ∈ B t denote the n -th pair of a data point with gradient ∇ f Θ ( b t,n ) and its corresponding label at task T t .
Further let ¯ ∇ f Θ ( B C ) be the averaged gradient vector of B C , which is randomly sampled from the coreset C .
The coreset afﬁnity
A ( b t,n | B C ∼ C ) between b t,n and B C is given by
[Equation]
While the past task is inaccessible after the completion of its training, our selectively populated replay buffer can be effectively used to describe the knowledge of the previous tasks.
The key idea is to select the examples that minimize the angle between the gradient vector of the coreset containing previous task examples and the current task examples.
Instead of randomly replacing the candidates in the coreset (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a; Aljundi et al., 2019b; Borsos et al., 2020), A promotes the selection of examples that do not degenerate the model performance on previous tasks.
To this end, we select the most beneﬁcial training instances which are representative and diverse for current task adaptation while maintaining the knowledge of past tasks.
In summary, our OCS for training task T t during CL can be formulated as:
[Equation]
τ is a hyperparameter that controls the degree of model plasticity and stability.
Note that, during the ﬁrst task training, we do not have the interference from previous tasks and we select the top- κ instances that maximize the minibatch similarity and cross-batch diversity.
Given the obtained coreset (cid:98) B t =
B t [ u ∗ ] , our optimization objective reﬂecting the coreset C , is as follows:
[Equation]
where B C is a randomly sampled minibatch from the coreset C and λ is a hyperparameter to balance the adaptation between the current task and past task coreset.
Overall training procedure for
Online Coreset Selection (OCS) is described in Algorithm 1.
To the best of our knowledge, this is the ﬁrst work that utilizes selective online training for the current task training and incorporates the relationship between the selected coreset and the current task instances to promote current task adaptation while minimizing the interference with previous tasks.
E XPERIMENTS 5. E XPERIMENTAL S ETUP
Datasets.
We validate OCS on domain-incremental CL for Balanced and Imbalanced Rotated MNIST using a single-head two-layer MLP with 256 ReLU units in each layer, task-incremental CL for Split
CIFAR-100 and Multiple Datasets (a sequence of ﬁve datasets) with a multi-head structured ResNet18 following prior works (Chaudhry et al., 2019a; Mirzadeh et al., 2020; 2021).
Additionally, we evaluate on class-incremental CL for Balanced and Imbalanced Split CIFAR-100 with a single-head structured ResNet-18 in Table B.9.
We perform ﬁve independent runs for all the experiments and provide further details on the experimental settings and datasets in Appendix A.
Baselines.
We compare OCS with regularization-based CL methods: EWC (Kirkpatrick et al., 2017) and Stable SGD (Mirzadeh et al., 2020), rehearsal-based CL methods using random replay buffer:
A-GEM (Chaudhry et al., 2019a) and ER-Reservior (Chaudhry et al., 2019b), coreset-based methods using CL algorithms: Uniform Sampling, k -means Features (Nguyen et al., 2018) and k -means
Embeddings (Sener & Savarese, 2018), and coreset-based CL methods: iCaRL (Rebufﬁ et al., 2017),
Grad Matching (Campbell & Broderick, 2019), GSS (Aljundi et al., 2019b), ER-MIR (Aljundi et al., 2019a), and Bilevel Optim (Borsos et al., 2020).
We limit the buffer size for the rehearsal-based methods to one example per class per task.
Additionally, we compare with Finetune, a naive CL method learnt on a sequence of tasks, and Multitask, where the model is trained on the complete data.
Metrics.
We evaluate all the methods on two metrics following the CL literature (Chaudhry et al., 2019a; Mirzadeh et al., 2021).
Average Accuracy ( A t ) is the averaged test accuracy of all tasks after the completion of CL at task T t .
That is, A t = 1 t (cid:80) ti =1 a t,i , where a t,i is the test accuracy of task T i after learning task T t .
[Table]
[Figure]
Average Forgetting ( F ) is the averaged disparity between the peak and ﬁnal task accuracy after the completion of continual learning.
That is, F
=
[Equation]
Choice of hyperparameters for OCS.
Note that we use the same value of κ = 10 , τ = 1 k for all experiments and analyses, including balanced, imbalanced, and noisy CL scenarios for all datasets, which shows that a simple selection of the hyperparameters is enough to show impressive performance.
We expect careful tuning would further enhance the performance of OCS.
5. Q UANTITATIVE A NALYSIS FOR C ONTINUAL L EARNING
Balanced continual learning.
Table 1 shows the results on the balanced CL benchmarks.
First, observe that compared to the random replay based methods (A-GEM and ER-Reservoir), OCS shows 19% relative gain in average accuracy, 62% and 79% reduction in forgetting over the strongest baseline on Rotated MNIST and Split CIFAR-100, respectively.
Second, OCS reduces the forgetting by 38% and 57% on Rotated MNIST and Multiple Datasets respectively over the coreset-based techniques, demonstrating that it selects valuable samples from the previous tasks.
We further illustrate this in Figure 4, where OCS consistently exhibits superior average accuracy and ﬁrst task accuracy.
Third, we show the scalability of OCS with larger episodic memory in Figure 5.
Interestingly, iCaRL shows lower performance than uniform sampling with a larger memory buffer for Rotated MNIST, while OCS outperforms across all memory sizes on both datasets.
Furthermore, we note that ER-MIR, GSS, and Bilevel Optim require 0 .
9 × , 3 . 9 × , and 4 .
2 × training time than OCS (see Table 5) on TITAN Xp, showing a clear advantage of OCS for the online streaming scenarios.
[Table]
[Figure]
v
[Figure]
r a g e t e
[Figure]
t a cc u r a c
[Figure]
Imbalanced continual learning.
To demonstrate the effectiveness of OCS in challenging scenarios, we evaluate on imbalanced CL in Table 1.
We emphasize that compared to balanced CL, OCS shows signiﬁcant gains over all the baselines for Rotated MNIST and Multiple Datasets.
Notably, it leads to a relative improvement of ∼ 7% and ∼ 9% on the accuracy, ∼ 11% and 40% reduction on the forgetting compared to the best baseline for each dataset, respectively.
The poor performance of the baselines in this setup is largely attributed to their lack of current task coreset selection, which results in a biased estimate degenerating model performance (see Figure 8).
Moreover, we observe that OCS outperforms Multitask for complex imbalanced datasets, perhaps due to the bias from the dominant classes and the absence of selection criteria in Multitask.
Similar to balanced CL, OCS leads to superior performance for larger episodic memory in imbalanced CL (see Figure 5).
Noisy continual learning.
Next, we evaluate on noisy Rotated MNIST dataset, which is constructed by perturbing a proportion of instances of the original dataset with Gaussian noise N (0 , 1) .
Tableshows that the addition of noise signiﬁcantly degrades the performance on all the baselines.
In contrast, OCS leads to a relative gain of 43% on accuracy, 20% and 35% reduction in forgetting on 40% and 60% proportion of noisy data.
Note that the performance gap is more signiﬁcant for the higher distribution of noisy examples, supporting our claim that the similarity and diversity across the training examples in the coreset play an essential role for the task adaptation in continual learning.
5. A BLATION S TUDIES
Effect of gradients.
In Table 3, we empirically justify the utilization of gradients (Grad-OCS) compared to the raw inputs (Input-OCS) and feature-representations (Feat-OCS).
We observe that
Grad-OCS signiﬁcantly outperforms Input-OCS and Feat-OCS on balanced and imbalanced CL, demonstrating that the gradients are a better metric to approximate the dataset.
Effect of individual components.
We further dissect Minibatch similarity ( S ), Cross-batch diversity ( V ) and Coreset afﬁnity ( A ) in Table 4.
Note that selection using S shows reasonable performance as the model can select valuable data points; however, it may select redundant samples, which degrades its performance.
In addition, V in isolation is insufﬁcient since it can select non-redundant and non-representative instances.
The combination of S and V improves the average accuracy, but it shows a marginal improvement on the forgetting.
To further gain insight into S and V , we interpolate between S and V in Figure 6, where we can observe that an optimal balance of S and V (indicated by the arrows) can further improve the performance of our proposed selection strategy.
Furthermore, A improves the forgetting since the selected candidates have similar gradient direction to the coreset of the previous tasks maximizing their performance.
However, A does not consider the current task distribution explicitly and depends on the quality of the memorized replay buffer.
We observe that using A in isolation obtains reasonably high performance on simple digit-based domain-incremental CL problems (e.g., Rotated MNIST) due to its inherent high resemblance among
[Table] [Table]
[Table] [Table]
[Figure] [Figure]
same class instances.
Consequently, suppressing catastrophic forgetting by selective training based on A shows a relatively high impact rather than selective training based on distinguishing more informative or diverse samples.
In contrast, A in isolation for selection is insufﬁcient for complicated and realistic CL problems such as imbalanced CL and multiple datasets, and all the three components ( S , V , and A ) contribute to the performance of OCS.
For Multiple Datasets, selection using only
A (58.1%) obtained worse performance in comparison to S + V + A (61.5%) and S + V (58.6%).
Further, selection using S + A ( 59 . 4 ± 2 . 0% ) and V + A ( 56 . 4% ± 1 . 3 ) also obtained 2.1%p and 5.1%p lower average accuracy than full OCS, respectively.
5. F URTHER A NALYSIS
Coreset visualization.
Next, we visualize the coreset selected by different methods for imbalanced and noisy rotated MNIST in Figure 7.
We observe that uniform sampling selects highly biased samples representing the dominant classes for imbalanced CL and noisy instances for noisy CL.
In contrast, iCaRL selects the representative samples per class for imbalanced CL; however, it selects noisy instances during noisy CL.
In comparison, OCS selects the beneﬁcial examples for each class during imbalanced CL and discards uninformative noisy instances in the noisy CL training regime.
T-SNE visualization.
We further compare the T-SNE visualization of the selected coreset by Bilevel
Optim, GSS and OCS in Figure 8.
We observe that the samples chosen by OCS are diverse, whereas
Bilevel Optim and GSS select the majority of the samples from the dominant classes.
We attribute the representative clusters and diversity in the samples selected by OCS to our proposed S (selects the valuable samples) and V (minimizes the redundancy among the selected samples) criteria.
Collaborative learning with MC-SGD.
We remark that OCS can be applied to any rehearsal-based
CL method with a replay buffer during training.
We empirically demonstrate the effect of collaborative learning with other CL methods in Table 6.
In particular, we use Mode Connectivity SGD (MCSGD)
(Mirzadeh et al., 2021), which encourages the mode connectivity between model parameters for continual and multitask loss and approximates the multitask loss through randomly selected replay buffer.
Note that OCS leads to a relative gain of 1 . 2% to 3 .
4% on accuracy over MC-SGD on
Permuted MNIST, Rotated MNIST, and Split CIFAR-100 datasets.
Furthermore, MC-SGD + OCS shows considerably lower forgetting, illustrating that OCS prevents the loss of prior task knowledge.
C ONCLUSION
We propose Online Coreset Selection (OCS), a novel approach for coreset selection during online continual learning.
Our approach is modelled as a gradient-based selection strategy that selects representative and diverse instances, which are useful for preserving the knowledge of the previous tasks at each iteration.
This paper takes the ﬁrst step to utilize the coreset for improving the current task adaptation, while mitigating the catastrophic forgetting on previous tasks.
Our experimental evaluation on the standard balanced continual learning datasets against state-of-the-art rehearsal-based techniques demonstrates the efﬁciency of our approach.
We also show promising results on various realistic and challenging imbalanced and noisy continual learning datasets.
We further show the natural extension of our selection strategy to existing rehearsal-based continual learning using a random-replay buffer.
Our future work will focus on improving the selection strategies and exploring ways to utilize unlabelled data stream during training.
R EPRODUCIBILITY S TATEMENT
We include the code with the instructions to reproduce the main experimental results in the abstract and clearly specify all the training details in Appendix A.
All the results are reported across ﬁve independent runs with mean and standard deviation.
Further, we specify the amount of compute and resources used in the Appendix A
A E XPERIMENTAL D ETAILS
Datasets.
We evaluate the performance of OCS on the following benchmarks:
Balanced and Imbalanced Rotated MNIST.
These datasets are MNIST handwritten digits dataset (LeCun et al., 1998) variants containing 20 tasks, where each task applies a ﬁxed random image rotation (between 0 and 180 degrees) to the original dataset.
The imbalanced setting contains a different number of training examples for each class in a task, where we randomly select 8 classes over 10 at each task and each class contains 10% of training instances for training.
The total amount of training instances at each class can be [ 5900 , 670 , 590 , 610 , 580 , 5400 , 590 , 620 , 580 , 590 ], where bold fonts denote the reduced number of instances for selected classes.
The size of the replay buffer is 200 for all the rehearsal-based methods. 2.
Balanced and Imbalanced Split CIFAR-100.
These datasets are CIFARdataset (Krizhevsky, 2012) variants, where each task consists of ﬁve random classes out of the 100 classes.
We use the Long-Tailed CIFAR-100 (Cui et al., 2019) for Imbalanced Split CIFAR-100 consisting of n = n i µ i samples for each class, where i is the class index, n i is the original number of training images, and µ = 0 .
It contains 20 tasks of ﬁve random classes out of the 100 classes.
The size of the replay buffer is 100 (one example per class) for all the rehearsal-based methods. 3.
Balanced and Imbalanced Multiple Datasets.
This dataset contains a sequence of ﬁve benchmark datasets: MNIST (LeCun et al., 1998)
, fashion-MNIST (Xiao et al., 2017), NotMNIST (Bulatov, 2011), Trafﬁc Sign (Stallkamp et al., 2011), and SVHN (Netzer et al., 2011), where each task contains randomly selected 1000 training instances from each dataset.
This dataset contains ﬁve tasks and 83 classes.
We use the same strategy as Long-Tailed CIFARto construct the imbalanced Multiple Datasets with µ = 0 .
The size of the replay buffer is(one example per class) for all rehearsal-based methods.
Network Architectures.
We use a MLP with 256 ReLU units in each layer for Rotated MNIST and a ResNet-18 (He et al., 2016) for Split CIFAR-100 datasets following Mirzadeh et al.
For
Rotated MNIST experiments, we use a single-head architecture, where the ﬁnal classiﬁer layer is shared across all the tasks, and the task identity is not provided during inference.
In contrast, we use the multi-head structured ResNet-18 for CIFAR-100 and Multiple Datasets experiments, where the task identiﬁers are provided, and each task consists of its individual linear classiﬁer.
Implementations.
We follow the design of Mirzadeh et al.
(2021) for evaluating all the methods.
We utilize their implementation for Finetune, EWC (Kirkpatrick et al., 2017), Stable SGD (Mirzadeh et al., 2020), A-GEM (Chaudhry et al., 2019a), ER-Reservoir (Chaudhry et al., 2019b) and MCSGD (Mirzadeh et al., 2021).
We adapt the implementation released by Borsos et al.
(2020) for
Uniform Sampling, iCaRL (Rebufﬁ et al., 2017), k -means Features (Nguyen et al., 2018), k -means
Embedding (Sener & Savarese, 2018), Grad Matching (Campbell & Broderick, 2019), and Bilevel
Optim (Borsos et al., 2020).
Further, we implement GSS (Aljundi et al., 2019b) and ER-MIR (Aljundi et al., 2019a) following the ofﬁcial code relased by the authors.
Following iCaRL (Rebufﬁ et al., 2017), we store a balanced coreset C t (equal number of examples per class) among the collected coreset candidates.
Memory Capacity.
Existing rehearsal-based continual learning methods (Chaudhry et al., 2019a;b;
Aljundi et al., 2019a; Mirzadeh et al., 2020; 2021) adopt two typical strategies to store data points in the replay buffer at the end of training each task: (1) memorizing a ﬁxed number of data points per task ( | C i | =
J/T ), where an index of the task in a task sequence i ∈ { 1 , ..., T } , the total number of task T , and memory capacity J , (2) fully utilizing the memory capacity and randomly discard stored samples of each task when new data points arrive from next tasks ( | C i | =
J/t ), where the current task t and an index of the observed task i ∈ { 1 , ..., t } .
While both strategies are available, we adopt the latter strategy for all baselines and OCS.
The details of this are omitted in Algorithm 1 for simplicity.
[Table] [Table]
We report the mean and standard- deviation of the average accuracy and average forgetting across ﬁve independent runs.
[Table] [Table]
[Table]
Hyperparameter conﬁgurations.
Table A.7 shows the initial learning rate, learning rate decay, and batch size for each dataset that are shared among all the methods.
Further, we report the best results obtained for λ ∈ { 0 . 01 , 0 . 05 , 0 .
1 , 1 , 10 , 50 , 100 } for all the experiments.
For OCS, we use τ = 1000 for all the experiments and batch size as 100 for Rotated MNIST and 20 for Split
CIFAR-100 and Multiple Dataset.
The running time reported in Table 5 was measured on a single NVIDIA TITAN Xp.
Due to the signiﬁcant computational cost incurred by the training of Bilevel Optim (Borsos et al., 2020) for online continual learning, we restrict the bilevel optimization procedure to construct the replay buffer at the end of each task training.
B A DDITIONAL E XPERIMENTS
Current task adaptation with the baselines.
One of our main contributions is the selective online training that selects the important samples for current task training.
Therefore, we investigate the application of the other baselines for current task training in Table B.8.
It is worth noting that all the rehearsal-based baselines that utilize their coreset selection criteria for current task adaptation decrease the performance ( 1 . 0 - 9 . 8% p ↓ ), except Grad Matching ( 0 .
5% p ↑ ) on Balanced Rotated
MNIST.
Moreover, for Imbalanced Rotated MNIST, Uniform Sampling, k -means Features, and k -means
Embedding increase the performance 1 .
9% p , 13 .
3% p , and 4 . 0% p compared to Tablerespectively.
In contrast, iCaRL and Grad Matching criteria decrease the performance by 1 . 7% p and 3 . 2% p on Imbalanced Rotated MNIST, respectively.
On the contrary, OCS improves the performance for both the balanced and imbalanced scenarios.
In light of this, we can conclude that efﬁcient coreset selection plays a crucial role in imbalanced and noisy continual learning; therefore, the future rehearsal-based continual learning methods should evaluate their method on realistic settings rather than the standard balanced continual learning benchmarks.
Class-incremental continual learning.
We also evaluate OCS for balanced and imbalanced classincremental CL (CIL) setups in Table B.9.
We Split CIFAR-100 dataset to ﬁve tasks with memory size of 1K for all methods.
While the problem is extremely hard to solve, we want to emphasize that OCS outperforms the strongest baseline by 10 .
61% and 63 .
6% on accuracy and forgetting respectively for balanced CIFAR-100 dataset, 24 .
05% and 30% on accuracy and forgetting respectively for imbalanced CIFAR-100 dataset in the CIL setting.
Note that we report the results for all the baselines using hyperparameter conﬁguration of the main experiments.
[Figure]
Uniform training with OCS coreset.
We further analyze the effect of online coreset selection for current task training in Table B.10a.
In particular, we compare uniform sampling for the current task while utilizing the coreset constructed by OCS for the previous tasks (Uniform + OCS) with our original selection scheme utilizing OCS for current and previous tasks.
First, observe that Uniform + OCS shows 2 .
6% and 9 .
2% relative decrease in performance on Rotated MNIST and Multiple datasets respectively compared to our original OCS selection strategy.
Second, note that Uniform +
OCS signiﬁcantly deteriorates the catastrophic forgetting for all datasets since uniformly sampled examples do not preserve the previous tasks knowledge.
Moreover, imbalanced continual learning shows a similar trend in Table B.10b, where Uniform + OCS leads to a drop in both the accuracy and forgetting across all benchmarks.
This further strengthens our claim that OCS is essential for the previous tasks and plays a vital role in encouraging current-task adaptation.
Distance between the whole dataset and its minibatch.
To verify our conjecture that a minibatch can approximation of the whole dataset and select few representative data instances at each minibatch iteration, we empirically validate that the whole dataset and its minibatch have signiﬁcant semantic relevancy.
More formally, for a given subset B t , dataset D t , and (cid:15) > 0 , we suppose that the neural network satisﬁes following equation,
[Equation]
where S ∗ is an arbitrary distance function.
To this end, we conduct a simple experiment using two different datasets (MNIST and CIFAR-10) and network architectures (MLP and ResNet-18) to show that it generally holds on various datasets and network architectures.
We use a 2-layered
MLP for MNIST and ResNet-18 for CIFAR-10 following our main experiments.
At each iteration of training,we measure the (cid:96) 2 distance ( S ∗ ( · ) =
(cid:96) 2 ( · ) ) and cosine similarity ( S ∗ ( · ) =
1 / ( sim ( · )) ) between the averaged gradient of the training minibatch and averaged gradient of the entire training dataset.
To show that the distance is sufﬁciently small, we also measure the gradient (cid:96) 2 distance between the entire dataset and the irrelevant dataset.
Note that we recalculated the gradient for the whole dataset at each iteration for all results to correctly measure the distance at each step.
As shown in Figure B.9, the gradient of larger minibatch shows better approximation to the gradient of the entire dataset for (cid:96) 2 distance and cosine similarity.
Further, note that that even the gradients of an arbitrary subset with a small-sized minibatch is signiﬁcantly similar to the whole dataset with a small (cid:15) , and it is more evident when compared to the irrelevant gradients from a different dataset, PMNIST (Permuted MNIST)
(Goodfellow et al., 2013).