Online Continual Learning on Sequences

by   German I. Parisi, et al.

Online continual learning (OCL) refers to the ability of a system to learn over time from a continuous stream of data without having to revisit previously encountered training samples. Learning continually in a single data pass is crucial for agents and robots operating in changing environments and required to acquire, fine-tune, and transfer increasingly complex representations from non-i.i.d. input distributions. Machine learning models that address OCL must alleviate catastrophic forgetting in which hidden representations are disrupted or completely overwritten when learning from streams of novel input. In this chapter, we summarize and discuss recent deep learning models that address OCL on sequential input through the use (and combination) of synaptic regularization, structural plasticity, and experience replay. Different implementations of replay have been proposed that alleviate catastrophic forgetting in connectionists architectures via the re-occurrence of (latent representations of) input sequences and that functionally resemble mechanisms of hippocampal replay in the mammalian brain. Empirical evidence shows that architectures endowed with experience replay typically outperform architectures without in (online) incremental learning tasks.


page 6

page 7


Prototypes-Guided Memory Replay for Continual Learning

Continual learning (CL) refers to a machine learning paradigm that using...

Rethinking Continual Learning for Autonomous Agents and Robots

Continual learning refers to the ability of a biological or artificial s...

Multilayer Neuromodulated Architectures for Memory-Constrained Online Continual Learning

We focus on the problem of how to achieve online continual learning unde...

Learning latent representations across multiple data domains using Lifelong VAEGAN

The problem of catastrophic forgetting occurs in deep learning models tr...

Continual Neural Mapping: Learning An Implicit Scene Representation from Sequential Observations

Recent advances have enabled a single neural network to serve as an impl...

Reducing Representation Drift in Online Continual Learning

We study the online continual learning paradigm, where agents must learn...

Continual Lifelong Learning with Neural Networks: A Review

Humans and animals have the ability to continually acquire and fine-tune...

1 Introduction

Real-world data is naturally non-stationary and temporally correlated. Artificial learning systems, agents, and robots should thus be able to learn in a continual fashion from rich streams of non-i.d.d. input. The ability of a system to continually acquire and fine-tune knowledge is known as continual learning (CL; see [Chen18, Parisi18review] for recent reviews). This paradigm is also referred to as lifelong learning (LL) in the literature. Although CL and LL are arguably different (e.g. LL assumes a finite learning phase or a lifetime that ends at a given time, whereas CL is not necessarily subject to this constrain), these terms are mostly used interchangeably. Machine learning models that learn in a continual fashion from non-stationary sequential input are of great interest to both the scientific community and the industry. Firstly, CL should be a key property of large-scale systems to keep learning over time after their deployment with the goal to efficiently fine-tune and transfer knowledge and skills from continuous (and potentially infinite) streams of novel input. Secondly, the development and evaluation of CL models will help provide valuable insights into how biological mechanisms of learning and memorization work in the brain [Aimone2009, Deng2010].

Empirical evidence shows that connectionists architectures are prone to catastrophic forgetting, i.e., when learning a new class or task, the overall performance on previously learned classes and tasks may abruptly decrease due to the novel input interfering with or completely overwriting existing representations [French1999, Mermillod13]

. Because catastrophic forgetting is a phenomenon that affects also deep learning models, the interest in CL models has grown almost exponentially in the machine learning community. To prevent, or at least alleviate, catastrophic forgetting in neural networks, researchers have studied how to address the plasticity-stability dilemma 

[Grossberg1980], i.e., how plastic should the models be to accommodate novel knowledge while preventing previously acquired knowledge to be forgotten and, thus, providing a certain degree of stability during the learning process.

The vast majority of CL models have taken inspiration from biological mechanisms of continual learning and can be divided into three main categories [Parisi18review]: synaptic regularization, structural plasticity, and memory replay. Approaches using synaptic regularization impose additional constraints on the update of neural weights to protect consolidated knowledge (e.g. [Kirkpatrick17, Zenke17]

). Synaptic regularization is inspired by theoretical neuroscience models in which consolidated knowledge is protected from forgetting via synapses with a cascade of states yielding different levels of plasticity 

[Fusi2005]. However, it remains unclear how to better implement it in artificial networks and, in particular, how to efficiently select the weights to be protected. Approaches with structural plasticity apply architectural changes to a model, typically expanding it with additional neural resources to accommodate representations from novel input (e.g. [Parisi2017a, Parisi18, Rusu16progressive]) For large-scale datasets, these models may have scalability issues and require additional modulatory mechanisms that control their growth over time. Approaches with memory replay implement the re-occurrence of raw stored, training samples or latent representations of the input to prevent catastrophic forgetting (e.g. [kemker18fearnet, Parisi18, pellegrini2019latent]). Intuitively, storing previously processed input samples to be subsequently replayed to a model (a process known as rehearsal) can be a very expensive and prohibitive practice. Instead, it has been shown to be more efficient to replay latent representations of the input, a process known as latent replay. This latter type of replay is closer to biological mechanisms of hippocampal replay in the mammalian brain [Deng2010, Mcclelland95].

