E VALUATING O NLINE C ONTINUAL L EARNING WITH CALM
Anonymous authors
Paper under double-blind review
A BSTRACT
Online Continual Learning (OCL) studies learning over a continuous data stream without observing any single example more than once, a setting that is closer to the experience of humans and systems that must learn “on-the-wild”.
Yet, commonly available benchmarks are far from these real world conditions, because they explicitly signal different tasks, lack latent similarity structure or assume temporal independence between different examples.
Here, we propose a new benchmark for OCL based on language modelling in which input alternates between different languages and domains without any explicit delimitation.
Additionally, we propose new metrics to study catastrophic forgetting in this setting and evaluate multiple baseline models based on compositions of experts.
Finally, we introduce a simple gating technique that learns the latent similarities between different inputs, improving the performance of a Products of Experts model.
I NTRODUCTION
Machines, like humans, can learn to perform multiple different tasks from feedback alone (Caruana, 1997).
On the other hand, humans, but not machines, can beneﬁt from settings in which tasks are presented repeatedly for multiple trials before switching to the next one (Flesch et al., 2018), whereas machines require examples to be presented in a shufﬂed ( i.i.d ) order to learn effectively.
Otherwise, they suffer from an effect known as “catastrophic forgetting” or “catastrophic interference” (McCloskey & Cohen, 1989; Ratcliff, 1990).
While there has been a considerable amount of work focused on solving this problem, an endeavour that also goes by the name of ‘Continual’, ‘Incremental’ or ‘Life-long’ Learning, a large part of it is evaluated on settings in which there is an explicit delimitation signal for every new task presented to the model (Kirkpatrick et al., 2017;
Zenke et al., 2017; Sodhani et al., 2018; Serra et al., 2018; Lopez-Paz & Ranzato, 2017; Fernando et al., 2017; Lee et al., 2017; Rusu et al., 2016; Li & Hoiem, 2018; Aljundi et al., 2017; Adel et al., 2020; Titsias et al., 2020; Ebrahimi et al., 2020; von Oswald et al., 2020;
Li et al., 2020; Yoon et al., 2020).
However, humans do not need any such signalling at all.
Consider, for example, the case of a child growing up in a multi-lingual environment.
Even though it is not entirely clear whether the child would rely on environmental cues (for instance, the identity of the speaker) to distinguish different input languages or not (De Houwer, 2017), any mechanism must be necessarily inferred from the context.
Moreover, even the concept of “task” could be vacuous, as it could be represented by shifting data distributions (Lesort et al., 2020).
Even though the emerging ﬁeld of Online Continual Learning (Parisi & Lomonaco, 2020; Aljundi et al., 2019a) or Task-Free Continual Learning
(Aljundi et al., 2019b; Lee et al., 2020) has started to propose solutions to these problems, commonly available benchmarks make assumptions that are far from the real world conditions, such as lacking latent similarity structure on the data stream (e.g. orthogonal permutations of an image pixels) or assuming temporal independence between different examples (e.g. an image of a chair can be classiﬁed as “chair” independently of any previous examples).
Consider, instead, the challenge of natural language learning which requires making sense of a highly correlated and temporally interdependent data stream.
We argue that the notable scarcity of benchmarks featuring temporally correlated sequences of examples, with short and long-term dependencies, latent similarities between different classes of examples, and no explicit delimitation when transitioning between different classes has left a blind spot in the Online Continual Learning community, which we address here.
Moreover, almost none of the commonly used benchmarks deals with language, further limiting the amount of research that extends to this modality.
Here, we make a two-fold contribution towards studying online continual learning in neural networks in a linguistic setting.
First, we bring CALM ( Class-Agnostic Continual Language
Modelling ) to the community, a continual language modelling evaluation framework containing text that alternates between different classes of input (e.g. different languages or domains) with latent similarities to which the models could adapt.
We introduce two variants.
The ﬁrst is a characterbased language modelling benchmark featuring ﬁve different languages that randomly switch between one another.
The second one is a word-based language modelling task, where the text alternates between four different domains.
No segmentation signal is given when a switch happens, thus requiring models to learn to adapt to these changes.
We also propose novel metrics that capture the impact of catastrophic forgetting in an online learning setting by measuring how efﬁciently can models adapt to class switches.
In line with Aljundi et al. (2019b), we note that when a distribution shift occurs, a neural network that suffers from catastrophic forgetting will display a spike in the loss signal, even when the distribution had been observed in the past (see Figure 1a).
Thus, we propose catastrophic forgetting metrics based on characterizing the size of these peaks.
The benchmark is provided as a Python library that can be easily imported into a PyTorch project.
1 Second, we evaluate multiple baselines based on expert architectures and propose a novel albeit simple mechanism that we call plastic gates , which we show to improve the performance of Products of Experts.
Our post-hoc analysis shows that this mechanism is effective in producing a gating strategy that helps to circumvent catastrophic interference while also uncovering latent similarities in the input classes.
R ELATED WORK
The ﬁeld of Continual Learning, Incremental Learning or Lifelong Learning has grown to encompass a large body of work, which is better summarized in respective reviews (Parisi et al., 2019;
Lesort et al., 2020).
An overwhelming majority of this work concerns image classiﬁcation problems or object recognition.
Some evaluation datasets are derived from traditional machine learning datasets by manipulating the input examples in more or less artiﬁcial ways –like Permuted
MNIST (Kirkpatrick et al., 2017) or Rotated MNIST (Lopez-Paz & Ranzato, 2017)– while others keep examples unchanged but present them in a speciﬁc non-i.i.d.
order, like for instance, iCIFAR100 (Rebufﬁ et al., 2017) or split-MNIST (Zenke et al., 2017).
All of these datasets comprise single-input classiﬁcation problems in which there are no temporal dependencies nor correlations between two consecutive examples.
To better approximate the conditions of real-world experiences, Fanello et al.
(2013), Lomonaco & Maltoni (2017) and Roady et al. (2020) introduced iCubWorld, CORe50, and Stream-51 respectively, which comprise short videos of objects from different angles (further including naturalistic scenes in the latter case).
These datasets address the problem of correlated examples, but not of temporal dependencies, which we do address in this work.
Li et al.
(2020) and de Masson d’Autume et al.
(2019) proposed the only benchmarks dealing with language that we know of, in which the former adopts a sequence to sequence paradigm to study incremental learning of new vocabulary items on simpliﬁed or artiﬁcial datasets, while the latter adapted existing text classiﬁcation and QA benchmarks analogously to above-mentioned work in image classiﬁcation.
Our work instead uses naturalistic textual data containing natural latent similarities between distributions that can drive information transfer or forgetting.
By and large, work directed to address catastrophic forgetting in neural networks presumes the existence of a task identiﬁer to signal different learning units.
However, recent work has aimed at tackling catastrophic forgetting even in conditions in which no task boundaries are provided (Aljundi et al., 2019b; Lee et al., 2020), going under the name of “Task-Free Continual Learning” or “Online
Continual Learning” (Parisi & Lomonaco, 2020; Aljundi et al., 2019a).
Of these works, only Aljundi et al.
(2019b) uses naturalistic data to classify actors appearing in soap-opera episodes (Aljundi et al., 2016), while others resort to artiﬁcially modiﬁed datasets like split or permuted MNIST.
Here, we complement this resource with a text-based benchmark for Task-Free Continual Learning, while arguing for more work on more naturalistic non-i.i.d.
datasets.
Another aspect of Continual Learning deals with how models are evaluated.
Most often, this is done by measuring accuracy on a dedicated test set (Lopez-Paz & Ranzato, 2017; Díaz-Rodríguez et al., 2018; Hayes et al., 2018; Chaudhry et al., 2018; de Masson d’Autume et al., 2019).
However this evaluation protocol is tailored for batch learning conditions, in which a model is ﬁt to a training dataset, and then stops learning.
Here, instead, we argue in favour of situated evaluation protocols adapted to far-from-equilibrium learning conditions (Holland, 1992) by adopting an Online Learning framework (Hoi et al., 2018), which is also known as the prequential approach (Dawid, 1984; Gama et al., 2013).
On the modelling side, this work explores Mixture of Experts (Jacobs et al., 1991) and Product of Experts (Hinton, 1999) architectures.
Variations thereof are at the base of many architectural proposals for addressing catastrophic forgetting (Rusu et al., 2016; Li & Hoiem, 2018; Aljundi et al., 2017; Lee et al., 2020).
However, often they are accompanied by other mechanisms, such as the growth of new modules, freezing of weights or generative modelling of the input.
Here we examine the simplest enactments of these architectures and propose an easy-to-implement gating mechanism which can be learned online and provides a strong baseline for more complex architectures.
Finally, our study falls within the line of language modelling using neural network models (Bengio et al., 2003; Mikolov et al., 2010).
In this context, adaptation to the recent past has been studied in the context of cache models (Grave et al., 2017; Merity et al., 2017).
There, a non-parametric model deals with capturing high-frequency recent statistics while a parametric model captures the more stable aspects of the distribution.
These solutions, however, are not well-adapted for cases in which the whole distribution changes over time.
Moreover, language modelling is generally studied in a train-test split, where a model is ﬁtted to the training data and asked to generalize over the unseen test data.
Here, instead, we study how a model can adapt to incoming data in an online fashion.
T HE CALM BENCHMARK
We designed a benchmark for evaluating Online Continual Learning algorithms having in mind the following three desiderata: 1) naturally correlated sequential data, 2) task agnosticism and 3) temporally situated evaluation.
Parisi & Lomonaco (2020) discusses the ﬁrst two.
The ﬁrst requires that on the one hand, data is observed in a potentially inﬁnite data stream with high-dimensional, non-stationary, and temporally correlated examples.
The second, that learning systems should not be fed external task boundaries to help them learn in these conditions.
Furthermore, we also introduce a third desideratum, by which we ask models to be evaluated in-situ on each example presented to the model, following the classical Online Learning setting (Hoi et al., 2018;
Sahoo et al., 2018).
We thus propose an Online Continual Learning benchmark featuring a language modelling objective where the data stream can switch between different distributions.
Because switches are not announced to the model, this is a “Single-Incremental-Task“ or “No task label” scenario under the framework proposed by Lesort et al.
More precisely, consider a sequence of observations x t ∈ X that are fed to a model M parametrized by Θ t , which makes the prediction ˆ y t ∈ Y .
Then, the true target y t ∈ Y will be revealed and the loss
L t =
L (ˆ y t , y t ) is observed and later used to compute the model’s performance from a given time S until time T as the average loss in that span ¯ L T S
= 1 T − S (cid:80) T t =
S L t for evaluation purposes.
Only after reporting the loss can the model be trained based on the received feedback, preventing data leakage.
In practice, these examples are presented as mini-batches ( X t , Y t ) ∈
X b × w × Y b × w containing b parallel streams, and chunked into small windows of length w for efﬁciency considerations related to the training of neural networks (Parisi & Lomonaco, 2020).
The data stream is composed of N sequences of consecutive mini-batches of length T 1 , T 2 , . .
. , T N , and starting at positions S
i = (cid:80) i − 1 j =1 T j .
In turn, each of these sequences belong to one of n different classes [ D 1 , . . .
, D n ] , presented in random order.
To characterize the effect of forgetting we note that a model that becomes disadapted to a given distribution will display a spike in the loss after the stream switches to this distribution, even if it has been observed before (see Figure 1a).
For a model to be resilient to catastrophic forgetting, it must adapt quickly to every new distribution, which can be characterized by the height and width of these peaks.
We thus propose the following metrics to complement the standard online performance:
• Loss after switch : Tracks the loss for the ﬁrst k times-steps after a switch occurs to quantify the height of the peak.
Formally, L@sw = 1 N (cid:80) Ni =1 ¯ L S
i + k S
i
• Recovery time after switch : Counts the number of time-steps that it takes the model to reach the mean loss observed for the last seen sequence of the current class.
In this way, we can quantify the length of the peak.
3. D ATASET
In this work, we created two datasets for CALM.
One is character-level and multilingual, whereas the other is word-level and multi-domain.
Both benchmarks feature conﬂicting learning signals when moving between domains or languages, making the learning systems susceptible to catastrophic forgetting.
For our ﬁrst dataset ( MultiLingual and character-based), we propose a language modelling benchmark in which incoming text data can alternate between different languages.
This benchmark is character-based because there would hardly be any forgetting at the word level, as the word distributions hardly share any support.
Concretely, we build on parts of the news corpus developed for the 2009 Workshop of Machine Translation (Callison-Burch et al., 2009).
We extracted text from ﬁve languages: English, French, Spanish, German, and Czech (containing 1.8B, 572M, 160M, 715M and 439M characters, respectively) because they all have similar character sets, while also showing interesting linguistic variability.
In particular, they belong to three different Indo-European branches: Romance (French and Spanish), Germanic (English and German), and Slavic (Czech).
As a consequence, there is a latent similarity structure between the different classes that models could learn to recognize.
Compared to earlier multilingual corpora (Kawakami et al., 2017), our dataset was carefully constructed to include only linguistically valid characters, in order to prevent nonlinguistic noise from interfering with our experiments.
For this, we removed all lines from the input that contained characters appearing less than 100 times on the full corpus.
The resulting character vocabulary consists of 211 characters.
The second dataset is an English word-level MultiDomain dataset.
For this, we used four different source corpora: news (same as above), europarl (Koehn, 2005), the British National Corpus (Consortium et al., 2007), and Wikipedia (Merity et al., 2017).
They each have 300M, 54M, 100M and 101.4M tokens, respectively.
In contrast with the previous dataset, word-level is the most appropriate choice here, as differences between the distributions at the character level would be too nuanced to drive any forgetting.
We kept in the vocabulary the top 25K words for each corpus, which after merging yielded a vocabulary size of 58K words.
Samples from all source corpora are included in the appendix.
We then created the ﬁnal MultiLingual and MultiDomain corpora by joining N = 100 different fragments evenly distributed among the different classes (languages or domains) with lengths sampled from a (truncated) exponential distribution: T i ∼ Exp ( λ ) .
Thanks to this distribution’s memorylessness property, it is virtually impossible to estimate when the next switch is going to happen.
While we do not constrain switches to occur at word or sentence boundaries, but rather after an integer number of sequences of length w , the noise introduced at transition points for this reason is relatively mild and does not affect the distribution-alternating nature of the dataset.
In beneﬁt, training and further analysis become considerably simpliﬁed by removing the need to handle variable-length input.
We constructed two different variations with shorter or longer fragments.
For MultiLingual, we constructed 1M and 10M-characters-long corpora with expected fragment lengths of λ = 10 k and λ = 100 k characters, respectively.
For MultiDomain we followed the same procedure, extracting 100 alternating sequences with mean lengths of λ = 10 k and λ = 20 k, for a total of 1M and 2M words.
These relatively modest sizes allow for faster iteration and exploration of different models, while still allowing us to observe forgetting (or lack thereof) dynamics in the studied models.
To facilitate further research, we release a Python library 2 providing a data iterator for both datasets in which a researcher can experiment with different variations by picking parameters N and λ .
B ASELINE M ODELS
To endow CALM with simple and yet, strong baselines, we explored architectures based on (Weighted) Product of Experts or PoE (Hinton, 1999) and Mixture of Experts or MoE (Jacobs et al., 1991; Eigen et al., 2013), henceforth generically denoted expert architectures.
Thanks to combining predictions from different experts, they can potentially learn different parts of the latent distributions.
Moreover, gating weights can avert catastrophic forgetting on the individual experts by modulating the learning signal, making them an excellent candidate to model Online Continual
Learning problems.
Indeed, while variations thereof have been explored before (see Section 2), here we emphasize simplicity as it would beﬁt baseline models, yet not neglecting performance.
In the standard implementation of expert architectures, mixture weights are produced by a third “gating” module as a function of the current inputs.
While this gating model could quickly adapt to changes in the environment, learning to do so is far from trivial in a continual learning setup, sometimes requiring pre-training to distinguish input classes (Aljundi et al., 2017).
The problem comes from the fact that the gating network must learn a latent classiﬁer to pick the experts best adapted to the current class, but classes are observed non-i.i.d.
as long sequences of examples from one class at a time.
Thus, the gating network can easily settle for a constant function for any given current class, which only changes when examples of a different class start to be observed, making experts vulnerable to catastrophic forgetting.
In order to alleviate this issue and make experts more stable, we propose plastic gates , by which the gates are fast-adapting parameter values that are trained on recent experience.
More formally, an expert architecture is composed of a set of modules M =
{ M 1 , . .
, M n } with parameters Θ M 1 , . .
, Θ M n , used to compute a unique prediction as follows.
When an input x (with target y ) is observed, it is fed to all modules M 1 ...n , obtaining log-linear outputs ˜y (1) =
M 1 ( x ) , . .
, ˜y ( n ) =
M n ( x ) .
Then, an additional vector of mixture weights w ∈ R n is used to combine them.
This vector is computed by a separate gating module w =
G ( x ) with parameters Θ G , jointly trained with the rest of the network.
The output of the full model y is then a linear combination of the individual modules outputs ˜Y =
[ ˜y (1) , . .
, ˜y ( n ) ] weighted by w 3 , after or before normalizing, depending on whether the model is MoE or PoE:
[Equation]
Note that in contrast to MoE, PoE are more efﬁcient to compute because they do not require to normalize the output of each individual model.
Once the loss is computed on a mini-batch ( X t , Y t ) and kept for evaluation (see Section 3), all sub-networks G and M are trained for one or more gradient steps to reduce this loss, and the system moves to the next mini-batch.
Plastic Gates Rather than learning a gating network, which can be challenging, we propose to continually learn the gating coefﬁcients that best ﬁt the recent experience:
[Equation]
In practice, we perform a (hyperparameter) number k of gradient descent steps on the above objective to allow for some regularization of the gates over time.
Parametrization for Language
Modelling We instantiate the expert modules M i to be doublelayered LSTM networks (Hochreiter & Schmidhuber, 1997), with predictions ˜y ( i ) t , h t
+ 1 ( i ) =
LSTM i ( x t , h t ( i ) ) .
For the regular gating network, we use a single-layer LSTM network.
That is, w t , h (cid:48) t + 1 = LSTM( x t , h (cid:48) t ) .
E XPERIMENTS
We explored the performance of different baseline models while they made a single pass over the
CALM datasets.
Following standard practice, rather than reporting the cross-entropy loss, we use the perplexity at each time step, given by exp ( L t ) .
Furthermore, we allowed the models to learn over the ﬁrst half of the datasets without being evaluated, and only start computing metrics on the second half.
Otherwise, we use the measures discussed in Section 3 to track models’ performance, namely, average perplexity ( ppl ), average perplexity for k = 10 batches after a switch ( ppl@sw ) and recovery time after a switch ( rec ).
We explored models featuring different degrees of modularization, varying their hidden size vectors to make them all have an approximately equal total number of parameters.
On one extreme, we had a large two-layers LSTM network.
Next, we considered standard PoE and MoE models with mixture weights computed by an LSTM gating network, plus their plastic weights variants ( +PW ), as described in Section 4.
Moreover, we trained ensemble models ( Ensemble ), which are equivalent to a MoE where all mixture weights are 1 n for all n modules.
We studied both a more centralized network composed of 5 modules and larger hidden dimensionality (marked with 5 ) and a more distributed network with 30 modules but with smaller hidden sizes (marked with 30 ).
As reference points (but not as real contenders), we also trained independent LSTMs ( Ind. LSTM ), one for each class, which enabled us to compare the performance of our model to a situation where there is no forgetting from conﬂicting learning signals, but also where there is no possibility of transferring learned representations across possibly related domains.
Furthermore, we compare a Mixture-ofSoftmax ( MoS ) model
(Yang et al., 2018), in which multiple softmax layers are combined to extract the predictions from a single LSTM module.
While we were also interested in applying state-of-theart online continual learning methods (Lee et al., 2020; Aljundi et al., 2019a), having these systems being designed for image classiﬁcation datasets they would require non-trivial adaptations significantly departing from the original models, which would limit any possible conclusions we could draw.
Similarly, we experimented extensively on validation data with Transformer models (Vaswani et al., 2017).
However, due to these models sensitivity to dataset size and learning rates scheduling schemes which have been studied extensively for batch-learning (Popel & Bojar, 2018), but not for these far-from-equilibrium (Holland, 1992) conditions, their performance was worse than expected.
We give a detailed account of our attempts in the appendix and leave a study on how to adapt these models for Online Continual Learning for future work.
We controlled the number of model parameters to remain constant for each of the MultiLingual (about 21M parameters) and the MultiDomain (about 600M parameters) experimental setups.
(The difference in size is explained by the larger vocabulary sizes in the latter.)
For this, we adjusted the hidden dimensionality of different models accordingly, which, together with all explored hyperparameters, are reported in the appendix.
We kept the size of the incoming batches ﬁxed at w =and b = 10 for all models and used PyTorch (Paszke et al., 2017) with the standard implementations for the underlying models.
5. R ESULTS
[Table]
[Figure]
We begin by observing that higher values of λ correspond to lower perplexities, as expected from the fact that these corpora with longer sequence lengths are also proportionally larger in total length.
Second, we note that Ensemble and MoE systems with 5 modules and larger hidden vectors outperformed models with 30 modules and smaller hidden dimensionality, but this is not the case for
PoE, which show comparable performance between the two variants or even the opposite trend.
Furthermore, the PoE’s performance is considerably better than the former two, which can be attributed to a combination of multiple factors.
On the one hand, we note that, in agreement with previous work (Shen et al., 2019), MoE models are often sensitive to a Winner-Takes-All (WTA) effect in which only one single expert gets trained at the end.
Thus, models with larger dimensionality per module can beneﬁt from having a larger capacity.
However, also ensembles show comparable performance, showing that this effect is not only caused by a single module being trained.
Perhaps, more important is the fact that, as hypothesized by Hinton (1999), PoE can use their capacity to learn complementary parts of the distribution, and thus it makes a smaller difference for them whether there are a few high-capacity modules or many of them, but with smaller capacity.
Next, we note that while PW does not strongly alter performance on MoE architectures, as expected from the WTA effect inﬂuencing these models, they signiﬁcantly improve the vanilla PoE counterparts, conﬁrming the effectiveness of the proposed mechanism in this task.
This observation holds not only for overall perplexity but also in terms of the metrics quantifying adaptation efﬁciency at class switches (ppl@sw and rec).
Indeed, Figures 1b and 1c show this fact in more detail, by representing the mean cross-entropy of each different model for the 15 batches occurring immediately after a switch.
As we can see, the PoE+PW model shows a large spike on the ﬁrst batch because its adaptation mechanism that depends on this error signal has not kicked in yet.
However, in the subsequent batch, its performance increases sharply outperforming comparable models.
In comparison to a monolithic LSTM model, PoE and PoE+PW models perform on-par on MultiLingual (although with better adaptation records), and better on MultiDomain.
In the latter case, we can observe that the version with 30 modules yields better performance than the one with just 5.
One possible explanation is related to word-level language modelling being a higher rank problem than character-level language modelling, and thus it can be better ﬁtted by combining the judgements from multiple lower-rank experts (Yang et al., 2018).
This explanation is also consistent with the comparatively better performance of the MoS model.
Finally, we note that the model with Independent LSTMs for each class performs best on MultiLingual, but it is outperformed by a large margin on MultiDomain.
We note that this model does not suffer from forgetting when switching classes but also misses the training signal from transferable training data.
As a consequence, it has an edge on MultiLingual, which switches between classes that have considerably different statistical properties, but not on MultiDomain where the differences between the classes are much more nuanced.
All in all, this shows that while, in consonance with previous results (Dhar & Bisazza, 2018), there is little room for transferring knowledge in the MultiLingual case, the MultiDomain setting provides plenty of opportunities for transferring knowledge across each domain.
Thus domain-agnostic systems can beneﬁt from them.
5. A NALYSIS
Next, we turned to analyze the gating strategies acquired by the more successful models to understand whether they have captured the latent similarities between classes and how might they help them in coping with catastrophic forgetting.
For this, we focused on the PoE+PW 30 modules operating on the MultiLingual dataset ( λ = 10 k) because its 30-dimensional gate vectors can represent more nuanced similarities.
Figure 1d shows a heatmap of the mixture weights as the model processes different language sequences.
High absolute values represent the activation of a module, regardless of whether these are negative or positive values.
It can be seen that upon language switches, the model reconﬁgures itself to a different set of mixture weights that are maintained more or less consistently within the sequence.
Furthermore, we note that modules that receive mixture weights close to 0 are protected from forgetting, as this gating value is also multiplied to the module’s gradients.
Moreover, we hypothesize that modules are protected even when their corresponding weight is set to the opposite sign (see, for instance, module 16 on English and Spanish), because the incoming training data serves as negative training data, namely, something not-to-be-predicted.
Thus, this should not affect what the model does predict when used with a positive weight.
Instead, this allows for dual use of the modules, encoding information both when it is weighted positively and negatively.
Finally, recall from Section 3.1 that the languages in our MultiLingual dataset are derived from different linguistic families with a latent similarity structure.
To uncover whether the learned latent similarities reﬂect this structure, we computed the correlations between the mixture weights produced while processing the last 100 batches of each class.
The results are displayed in Figure 1e, and show that the similarities are indeed well-reﬂected in the gating values.
Notably, we observe that Czech seems to be using the most distinct set of modules.
Spanish and French correlate quite strongly in the modules they use, and while English also correlates with French, it also does so with
German, with the latter correlating to a lesser extent with the other languages.
Indeed, applying a simple hierarchical clustering algorithm over this matrix recovers the underlying linguistic families!
C ONCLUSIONS
In this paper, we have introduced the class-agnostic continual language modelling task (CALM), together with a Python library with MultiLingual and MultiDomain datasets, which allows multiple parameter conﬁgurations and can also be easily adapted to different corpora.
We expect that it will foster more empirical work on continual learning in a language-centred setup in which there is a natural latent similarity structure between different tasks.
We have argued that in addition to measuring the overall performance of models in an online learning fashion, their susceptibility to catastrophic forgetting can be observed in terms of adaptation speed to changes in the input class, and proposed measures to capture it.
Finally, we have evaluated multiple simple baselines to serve as references for future work on this benchmark and introduced a simpliﬁcation of the gating strategy for a Product of Experts, which improves its performance signiﬁcantly by allowing it to distribute effectively different distributions across different experts so that the resulting system can act as a strong baseline for future work on this task.
While addressing catastrophic forgetting is still a major challenge for Online Continual Learning, it is by no means the only one.
In the future, we would like to understand how learning systems can also bootstrap on their knowledge to improve their learning skills, so that they will not only be able to acquire knowledge from different sources in a seamless way but also get better at it as they go.
A C ORPUS EXAMPLES
Figure 2 and 3 present samples from the corpora used for our dataset.
As stated in the paper, we can notice a much bigger difference between input class in the case of the multilingual setup, while the differences in the case of the multidomain setup are more subtle and nuanced.
[Figure]
czech Mad’arská iNFiNITY Coliseum Lan je pokraˇcováním úspˇešného BECUPu, z nˇehož si nejeden náš tým v minulosti odvezl medaili.
english
If Hofmann played the role of paterfamilias, Anaïs Nin was the bad mother to Admiral and De Niro’s group.
This one wasn’t close.
french Le Beatle
s’en est alors emparé pour créer un chef-d’oeuvre psychédélique longtemps associé à l’usage du LSD.
german Im ersten Jahr hatten sie schon 278 Anfragen, fast 60 ehemalige Manager und Unternehmer wollten mitmachen.
spanish
Los despidos serán realizados por medio del plan de GM de cese de empleo, por lo que no se ofrecerán jubilaciones anticipadas
[Figure]
Good weather for the crops.
Have your sheep been suffering much from the staggers ?
Have you contributed a great deal this year to the butter mountain ?
[Figure]
I would like your advice about Rule 143 concerning inadmissibility.
My question relates to something that will come up on Thursday news
If Hofmann played the role of paterfamilias, Anaïs Nin was the bad mother to Admiral and De Niro’s group.
This one wasn’t close.
wiki
Otto , Prince of Bavaria , was chosen as the ﬁrst King of Greece in 1832 , under the name Othon .
His arrival in Nafplio , then the Greek capital, was hailed enthusiastically by Makriyannis
B F URTHER ANALYSIS B. P O E WEIGHTS BEHAVIOUR
We also inspected the gate values produced by LSTM-gated PoE models observing that the models are indeed not learning a class-switching mechanism.
We hypothesized that this is due to the fact that when the experts are still untrained, the LSTM produces some arbitrary but consistent gating values, making those selected modules being the only ones to be trained, and thus falling into a vicious cycle.
As a sanity check that supports this hypothesis, we ﬁrst pre-trained a set of modules while still using our simple gating mechanism.
Then, we initialized with these modules a network that now used LSTM mixture weights, but training on very short sequences to avoid the effect of catastrophic forgetting affecting the network.
In this context, the network learned the appropriate gating as expected.
B. M ULTI D OMAIN MODULE CORRELATION
In comparison with the Multilingual setup, correlations in the MultiDomain case are much weaker.
Moreover, they are weak even within the same class: When we measure the autocorrelation between weights pertaining to the last 100 batches with the preceding 100 ones we obtain values in the order of 0 .
65 , much lower than for the MultiLingual experiments, where they are in the order of 0 .
96 (see
Figure 4b).
This shows that model usage is less consistent per-class, which could be explained by the fact that classes are much more nuanced than in MultiLingual and their corresponding distributions are far more complex.
These results are also consistent with our experimental observation that the
MultiDomain dataset was more amenable to transfer between different classes than the MultiLingual, as these classes could be distributed more evenly across the model and could be characterized with multiple mixture weights conﬁgurations.
[Figure]
C T RANSFORMER E XPERIMENTS
We experimented extensively with Transformer models.
One difference with respect to LSTM models is that Trasnformers, at least in their vanilla versions, are not autoregressive, and thus they cannot transfer information from the past.
In standard NLP tasks, they largely overcome this problem by using a large context window on which they can operate effectively.
Thus, to afford them similar memory capabilities, we kept a buffer of the last b × 512 consecutive examples that was continually updated with each incoming mini-batch.
Vaswani et al.
(2017) describes a learning rate scheduling scheme in which the learning rate is linearly increased until reaching a number of warmup steps, and then annealed from that point on.
Considering that in a Continual Learning setup the model is not expected to converge, annealing might not be appropriate.
Thus, we also experimented with keeping the learning rate ﬂat after that point on.
We experimented with both learning rate schedules, plus no scheduling at all.
Furthermore, we considered both training with default Adam parameters ( α = 10 − 3 , β
= (0 . 9 , 0 . 999) ) or the ones reported by Vaswani et al.
and
base learning rates of 1 d model , 1 e − 3 , 5 e − 3 , 0 .
Also, we tuned the warmup steps among 400 , 2000 and 4000 steps.
The best perplexity results we obtained in the Multilingual validation data were 13 .
2 for λ = 10 k and 6 .
02 for λ = 100 k, whereas in the
Multidomain validation data we got 686 average perplexity for λ = 10 k and 527 for λ
= 20 k.
D G ENERATED OUTPUT
In Figure 5, we present generated samples from different stages of training.
These generated examples are produced by sampling one character at a time from the models, and using them as input for the next time step.
As quantitatively observed in the paper, it adapts much faster to the current input type (French) in comparison with an LSTM, which generates text resembling the language of the previously seen class even after 10 batches.
PoE+PW
LSTM end english for a release was the week in Troust Pglates in George Services are claimed whet this could get one
Tvice.
(Relátórs had the state’s annual annual Call Statua plannting more years’ physical cost 5 batchesfrench lement Filmarian Roads.
Aus cadres et temps disputer Lileana Maan.
Institution, le provinces, unbieut eau polítical but the room of Noxe Common Electrical Taladei Baritef.
BAG - Runey premium begai maki 10 batchesfrench
Deﬁnit werde à l’équipe pass, libertant Youth Losier Chavez and
Jean-Pierro.
«Vu entre fascal publ attempted Jueves Mo., unit encome ergarded a next post television genetical dangere tet.
For hemous end french ive commune services au championnat où qui se sont renfovées de la hierre du 23,4er est dit doubles el-Bilanze extranger à la ﬁn de l‘Etat: "
Yens ni irneu à Show Joban ?
Il vio, les grandes hommes de
E M ODEL SIZES
As it is shown in Table 2, the number of hidden units varies for most of the models.
We vary the hidden size in order to keep a similar number of parameters across the models: around 22 million for the multilingual setup and around 600 million for the multidomain one.
[Table]
F
H YPERPARAMETER
SEARCH
Table 3 present the explored hyperparameters for LSTM and PoE. The parameters in bold are the ones chosen for the ﬁnal models, with the exception of PoE-5 and PoE+PW 5 which are marked with italics.
The meaning of the different hyperparameters for Table 3 is:
• nhid: the size of the hidden state of the base LSTM • dropout: the dropout value used in the base module of the LSTM • learn iter.
: how many learning iterations over each batch are done before moving to the next batch • adapt.
iter.
: it is used in the case of PoE+PW and it shows how many iterations to train the gating weights are done for each learning iteration.
• modules: how many modules does the PoE models contain • gating nhid: the size of the hidden state for the LSTM used to calculate the gating weights in the case of PoE • clear gating: it is a boolean value which clears the hidden state of the LSTM used for gating weights in the case of PoE
Also, MoS was tuned following the hyperparameters: 1 or 2 learning iterations, learning rate 1e3 or 5e-4.
For the domain setup, we considered the combinations: (nsoftmaxes=2, nhid=4750) or (nsoftmaxes=50, nhid=2620).
On the other hand, for the multilingual dataset, we considered (nsoftmaxes=2, nhid=1200) or (nsoftmaxes=75, nhid=500).
[Table]
-30, MoE/PoE+PW 30 and the italic parameters are the ones chosen for MoE/PoE-5 and MoE/PoE+PW
G S TANDARD D EVIATIONS
[Table]
λ = 10k λ
= 100k λ = 10k
λ = 20k ppl ppl@sw rec ppl ppl@sw rec ppl ppl@sw rec ppl ppl@sw
[Table]
LSTM 0 .
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
Large LSTM
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
Ensemble0 .
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
Ensemble 30 0 .
[Table] [Table]