ELLE: Efficient Lifelong Pre-training for Emerging Data
Yujia Qin, Jiajie Zhang, Yankai Lin, Zhiyuan Liu, Peng Li, Maosong Sun, Jie Zhou
Introduction
Pre-trained language models (PLM) have broken the glass ceiling for various natural language processing (NLP) tasks (Radford et al., 2018; Devlin et al., 2019; Han et al., 2021). However, most of the existing PLMs are typically trained with a static snapshot of the web information, ignoring that in real-world scenarios, streaming data from various sources may continuously grow, e.g., the gatherings of literary works (Zhu et al., 2015), news articles (Zellers et al., 2019) and science papers (Lo et al., 2020). In addition, the distribution of incoming data may also vary over time. This requires PLMs to continually integrate the information from all the sources to grasp the versatile structural and semantic knowledge comprehensively, so that PLMs could utilize the proper knowledge to boost the performance in various downstream tasks.
A simple yet effective way to integrate all the information is to pre-train PLMs on all the existing data exhaustively. However, such a process is computationally expensive (Schwartz et al., 2019), especially under the information explosion era when tremendous data is continually collected. This leaves us an important question: with limited computational resources, how can we efficiently adapt PLMs in a lifelong manner? We formulate it as the efficient lifelong pre-training problem. Similar to conventional lifelong learning, PLMs are expected to continually absorb knowledge from emerging data, and in the meantime, mitigate the catastrophic forgetting (McCloskey and Cohen, 20p) of previously learned knowledge.
In addition, efficient lifelong pre-training poses two new challenges: (1) efficient knowledge growth. When the overall data scale accumulates to a certain magnitude, packing more knowledge into a fixed-sized PLM becomes increasingly hard, which significantly impacts the efficiency of PLM’s knowledge growth. This is because larger PLMs show superior sample efficiency and training efficiency over their smaller counterparts (Kaplan et al., 2020; Li et al., 2020) due to overparameterization (Arora et al., 2018). That is, larger PLMs learn knowledge in a more efficient way. Therefore, timely model expansions are essential for efficient knowledge growth; (2) proper knowledge stimulation. During pre-training, various knowledge from all domains is packed into PLMs hastily. However, a certain downstream task may largely require the knowledge from a specific domain. Thus it is essential for PLMs to disentangle different kinds of knowledge and properly stimulate the needed knowledge for each task.
In this paper, we propose ELLE, targeting at Efficient LifeLong pre-training for Emerging data. Specifically, (1) to facilitate the efficiency of knowledge growth, we propose the function preserved model expansion to flexibly expand an existing PLM’s width and depth. In this way, we increase PLM’s model size and thus improve its training efficiency. Before being adapted to a new domain, the expanded PLM performs a function recovering warmup to regain the functionality of the original PLM; (2) for proper knowledge stimulation, we pre-implant domain prompts during pre-training to prime the PLM which kind of knowledge it is learning. Therefore, versatile knowledge from multiple sources can be disentangled. During downstream fine-tuning, we could further utilize these implanted prompts and manipulate the PLM to stimulate the proper knowledge for a specific task.
To demonstrate the effectiveness of ELLE, we simulate the scenario where streaming data from domains sequentially comes. We pre-train two typical PLMs (BERT and GPT) and expand their model sizes each time when the new data is available. We experiment when the number of parameters is sequentially grown from both M to M and M to M. The experimental results show the superiority of ELLE over multiple lifelong learning baselines in both pre-training efficiency and downstream task performances. In addition, we conduct sufficient experiments to verify the effectiveness of each component of ELLE. In general, we provide a promising research direction and hope this work could inspire more future attempts towards efficient lifelong pre-training.
Related Work
Lifelong learning aims at incrementally acquiring new knowledge, and in the meantime, mitigating the catastrophic forgetting issue. Numerous efforts have been spent towards this goal, including (1) memory-based methods (Rebuffi et al., 2017; Rolnick et al., 2019), which perform experience replay with authentic data (de Masson d’Autume et al., 2019), automatically generated data (Sun et al., 2020), or previously computed gradients (Lopez-Paz and Ranzato, 2017) conserved in the memory, (2) consolidation-based methods (Kirkpatrick et al., 2017; Aljundi et al., 2018), which introduce additional regularization terms to consolidate the model parameters that are important to previous tasks, and (3) dynamic architecture methods (Rusu et al., 2016; Yoon et al., 2018), which fix trained network architectures in old tasks and dynamically grow branches for new tasks. Lifelong learning is also a hot topic for PLMs. Some target at domain adaptation through continual pre-training (Gururangan et al., 2020), parameter-efficient adapters (He et al., 2021) and sparse expert models (Gururangan et al., 2021). Others focus on the incremental acquisition of factual knowledge that changes over time (Dhingra et al., 2021; Jang et al., 2021). However, the existing works seldom consider our lifelong learning setting where streaming data from multiple sources is sequentially gathered. Recently, researchers have also conducted a series of empirical studies on the continual learning of PLMs (Wu et al., 2021; Jin et al., 2021).
Efficient Pre-training in NLP.
Many attempts have been made towards improving the efficiency of pre-training, such as designing novel pre-training tasks (Clark et al., 2020), model architectures (Zhang and He, 2020), optimization algorithms (You et al., 2020) and parallel architectures (Shoeybi et al., 2019; Shazeer et al., 2018). Until recently, researchers propose to “back distill” the knowledge from existing PLMs to accelerate large PLMs’ pre-training (Qin et al., 2021a). Another line of work proposes progressive training to dynamically expand an existing PLM’s size through parameter recycling (Gong et al., 2019; Gu et al., 2021; Chen et al., 2021). However, these methods typically focus on training PLMs on one static corpus, and thus cannot be directly applied to our lifelong pre-training setting.
Methodology
A PLM generally consists of an embedding layer and Transformer (Vaswani et al., 2017) layers. Given an input consisting of a series of tokens, i.e., , first converts the input into embeddings , which are sequentially processed by each Transformer layer into contextualized hidden representations , where .
Task Definition.
Assume a stream of corpus from domains (e.g., news articles, web content and literary works) is sequentially gathered, i.e., , where . The whole training process can be partitioned into several stages. Initially, we have a PLM , which has been well trained on , and for the -th stage (), we obtain a new collection of data . Assume in this stage, we only have limited computational resources , our goal is to continually pre-train the existing PLM to learn new knowledge on , and obtain a new PLM . Meanwhile, we expect the adapted PLM should not forget the previously learned knowledge of .
Overall Framework.
As illustrated in Figure 1, starting from , which is trained on previous data , we first expand ’s width and depth and construct an enlarged PLM to improve its training efficiency. Then we perform function recovering warmup and train to inherit the knowledge of to obtain . The above procedures are dubbed as function preserved model expansion (§ 3.2). After that, we continually pre-train to gain new knowledge on . To mitigate the catastrophic forgetting on the previously learned knowledge, we employ data-based memory replay on a subset of previously gathered data conserved in the memory, where () and is the constrained memory size for each domain. To help PLMs disentangle the knowledge during pre-training and also stimulate the needed knowledge for each downstream task, we implant domain prompts into PLMs during the whole training process (§ 3.3).
2 Function Preserved Model Expansion
To accumulate knowledge more efficiently, each time when a new corpus comes, we expand both ’s width and depth to attain the superior sample efficiency and fast convergence brought by larger model capacity (Li et al., 2020).
Depth Expansion.
For depth expansion, previous works generally resort to stacking all the original PLM layers into layers through parameter replication (Gong et al., 2019). Such initialization is demonstrated to improve training efficiency.
However, the above layer stacking method restricts the number of layers of the enlarged PLM to be integer multiples of that of the original PLM , which is not flexible for practical uses. To improve the expansion flexibility so that could be expanded with arbitrary number of layers, we propose a novel layer insertion method to construct a new PLM with layers, where . Specifically, we randomly select layers from , copy each layer’s parameters and insert the replication layer right before / after the original layer. We found empirically that inserting the copied layer into other positions would cause a performance drop, and the reason is that it will violate the processing order of the original layer sequence and break the PLM’s original functionality. At each expansion stage when new data comes, since different layers have different functionalities, we always choose those layers that have not been copied before to help PLMs develop in an all-around way, instead of just developing a certain kind of functionality. Since both width expansion and depth expansion are compatible with each other, we simultaneously expand both of them to construct an enlarged model , which inherits ’s knowledge contained in the parameters.
Function Recovering Warmup.
Since the above model expansion cannot ensure exact function preservation and inevitably results in functionality loss and performance drops, we pre-train the initialized PLM on the previous corpora conserved in the memory to recover the language abilities lost during model expansion, which is dubbed as function recovering warmup (FRW). After the warmup, we obtain , which successfully inherits the knowledge from and is also well-prepared for the next training stage.
3 Pre-trained Domain Prompt
Instead of training a separate model for each domain, we expect a single compact PLM to integrate the knowledge from all the sources. When confronted with a downstream task from a specific domain, the PLM needs to expose the proper knowledge learned during pre-training. To facilitate both knowledge acquisition during pre-training and knowledge exposure during fine-tuning, we resort to prompts as domain indicators and condition the PLM’s behavior on these prompts. Soft prompts have been demonstrated as excellent task indicators (Qin et al., 2021b) and have non-trivial transferability among tasks (Su et al., 2021).
Specifically, during pre-training, to disentangle the knowledge from different sources, we implant a soft prompt token into the input to prime the PLM which kind of knowledge it is learning. The prompt of domain is a tunable vector . We prepend before the original token embeddings for an input , resulting in the modified input , which is then processed by all the Transformer layers. Each is optimized together with other parameters of the PLM during pre-training. During fine-tuning, when applying the PLM on a similar domain of data seen before, we could leverage the trained domain prompt and prepend it before the input of downstream data. In this way, we manually manipulate the PLM to stimulate the most relevant knowledge learned during pre-training.
Experiments
We simulate the scenario where streaming data from domains is gathered sequentially, i.e., the concatenation of Wikipedia and BookCorpus (WB) (Zhu et al., 2015), News Articles (Ns) (Zellers et al., 2019), Amazon Reviews (Rev) (He and McAuley, 2016), Biomedical Papers (Bio) (Lo et al., 2020) and Computer Science Papers (CS) (Lo et al., 2020). For each corpus , we roughly sample M tokens, and the quantity for each () is comparable to the pre-training data of BERT (Devlin et al., 2019). In addition, considering that in practice, the expense of storage is far cheaper than the computational resources for pre-training, we maintain a relatively large memory compared with conventional lifelong learning settings by randomly sampling M tokens () for each corpus .
Evaluated Models.
We mainly follow the model architectures of BERT and GPT (Radford et al., 2018). We use byte-level BPE vocabulary to ensure there are few unknown tokens in each corpus. We experiment with the initial PLM of layers and hidden size of (around M parameters, denoted as / ), and linearly enlarge the PLM’s number of parameters for times, to the final PLM of layers and hidden size of (around M parameters, denoted as / ). We also experiment on a larger model size, i.e., growing the PLM from (M) to (M). Details of each ’s architecture are listed in appendix B. We also discuss the effect of expanded model size at each stage in appendix A.
Training Details.
We train our model for steps for the first corpus. For the following domain (), after the model expansion, we perform function recovering warmup for steps, then train the resulting PLM for steps on the new data together with memory replay. Following Chaudhry et al. (2019b), we jointly train PLMs on a mixture samples from both and in each batch, and the sampling ratio of and is set to in every batch. Adam (Kingma and Ba, 2015) is chosen as the optimizer. All the experiments are conducted under the same environment of V100 GPUs with a batch size of . More training details of pre-training are left in appendix B. We also experiment with fewer computational budgets and memory budgets in appendix G, and find that within a reasonable range, both of the two factors would not significantly influence the performance of ELLE.
Evaluation Metrics.
We deem one algorithm to be more efficient if it could achieve the same performance as other methods utilizing fewer computations. For PLM, this is equivalent to achieving better performance using the same computations since pre-training with more computations almost always results in better performance (Clark et al., 2020). We evaluate the PLM’s performance during both pre-training and downstream fine-tuning.
Specifically, for pre-training, we propose two metrics to evaluate how PLMs perform on the learned domains following Chaudhry et al. (2019a): (1) average perplexity (AP) and (2) average increased perplexity (). We record the train wall time (Li et al., 2020) during pre-training. For a model checkpoint at time step when learning the -th domain, we measure the checkpoint’s perplexity on the validation set of each domain . Let be the perplexity on the -th domain when the PLM finishes training on the -th domain, the above metrics are calculated as follows:
where AP measures the average performance on all the seen data . Lower AP indicates the PLM generally learns more knowledge from existing domains; measures the influence of current data on previous data . Lower means PLMs forget less knowledge learned before.
To evaluate PLMs’ performance in downstream tasks, for each domain, we select a representative task that is relatively stable, i.e., MNLI (Williams et al., 2018), HyperPartisan (Kiesel et al., 2019), Helpfullness (McAuley et al., 2015), ChemProt (Kringelum et al., 2016) and ACL-ARC (Jurgens et al., 2018) for WB, Ns, Rev, Bio and CS, respectively. Training details for fine-tuning are left in appendix C.
Baselines.
Keeping most of the experimental settings the same, we choose the following baselines for comparison: (1) Naive, which is a naive extension of Gururangan et al. (2020) to continually adapt PLMs for each domain and can be seen as the lower bound; (2) EWC (Schwarz et al., 2018), which adopts elastic weight consolidation to add regularization on parameter changes; (3) MAS (Aljundi et al., 2018), which estimates parameter importance via the gradients of the model outputs; (4) ER (Chaudhry et al., 2019b), which alleviates forgetting by jointly training models on a mixture samples from new data and the memory . ELLE is based on ER and additionally introduces the model expansion and pre-trained domain prompts. For ER, we set the sampling ratio of and to be in every batch same as ELLE; (5) A-GEM (Chaudhry et al., 2019a), which constrains the new parameter gradients to make sure that optimization directions do not conflict with gradients on old domains; (6) Logit-KD, which prevents forgetting by distilling knowledge from the previous model using the old data in the memory; (7) PNN (Rusu et al., 2016), which fixes the old PLM to completely avoid knowledge forgetting and grows new branches for learning new knowledge. For a fair comparison, we control the total train wall time of ELLE and all the baselines to be the same at each training stage, so that each method consumes the same computational costs.
2 Main Results
Table 1 summarizes the pre-training performance each time when the PLM finishes training on a specific domain. Figure 2 depicts the trend of AP for BERT w.r.t. train wall time, other trend curves are illustrated in appendix D. We also report the final downstream performance for discriminative PLMs (BERT) on each domain after finishing the whole pre-training in Table 2. The intermediate downstream performance each time when the PLM finishes training on one domain is left in appendix C.
(1) From the results in Table 1, we observe that, compared with all the baselines, ELLE achieves the lowest AP and satisfying after finishing training on each domain. This demonstrates that, given limited computational resources, ELLE could acquire more knowledge and in the meantime, mitigate the knowledge forgetting problem. (2) We also observe from Figure 2 that the AP of ELLE descends the fastest, showing the superior training efficiency of ELLE over all baselines. (3) Besides, ELLE performs the best on all downstream tasks, indicating that the knowledge learned during pre-training could be properly stimulated and leveraged for each downstream task. (4) The superiority of ELLE is consistently observed on the larger model size, i.e., and other model architectures, i.e., . This shows that ELLE is agnostic to both the model size and the specific PLM model architecture chosen. We expect future work to apply ELLE to other PLM architectures and extremely large PLMs.
Comparisons with Baselines.
(1) First of all, consolidation-based methods (EWC and MAS) perform almost comparable with the naive baseline in either pre-training or downstream tasks. This means that parameter regularization may not be beneficial for PLMs’ knowledge acquisition. (2) Among memory-based methods, gradient-based replay (A-GEM) exhibits poorer performance in pre-training, on the contrary, data-based replay (ER and Logit-KD) achieve lower AP and than the naive baseline, demonstrating that replaying real data points could more efficiently mitigate the knowledge forgetting problem. Meanwhile, all of the memory-based methods perform comparable or worse than the naive baseline in downstream performance. (3) PNN achieves significantly lower AP than non-progressive baselines, and is immune to knowledge forgetting (). It also performs better on the downstream tasks than other baselines. This indicates that enlarging the network is an effective way for lifelong pre-training and also benefits downstream tasks.
Analysis
In this section, we conduct analyses to investigate the effect of ELLE’s components. We follow the setting in § 4 by choosing as the initial model and continually growing it to . Specifically, we investigate the effect of (1) width expansion (WE), (2) depth expansion (DE), (3) function recovering warmup (FRW), (4) the random noises added into the newly constructed parameters during model expansion () and (5) the pre-trained domain prompts (PT). We test ELLE under different combinations of the above components and compare the results. The experimental results of pre-training and downstream tasks are summarized in Table 3 and Table 4, respectively. Detailed trend curves for AP and are illustrated in appendix D.
First, we compare the differences of conducting only width expansion (WE+FRW), only depth expansion (DE+FRW) and expansion on both width and depth (WE+DE+FRW) before function preserving warmup. For a fair comparison, we keep the total number of ’s increased parameters for the above three strategies almost the same at each stage . The specific model architectures are listed in appendix F. The results show that: (1) compared with the non-expanding baseline, all these three strategies achieve better pre-training and downstream performance, showing that with the growth of model size, the sample efficiency and training efficiency are extensively increased. Therefore, PLMs could gain more knowledge with limited computational resources and perform better in downstream tasks; (2) compared with expanding only width or depth, expanding both of them is more efficient and can also achieve better downstream performance on almost all domains, except the Ns domain. This is also aligned with previous findings that PLM’s growth favors compound scaling (Gu et al., 2021). We also conclude from the trend curves in appendix D that only expanding depth will make the training process unstable.
Effect of Function Recovering Warmup.
We compare the performance of the model expansion w/ and w/o FRW, i.e., WE+DE and WE+DE+FRW. For a fair comparison, we keep the total train wall time for either strategy the same, in other words, for WE+DE, PLMs can be trained for more steps on the new domain due to the removal of FRW. However, the results show that WE+DE achieves worse AP and , indicating that without FRW, PLM would learn new knowledge slower and also forget more previous knowledge. The trend curve in appendix D also shows that AP and decrease faster with FRW. This demonstrates the necessity of the warmup after model expansion, i.e., PLMs could better recover the knowledge lost during model expansion and also get prepared for learning new knowledge. Meanwhile, WE+DE+FRW performs slightly better than WE+DE in most of the downstream tasks, except the Ns domain.
Effect of Random Noises.
Different from the original FPI (Chen et al., 2021), ELLE additionally adds random noises into the newly copied parameters after expanding the width of PLMs as mentioned in § 3.2. By comparing the model performance w/ and w/o this trick, i.e., WE+DE+FRW and WE+DE+FRW+, we can see that the added noises significantly speed up pre-training and also conduce to improving PLM’s overall downstream performance. This validates our hypothesis that random noises are useful for breaking the symmetry of the copied parameters, thus providing a better initialization that further optimization favors.
Effect of Pre-trained Domain Prompts.
To investigate the effect of pre-trained domain prompts, we first compare the performance w/ and w/o them, i.e., WE+DE+FRW+ and WE+DE+FRW++PT. From the results we can conclude that when aided with domain prompts, PLMs achieve lower AP and during pre-training, showing that domain prompts could accelerate pre-training and alleviate catastrophic forgetting by disentangling the knowledge from different sources. Furthermore, domain prompts generally improve downstream performance by stimulating the proper knowledge needed for each task.
To rigorously investigate how domain prompts stimulate the knowledge during fine-tuning, for a PLM pre-implanted with prompts during pre-training, we test its downstream performance when (1) no prompt is prepended in the input (i.e., ELLE- ) during fine-tuning and (2) a prompt from a random wrong domain is prepended in the input (i.e., ELLE + ). The results in Table 5 show that both of the above strategies have lower downstream performance than prepending the right prompt (ELLE). We hypothesize the reasons are two-fold: (1) firstly, for ELLE- , there exists a great gap between the formats of input during pre-training and fine-tuning, and such a gap would hinder the successful knowledge transfer; (2) secondly, for ELLE + , although the above gap disappears, the PLM is primed with a wrong domain prompt, and thus cannot properly stimulate the knowledge that is most relevant to the downstream task. Although manually deciding the most relevant domain prompt for a specific downstream task is relatively easy and fast, such a process can also be automated by training a domain discriminator, which is left as future work.
Attention Pattern Visualization of a Stream of PLMs.
Through the function preserved model expansion, PLMs inherit the knowledge of their “ancestors” contained in the parameters. Intuitively, the descendant PLM (the expanded larger PLM) should have similar functionalities to the ancestor PLM (the original PLM before model expansion). We thus investigate such functionality similarity through the lens of attention patterns of each attention head in the Transformer layer.
Specifically, we visualize the attention patterns of a stream of PLMs () trained by ELLE when growing from to . We checkpoint each PLM when it finishes training on the emerging data . We input the same data into these checkpoints to derive the attention patterns. The results are illustrated in Figure 3, from which we observe that the attention patterns of a head in a descendant PLM are surprisingly similar to those of its “ancestors”, even if the descendant PLM is further trained on the new data and enlarged many times. This indicates that the expanded PLM by ELLE successfully inherits the knowledge from its “ancestor”, and thus exhibits similar functionality to some extent.
Conclusion
In this paper, we present the efficient lifelong pre-training problem, which requires PLMs to continually integrate the information from emerging data efficiently. To achieve our goal, we propose ELLE and progressively expand PLMs to acquire knowledge efficiently and mitigate the knowledge forgetting. We also pre-implant domain prompts during pre-training and use them to stimulate the needed knowledge for downstream tasks. The experimental results show the superiority of ELLE over various lifelong learning baselines in both pre-training efficiency and downstream performances.
Acknowledgments
This work is supported by the National Key R&D Program of China (No. 2020AAA0106502), NExT++ project from the National Research Foundation, Prime Minister’s Office, Singapore under its IRC@Singapore Funding Initiative, Beijing Academy of Artificial Intelligence (BAAI), and International Innovation Center of Tsinghua University, Shanghai, China. This work is also supported by the Pattern Recognition Center, WeChat AI, Tencent Inc. Yujia Qin, Jiajie Zhang and Yankai Lin designed the methods and the experiments. Jiajie Zhang conducted the experiments. Yujia Qin, Jiajie Zhang and Yankai Lin wrote the paper. Zhiyuan Liu, Peng Li, Maosong Sun and Jie Zhou advised the project and participated in the discussion. The authors would like to thank Yichun Yin and Cheng Chen for their constructive advice.
References
Appendices
Appendix A Additional Analysis on Function Preserved Model Expansion
In addition to the analyses of function preserved model expansion conducted in our main paper, in this section, we further analyze the effect of (1) the expanded model size at each training stage and (2) the choice of copied layer during depth expansion. We experiment on the combination of WE+DE+FRW as mentioned in § 5 and choose as the initial PLM . Other settings are kept the same as § 5.
In our main experiments, we assume that the data size of each emerging corpus is the same and linearly enlarge the model size when conducting model expansion. In this section, we explore the effect of expanded model size given limited computational resources. We conduct experiments on a stream of data from domains, i.e., WB, Ns and Rev domain. We start from the initial PLM and continually adapt it to new corpora. Under the same training environment, we control the computational costs (train wall time) of each domain to be seconds. We compare the performances when the PLM expands , , , and layers and heads for each domain, respectively. Note the PLMs expanded with a larger size would be trained with fewer steps to control the train wall time.
The results are shown in Table 6, from which we can conclude that the best performance is obtained when the model expands layers and heads at each expansion stage, and expanding more or fewer parameters leads to a performance drop. The reasons are two-fold: (1) firstly, as mentioned before, expanding the model size improves the sample efficiency (Kaplan et al., 2020; Li et al., 2020), which is beneficial for PLMs’ knowledge acquisition; (2) secondly, when increasing the expanded model size, the benefits from inheriting the knowledge of a small PLM would become less and less evident. To sum up, expanding with an intermediate size strikes the best trade-off between the above two reasons, and there may exist an optimal expanded size when performing model expansion.
Intuitively, the optimal expanded model size may be influenced by many factors, e.g., the computational budgets, the amount of emerging data, the PLM’s model architecture, etc. And systematically analyzing the effects of all these factors is beyond the scope of this paper, thus we expect future works to design algorithms to accurately estimate the optimal expanded size for model expansion.
Choice of Copied Layer.
As mentioned in § 3.2, each time when we conduct width expansion, we choose those layers that have not been copied before. To demonstrate the benefit of this trick, we compare three expansion strategies: (1) always replicating those layers that have not been copied before (WE+DE+FRW); (2) always replicating the first layer (WE++FRW) and (3) always replicating the last layer (WE++FRW).
The results in Figure 4 show that AP and descend the fastest when we always replicate those layers that have not been copied before (i.e., WE+DE+FRW). This demonstrates that, since different layers have different functionalities, choosing those layers that have not been expanded before would help PLMs develop in an all-around way, instead of just developing a certain kind of functionality. Furthermore, we find empirically that when pre-training PLMs continually on multiple domains, if we always choose those layers that have not been expanded before at each depth expansion stage, then the final performance is not sensitive to choosing which layers to expand first.
Appendix B Pre-training Hyper-parameters
In Table 7, we list the architectures and the hyper-parameters for the PLMs we pre-trained with ELLE in this paper, including the total number of trainable parameters (), the number of layers (), the number of units in each bottleneck layer (), the number of attention heads (), the inner hidden size of FFN layer (), the learning rate (lr), the training steps of FRW (SF), the training steps of adaptation after FRW (STF) when learning the new corpus, the ratio of learning rate warmup (RW), and the total train wall time (TWT). We set the dropout rate for each model to , weight decay to and use linear learning rate decay for BERT and inverse square root decay for GPT. We adopt Adam (Kingma and Ba, 2015) as the optimizer. The hyper-parameters for the optimizer is set to for , respectively. We reset the optimizer and the learning rate scheduler each time when the PLM finishes FRW or the training a on new corpus. All experiments are conducted under the same computation environment with NVIDIA 32GB V100 GPUs. All the pre-training implementations are based on fairseqhttps://github.com/pytorch/fairseq Ott et al. (2019) (MIT-license).
Appendix C Implementation Details and Additional Experiments for Downstream Fine-tuning
Table 8 describes the hyper-parameters for fine-tuning PLMs on downstream tasks of each domain. The implementations of MNLI are based on fairseqhttps://github.com/pytorch/fairseq Ott et al. (2019) (MIT-license). The implementations of HyperPartisan, Helpfulness ChemProt, and ACL-ARC are based on Gururangan et al. (2020)https://github.com/allenai/dont-stop-pretraining.
Additional Experiments.
Figure 5 visualizes the specific F1 on each downstream task and the average F1 of PLMs trained with Naive, A-GEM, EWC, MAS, ER, Logit-KD, PNN and ELLE after finishing training on each domain when we choose as the initial PLM . The average F1 when finishing training on the -th domain is calculated as follows:
where is the F1 score of evaluated on the downstream task of the -th domain. We also list the detailed numerical results for each task in Table 9, covering all PLMs trained by each lifelong learning method.
The results show that ELLE outperforms all the lifelong learning baselines after finishing training on each domain, demonstrating that ELLE could properly stimulate the learned knowledge during pre-training and boost the performance in downstream tasks.
\text{AP}^{+} For the experiments in § 4, the trend curves of average perplexity (AP) and average increased perplexity () w.r.t train wall time are shown in Figure 7 (growing from to ), Figure 8 (growing from to ), and Figure 9 (growing from to ). Each figure illustrates the performance of different lifelong learning methods. The above results reflect that, compared with all the baselines, AP and of ELLE descend with the fastest speed, demonstrating that ELLE could acquire knowledge and mitigate the knowledge forgetting on previous domains more efficiently. Thus given limited computational resources, PLMs trained by ELLE could integrate more information from different domains.
For the analysis in § 5, we visualize the trend curves of AP and when choosing different combinations of strategies. Specifically, we investigate (1) the effect of width / depth expansion in Figure 10 (comparing WE+FRW, DE+FRW and WE+DE+FRW); (2) the effect of function recovering warmup in Figure 11 (comparing WE+DE and WE+DE+FRW); (3) the effect of random noises added into the newly initialized parameters during model expansion in Figure 11 (comparing WE+DE+FRW and WE+DE+FRW+) and (4) the effect of pre-trained domain prompts in Figure 12 (comparing ELLE and ELLE-PT). All of the above results again demonstrate the effectiveness of ELLE’s each component.
Appendix E Representational Similarity of a Stream of PLMs
We investigate the representational similarity (Abnar et al., 2019) of a descendant PLM and its ancestors. Representational similarity measures how similar two PLMs represent the data. Specifically, we experiment on a stream of PLMs when growing to . For a model and its ancestor (), we randomly sample [MASK] tokens from the raw corpus , and get the probability distributions and output by the LM head of and , respectively for each [MASK] token , where . We calculate the average representational similarity (ARS) between and all its ancestors as follows:
where KL denotes the Kullback-Leibler divergence between two probability distributions. Higher means the representations of and its ancestors are more similar. To some extent, could reflect how much knowledge / functionality of the ancestors is preserved by .
We compare ARS of PLMs trained by Naive, MAS, ER, Logit-KD and ELLE and illustrate the results in Figure 6, from which we observe that Logit-KD has the highest ARS. This is because the training objective of knowledge distillation in Logit-KD is highly correlated with ARS. In addition, ELLE takes second place. We also find that, with PLMs continually absorbing new knowledge, the ASR generally decreases.
Appendix F Model Architectures for the Analysis of Model Expansion
In Table 12, we list the model architectures of all the investigated PLMs when conducting the analysis of model expansion in § 5. Specifically, three strategies are investigated, including WE+FRW, DE+FRW and WE+DE+FRW. As mentioned in our main paper, for a fair comparison, we keep the total number of ’s increased parameters for the above three strategies almost the same at each stage .
Appendix G Performance of ELLE with Fewer Computational Budgets and Storage Budgets
To investigate the performance of ELLE under limited (1) computational budgets and (2) storage budgets, in this section, we take an initial step to investigate the effect of (1) training resources (train wall time) and (2) memory size for ELLE. Following the experimental setting in § 4, we continually grow to on a stream of data from domains. We test the performance of ELLE and a series of lifelong learning baselines (MAS, ER, Logit-KD and PNN), by (1) reducing the train wall time by half (for Ns, Rev, Bio and CS domain) and (2) randomly sample only M tokens (% of the full corpus) as the memory for each corpus , compared with the memory size M in § 4.
The experimental results for the above two settings are listed in Table 10 (pre-training) and Table 11 (fine-tuning), respectively. We also illustrate the trend curves of AP and in Figure 13 and Figure 14. From the above results, we find that: (1) when given fewer computational budgets and storage budgets, ELLE still outperforms all the lifelong learning baselines in both pre-training and downstream performance, which demonstrates the superiority of ELLE; (2) for ELLE, when PLMs are trained with fewer computational budgets, we observe significant performance drops in both pre-training (higher AP and ) and downstream tasks (lower average F1). This shows that pre-training with fewer computations would harm PLMs’ knowledge acquisition; (3) for ELLE, when there are fewer memory budgets, although we also observe slight performance drops in pre-training (higher AP and ), the performance in downstream tasks is generally not influenced, with the average F1 score keeping almost the same (). This shows the data-efficiency of PLMs, i.e., PLMs could easily recall the learned knowledge by reviewing small-scale data conserved in the memory (as few as ). As mentioned before, considering that for pre-training, the expense of storage (e.g., hard disks) is far cheaper than the computational resources (e.g., GPUs), the storage space problem for memory seldom needs to be considered.
Appendix H Details of Baselines
We tried different hyper-parameters for baselines, including the regularization parameter for EWC and MAS, and the memory size for A-GEM, to derive and report their best performance. Their AP and curves are shown in Figure 15, 16 and 17. From the results we can see that none of these hyperparameters works well. For EWC and MAS, when the regularization parameter is small, the pre-training performance is not better than that of naive method. However, if we slightly increase , the performance would become worse than baseline. For A-GEM, the case with bigger memory also doesn’t outperform cases with smaller memory and naive case. Specially, we observed that during A-GEM pre-training, % of the inter-products of current gradient and replay gradient are positive, implying that pre-training on different domains is similar to each other to a large extent. This might indicate that EWC, MAS, and A-GEM cannot deal with the subtle difference of various domains.