We show in Fig. 1 the most popular and recent CL approaches divided into the above-described categories and their combinations. In the diagram, we differentiate methods with rehearsal (replay of explicitly stored training samples) from methods with generative replay

(replay of latent representations or the training samples). Crucially, although an increasing number of methods have been proposed, there is no consensus on which training schemes and performance metrics are better to evaluate CL models. Different sets of metrics have been proposed to evaluate CL performance on supervised and unsupervised learning tasks (e.g. 

[Hayes18NewMetrics, Kemker17, Diaz18]). In the absence of standardized metrics and evaluation schemes, it is unclear what it means to endow a method with CL capabilities. In particular, a number of CL models still require large computational and memory resources that hinder their ability to learn in real time, or with a reasonable latency, from data streams.

Figure 1: Venn diagram of some of the most popular CL strategies: CWR [Lomonaco17], PNN [Rusu16progressive], EWC [Kirkpatrick17], SI [Zenke17], LWF [Li17], ICARL [Rebuffi16], GEM [Lopez-Paz17], FearNet [kemker18fearnet], GDM [Parisi18], ExStream [Hayes18MemoryEfficient], Pure Rehearsal, GR [Shin17], MeRGAN [wu2018memory] and AR1 [Maltoni18]. Rehearsal and Generative Replay upper categories can be seen as a subset of replay strategies.

Online CL (OCL) adds a number of desiderata to CL systems and their evaluation to ensure their ability to learn continually from potentially infinite sequential data in an online fashion, i.e., the ability to efficiently learn from one pass of the data. In the next sections, we first define CL and OCL and then summarize and discuss recent deep learning models that address OCL on data streams through the use and combination of synaptic regularization, structural plasticity, and experience replay.

2 Online Continual Learning

OCL builds on top of CL with a set of additional desiderata. In particular, online learning needs to take place as input data arrive and, since it should take place in real time, computational and memory resources must be considered. Online learning shares a number of key properties with streaming learning [Hayes18MemoryEfficient], and the boundaries between these two paradigms get fuzzy in the machine learning literature. In streaming learning, models are incrementally trained with one pattern at the time. However, it is computationally more efficient to let OCL methods process the input also as mini-batches if the data is available [pellegrini2019latent]. In this section, we first define CL and then discuss a set of desiderata for OCL on data sequences.

2.1 Formalizing CL Algorithms

We define CL, and thus OCL, within the framework presented in [lesort:hal-02381343]

: we assume CL aims to tackle a probably approximately correct (PAC) learnable problem in the approximation of a target hypothesis

as well as learning from a sequence of non-i.i.d. training sets. This framework can also be seen as a generalization of the one proposed in [Lopez-Paz17], where learning happens continuously through a continuum of data and a task supervised signal may be provided along with each training example.

In CL, data can be conveniently seen as drawn from a sequence of distributions . Let us define is a potentially infinite sequence of unknown distributions over , where and

are input and output random variables respectively. At time

, a training set containing one or more observations is provided from to the algorithm. A task is a learning experience characterized by a unique task label and its target function , i.e., the objective of its learning. It is important to note that tasks are an abstract representation of a learning experience carrying a task label. This label helps split the full learning experience into smaller learning pieces. However, there is necessarily no bijective correspondence between data distributions and tasks.

Given as the general target function, i.e., our ideal prediction model, and a task label , a CL algorithm is an algorithm with the following signature:



  • is the current hypothesis at timestep

    (the parametric model learned continually);

  • is an external memory where we can store previous training examples or partial computation not directly related to the parametrization of the model;

  • is a task label that can be used to disentangle tasks and customize the hypothesis parameters. For simplicity, we can assume as the number of tasks, one for each ;

  • is the training set of examples. Each is composed of a number of examples with . Each example , where is the feedback signal and can be the optimal hypothesis (i.e., exact label

    in supervised learning), or any real tensor (from which we can estimate

    , such as a reward

    in reinforcement learning).

It is worth pointing out that each can be considered as a stationary distribution. However, this framework allows to accommodate CL approaches where examples can also be assumed to be drawn in a non-i.i.d. fashion from each over  [Gepperth16, Hayes18NewMetrics].

A CL scenario is a specific CL setting in which the sequence of task labels respects a certain task structure over time. Based on the proposed framework, we can define three different common scenarios:

  • Single-Incremental-Task (SIT): .

  • Multi-Task (MT): .

  • Multi-Incremental-Task (MIT): and .

An example of a single-incremental-task (SIT) scenario is a classification task between cats and dogs, where the class distribution changes over time. First, there may only be input images of white dogs and white cats, whereas later only black dogs and black cats. Therefore, while learning to distinguish black cats from black dogs the algorithm should not forget to differentiate white cats from white dogs. The task stays the same but such a concept drift might lead to forgetting. Instead, a multi-task (MT) scenario in a classification setting would first consist of learning cats versus dogs, and later cars versus bikes, without forgetting. The task label changes when the classes change and the algorithm can use this information to maximize its performance over time. The multi-incremental-task (MIT) is the scenario where the same task can occur multiple times in the sequence of tasks, but such a task is not the only existing one.

