# How to avoid 'Catastrophic forgetting'?

Here he says that when we want to fine-tune a pre-trained model to add a new label or correct some specific errors, it can introduce the 'Catastrophic Forgetting' problem (loses its generality). To combat this, he proposes a technique called Pseudo-rehearsal. He says to predict a number of examples with the initial model, and mix them through the fine-tuning data and uses it as an objective for the model.

So does this mean that I use $\hat{Y}(The Predicted Value)$ instead of $Y(The Ground Truth)$ generated by the initial model, mix it with the new $Y$ values of the newly obtained data points and use it to train my model?

Am I correct? Can someone elaborate?

• All exponential functions are zero-order. In other words, they are memoryless. The causes of 'catastrophic forgetting' are in the basic model assumptions. Given that, 'catastrophic' events are not only quite likely, they are inevitable across long, iterative chains. *Pseudo-rehearsal' is a bandaid and not a real solution. Reversion to non-zero order assumptions that go beyond the exponential family would be one approach. Suggestions for this include robust, nonparametric and distribution-free assumptions, leveraging extreme value distributions, and so on. – Mike Hunter Nov 24 '17 at 15:15

What is Catastrophic forgetting? Let's consider two tasks: Task A and task B. Now, suppose we're using a pre-trained model that is already pretty good on task A (learned weights $\theta_A$), and we want to "fine-tune" it to also fit task B. The common practice is to take the weights of a model trained on task A and use them as initialization for training on task B. This works well in applications in which task B is a "sub-task" of task A (e.g task B is detecting eyeglasses, and task A is detecting faces). When B is not a sub-task of A, there is the fear that catastrophic forgetting will occur: essentially, the network will use the same neurons that were before optimized for task A, for predicting on task B. In doing this, it will completely lose its ability to classify instances of task A correctly. You can actually experiment with this yourself: You can building a small network that can tell whether an MNIST image is a 5 or not a 5 and measure it's accuracy at this task; If you then go on to finetune this model to the task of telling whether an MNIST image is a 4 or not, you will note that the accuracy of the final model on the original task (recognizing 5) has worsened.
A Naive Solution. The naive solution to catastrophic forgetting would be to not only initialize the weights of the finetuned model to be $\theta_A$, but also add regularization: penalize the solution of the finetuned model when it get's far from $\theta_A$. Essentially, this means the the objective will be to find the best solution for task B that it still similar to $\theta_A$, the solution to task A. The reason why we call this a naive approach is that it often doesn't work well. The functions learned by neural networks are often very complicated and far from linear, so a small change in parameter values (i.e $\theta_B$ being close to $\theta_A$) can still lead to very different outcomes (i.e $f_{\theta_A}$ is very different from $f_{\theta_B}$). Since it's the outcomes we care about, this is bad for us.
Pseudo-rehearsal. A better approach would be to try to be good on task B while simultaneously giving similar answers to the answers given by $f_{\theta_A}$. The good thing is that this approach is very easy to implement: Once you have learned $\theta_A$, we can use that model to generate an infinite number of "labeled" examples $(x,f_{\theta_A}(x))$. Then, when training the fine-tuned model, we will alternate between examples labeled for task B and examples of the form $(x,f_{\theta_A}(x))$. You can think about the latter as "revision exercises" that make sure that our network does not lose it's ability to handle task A while learning to handle task B.