Investigating Catastrophic Forgetting During Continual Training for Neural Machine Translation (2020)

Abstract: Neural machine translation (NMT) models usually suffer from catastrophic forgetting during continual training where the models tend to gradually forget previously learned knowledge and swing to fit the newly added data which may have a different distribution, e.g. a different domain. Although many methods have been proposed to solve this problem, we cannot get to know what causes this phenomenon yet. Under the background of domain adaptation, we investigate the cause of catastrophic forgetting from the perspectives of modules and parameters (neurons). The investigation on the modules of the NMT model shows that some modules have tight relation with the general-domain knowledge while some other modules are more essential in the domain adaptation. And the investigation on the parameters shows that some parameters are important for both the general-domain and in-domain translation and the great change of them during continual training brings about the performance decline in general-domain. We conducted experiments across different language pairs and domains to ensure the validity and reliability of our findings.

## introduction neural machine translation (nmt) models @xcite @xcite @xcite have achieved state-of-the-art results and have been widely used in many fields. due to numerous parameters, nmt models can only play to their advantages based on large-scale training data. however, in practical applications, nmt models often need to perform translation for some specific domain with only a small quantity of in-domain data available. in this situation, continual training @xcite , which is also referred to as fine-tuning, is often employed to improve the in-domain translation performance. in this method, the model is first trained with large-scale general-domain training data and then continually trained with the in-domain data. with this method, the in-domain performance can be improved greatly, but unfortunately, the general-domain performance decline significantly, since nmt models tend to overfit to frequent observations (e.g. words, word co-occurrences, translation patterns) in the in-domain data but forget previously learned knowledge. this phenomenon is called catastrophic forgetting. figure 1 shows the performance trends on the in-domain and general-domain. many methods have been proposed to address the catastrophic forgetting problem under the scheme of fine-tuning. @xcite ensembles the general-domain model and the fine-tuned model together so that the integrated model can consider both domains. @xcite introduces domain-specific output layers for both of the domains and thus the domain-specific features of the two domains can be well preserved. @xcite , @xcite , and @xcite propose regularization-based methods that introduce an additional loss to the original objective to help the model trade off between the general-domain and in-domain. all these methods show their effectiveness and have mitigated the performance decline on general-domain, but we still don't know what happened inside the model during continual training and why these methods can alleviate the catastrophic forgetting problem. the study on these can help to understand the working mechanism of continual training and inspire more effective solutions to the problem in return. given above, in this paper, we focus on the catastrophic forgetting phenomenon and investigate the roles of different model parts during continual training. to this end, we explore the model from the granularities of modules and parameters (neurons). in the module analyzing experiments, we operate the model in two different ways, by freezing one particular module or freezing the whole model except for this module. we find that different modules preserve knowledge for different domains. in the parameter analyzing experiments, we erase parameters according to their importance which is evaluated by the taylor expansion-based method @xcite . according to the experimental results, we find that some parameters are important for both of the general-domain and in-domain and meanwhile they change greatly during domain adaptation which may result in catastrophic forgetting. to ensure the validity and reliability of the findings, we conduct experiments over different language pairs and domains. our main contributions are summarized as follows: ## background in our work, we apply our method under the framework of transformer @xcite which will be briefly introduced here. we will also introduce the terminology and symbols used in the rest of the paper. we denote the input sequence of symbols as @xmath0, . . . , x j ), the ground-truth sequence as y * = (y * 1 , . . . , y * i * ) and the translation as @xmath1, . . . , y i ). the encoder the encoder is composed of n identical layers. each layer has two sublayers. the first is a multi-head self-attention sublayer (abbreviated as sa) and the second is a fully connected feed-forward network, named ffn sublayer (abbreviated as ffn). both of the sublayers are followed by a residual connection operation and a layer normalization operation. the input sequence x will be first fed into the embedding layer (abbreviated as emb) and converted to a sequence of vectors the decoder the decoder is also composed of n identical layers. in addition to the same kinds of two sublayers in each encoder layer, a third sublayer is inserted between them, named cross-attention sublayer (abbreviated as ca), which performs multi-head attention over the output of the encoder stack. the final output of the n -th layer gives the target hidden states, denoted as @xmath2; . . . ; s i ], where s i is the hidden states of y i . the objective the output of the decoder will be fed into the output layer (abbreviated as out) and we can get the predicted probability of the i-th target word over the target vocabulary by performing a linear transformation and a softmax operation to the target hidden states: ## module analysis in this work, we will investigate the cause of the catastrophic forgetting phenomenon from the perspectives of modules and parameters. as we know, the structure and the various kinds of modules in it has a large impact on translation. in this section, therefore, we will study the function of different modules by isolating them during continual training. the study on the parameters will be discussed in section 4. ## parameter analysis when the structure of the nmt model is fixed, the performance is determined by its parameters. during continual training, the change of the training data distribution makes the distribution of model parameters vary accordingly, which leads to the variation of translation performance on both the general-domain and in-domain. motivated by this, therefore, we want to investigate the changing trend of model parameters during continual training, aiming to figure out the influence of different parameters. intuitively, different parameters may have different importance for the nmt model, thus we firstly propose a method for evaluating the importance of parameters in this section. then, we erase the model parameters increasingly according to the importance to see the change of bleu scores. finally, we visualize the parameters and measure their variations in the values to establish the connection between the parameter variation and the catastrophic forgetting phenomenon. ## conclusion in this work, we focus on the catastrophic forgetting phenomenon of nmt and aim to find the inner reasons for this. under the background of domain adaptation, we propose two analyzing methods from the perspectives of modules and parameters (neurons) and conduct experiments across different language pairs and domains. we find that some modules tend to maintain the general-domain knowledge while some modules tend to adapt to the in-domain; we also find that some parameters are more important for both the general-domain and in-domain translation and the change of them brings about the performance decline in general-domain. based on our findings, we have proposed several ideas that may help improve the vanilla continual training method. we will prove the effectiveness of these ideas in future work.