2.2 OCL on Sequences

OCL requires the quick integration of information during the learning process. While typically supervised, unsupervised, and reinforcement learning paradigms divide the training phase from the test phase (with possible validation steps), in OCL the learning is seamless and such distinction can be applied to the data (i.e. to use a test-set that evaluates the model’s performance) but cannot be used to constrain the underlying learning mechanisms. In ecological learning environments, the data stream is assumed to be non-stationary and temporally correlated. In this context, we can introduce four desiderata that better reflect the ability to continually learn from non-i.d.d. streams in an online fashion:

1. Sequential Data: We assume a potentially infinite data stream to be high-dimensional, non-stationary and temporally correlated. In OCL, incoming patterns must be processed one by one or as mini-batches for the quick integration of information while preventing catastrophic forgetting. Training strategies can take advantage of temporally correlated data streams to accelerate learning.

2. Task-Agnosticism: The model should work in the absence of supplementary supervised signals such as task boundaries or labels (i.e. , ). In particular, the scenario in which an oracle provides the CL algorithm the task label both during training and testing to help reduce forgetting, disentangle representations and customize the agent behaviors constitutes a step-back with respect to the concept of CL algorithms which should learn continuously from a never-ending stream of data with none or very sparse supervised signals.

3. Bounded Resources: The number of training sets can potentially be unlimited, and thus, computation and memory should not be proportional to the number of hypothesis updates over time in any way. While available computational and storage resources can significantly vary, a finite upper bound should rather exist and be considered, especially with . Within the framework proposed in [lesort:hal-02381343], the resource bound may be formulated as follows: for every step in time, the number of current examples contained in the memory is lower than the total number of previously seen examples: .

4. Experience Replay: The periodic replay of previously encountered data samples (e.g. stored in a replay buffer) can alleviate catastrophic forgetting. However, storing data samples has the general drawback of large memory requirements and re-training complexity. In the brain, hippocampal replay provides the means for the gradual integration of knowledge and is thought to occur through the re-activation of latent representations [Mcclelland95] In latent replay, samples can be drawn from a probabilistic or generative model and replayed to the system for memory consolidation [Robins95].

2.3 Datasets and Benchmarks

Most of the proposed continual learning models have been designed for and evaluated with visual information. Datasets such as ImageNet and Pascal VOC provide a very good playground for classification and detection approaches. However, they were designed with static evaluation protocols in mind, i.e., the entire dataset is split into two parts: a training set is used for (one-shot) learning and a separate test set is used for performance evaluation. Splitting the training set into a number of batches is essential to train and test continual learning approaches.

Most of the existing datasets are not well suited to this purpose because they lack a fundamental ingredient: the presence of multiple (unconstrained) views of the same objects taken in different video sessions (e.g. varying background, lighting, pose, occlusions). The presence of temporally coherent sessions (i.e., videos where the objects move in front of the camera) is a key feature since temporal smoothness can be used to simplify object detection, improve classification accuracy, and address unsupervised scenarios [Maltoni2016-icpr]. This important propriety would indeed allow a natural interplay between sequence learning and CL approaches.

In the context of object recognition, we can consider three continual learning scenarios:

  • New Instances (NI

    ): new training patterns of the same classes become available in subsequent batches with new poses and conditions (illumination, background, occlusion, etc.). A CL model is expected to incrementally consolidate its knowledge about the known classes without compromising what it has learned before.

  • New Classes (NC): new training patterns belonging to different classes become available in subsequent batches. In this case, the model should be able to deal with the new classes without decreasing accuracy on the previous ones.

  • New Instances and Classes (NIC): new training patterns belonging both to known and novel classes become available in subsequent training batches. A CL model is expected to consolidate its knowledge about the known classes and to learn the novel ones.

Most CL benchmarks are benchmarks adapted from others fields, for instance:

  • Classification: MNIST [LeCun10], Fashion-MNIST [Xiao2017], CIFAR10/100 [Krizhevsky09], Street View House Numbers (SVHN) [Netzer11], CUB200 [Welinder10], LSUN [Yu15], ImageNet [krizhevsky12], Omniglot [lake2015human] or Pascal VOC [Everingham15] (object detection and segmentation).

  • Reinforcement Learning: Arcade Learning Environment (ALE) [Bellemare13] for Atari games, SURREAL [Fan18] for robot manipulation and RoboTurk for robotic skill learning through imitation [Mandlekar18], CRLMaze extension of VizDoom [lomonaco2019continual] and DeepMind Lab [Mankowitz18].

These datasets are then split, artificially modified via image rotations or the permutation of pixels, and concatenated together to create sequences of tasks. As an example, permuted MNIST [Kirkpatrick17] and rotated MNIST [Lopez-Paz17] are CL datasets artificially created from MNIST.

Dataset Cat. Obj. Sess. Frames per sess. Format Acquisition setting Outdoor sessions
NORB [LeCun2004] 5 25 20 20* grayscale turntable no
COIL-100 [Nene1996] - 100 20 54* RGB turntable no
iLab-20M [Borji2016] 15 704 - - RGB turntable no
RGB-D [Schwarz2015] 51 300 - - RGB-D turntable no
BigBIRD [bigbird] - 100 - - RGB-D turntable no
ALOI [aloi] - 1000 - - RGB turntable no
BigBrother [Franco2009] - 7 54 20 RGB wall cam. no
iCubWorld28 [Pasquale2015a] 7 28 4 150 RGB hand hold no
iCubWorld-Transf [icub-transf] 15 150 6 150 RGB hand hold no
OpenLORIS [icub-transf] 19 69 7 500 RGB-D moving cam. no
CORe50 [Lomonaco17] 10 50 11 300 RGB-D hand hold yes (3)
Table 1: Comparison of datasets (with temporal coherent sessions) for continual object recognition. * Temporal coherent training/test sessions for NORB and COIL-100 have been defined in [Maltoni2016-icpr].

In Table 1, we compare datasets that we believe are better suited for CL tasks (mostly in the context of continuous object recognition such as CORe50 [Lomonaco17], OpenLORIS [openloris] or iCub-Transformation [icub-transf]). Datasets where temporal coherent sequences are not available (or cannot be generated from static frames) were excluded. In the first group of datasets (NORB, COIL-100, iLAB20M, Washington RGB-D, BigBIRD, ALOI), objects are positioned on turntables and acquisition is systematically controlled in term of pose/lighting. Neither complex backgrounds nor occlusions are present in these datasets. For NORB and COIL-100 we defined in [Maltoni2016-icpr] a number of exploration sequences that turn the native static benchmarks into continual learning tasks; [Maltoni2016-icpr] also reports supervised and semi-supervised accuracy for the NI scenario. Exploration sequences can be generated for the other datasets in this group as well by randomly walking through adjacent static frames in the multivariate parameter space; however, the obtained sequences would remain quite unnatural. BigBrother dataset (see [Lomonaco2016] [Franco2009]

) is an interesting incremental learning setup in the face recognition domain but copyright restrictions do not allow the public distribution of the dataset. Finally,

iCubWorld ([Pasquale2015a], [icub-transf]) and OpenLORIS have been acquired in a robotic vision context and are similar to CORe50. In fact, objects are handhold at nearly constant distance from the camera and are randomly moved. Among all these datasets, CORe50 and OpenLORIS comprise a higher number of longer sessions (including outdoor ones), more complex backgrounds and also provide depth information that can be used as extra-feature for classification and/or to simplify object detection. We think that cross-evaluating online continual learning approaches on, iCubWorld-Transf and OpenLORIS could be very interesting.

Figure 2: Example images of the 50 objects in CORe50. Each column denotes one of the 10 categories [Lomonaco17].
Figure 3: Example of 1 second recording (at 20 fps) of object #26 in session #4 (outdoor) [Lomonaco17].

3 Hybrid Approaches for Gradient-Based OCL

In this section, we will discuss a number of recently proposed algorithms for OCL based on gradient-descent. We will start with simple algorithms inspired by structural plasticity in the brain, moving towards more complex and hybrid approaches also using synaptic regularization as well as experience replay. We show that simply combining different and complementary approaches for OCL results in higher memory retention and, ultimately, in a better overall performance.

3.1 Copy Weight with Reinit (CWR)

CWR [pmlr-v78-lomonaco17a] was proposed as a baseline technique for CL from sequential batches. While this approach can work for NC (new classes) as well as for NIC (new instances and classes) update content type, here we focus on NC under SIT scenario. The most obvious approach to implement an SIT strategy seems to be:

  1. Freeze shared weights after the first batch.

  2. For each batch

    , extend the output layers with new neurons/weights for the new classes, randomly initialize the new weights but retain the optimal values for the old class weights. The old weights could then be frozen (denoted as FW in

    [Lomonaco2017-arxiv]) or continued to be tuned (denoted as CW in [Lomonaco2017-arxiv]).

To learn class-specific weights without interference among batches, CWR maintains two sets of weights for the output classification layer: are the consolidated weights used for inference and the temporary weights used for training: are initialized to 0 before the first batch, while are randomly re-initialized (e.g., Gaussian initialization with std = 0.01, mean = 0) before each training batch. In other words, can be seen as a sort of hippocampus where consolidated concepts are maintained, while as a short-term working memory in the cortex used to learn new concepts without interfering with stable ones. At the end of each batch training, the weights in corresponding to the classes in the current batch are scaled and copied in : this is trivial in NC case because of the class segregation in different batches but is also possible for more complex cases [pmlr-v78-lomonaco17a]. To avoid forgetting in the lower levels, after the first batch , all the lower level weights are frozen. Weight scaling with batch-specific weights is necessary in case of unbalanced batches with respect to the number of classes or number of examples per class.

In CWR experiments reported in [pmlr-v78-lomonaco17a], we used models without class-shared fully connected layers (e.g., we removed FC6 and FC7 in CaffeNet) to better disentangle class-specific weights. Since weights are frozen after the first batch, fully connected layer weights tend to specialize in the first batch classes only. CWR implementation is very simple and, the extra computation is negligible and for each batch , its overhead consists of the storage of temporary weights , totaling values, where is the number of classes and the number of penultimate layer neurons.

Copy Weight with Reinit+ (CWR+)

In [maltoni2019], the authors proposed two simple modifications of CWR: the resulting approach is denoted as CWR+. The first modification, mean-shift, is an automatic compensation of batch weights . Tuning such parameters is annoying and a wrong parametrization can lead the model to underperform. Empirical evidence shows that if the weights learned during batch are normalized by subtracting their global average, then rescaling by is no longer necessary (i.e., all

). Other reasonable forms or normalization, such as setting standard deviation to 1, led to worse results in our experiments. The second modification, denoted as zero init, consists in setting initial weights

to 0 instead of typical Gaussian or Xavier random initialization. It is well known that neural network weights cannot be initialized to 0, because this would cause intermediate neuron activations to be 0, thus nullifying back-propagation effects. While this is certainly true for intermediate level weights, it is not the case for the output level [maltoni2019].

What is important here is not using the value 0, but the same value for all the weights (0 is used for simplicity). It has been shown that this has a significant impact on the training dynamic and the forgetting [maltoni2019]

. If output level weights are initialized with Gaussian or Xavier random initialization they typically take small values around zero, but even with small values in the first training iterations the softmax normalization could produce strong predictions for wrong classes. This would trigger unnecessary errors backpropagation changing weights more than necessary. While this initial adjustment is irrelevant for normal batch training, we empirically found that is detrimental for continual learning.

3.2 Architect & Regularize (AR1)

A drawback of simple structural plasticity approaches as CWR and CWR+ is that weights are tuned during the first batch and then frozen. AR1, firstly proposed in [maltoni2019], consists of the combination of an Architectural and Regularization approach. In particular, CWR+ is extended by allowing to be tuned across batches subject to a regularization constraint (as per LWF [Li17], EWC [Kirkpatrick17] or SI [Zenke17]

). The authors performed several combination experiments on CORe50 to select a regularization approach; each approach required a new hyperparameter tuning w.r.t. the case when it was used in isolation. At the end, the choice for AR1 was in favor of SI

[Zenke17] because of the following reasons:

  • LWF performs nicely in isolation, but in our experiments it does not bring relevant contributions to CWR+. Being the LWF regularization driven by an output stability criterion, most of the regularization effects go to the output level that CWR+ manages apart.

  • Both EWC and SI provide positive contributions to CWR+ and their difference is minor. While SI can sometimes be unstable when operating in isolation, it has been shown that it is much more stable and easy to tune when combined with CWR+ [maltoni2019].

  • SI overhead is small since the computation of trajectories can be easily implemented from data already computed by SGD.

Considering the low computational overhead and the fact that typically SGD is typically early stopped after 2 epochs, AR1 is suitable for online continual learning.

AR1* and Latent Replay

A simple approach such as CWR+, where the fully connected layer is implemented as a double memory, is quite effective to control forgetting in the SIT - NC scenario. However, after the first training batch, CWR+ freezes all the layers except the last one, thus losing the benefit of an incremental adaptation of the underlying representation. AR1 [maltoni2019] was then proposed to extend CWR+ by enabling end-to-end continual training throughout the entire network. To this purpose, the Synaptic Intelligence [Zenke17] regularization approach (similar to EWC [Kirkpatrick17]) is adopted to constrain the change of critical weights. In [Lomonaco2019], the authors:

  1. adapt CWR+ to the NIC scenario, thus making it able to reload past weights for already known classes and to adapt them with weighted contributions from different batches. As AR1 incorporates CWR+ in its main algorithm, this modification will result in two continual learning strategies, denoted as CWR* and AR1*.

  2. show that in a fine-grained scenario with small and non i.i.d. batches, Batch Normalization layers thwart the continual learning process and replacing them with Batch Renormalization

    [loffe2017] can effectively tackle this problem.

  3. propose a selective weight freeze for the CNN models adopting Depth-Wise Separable Convolutions.

  4. reduce the computational and storage complexity of AR1 (and in general of EWC like approaches), by introducing an alternative way to implement weights update starting from the Fischer matrix.

While 1. is specific to CWR+, 2-4. can be applied to other CL approaches as well.

AR1* proved to be effective even without any kind of experience replay. However, even a small percentage of replay patterns can be extremely beneficial for taming forgetting [pellegrini2019latent]

. In deep neural networks, the layers close to the input (often referred to as representation layers) usually perform low-level feature extraction and, after the proper pre-training on a large dataset (e.g., ImageNet), their weights are quite stable and reusable across applications. Higher layers, instead, tend to extract class-specific discriminant features and their fine-tuning is often important to maximize accuracy.

Figure 4: Architectural diagram of Latent Replay [pellegrini2019latent].

For this reason, latent replay was introduced [pellegrini2019latent]: instead of maintaining copies of input patterns in the external memory in the form of raw data, they stored the activations volumes at a given layer (denoted as Latent Replay layer; see Fig. 4). To keep stable representations and valid stored activations, it was proposed to slow down the learning at all the layers below the latent replay one and to leave the layers above free to learn at full pace. In the limit case where low layers are completely frozen (i.e., slow down to 0), latent replay is functionally equivalent to rehearsal from the input (hereafter denoted as native rehearsal), but achieves a computational and storage saving thanks to the smaller fraction of patterns that need to flow forward and backward across the entire network and the typical information compression that networks perform at higher layers.

Figure 5: AR1*free with latent replay () for different choices of the latent replay layer [pellegrini2019latent]. Setting the replay layer at the pool6 layer makes AR1*free equivalent to CWR*. Setting the replay layer at the “images” layer corresponds to native rehearsal. The saturation effect which characterizes the last training batches is due to the data distribution in NICv2 – 391 (see [Lomonaco2019]): in particular, the lack of new instances for some classes (that already introduced all their data) slows down the accuracy trend and intensifies the effect of activations aging.
Figure 6: Accuracy results on the CORe50 NICv2 – 391 benchmark of CWR*, AR1*, DSLDA, iCaRL, AR1*free (conv5_4), AR1*free (pool6[pellegrini2019latent]. Results are averaged across 10 runs in which the batches order is randomly shuffled. Colored areas indicate the standard deviation of each curve. As an exception, iCaRL was trained only on a single run given its extensive run time (14 days).

In the general case where the representation layers are not completely frozen the activations stored in the external memory suffer from an aging effect (i.e., over time they tend to increasingly deviate from the activations that the same pattern would produce if feed-forwarded from the input layer). However, if the training of these layers is sufficiently slow the aging effect is not disruptive since the external memory has enough time to be rejuvenated with fresh patterns. When latent replay is implemented with mini-batch SGD training: (i) in the forward step, a concatenation is performed at the replay layer (on the mini-batch dimension) to join patterns coming from the input layer with activations coming from the external storage; (ii) the backward step is stopped just before the replay layer for the replay patterns.

In Figure 5, we show the accuracy of AR1*free with latent replay () for different choices of the rehearsal layer (reported between parenthesis) is shown. As expected, when the replay layer is pushed down the corresponding accuracy increases, showing that a continual tuning of the representation layers is important. However, after conv5_4/dw there is a sort of saturation and the model accuracy no longer improves. The residual gap (4%) with respect to native rehearsal is not due to the weights freezing of the lower part of the network but to the aging effect introduced above. This can be proved by implementing an “intermediate” approach that always feeds the replay pattern from the input and stops the backward at conv5_4

: such an intermediate approach achieved an accuracy very close to the native rehearsal at the end of the training. The accuracy drop due to the aging effect can be further reduced with better tuning of BNR hyper-parameters and/or with the introduction of a scheduling policy, making the global moment mobile windows wider as the continual learning progresses (i.e., more plasticity in the early stages and more stability at later stages). In Figure

6, we show the iCaRL accuracy over time and compare it with AR1*free (conv5_4/dw), AR1* (pool6) as well as the top three performing rehearsal-free strategies on CORe50 NICv2-391 (CWR*, AR1* and DSLDA) are reported. While iCaRL exhibits better performance than LWF and EWC (as reported in [Lomonaco2019]), it is far from DSLDA, CWR* and AR1*.

Overall, AR1* combined with latent replay shows to be substantially more effective for OCL on sequential data streams with a good resource consumption trade-off [pellegrini2019latent]).

4 Growing Networks with Experience Replay

In this section, we introduce two approaches using growing neural networks for unsupervised learning and human action classification from videos. The architectures discussed here can learn also in the absence of an explicit teaching signal such a class label. The requirement for dense human annotations used by standard regression techniques is undesirable as such labels are typically not present in real-world learning scenarios.

The architectures comprise growing self-organizing networks for learning from sequential input. Specifically for self-organizing networks, catastrophic interference is modulated by the conditions of map plasticity, the available resources to represent information, and the similarity between new and old knowledge [Parisi17, Richardson08]. Growing networks can dynamically add new neurons and synapses to accommodate novel knowledge and protect consolidated embeddings from catastrophic interference. Importantly, we will describe how self-organizing learning dynamics can be leveraged to implement efficient experience replay mechanisms without the need for additional memory resources such as ad-hoc replay buffers.

4.1 Growing Self-Organizing Networks

In Parisi et al. [Parisi17], we proposed a self-organizing architecture consisting of a series of hierarchically arranged growing networks for the continual learning of human actions from videos. Each layer in the hierarchy comprises a growing recurrent network Gamma-GWR and a pooling mechanism for learning action features with increasingly large spatiotemporal receptive fields (Fig. 7). The proposed deep architecture is composed of two distinct processing streams for pose and motion features, and their subsequent integration in the STS layer.

The Gamma-GWR extends the Grow When Required (GWR) network [Marsland2002]

with temporal context. Each neuron consists of a weight vector

and a number of context descriptors  (with ). Given as input, the index of the best-matching unit (BMU), , is computed as:


where denotes the Euclidean distance, and are constant values that modulate the influence of the temporal context, is the weight vector of the BMU at , and is the global context of the network with . For an input , the activity of the network, , is defined in relation to the distance between the input and its BMU (Eq. 2):


thus yielding the highest activation value of when the network can perfectly match the input sequence (). The training of the neurons is carried out by adapting the BMU and its neighboring neurons :


where , is a constant learning rate (), and is a habituation counter that decreases over time as the neurons are fired (i.e., selected as the BMU or its neighbor).

Figure 7: Diagram of our deep neural architecture with Gamma-GWR networks for continual action recognition [Parisi17].

Empirical studies have shown that Gamma-GWR networks with additive neurogenesis show a better performance than a static GWR network with the same number of neurons [Parisi2018c]. While the mechanisms of structural plasticity in the Gamma-GWR do not resemble biologically plausible mechanisms (e.g., [Ming2011]), the GWR learning algorithm represents an efficient computational model that incrementally adapts to non-stationary input. Crucially, the GWR model creates new neurons whenever they are required and only after the training of existing ones. The neural update rate decreases as the neurons become more habituated, which has the effect of preventing that noisy input interferes with consolidated neural representations. Similar GWR-based approaches have been proposed for the incremental learning of body motion patterns [Mici2017, Elfaramawy2017, Parisi2016] and human-object interaction [Mici2018].

To achieve invariance to scale and translation, we implemented MAX-pooling layers after each Gamma-GWR network with the receptive field of neurons increasing along the hierarchy. This approach has shown competitive results with batch learning methods on the Weizmann 

[Gorelick2005] and the KTH [Schuldt2004] action benchmark datasets. On the KTH dataset, this method outperforms the overall accuracy reported by [jung2015]

with three different deep learning models: convolutional neural network (CNN, 92.9%), multiple spatiotemporal scales neural network (MSTNN, 95.3%), and 3D-CNN (96.2%). A direct comparison with these methods is however hindered by the fact that they differ in the type of input and number of frames per sequence used during the training and the test phase. On the Weizmann dataset, the Gamma-GWR model outperforms other hierarchical models that do not rely on handcrafted features, such as 3D CNN (

, [Ji2013]

) and 3D CNN in combination with long short-term memory (

, [Baccouche2011]).

Figure 8: Incremental learning: classification accuracy averaged across all the combinations for a given number of action classes [Parisi17].

Overall, the Gamma-GWR model shows competitive results with batch learning methods on action benchmark datasets. However, the neural growth and update are driven by the minimization of the bottom-up reconstruction error and, thus, without taking into account top-down, task-relevant signals that can regulate the plasticity-stability balance. The mechanism to prevent the acquisition of new information from forgetting existing knowledge is embedded in the dynamics of the self-organizing learning algorithm that allocates new neurons or updates existing ones based on the discrepancy between the input distribution and the prototype neural weights. To support this claim, we conducted an additional experiment in which we explore how our model accounts for avoiding catastrophic interference when learning new action classes.

For both datasets, we first trained the model with a single action class and then scaled up progressively to all the others in order to observe how the performance of the model changes for an increasing number of action classes. The results are shown in Fig. 8, where the classification accuracy was averaged across all the combinations for a given number of action classes. Although the performance decreases as the number of action classes is increased, this decline is not catastrophic. However, it is complex to establish whether this accuracy decrease is caused by catastrophic interference or the labeling strategy. We observed that the overall quantization error of the networks tends to decrease over the training epochs, suggesting that the prototype neurons are effectively allocated and fine-tuned to better represent the input distribution.

4.2 Replay via Neural Re-Activations

This vanilla Gamma-GWR model has a set of limitations in OCL scenarios. In particular, it is non-trivial to empirically find the adequate hyper-parameters to achieve an optimal plasticity-stability balance. To completely alleviate catastrophic forgetting, the model may grow until it becomes computationally expensive to process data in real time, reducing its ability to work with large-scale datasets. Instead, if the model excessively limits its growth, its overall performance over time may decrease due to progressive forgetting as it can be seen in Fig. 8. A replay mechanism could prevent the model from progressive forgetting. Additionally, although the networks would keep learning in an unsupervised fashion, a teaching signal can be used to modulate their growth during the learning phase.

Figure 9:

(A) Illustration of the GDM architecture. Extracted features from image sequences are fed into a growing episodic memory (G-EM). Neural activation trajectories from G-EM are fed to the growing semantic memory (G-SM). While the learning process of G-EM remains unsupervised, G-SM uses class labels as task-relevant signals to regulate levels of plasticity. After each learning episode, neural re-activation trajectories are replayed to both memories (green arrows); (B) The architecture classifies image sequences at instance level (episodic experience) and at category level (semantic knowledge). For classification, neurons in G-EM and G-SM associatively learn histograms of class labels from the input (red dashed lines); (C) To enable memory replay in the absence of sensory input, G-EM is equipped with temporal synapses that are strengthened between consecutively activated neurons 


In [Parisi18], we proposed growing dual-memory learning (GDM) comprising a deep convolutional feature extractor and two hierarchically arranged recurrent self-organizing networks (Fig. 9). The GDM model comprises an episodic memory and a semantic memory, both implemented as extended Gamma-GWR networks [Parisi17]. The growing episodic memory (G-EM) learns from sensory experience in an unsupervised fashion, i.e., levels of structural plasticity are regulated by the ability of the network to predict the spatiotemporal patterns given as input. Instead, the growing semantic memory (G-SM) receives neural activation trajectories from G-EM and uses task-relevant signals (input annotations) to modulate levels of neurogenesis and neural update, thereby developing more compact representations of statistical regularities.

G-EM and G-SM mitigate catastrophic forgetting through self-organizing learning dynamics with structural plasticity, increasing information storage capacity in response to novel input. For the consolidation of knowledge over time, internally generated neural activity patterns in G-EM are periodically replayed to both memories, thereby mitigating catastrophic forgetting during incremental learning tasks. To yield periodic experience replay, G-EM is equipped with synapses that learn statistically significant neural activity in the temporal domain. This results in the generation of sequence-selective neural activation trajectories that can be replayed to both networks after each learning episode without requiring additional memory resources to store the input. To preserve the temporal structure of the input during experience replay, the model generates temporally-ordered trajectories of neural activity. The trajectories are created by using the asymmetric temporal links of G-EM to recursively reactivate sequence-selective neural activity trajectories (RNATs) embedded in the network. RNATs can be computed for each neuron in G-EM for a given temporal window and replayed to G-EM and G-SM after each learning episode triggered by external input stimulation. For each neuron in G-EM, a RNAT of length can be generated:


where is the matrix of temporal synapses and .

The set of generated RNATs from all G-EM neurons is replayed to G-EM and G-SM after each learning episode. Sequence-selective prototype sequences can be generated and periodically replayed without the need to explicitly store the temporal relations and labels of previously seen training samples. This is in agreement with neurophysiological studies evidencing that hippocampal replay consists of the reactivation of previously stored patterns of neural activity occurring predominantly after an experience [Kudrimoti4090, Karlsson2009].

Figure 10: Comparison of the effects of forgetting during incremental learning with and without memory replay at an instance level (A,B) and category level (C,D). Each category contains 5 instances. The plots show the average accuracies on the categories encountered so far (A,C) and the accuracies on the first encountered category (B,D) as further new categories are learned. The shaded areas show the standard deviation [Parisi18].

A series of experiments evaluating the performance of the GDM model on the CORe50 dataset show the benefit of using memory replay. In the training strategy with replay, after each learning episode (i.e., a training epoch over the mini-batch), the model generates a set of RNATs from the G-EM neurons. Thus, the number of RNATs of length is equal to the number of neurons created by G-EM. RNATs are replayed to G-EM and G-SM in correspondence of novel sensory experience to reinforce previously encountered categories. Fig. 10 shows a comparison of the overall accuracy on all the object categories encountered so far to the accuracy on the first encountered category over the number of encountered categories. At an instance level (Fig. 10.A-B), incremental learning with memory replay improves the overall accuracy to (from ) and accuracy on the first 5 instances to (from ). At a category level (Fig. 10.C-D), the overall accuracy increases to (from ) and the accuracy on the first encountered category to (from ). Overall, results show that replaying RNATs generated from G-EM significantly mitigates the effects of catastrophic forgetting over time.

5 Conclusions

OCL is a crucial but challenging aspect of learning systems. Empirical evidence shows that the use of episodic memory can significantly alleviate catastrophic forgetting and that, when this memory replays latent input representations rather than explicitly stored training samples encountered during the learning phase, training complexity can be reduced. Overall, generative memory replay strategies may not only empirically useful but also fundamental, especially when processing non-i.i.d. sequential data streams.

Future research should aim at modeling and integrating additional aspects of learning found in biological systems which would allow artificial agents to learn efficiently in more complex environments. Examples of these aspects include curriculum and transfer learning. Humans and animals exhibit better learning performance when training examples are organized in a meaningful way, e.g., by making the learning tasks gradually more difficult [Krueger2009]. Following this observation, it was shown in [Elman1993] that having a curriculum of progressively harder tasks leads to faster training performance in neural networks. While a number of methods have been proposed that explore the use of training curricula (e.g. [Graves2016, Reed2015]

), these methods have not been investigated in combination with continual learning. In transfer learning, previously acquired knowledge in one domain is applied to solve a problem in a novel domain 

[Holyoak1997]. For this reason, transfer learning represents a significantly valuable feature for inferring general laws from (a limited amount of) samples. Recent methods proposed, for instance, the use of growing neural networks to transfer learned low-level features and high-level policies from a simulated to a real environment (e.g. [Rusu2017]). However, scalable OCL systems with transferable knowledge remain an open and exciting challenge.


The authors would like to thank the ContinualAI organization and the other ContinualAI Research fellows for their support.