Learn Faster and Forget Slower via Fast and Stable Task Adaptation

Training Deep Neural Networks (DNNs) is still highly time-consuming and compute-intensive. It has been shown that adapting a pretrained model may significantly accelerate this process. With a focus on classification, we show that current fine-tuning techniques make the pretrained models catastrophically forget the transferred knowledge even before anything about the new task is learned. Such rapid knowledge loss undermines the merits of transfer learning and may result in a much slower convergence rate compared to when the maximum amount of knowledge is exploited. We investigate the source of this problem from different perspectives and to alleviate it, introduce Fast And Stable Task-adaptation (FAST), an easy to apply fine-tuning algorithm. The paper provides a novel geometric perspective on how the loss landscape of source and target tasks are linked in different transfer learning strategies. We empirically show that compared to prevailing fine-tuning practices, FAST learns the target task faster and forgets the source task slower. The code is available at https://github.com/fvarno/FAST.


Introduction
In many real-world applications, learning quickly is as vital as the ultimate performance. However, the speed at which the results are required is often not able to be predetermined. For example, a smartphone user may expect a face or speech recognition tool to be customized and provide reasonable results at anytime after exposure to the data. Ideally, a fast converging anytime algorithm is needed to progressively learn these kind of tasks. Anytime algorithms are expected to improve their performance upon allocating more computation time and data (Korf, 1998) and inevitably could be interrupted at anytime depending on how impatient the user or application is (Boddy and Dean, 1989). Conversely, a typical Deep Neural Network (DNN) model with so-called medium capacity may require up to weeks or even months to be trained using thousands of training examples and large amounts of computational power until it exhibits a satisfactory level of performance. 1 Moreover, since first-order Gradient Descent (GD)-the preferred means of training DNNs-is not an anytime algorithm, guaranteeing fast and progressive generalizable results while training is challenging for DNNs, making them harder to deploy at any time.
A popular trend currently defines the life-cycle of a DNN model to eventually settle in the Model Deployment stage and work in that stage indefinitely (Ashmore et al., 2019). With this mindset, although the progression of the performance is usually validated using a held-out portion of the training data, different models are typically compared through their final test results. How quickly cutting-edge models reach different performance milestones during training is often overlooked, which leads to unnecessary expenses in addition to large amounts of heat emission  that in turn damages the environment in different ways (Strubell et al., 2019). 2 The importance of learning efficiency is even more pronounced when it comes to certain learning settings. For instance, a conventional practice in neural architecture search is to find competent architectures based on the performance that each sampled architecture achieves after being trained for a relatively short time (Wang et al., 2019b;Zela et al., 2018).
Various techniques have been proposed to ease the burden of training DNNs that can potentially offer better performance in shorter time, thus lowering the time requirements and compute cost. These techniques include initialization (Glorot and Bengio, 2010;He et al., 2015;Arpit and Bengio, 2019), optimization (Qian, 1999;Botev et al., 2017;Tieleman and Hinton, 2012;Kingma and Ba, 2015), and normalization (Ioffe and Szegedy, 2015;Ba et al., 2016;Wu and He, 2018;Qiao et al., 2019) methods, architectural modifications (He et al., 2016;Szegedy et al., 2017), and many others (He et al., 2019b). A well-known approach for accelerating the training process of a DNN on a given task is to fine-tune it after being pretrained on a similar source task with abundant data .
Despite its high necessity, a well-defined fine-tuning procedure that leads to fast and progressively generalizable results is currently missing from the transfer learning literature. A typical practice of adopting a pretrained model is to remove some parameters and append new ones such that the model's output matches the dimensions of the target task (Wang et al., 2019a;Chu et al., 2016). 3 In this paper, we argue that without special considerations in optimizing a model that is formed in this way, transfer learning may become highly inefficient, though still better than training from scratch. In fact, we show that carelessly optimizing such model can lead to catastrophic forgetting (McCloskey and Cohen, 1989;Goodfellow et al., 2013), even before learning to perform a new task. Our objective is twofold: first, we want to accelerate the adaptation of Convolutional Neural Networks (CNNs) 1. As of today, a DNN model with tens to hundreds of millions of parameters is known to have medium capacity. 2. As an example of the training cost, Yang et al. (2019) (XLNet) reported using a cloud infrastructure for training their model that costs tens of thousands of dollars. 3. We use the term model adoption (not adaptation) to refer to the process in which the pretrained model is altered such that it becomes prepared for learning a target task.
for classification; and second, we want to maintain a good generalized performance for these models during most of the training, from the beginning until convergence. We achieve these goals mainly by adjusting the magnitude of the gradients that back-propagate through the parameters of the softmax classifier toward the rest of the modules.
Our main contributions in this paper are identifying a source of inefficiency in the parametric softmax classifier, bringing to light the catastrophic forgetting it causes, and finally tackling it by introducing Fast And Stable Task-adaptation (FAST), a novel optimization procedure for fine-tuning. Unlike the prevailing technique of fine-tuning which is unconcerned by initialization of the appended parameters Chu et al., 2016;Wang et al., 2019a), our algorithm does not entangle the spaces formed by the pretrained and appended parameters all at once; instead, it bridges them in a gradual and smooth order. At the beginning of the training when even the most-popular advanced-optimization techniques lack a clear perspective, FAST slows down updates on the pretrained parameters and at the same time it quickly adapts the appended ones starting from all zero-the origin of the parameter space they form. By moving away from the origin, the norm of the appended parameters increases. Properly adjusting the rate with which this norm is escalated, leads to updates with efficient magnitude and direction on the pretrained parameters. Our experiments suggest that FAST accelerates the convergence of fine-tuning deep pretrained CNNs for classification tasks.
The rest of the paper is organized as follows. Section 2 describes our notation and gives further insight about the scope of the paper. In Section 3, our novel geometric perspective is both introduced and exploited to depict the most common transfer learning techniques. 4 Our proposed method for fine-tuning is explained in Section 4 and its relation to other research works is expanded in Section 5. Section 6 contains the experiments and results and finally the paper is concluded in Section 7, where also future works are discussed.

Background and Notation
In this section, our notation is establish and a brief background on parametric classifiers is provided.

Notation
In our setting, a CNN consists of a non-linear feature extractor φ : X −→ R D that is followed by a linear label-space mapping, 5 f : R D −→ R N and a probability estimation function p. φ extracts the features of any input x ∈ X in the form of a feature vector such as a ∈ R D . We assume each true label y is one-hot encoded, logistic softmax is used as the 4. The term transfer learning may represent a broad range of techniques which involve transferring knowledge among tasks; however, unless explicitly indicated, we use it to refer to classical transfer learning; the most widely known category of transfer learning in which the parameters that are pretrained on one task are employed to learn another. 5. Each instance in the extracted feature space can be considered to be 1-dimensional. Practically, this unification in number of dimensions of extracted features is applied in two major ways for image classification, described by (Lifchitz et al., 2019).
probability estimation function, meaning and the negative log-likelihood is employed as the loss function. 6 If the output of f (a) is z andŷ = p(z), the loss could be written as l = −y ln (ŷ).
The elements of vectors z ∈ R N andŷ ∈ R N are called softmax logits and predicted labels, respectively.
In this paper, we use the term CNN classifier to refer to a model which contains a convolutional feature extractor, a label-space mapping module, and a probability estimation function. For disambiguation, the term classifier will be used to refer to a model with similar components excluding a feature extractor. The exponential functions and division in Equation (1) apply element-wise on their vector argument and 1 N ×N is an N × N matrix of all ones. For the sake of simplicity and consistency, we refer to the mini-batched version of the forwarding data, the backwarding gradients and the labels with capital symbols. For example, A ∈ R M ×D is the mini-batched version of a with M rows, each containing feature vectors corresponding to one example. The elements of matrices are addressed by subscripts with the first element indicating the row number. A m and A :,d represent the m-th row and d-th column of A, respectively. We also show the sequence of training mini-batches exposed to the model by writing the number of applied gradient updates inside parenthesis in the superscripts. For instance, Z (0) refers to the logits corresponding to the first iteration of the training mini-batch. In our notation, ||u|| v and ||u|| F represent the L v -norm and Frobenius norm of vector u respectively; whereas, |u| indicates its number of elements or dimensions (e.g. if u ∈ R V then |u| = V ).

Parametric Classifiers
The importance of the classifier's role has been already discussed in DNN literature. However, most of the research works in this realm have only focused on the sort of features that different classifiers encourage the feature extractor to learn (Luo et al., 2018;. The randomly-initialized parametric softmax classifier is still the preferred classifier of state-of-the-art models in computer vision (He et al., 2016;Huang et al., 2017b;Ma et al., 2018;Sandler et al., 2018;Xie et al., 2017a;Tan and Le, 2019). It applies a softmax function on a linear mapping f , where f is often the dot-product between its inputs (extracted features) and its parameters W ∈ R N ×D , that is in which the subscript db stands for dot-product.
The first dimension of W is the number of classes, so its dimension depends on the performing task. To adapt a pretrained model to a new task, usually a random set of values 6. We could not find any previous work which defines the softmax in a vectorized form as we present in Equation (1), so we assume that this notation for softmax is novel.
is drawn for initializing W Agrawal et al., 2014;Li and Hoiem, 2018). Appending a randomly-initialized classifier to a meaningful set of features results in a heterogeneously parametrized model. Training a pretrained feature extractor along with a randomly initialized classifier can contaminate the genuinely learned representations and significantly degrade the maximum transferable knowledge.
Usually the fine-tuning is slowed down by decreasing the learning rate to compensate for this knowledge leak (Li and Hoiem, 2018) which undermines the applications' potential for early deployment. 7 Such a downturn in efficiency is often disregarded, though some attempts have been made to improve the performance through modifying the classifier for certain models, learning scenarios and learning objectives. For instance, Luo et al. (2018) proposed some modifications to a VGG model (Simonyan and Zisserman, 2015) along with replacing the dot-product in the label-space mapping (see Equation 3) with two candidate operations. Similarly many studies in few-shot learning replace the commonly used dot-product operation of the classifier with another bounded operation so called cosine classifier Vinyals et al., 2016;Gidaris and Komodakis, 2018). 8 While our focus in this paper is only on a typical learning scenario, we look for the source of inefficiency in the initialization of the W instead of making changes to the projection operation. We justify our perspective by highlighting the forgetting effect during the finetuning of a pretrained model. In our proposed method, the euclidean norms of the featureto-label-space projection vectors (||W n || 2 ) increase during the course of training. This gradual growth empowers the model to smoothly adapt the pretrained parameters to the new task with a reduced forgetting effect.
From the definition of f db in Equation (3) and the loss objective noted in Equation (2), it is easy to show that The prediction error (or simply error) δ is non-positive everywhere, except for the index corresponding to the true class. Notice that if the index of the true class is n then y n = 1. The updates on W are calculated based on the cumulative gradient of all examples in the mini-batch. Therefore, using the batched version of a and δ we have in which 1 M appears from averaging the loss across the batch dimension. Here, it is assumed that to calculate the mini-batch's loss, the dimension of the loss vector is reduced by averaging-i.e., = 1 M M m=1 l m where l m = −Y m lnŶ m . For simplicity, let us assume vanilla gradient descent with learning rate α is applied, then the (τ + 1)-th update for W 7. Li and Hoiem (2018) refer to the knowledge that is leaked from the feature-extractor's parameters at the beginning of the fine-tuning as drift in the parameters. 8. The mapping function of cosine classifier is generally defined as ∀n ∈ {1, . . . , N } : fcosine(a, Wn) = γ( a ||a|| 2 W T n ||Wn|| 2 ), where γ is a constant or learnable scalar. is calculated as where W (0) denotes the value of W before applying any updates. Traditionally, the elements of W (0) are randomly selected, yet there have not been an agreement nor a notable argument on the distribution to draw these elements from. Different strategies chosen for initializing W are further discussed in 5.1.

Proposed Geometric Interpretation of Transfer Learning
To justify the impact of adopting a pretrained model, most research works rely on the concept of learning multiple levels of representations (Zeiler, 2012;Goodfellow et al., 2016). According to this concept, higher-level representations contain more abstract features (Bengio, 2012). These representations correspond to the layers that are closer to the input of the model and usually are the ones that are maintained through the model adoption process (Zhong et al., 2016). Another popular geometric view of DNNs, depicts the loss landscape in the space formed by all the model's parameters, regardless of the layers they belong to . This perspective has provided researchers with the intuitions behind many optimization algorithms (Qian, 1999;Duchi et al., 2011;Tieleman and Hinton, 2012;Kingma and Ba, 2015). Stochastic Gradient Descent (SGD) walks the parameters through the parameters' space under the light of local clues in the loss landscape to settle them in a minimum point, and hopefully this point provides the estimator a small loss when it is exposed to unseen data.
In order to employ the latter geometric view for understanding the concept of transfer learning, answering a fundamental question seems to be necessary: in the space formed by the model's parameters, how much and in what direction should SGD drive the parameters to quickly adapt a pretrained model to a target task? In other words, in the aforementioned space, how much the minimum of the target task's loss deviates from that of the source task and what is a good trajectory to quickly approach it?
On the way to search for an answer, let the euclidean space formed by the parameters u be S(u) = S(u 1 , u 2 , . . . , u |u| ). Notice that, each point on the landscape of the loss that is depicted in parameter space S(u), is in fact a point in S(u, ) with the loss ( ) being the only non-parametric dimension in this space. As mentioned earlier, to adopt a pretrained model for a classification task, the space of all model's parameters are often manually changed from S(θ, v) to S(θ, W ) and we call v and W removed and appended parameters, respectively. So, during the adoption process, not only the number of dimensions in the parameter space may change, but also the appended parameters are generally not relevant to either of the tasks (the source task and the target task) before fine-tuning starts. In fact, right after appending new parameters, spotting the minimum of the source task's loss-where the pretraining has landed in-becomes intractable.
To make it possible to exploit the geometric view of the loss landscape for transfer learning, we only consider loss landscape in S(θ). This relaxed view enables our analysis to link the loss landscapes of the two tasks at the expense of having more complicated view of the loss landscape of the target task. In this scheme, the modifications made in the appended parameters are reflected as deformation of the loss landscape in the space of the pretrained parameters. More formally, moving in S(W ) is reflected as changes along the dimension of S(θ, ). This perspective is flexible enough to symbolically describe the effect of different transfer learning strategies as it is shown in Figure 1 and Figure 2.
The intuition provided in these figures is novel in the sense that it can reflect the modifications in S(θ) in an abstract way while having an idea about how the loss landscape is reflected in that space. It relaxes the complexity in depicting a heterogeneous space formed by both the pretrained and appended parameters, and opens up the opportunity to geometrically link the source task's and target task's loss landscapes.
In each of the subplots in Figure 1 or Figure 2, a model pretrained on task T s is adopted to accelerate learning the target task T t . The center of the gray contours at the bottom, marked with θ * Ts , represents the minimum in the loss landscape of T s where θ settles in, at the end of the pretraining. Similarly, the aiming minimum in the loss landscape of T t is shown with θ * Tt , though its location in the space is subjected to change because the appended parameters are modified by the optimization algorithm. Thus, to make a clearer view, changes in the location of θ * Tt is shown by multiple sets of contours with a grey-level set at the top to indicate the initial location and is following by several color-tempered sets which represent the deformations made in the loss landscape. we have simplified the landscape deformations with simple affine transformations (shift, scale and rotation) applied on the minimum; however, many other kinds of transformations are also possible. The levels of the loss landscapes are shown with differently tempered colors. The black is the coldest color used to show the minima and ivory is used to describe the high altitude surfaces (with large loss values). Notice that, the chosen shapes are symbolic to simply show the effect of each method; otherwise, the true patterns of minima could be of any arbitrary shape (Skorokhodov and Burtsev, 2019;Czarnecki et al., 2019).
Starting from θ = θ * Ts , the goal of the optimization is to make θ get as close as possible to θ * Tt . Figure 1a describes feature extraction (e.g., employed by ) in which only the appended parameters are trained and thus θ = θ * Ts stays hold during the task-adaptation. On the other hand in fine-tuning (e.g., employed by ) shown in Figure 1b, both transferred and appended parameters are jointly trained. The blue curve represents the movements of θ in S(θ) corresponding to the steps taken by the optimization algorithm.
As shown in Figure 1, compared to feature extraction, fine-tuning can potentially guide θ closer to θ * Tt . However, as depicted in Figure 1b and described later in the paper, carelessly initializing W can mislead the optimization algorithm to guide θ in a wrong direction at the beginning of fine-tuning. If the initial steps be large, they take θ far away from θ * Tt and make the training slow. One possible solution employed by Li and Hoiem (2018) is to start with a classifier warmup phase within which only W is modified and θ is kept unchanged before they jointly be train as in the typical fine-tuning. This approach is depicted in Figure  2a where the arrows and circled numbers determine the sequence of the applied changes.
The inclusion of a classifier warmup phase prevents W from randomly distorting the back-propagating gradients and, therefore, the initial modifications on θ become more likely to be in a path that leads to θ * Tt . However, since the distance from θ * Tt is not predetermined by the first-order GD, it is also likely that the initial steps for θ overshoot the minimum. Clearly, it is not easy to find an optimal step size for these steps considering the commonly large number of dimensions in S(θ, ). As we will expand in the next sections, our proposed method for fine-tuning builds θ * Tt close to θ * Ts without notably misdirecting θ at anytime from beginning until the convergence. The geometrically interpretation of this method is shown in Figure 2b.

Factors that Control the Velocity of Convergence
Ideally, SGD drives the pretrained parameters (θ) toward a good minimum in the target task's loss landscape located at θ * Tt , and at the same time, through modifying W it guides θ * Tt toward θ in the opposite direction. The velocity of moving W in S(W ) at optimization step τ is calculated as V (τ ) On the other hand, Equation (5) could be written in the following form which can turn Equation (6) into Moreover, the relative velocity of W and is equal to V W , = ∂ ∂W which is already found in Equation (4). Interestingly, which is equal to stating that the velocity of deformations of the loss landscape-and in the extreme case, the velocity of shifting θ * Tt -in S(θ) that is rooted from modifying W is linearly related to what we found in Equation (8).
Similarly, the velocity of moving θ in S(θ) at optimization step τ is Since SGD is used to update the parameters, we have where β is the learning rate with which θ is updated. Notice that in Section 2, α is employed to represent the learning rate that SGD uses for updating W and traditionally α = β. By plugging the formula we obtained for calculating W (τ ) in Section 2, Equation (11) can be updated to From Equation (5) and Equation (12) we can conduct or even simpler This shows that varying the rate with which W is modified, not only changes the rate of deforming and shifting the aiming minimum of loss in S(θ), but also greatly influences how fast θ approaches it. The calculated velocities take the origin of S(θ) as the privileged frame; 9 thus, according to our hypothesis the relative velocity of θ with respect to θ * Tt is expected to be different than V θ (desirably larger). An interesting fact about Equation (13) and Equation (8) is that altering β only influences the speed of updating θ whereas α impacts the speed of shifting the aimed minimum in addition to that. As we will explain in Section 4, this fact helps FAST to provide a less compromised generalized performance during the course of training.

Minimum Makeup
Logistic softmax function normalizes its inputs such that they sum up to one. The magnitude of its inputs is exponentially reflected in the discrepancy among its outputs. The negative log-likelihood loss that is applied on top of it, is notably affected by this characteristic. By initializing the classifier's weights to values that are closer to zero, the loss becomes further independent from the extracted features. Equivalently, as the entries of W (0) go closer to zero, the landscape of the loss in θ becomes flatter, until a point where everything is leveled and equal to ln (N ). In this situation the loss becomes independent from the extracted features. That is, for all possible values of θ in S(θ, ) we have = 0. For this reason, the initial state of the minima in the target task's loss landscape is not shown with gray colors in Figure 2b unlike other plots in Figures 1 and 2. Because of its level of freedom, a flat loss landscape in the space of θ is much easier to deform. If done carefully, it can be immediately deformed such that a minimum is placed close to the current state of θ (this can be implied from the arguments in Section 4.1). In fact, instead of finding a solution to increase the relative speed between θ and θ * Tt , this strategy makes it possible to initially build a minima close to where θ is located in S(θ). In Section 4, we describe how FAST uses this characteristic to decrease the number of steps required to converge.

FAST
Fine-tuning a pretrained CNN model on a new classification task usually requires the parametric classifier to be rebuilt accordingly. The most common way of doing this is to simply replace the parameters of the pretrained classifier with randomly-initialized ones that satisfy the dimension of the target task (Chu et al., 2016). We argue that, optimizing the reconstructed model carelessly, can significantly contribute to a phenomenon known as catastrophic forgetting (Goodfellow et al., 2013;McCloskey and Cohen, 1989). We show that a large ||W || F can make the model highly biased toward certain classes at the beginning of the fine-tuning procedure. Not only could this kind of prejudgement misrepresent the usability of the features for the new task, but it could also damage the transferred knowledge in at least two ways. First, the gradients back-propagated toward parameters of the feature extractor include an error term that is not correlated with neither the transferred knowledge nor the target task in a meaningful way. Second, even if such an error is in a correct direction, it is distorted (weighted) by the random-initialized parameters of the classifier, which in turn affects the pretrained parameters during back-propagation. The outcome of these two issues is symbolically reflected in the unguided initial direction of the blue curve in Figure 1b.
Depending on how largely the feature extractor's parameters are updated initially, the transferred knowledge may be highly forgotten due to massive changes in the relations among the pretrained parameters. Forgetting the previously learned knowledge before learning anything about the new task is clearly in contrast with the essence of transfer learning. The most immediate consequence of such prevailing detriment is that it can delay the convergence. As discussed in Section 5.3, classifier warmup employed by Li and Hoiem (2018), can alleviate the problems caused by initializing W randomly. However, as shown in Section 6.4, the model is still prone to catastrophic forgetting right after the classifier's warmup phase ends. In this case, updates to the parameters of the feature extractor are likely in a correct direction but with an uncontrolled magnitude, which considering how the first order GD works, does not completely prevent catastrophic forgetting and may overshoot the minimum it is aiming to converge to. Figure 2a intuitively reflects the effect of classifier warmup. In this figure, the red arrow marked with a circled number is plotted to show that through classifier warmup phase a minimum goes close to θ (0) while β = 0. Also, the blue circled number indicates that SGD starts modifying the pretrained parameters right after the first phase is finished.
Our proposed method, FAST, solves the aforementioned problems and hence accelerates the training process. FAST consists of two simple modifications compared to the traditional fine-tuning: 1. W is initialized with zero (see Equation 15).
2. Learning rates α and β are found such that θ and T * 2 approach each other in S(θ) with a relative velocity that is small enough so that they do not broadly cross each other, but large enough so that the anytime performance is not compromised.
Basically, FAST makes the fine-tuning procedure more robust by dampening large and noisy updates to the parameters. Algorithm 2 contrasts our method with the prevalent approach described in Algorithm 1. In these algorithms, SGD with momentum (Qian, 1999) is used to optimize the objective; however, as we will see in Section 6.6, FAST also could help the stability and speed of the convergence when more complex optimization algorithms like Adam (Kingma and Ba, 2015) is used.
In Algorithm 2, rates of applying updates on the classifier and the feature extractor are separately chosen. In the first look this seems more challenging because of having an extra hyper-parameter but we will show the necessity of separately choosing α and β in Sections 4.2 and 6.5. In the rest of this section, we justify and/or provide intuitions behind the modifications FAST makes compared to the traditional fine-tuning.
Algorithm 1: Traditional way of fine-tuning a pretrained DNN on a classification task with logistic softmax classifier using SGD+momentum input : θ, β, X, D, N and M output: θ, and W 1 Generate new parameters W ∈ R N ×D θ from Equation (8) and Equation (12), respectively

Initialization for Entropy Maximization
From a psychological point of view, bias toward specific groups or subjects matters much more in the earlier stages of the human's life. Children's attitudes are quite flexible as early as ages three or four (Byrnes, 1995). However, attitudes of grown-ups are more difficult to change. Social Learning Theory implies that prejudgment is primarily learned (Bandura and Walters, 1977). Similarly, we expect a neural network to stay neutral in associating an example to different classes prior to any training. Otherwise, any initial tendency toward specific decisions could not only make learning more difficult, but also the resulting representation (i.e., extracted-features in our learning scenario) may stay tied to the initial bias. For example, if prior to training, two classes are assumed to be very entangled, without evidence in the ground truth, this false assumption may implicitly require the learned representations to increase the number of discriminating features activated for those classes. This can make the truly similar classes starve from discriminating features.

Why Does Careful Initialization of W Matter?
Depending on the magnitude of W (0) , the extracted features A and the learning rate α, one can expect an arbitrary update number τ until the relations in W are altered. During this period, the gradients that are injected to the feature extractor's parameters, are scaled Algorithm 2: FAST for fine-tuning a pretrained DNN on a classification task input : θ, α, β, X, D and N output: θ, and W 1 Generate new parameters W ∈ R N ×D θ from Equation (8) and Equation (12), respectively by the dot-product between the error and W (0) . That is, for τ < τ , if then, It means that the extracted features get credit and penalty for correct and wrong class predictions, but this feedback is weighted by the randomly selected W (0) . Concretely, this behavior is not desired and may slow down or even damage the training process. Geometrically, this means that for a long time V W remains minuscule, so the relative velocity between θ and θ * Tt would not surpass what we calculated in Equation (13). If the condition stated in Equation (14) persists, the parameters of the feature extractor may eventually adapt so that they can decrease the error. In the extreme case W is kept unchanged while updates are only applied to θ. The empirical outcome of this scenario is shown in Section 6.3.

How Does FAST Tackle the Initialization Problem?
FAST maximizes the per-example entropy of the predicted labels by letting ∀ n ∈ {1, . . . , N }, ∀ e ∈ {1, . . . , E} : ||W (0) n,e || 2 = ≈ 0 where epsilon is a number close to zero, defined only in order to maintain logits in the computational graph. 10 Unless the magnitude of A or the number of features D is extremely large, we should get a (0) n ≈ 0. Passing this through softmax function results in which maximizes the per-example entropy of the predicted labels, that is From the inference's perspective, the effect of initializing W with close to zero values is similar to applying an extremely high temperature to the softmax function. Defined by Hinton et al. (2015), softmax with temperature u is defined with a slight modification compared to Equation (1), such that Even if is drawn randomly for each entry of W (0) , Equation (16) still holds with a high precision. Notice that since the logits are close to zero, the exponential functions work in a linear regime and could be approximated by their Taylor series as so the differences in different draws of cannot make a big difference inŷ as long as their variance is close to zero. FAST providesŷ with the maximum entropy that it can have, since every class is predicted equally per inferred example.

Initial Reduction in the Variance of the Error
Maximum entropy of predicted labels can reduce the average variance of the commencing back-propagated error if the first training mini-batch (batch) is balanced. 11 To show this, we first expand the variance of the error as in Equivalently, the average of this variance across the instances in the first mini-batch (batch) could be written as 10. Usually the practical implementation of softmax is such that maintaining the computational graph is automatically handled even if is set to zero. 11. In this context, being balanced means having the same number of instances for each class.
where the constant value represents the L2-norm of the true labels which is always equal to one, that is ||y|| 2 2 = 1. ψ is the average probability assignment for the correct labels or the soft accuracy defined as Maximizing the soft accuracy is the goal of training. If M is large enough and the first mini-batch (batch) is balanced, the initial soft accuracy is usually a random number with having 1 N as its sample mean. On the other hand, using Lemma 1 or, in a more general way, employing Lemma 2 along with Axiom 3 (all defined in Appendix A), we know that that the average L2-norm of the predicted labels (second term on the right side of equality in Equation 19) is minimized only when the entropy of the predicted labels are maximized for each instance. Hence, considering no prior knowledge about the new task, using our proposed initialization, a notable part of the variance of the error that could potentially mislead SGD toward representations is removed. Specifically, for the case of a balanced first mini-batch (batch), our method yields

Automatic Shift between Training Phases
In mapping function f dp , W is the Jacobian matrix required in the gradient chain rule to back-propagate from the label-space toward the feature-space. Initializing W (0) to values that are close to zero makes the back-propagation stall at a in the first backward phase, i.e.
However, the feature-space to label-space projection vectors are updated such that which could be rewritten as It takes a few steps until ||W || F and consequently ∂ ∂a become large enough to notably change the pretrained parameters. We name this period auto-warmup phase since it is similar to classifier warmup employed by Li and Hoiem (2018), except that instead of manually freezing the feature extractor's parameters, it keeps them almost intact by making ||W || F small. Throughout the auto-warmup phase, the parameters of the classifier are modified to form a meaningful connection between the extracted features and the predicted labels. Assuming source and target tasks to have some similarities, this connection can significantly drop the entropy of the predicted labels based on the quality of the updates (that is how much the mini-batches represent the underlying data distribution). Geometrically, the landscape of the target task's loss in S(θ) may notably deform through this phase. After taking enough number of steps, the blocked path to back-propagate the error toward the feature extractor is gradually opened up due to ||W || F = 0, and the training can go through its expected behavior. 12 4.1.5 W as a Feature-class Relevance Matrix The second term on the right side of Equation (20) is identical for all rows of W , so in action, it does not make a predicted label win over another. Regardless of such additive value for all label estimators, if Y (0) is stratified across classes (that is when the first training mini-batch is balanced), the rows of W (1) would resemble what Snell et al. (2017) named prototypes. In other words, W (1) is a label-feature relevance matrix formed based on the information in the first mini-batch (batch) of the extracted features. In the next forward pass of training, we have which implies how similar a (1) is to the label-feature relevance representation of class n, according to what was already learned. Continuing, this implicitly forms a sort of moving average over label-feature relevance matrices, calculated from different mini-batches and, as expected, the lower the error becomes, comparably smaller changes are applied. As we described, initializing W to values that are close to zero causes the first updates to make a meaningful link between the obtained features and the objective of the new task. However, this deviation from zero could further escalate through the next updates. Paying attention to Equation (5) reveals that the speed of modifying W in each update is directly related to the amount of observed error. Hence, decreasing the training loss would decrease the amount of changes in W upon preserving the distribution of extracted features in different mini-batches. Fortunately, due to the prevailing use of normalization layers in deep CNNs, the extracted features are robust to sudden changes even with a large shift in distribution or magnitude of the raw input batches.

Scaling up the Number of Classes
If the number of classes increases, so does the probability of accidentally biasing toward a specific class. Thus, the maximum entropy initialization sounds even more essential. Interestingly, if Equation (16) holds, the average error is not changed by increasing the number of classes. That is because the prediction error is fixed to On the other hand, ||y (0) || 2 and consequently ||δ (0) || 2 drop by increasing the value of N .

Progressive Entropy Minimization
Overconfidence is a type of subjective bias by which people's certainty in their judgement is much higher than their objective accuracy (Pallier et al., 2002). In support of the well-known DunningKruger effect (Kruger and Dunning, 1999), Sanchez and Dunning (2018) show that at the beginning of learning a classification task, people gain a lot of overconfidence. By learning more, this surge of confidence usually is followed by a downturn and then a gradual rise that is more correlated with the person's accuracy (Sanchez and Dunning, 2018). However, at any stage it is ideally desired to match certainty with the amount of knowledge one has obtained about a matter (Russo and Schoemaker, 1992;Winman et al., 2004;Arkes et al., 1988;Speirs-Bridge et al., 2010). Moreover, Meyniel et al. (2015) argue that in humans, confidence is not derived from a heuristic process but rather is formed during their learning process. In the context of classification with DNNs, the probabilities that the logistic softmax function produces are sensitive to the magnitude of the input logits. It makes much more sense to have a gradual decrease in the entropy of the predicted labels while training a DNN; however, when we use transfer learning, a sudden raise in the confidence may happen during the first few updates. FAST prevents the transferred knowledge from being disturbed by a sudden jump in the amount of confidence.

Controlling the growth of ||W || F
Forgetting can still happen after the auto-warmup phase. That is, when ||W || F grows much faster than a notable amount of decline in the norm of prediction error. In this situation, although W is meaningful and back-propagating through it may not mislead gradients on θ, it can highly raise their magnitude. Assuming that a first order GD is used, a very large step, even if pointing toward a minimum in the landscape of the loss, can still be a large damage to the transferred knowledge. Geometrically, in this scenario, at a particular step the relative speed of θ and θ * Tt in S(θ), may become much larger than the distance between them and they keep broadly crossing each other. A more severe case could be observed during a transition to fine-tuning when a classifier warmup phase is used. This is further explained in Section 6.4. FAST solution to this problem is to control the magnitude with better choices for α and β.

The Case of Different Learning Rates
In Section 3, we geometrically investigated the impacts of altering α and β. Initializing W with close to zero values makes the role of these learning rates even more pronounced. That is, eliminating W (0) T from Equation (13) makes V θ to be proportional to the product of rates, i.e V θ ∝ αβ.
As indicated earlier, α affects both the speed of θ and the minimum it approaches, and from what we just mentioned this effect is directly proportional to both of them; therefore, α modifies the relative velocity between θ and its closest minimum with a square order. Based on Equation (22), if similar to the traditional fine-tuning we also choose α = β, the order becomes cubic. Therefore, choosing necessarily equal learning rates ties up the velocities of θ and θ * Tt and can cause the anytime performance to be compromised. The empirical outcomes of separately tuning α and β is further expanded in Section 6.5.

Related works and discussion
Initialization and optimization are closely-related subjects in deep learning (Sutskever et al., 2013), although they have often been studied individually. In fact, the former may help the latter to speed up the convergence. Optimization algorithms are usually used to search through the space that is formed by the model's parameters. GD, in particular, surfs this space by moving through it and looking at the objective of the search (minimizing the loss) after each step. Undoubtedly, the number of steps to reach the objective is affected by where the first step is taken from. Transferring knowledge in form of pretrained parameters from one neural network to another can be viewed as a kind of parameter initialization. Furthermore, we already have emphasized the importance of a customized optimization procedure toward the efficiency of fine-tuning the pretrained models. In the following, we take a closer look at how previous works are related to ours in respect of initialization, optimization, and transfer learning concepts.

Initialization
Most widely known studies on parameter initialization in DNNs focus on preserving the variance of the flowing data along the depth (Glorot and Bengio, 2010;He et al., 2015). This strategy prevents the activations from vanishing/exploding and allows training faster and deeper networks. Specifically, for a parameterized linear layer with D input and N output neurons, Xavier's initialization method (Glorot et al., 2011) recommends initializing the parameters from a symmetric uniform distribution with variance equal to 1 6D to preserve the variance in the forwarding flow (fan-in mode), and a variance equal to 1 6N to preserve the variance in the backwarding flow (fan-out mode). Kaiming initialization (He et al., 2015) takes ReLU activations into account and relaxes the distribution to be symmetric and independent and identically distributed (i.i.d.). They provide variances 2 D and 2 N for the mentioned directions respectively. Arpit and Bengio (2019) recently acknowledged that the initialization introduced by He et al. (2015) is the optimal one for a ReLU network trained from scratch. They recommended the use of the fan-out mode. In line with the mentioned initialization methods, to avoid the exploding or vanishing problem, Saxe et al. (2013); Mishkin and Matas (2015); Xiao et al. (2018) initialize the weights with orthogonal matrices. Similarly, Balduzzi et al. (2017) proposed look linear initialization which prevents gradients in deep feed-forward networks to further shatter along the depth. 13

Initialization for the Classifier
So far, the research community has paid little attention to the initialization for taskadaptation. In many recent studies, the classifier's parameters that are appended to a pretrained model are initialized using variance preserving methods (Li and Hoiem, 2018;Shermin et al., 2018;Wang et al., 2019a). Included in this group, EfficientNet (Tan and Le, 2019;Xie et al., 2019), which shows state-of-the-art classification performance on Im-ageNet's ILSVRC-2012 data set (Russakovsky et al., 2015), uses classifiers initialized with Xavier's method (Glorot et al., 2011) for fine-tuning on new tasks (Abadi et al., 2017).
13. Gradient shattering is defined by Balduzzi et al. (2017) to indicate the phenomenon in which the backpropagating error may further go toward resembling white noise as the depth increases.
Some works do not adjust the initialization based on the embedding size or the number of classes; for instance, Wang et al. (2019a) and Krizhevsky et al. (2012) always choose 0.000025 and 0.001 as the variance of elements of W (0 respectively. 14 He et al. (He et al., 2015), exempted the classification layer of the models used in their experiments from the distribution for initializing weights that they have recommended. This layer's distribution is stated to be found experimentally. Such a strategy could be traced down to even earlier practices in constructing deep neural networks (Simonyan and Zisserman, 2015). Instead of speculation, we investigate the effect of the initialization of the classifier on the training procedure. However, we narrow down our focus to an optimal initialization for adapting a pretrained model to a new task. Our previous work on classifier initialization (Varno et al., 2019) and a recently published paper by Dodge et al. (2020) have evidently enlightened the importance of the initialization for task-adaptation. FAST uses similar initialization technique as of our previous work (Varno et al., 2019) but it highly improves the way its merits are exploited and comprehended.

Deterministic Initialization for the Classifier
Looking into special learning scenarios, two papers (Qi et al., 2018;Gidaris and Komodakis, 2018)

Optimization
Due to being computationally affordable, first order approximation of GD is the preferred optimization algorithm for training deep learning models. Based on the size of memory required for loading the training data set and the model's parameters, in each step, GD may only be applied on a portion of the data (mini-batch of data). This makes the behaviour of the algorithm dependent on the sequence of the observed mini-batches (McCoy et al., 2020;Dodge et al., 2020); thus, the algorithm is often called Stochastic Gradient Descent 14. Krizhevsky et al. (2012) also use an intercept (bias) vector that is initialized to all ones. 15. We use joint-training to indicate the learning scenario studied by Qi et al. (2018) according to the terminology used by Li and Hoiem (2018).
(SGD) in the context of DNNs. Its simplest form known as vanilla SGD applies , for any set of parameters θ.

Speed of the Convergence
A line of research focuses on reducing the number of required steps to reach a minimum in the loss landscape (Qian, 1999;Botev et al., 2017;Duchi et al., 2011;Zeiler, 2012;Tieleman and Hinton, 2012;Kingma and Ba, 2015). Adding momentum to SGD (Qian, 1999) decreases its dependency on the noise in individual mini-batches. It simply adds a moving average to the gradient of each parameter (look at line 10 of Algorithm 1). From a rather different point of view, Duchi et al. (2011) introduced AdaGrad to dampen the oscillation along very steep dimensions in the loss landscape. 16 It normalizes the gradient of the loss with respect to each parameter with its L 2 -norm that is summed over all the previous steps. It could be thought as modifying the vanilla SGD by scaling the learning rate of each parameter θ i at any step t by g (t) Since elements in this summation are always positive, the learning rate keeps scaling down as the training goes on until when the optimization algorithm becomes unable to modify any parameter. To address this issue, Adadelta (Zeiler, 2012) and RMSProp (Tieleman and Hinton, 2012) were introduced with a slight difference. They altered Equation (23) such that instead of taking all of the previous optimization steps into account only a weighted average over a window of the steps is considered. Taking advantage of a hybrid strategy, Adam (Kingma and Ba, 2015) integrated momentum with RMSProp and is known for notably speeding-up the convergence compared to SGD that only works with with momentum.

Performance Gap
Despite its merits, Adam has been largely criticized for asymptotically being outperformed by SGD with momentum (Keskar and Socher, 2017;Reddi et al., 2018). Dampening the gradients along the dimensions with a high frequency (Zeiler, 2012;Tieleman and Hinton, 2012;Kingma and Ba, 2015) is found to gain over SGD only in the beginning of the training (Keskar and Socher, 2017) which corresponds to moving across regions of the loss landscape with high altitudes. These regions are often more chaotic compared to regions closer to the minima . Motivated by these facts, we will empirically show that in the case of fine-tuning on a similar task, the gap between the performance of Adam and SGD with momentum could be significantly reduced. This mainly comes from the fact that, unlike the traditional fine-tuning, optimizing the classification objective with FAST does not make parameters to step out of the proximity of θ * T 2 (the minimum in the loss landscape of the target task) far onto the high altitudes.
16. Steepest dimension is the dimension that determines the degree of Lipschitz continuity and could vary from one neighborhood to another in the loss landscape.

Initial Variance of the Error
Vaswani et al. (2017) and Popel and Bojar (2018) showed that a warmup phase for adaptive learning rate can significantly accelerate the training convergence. 17 It is an initial training phase in which a very small learning rate is applied.  found the source of this phenomenon in the large initial variance of the gradients. They demonstrate this by showing that the distribution of the gradients has momentous changes in the first few optimization steps and addressed the issue by an optimization algorithm that dampens the variance accordingly. Similarly, Luo et al. (2019) and  proposed to set dynamic boundaries on the magnitude of the updates. Keskar and Socher (2017) proposed to start training with Adam to take advantage of the convergence speed and then switch to SGD with momentum to better generalize when converged. Our proposed optimization algorithm for fine-tuning also decreases the initial variance of the gradients and similarly accelerates the training convergence. Using FAST, neither the speed of convergence nor the generalizable performance at convergence are scarified. FAST finds its merits in controlling the velocity of applying updates only via the first gate that gradients back-propagate through (e.g., the classifier layer). Although our work focuses only on classification, the analysis we provide suggests that in an already stable model (e.g., pretrained on a similar task, so at comparably low altitude regions of the loss landscape), SGD with momentum is able to show a competent convergence speed as long as the pretrained parameters are not disrupted by sudden and large-variance gradients, which can cause overshooting the minimum of the loss landscape that they aim to converge. It is worth mentioning that label smoothing (Szegedy et al., 2016) is also relevant in the sense that it reduces the initial variance of the gradients by decreasing the L 2 -norm of the true labels, while our method focuses on the norm of the predicted labels for which the magnitude could be automatically adapted during the course of training (unlike the norm of the true labels).

Other Related Works on Optimization
Loshchilov and Hutter (2016) aim to improve the anytime performance while training DNN models with a scheduling the value of the learning rate. Although using learning rate schedulers have been shown to be a promising direction, we choose not to experiment with it to avoid introducing conflating factors into our study. Moreover, depicting the loss landscape in the other spaces rather than the space of all parameter have not been a common strategy in the deep learning community. Among the particular works that have employed this strategy, Yu et al. (2019) found visualizing the loss landscape in the input space to be more inline with their findings about adversarial vulnerability and robustness of neural networks. Furthermore, although our analysis about the connection between the minima in loss landscapes of two similar tasks is novel, depicting such connection between minima in the loss landscape of a single task has been already investigated. In this line of research, Becker et al. (2020) found the depth (number of layers) to be an indicator of how strided the minima are spread on the loss surface. Draxler et al. (2018) disputed the common perception about the location of minima of the loss landscape of CNN models at the bottom of distinct valleys and suggested that they are connected in a common low-altitude valley.

Transfer Learning
Although the literature is not unanimous about the exact concept for which transfer learning should refer to, in its most widely known meaning it indicates borrowing knowledge from a learned task to learn a new one (Pan and Yang, 2009). It usually is categorized into feature extraction and fine-tuning (Li and Hoiem, 2018), where the former means only the appended parameters are altered during the training on the target task, while the latter also considers adapting the pretrained parameters. It is well-accepted among the community that fine-tuning could accelerate the training procedure compared to learning from scratch; 18 however, whether it also improves the outcomes (Kornblith et al., 2019;Raghu et al., 2019) or they results asymptotically emerge (He et al., 2019a) is still an open debate. More recently, the latter hypothesis got back the attention of the community since the models that exhibit state-of-the-art classification performance on many machine vision benchmarks are those that are pretrained on larger source data sets (Wang et al., 2019a;Xie et al., 2019).

Catastrophic Forgetting
Fine-tuning a pretrained neural network on a new task, greatly degrades the performance of the model on the source task. This phenomenon is widely known as catastrophic forgetting (McCloskey and Cohen, 1989). Goodfellow et al. (2013) empirically found that dropout (Srivastava et al., 2014) reduces catastrophic forgetting although at the cost of performing sub-optimal on the new task. Kirkpatrick et al. (2017) introduced a way to spot the parameters that are more important for the source task and to assign a smaller learning rate to them. The practical importance of less forgetting is highlighted in a generic learning scenario so called continual learning (van de Ven and Tolias, 2019; Hsu et al., 2018). It consists of several learning sub-scenarios with real life applications that take into account incrementally learning new tasks (Li and Hoiem, 2018), domains (van de Ven and Tolias, 2019) or classes (Rebuffi et al., 2017). Due to its practicality, continual learning has recently become more popular and is even studied combined with other learning scenarios (Lao et al., 2020). We consider exploiting the knowledge preserving aspect of FAST in continual learning as a possible direction for the future works. However, in this paper we retain our focus on the classic transfer learning where interestingly, in contrast to the previous studies, our method does not make an explicit effort to retain the performance of the source task and does not compromise the performance on the target task. Our main goal is to accelerate the finetuning process on the target task without compromising its convergence performance and as a bi-product the source task is also forgotten less than in a typical fine-tuning procedure.

Meta-learning
Meta-learning or learning to learn (Schmidhuber, 1993) is a generalization of the classic transfer learning, where the transferred knowledge is obtained from a collection of tasks instead of only one. It has been a while since meta-learning has become the leading research direction to tackle few-shot learning (Finn et al., 2017;Nichol et al., 2018;Li et al., 2017; 18. Learning from scratch refers to a setting in which the parameters of the model are randomly initialized. In deep learning literature, learning from scratch sometimes, comes as the opposite case of transfer learning. Mishra et al., 2018). However, recently, it has been shown that state-of-the-art metalearning methods are not much superior compared to a more complex fine-tuning (Dhillon et al., 2019) or even feature extraction .

Classifier Warmup
Li and Hoiem (2018) considered a classification warmup phase before fine-tuning on a new target task. In this phase, the feature extractor works in its inference mode and only the parameters of the classifier are updated. This is similar to finding a better initialization for the classifier though not only the representation learning is postponed, the number of required updates in the classification warmup phase is not known. The optimal number depends on many factors, including the values drawn for W (0) . Li and Hoiem (2018) used a validation set to determine when the classifier warmup phase should be ended. Our experiments suggest that, the transition from feature extraction to fine-tuning in this form causes a minimum overshooting, which immediately damages the model's performance (see section 6.4 for a more complete explanation). In contrast, our method does not demand manually switch between training phases. Instead, it chooses the initialization and the learning rate of W such that the magnitude of the updates on the feature extractor's parameters become proportional to both the error and its certainty (through gradual entropy minimization).

Experiments
In this section, we first define our methodology to compare anytime performance of different models and then use it to quantitatively validate our hypothesis through different experiments.

Evaluation Methodology
To evaluate different models or training procedures applied on a standard supervised task, three labeled partitions of data are commonly used. Training set helps GD to move through the parameters' space. Validation set is mainly used to monitor the generalizable performance during training. If the inferred performance (or another measure like loss) on validation set improves, the state of the model is stored, so it could be deployed when the training ends without any further progress. Test set is used to compare the performance of different models deployed after training has ended. In this scheme, validation set compensates for the non-monotonic trend of outcomes that GD may show during training; however, the speed of achieving a certain level of generalizable performance is disregarded and the judgement is made only based on the final test results. To better justify training procedures that guide the model through trajectories in the parameters' space with better outcomes during the course of training, the deployment results could simply be monitored at a pre-defined set of deployment checkpoints. This sounds more inline with the train-deploy cycle through which a human being usually learns to perform a single task.
There have been a lot of research works on speeding-up the convergence of neural networks, yet only a few have shown their gain in a quantitative way (e.g., Raghu et al. (2019)). Some DNN classifiers have been viewed and analyzed in the context of anytime algorithms but often in terms of anytime prediction which is concerned about the inference time (Hu et al., 2019;Huang et al., 2017a;Amthor et al., 2016;Wan et al., 2019)-that is, the performance at inference time could be varied based on the time and energy constraints. In contrast, we introduce a new quantitative way to show how much the learning process of a model is sped-up at certain deployment checkpoints, and exploit it to compare our proposed methods with the baselines. Anytime Deployment Performance (ADP) is the term we use to indicate the results that are collected in this way. ADP reflect the stability of the generalizable results in terms of an anytime algorithm, which tolerates the interruption of the training at almost anytime. We define ADP simply to be the test performance on the best saved model until certain checkpoints which are pre-determined by a sequence of the number of training steps. For instance, let us assume that during the training, the state of the model is saved exactly after t training updates because evaluating it on a validation set at that step shows the best validation performance up to t. If the smallest deployment checkpoint that is equal or larger than t is τ , and from t to τ the validation performance does not improve, then the state of the model that was stored right after the t-th update is retrieved at τ and its performance is measured on the test set. These measures are reported as the ADP.

Effect of Classifier Initialization
In this experiment, we aim to validate our hypothesis about the influence of carelessly initializing the parameters appended through model adoption using the concept of catastrophic forgetting. Let T s and T t be the source and target tasks respectively; that is, the model is already trained on T s and the goal is to fine-tune it on T t . We want to show that for currently well-known fine-tuning techniques, at the beginning of the training, the performance of the model on T s suddenly drops without much gain in its performance on T t . Additionally, we want to see how forgetting to perform T s would impact the speed of convergence on T t .

Setup
To cover engagement of features in different levels of representations, we consider two scenarios: first, choosing T s and T t to be identical and second, choosing them to be unrelated and from completely distinct domains. A ResNet-18 (He et al., 2016) that is already pretrained on ImageNet's ILSVRC-12 (Russakovsky et al., 2015) is used for this experiment. Five percent of the training split of each task is separated for validation in a stratified order. Training, validation, and test images are resized to 128×128. Random horizontal flip is applied on images of the training mini-batches. Size of each training mini-batch is 100 (M = 100) with equal number of images per label. SGD is used with learning rate of 0.01 and gradient momentum equal to 0.9. The number of gradient updates (steps) between two consecutive validations is increased gradually starting from 1 and saturating at 10. ADP checkpoints are set to the update numbers corresponding to the Fibonacci sequence, except for the third number which is skipped because it is equal to the second number in the sequence.
The source task is chosen to be classification defined over CIFAR-100 data set (Krizhevsky et al., 2009). CIFAR-100 includes 32×32 labeled RGB images of natural objects from 100 classes with 500 training and 100 test examples per class. W is initialized according to the fan-in mode of Kaiming's method (He et al., 2015) and trained for 120 epochs. In the first scenario, the target task is chosen to be identical to the source task, and as usually is done in fine-tuning, in the transition from T s to T t the pretrained classifier is replaced with a random one. The second scenario, chooses T t to be the classification defined over MNIST data set (LeCun et al., 1998). MNIST consists of 28×28 gray-level labeled images of handwritten digits with 60000 training and 10000 test examples. Multiple sets of models are fine-tuned, initializing W by drawing from zero-centered normal distributions with different standard deviations ranging from 1 down to 10 −8 for each set of models. Normal distribution is shown with N which takes its mean and standard deviation as its first and second arguments respectively. For example, to show that W is initialized with zero-centered normal distribution that has a standard deviation equal to 1, we note W W W (0) ∼ N (0, 1). Each experiment is repeated using a set of 15 different random seeds. In our setup, applying different random seeds not only initializes W differently but also exposes dissimilar sequence and combination of training mini-batches to the model. 19 During fine-tuning, the model is deployed on both the source and target tasks at determined checkpoints (pseudo-Fibonacci sequence). To deploy the model on the source task in this stage, the test split of the source task is first fed to the feature extractor in its inference mode, then it is passed through the classifier that was trained on the source task and has been detached through the model adoption process.

Results and discussion
Scaling down the magnitude of the initial values of W not only increases the speed of convergence to the target task, but also retains more knowledge from the source task. This is concluded from the ADP performance of these tasks shown in Figure 3. Although the rising ||W || F in some curves shown in Figure 4 indicates that θ is considerably modified (unlike feature extraction where β = 0) after just a few steps, the corresponding deployment performance of the source task plotted in the second row of Figure 3 suggests that almost no forgetting happens when T s = T t and W (0) −→ 0. Figure 5 outlines the results of the second scenario (T s = T t ). Notice that according to these results, when W (0) is closer to zero, within only 50 SGD steps (visiting total 5000 input images), ADP of T t reaches over 96% accuracy while showing 20% ADP accuracy on T s . This is notable, considering the target task being in a totally different domain and the source task having 100 classes (compared to the expected accuracy from random outputs for a balanced task at 1%).
Rooted from the adverse effect of retaining the condition stated in Equation (14) for a long time and its connection with curves in Figure 4 and their corresponding ADP results in Figure 3, we conclude that initializing the classifier appended through model adoption with close-to-zero values, not only better preserves the transferred knowledge but also can accelerate the training procedure on the target task. : Understanding the effect of initializing W through catastrophic forgetting. ADP accuracy on T t at the top and T s at the bottom. Both tasks are identical and defined by classification on CIFAR-100 data set. The horizontal axis shows the optimization steps on the target task which is shared among the two plots.

Effect of Parameter Heterogeneity
It is already explained analytically (in Section 4.1) and empirically (in Section 6.2) that why initializing W with large and random values, misleads the optimization algorithm to take large and aimless steps in S(θ) at the beginning of the fine-tuning. Also we showed that these steps cause the model to forget the transferred knowledge and consequently slow down the convergence. One interesting question is how much of this damage comes from the randomness of W apart from its magnitude. We try to answer this question in this experiment and partly in the next one. Geometrically, for the period that Equation (14) holds, the landscape of the target task's loss does not deform much in S(θ) (the target minimum in Figure 1 stays almost hold for that period). In this situation, if W (0) is carelessly drawn, it is very likely that the trajectory through which SGD guides θ, becomes long and hard to settle. To further pronounce this phenomenon, by setting α to zero, we force the optimization algorithm to keep W as it is initialized; hence, the convergence only relies on θ traveling in S(θ, ). This makes us able to abstractly perceive the effect of the fast geometric deformation that FAST provides.

Setup
We compare ADP when randomly-initialized W is kept unchanged (α = 0) during finetuning compared to when it is updated with the same rate as θ (α = β). For both cases we choose W (0) ∼ N (0, 10 −2 ). The rest of the setup is identical to the first scenario of the previous experiment except that fine-tuning is done on CIFR100 as the target task (T 2 ) by adopting an off-the-shelf model pretrained on ImageNet's ILSVRC-12 (Russakovsky et al., 2015) (T 1 ). Figure 6 suggests that when the loss landscape deforms as discussed in Section 3, the convergence is significantly accelerated. The shadows representing 95% confidence intervals are barely visible indicating that the results shown in this figure are highly consistent. The results in this experiment strongly support our hypothesis which recognizes the deformation of the loss landscape in the space of the transferred parameters to largely influence the convergence speed.

Classifier Warmup
Introduced by Li and Hoiem (2018), fine-tuning could be done after a classifier warmup phase during which only the classifier is modified. The transition from this phase to finetuning is committed whenever the validation performance does not improve for a number of training steps. In this experiment we show how using classifier warmup effects the generalizable performance while training.

Setup
The warmup phase is stopped whenever the validation accuracy has not improved at least one percent for 10 consecutive SGD steps. The rest of the setup is akin to that of Section 6.3.

Results and discussion
Large leaps of validation accuracy pointed with arrows in the first row of Figure 7 show the step at which the transition from classifier warmup phase to jointly training θ and W is committed. At these points, the back-propagate gradients have comparably large magnitude which makes SGD take a big (but unnecessary) step in S(θ). The size of this step depends on ||W || F which in turn depends on W (0) and α. In this experiment, we use α = 10 −2 but initializing the classifier in different ways. The orange and green curves correspond to the fan-out and fan-in modes of Kaiming initialization He et al. (2015) respectively. The blue curves shows the effect of letting the running statistics-used in normalization layers of feature extractor-to be updated during the training of classifier. Similarly, the running statistics are updated for the case shown with red curves but the classifier is initialized with small-variance values in this case. The reason for including cases with updating running statistics is to opt-out its influence factor and make more certain conclusions.
Unlike other experiments, the visualization made for this experiment only reflects a single random seed (no shadow is plotted to indicate confidence interval) and the outcomes of runs with other random seeds are not shown so to let the minimum overshooting leaps be visually clear. The optimization steps where sudden leaps in the performance of different curves takes place in Figure 7, support our geometric hypothesis visualized in Figure 2a. In summary, the results presented in this experiment suggest that although including a classifier warmup phase can help the optimization algorithm to take its initial steps in a correct direction, it still is prone to minimum overshooting. In the sever case of minimum overshooting, θ may step into high-altitude regions of the loss landscape which makes the convergence non-efficient and can cause catastrophic forgetting.

The Effect of Unequal Learning Rates
As shown in Section 4.2, the effect of α on the relative velocity of θ and θ * Tt is much larger than that of β. This implies that for an efficient convergence rate, the learning rates of the feature extractor and the classifier should be adjusted independently or at least should not necessarily be set equally as is traditionally done. Considering Equation (5), this is even more pronounced when W is initialized with close to zero values. In this experiment we compare the outcome of scaling the learning rates in symmetric and asymmetric ways. To do so, starting from a baseline, we scale-up and scale-down α and β both equally and unequally, and inspect the outcomes.

Setup
In this experiment we use ResNet-18 (He et al., 2016) and VGG-19 (Simonyan and Zisserman, 2015) which are pretrained on ImageNet's ILSVRC-12 (Russakovsky et al., 2015) to fine-tune on the classification task defined over CIFAR-100 data set (Krizhevsky et al., 2009). For all the cases, W is initialized randomly from a zero-centered normal distribution with a close to zero standard deviation (10 −8 ). The rest of the setup is akin to that of Section 6.3 except that the learning rates for SGD optimization are explicitly expressed in plots on each curve.  Figure 8a improves the ADP eventually, though it degrades the performance in the first 100 optimization steps. On the other hand, as shown by the red curve on Figure 8b, if only β is scaled down, the best performance is similarly improved but is not compromised on the earlier steps at all.

Results and discussion
For VGG-19 (Simonyan and Zisserman, 2015) which compared to ResNet-18 (He et al., 2016) is a more challenging model to train , the difference between the aforementioned learning-rate scaling strategies seems to be bolder. This is depicted in Figure 9 where the asymmetric scaling more significantly speeds-up the ADP performance.
The results in this experiment indicate that in order to have an efficient ADP, the learning rates of the pretrained feature extractor and appended classifier are better to be tuned separately. This statement does not intend to convey that, these learning rates do not influence the optimal value of each other but rather it emphasizes that the prevailing practice to set them equal could compromise the performance either at the beginning of the training or for a long time afterward. Furthermore, the compromise seems to be more significant as much as the loss landscape is more chaotic (e.g., VGG-19 compared to ResNet-18 as explained by ).

Optimization
Putting the outcomes of sections 6.2 and 6.5, we want to compare the complete FAST method with a fine-tuning baseline. However, we first need to answer two fundamental questions.
• First, are the outcomes of employing FAST essentially different from those of the baseline or similar convergence behavior could be obtained by tuning the learning in the baseline?
• Second, does FAST reduce the performance gap between SGD with momentum and Adam as hypothesized (see Section 5.2)?
In this experiment we look for answers to these question from an empirical point of view. asymmetrically for fine-tuning on ResNet-18 (He et al., 2016). In all cases c = 10 −2 .

Setup
In this experiment we use VGG-19 (Simonyan and Zisserman, 2015) as our challenging optimization case in addition to DenseNet-201 (Huang et al., 2017b) which according to what  states about the skip connections, is characterized with a relatively smooth loss landscape despite having a lot of layers. Both models are pretrained on Im-ageNet's ILSVRC-12 (Russakovsky et al., 2015) and the goal is to fine-tune them on the classification task defined over CIFAR-100 data set (Krizhevsky et al., 2009). The learning rates and initialization setup for FAST and the baselines are explicitly stated on the plots. Wherever Adam optimization algorithm (Kingma and Ba, 2015) is used, its exponential decay rates for estimating the first and the second moments are set to 0.9 and 0.999 respectively (the default recommended by the original paper). The results are also verified for RAdam algorithm which is introduced more recently by . The definition of asymmetrically for fine-tuning on VGG-19 (Simonyan and Zisserman, 2015). In all the cases c is equal to 0.05 and W (0) ∼ N (0, 10 −8 ).
RAdam is directly borrowed from the implementation that the authors provided and the default hyper-parameters are preserved.

Results and discussion
Similar to Section 6.5, when the unified learning rate is scaled down or scaled up for the baselines, in this experiment, the ADP performance is either compromised at the beginning of fine-tuning or for a large number of steps afterward. In other words, optimizing the baselines with larger learning rates improves the performance at the beginning of fine-tuning but holds it back from reaching its potential performance thereafter. However, as it is shown in Figures 10b and 10a, employing FAST provides with achieving a non-compromised ADP. Figures 11b and 11a, have the same message as that of Figures 10b and 10a except that all the models corresponding to the curves in these Figures use Adam optimizer. The baseline curves are marked with f/i which refers to the fan-in mode of Kaiming (He et al., 2015) method used for initializing the appended parameters. 20 A rough comparison between Figures 10b and 11b, clearly reveals that Adam substantially speeds-up the convergence of the baselines compared to SGD with momentum. However, applying Adam on top of FAST does not make a huge difference. To make it easier to compare the cases that use FAST in Figures 10b and 11b, we plotted the same corresponding curves again in Figure 13b. We also compared the aforementioned optimization algorithms that use FAST with a case in which Nesterov momentum (Nesterov, 1983) is used instead of the simple momentum in SGD. Also notice that as expected, Adam fails to get on par with SGD with momentum after a long period of training but generally the performance gap comparably looks minor during the whole training period.
Finally, Figure 12a compares FAST with the baselines when RAdam optimization algorithm  is employed. Unlike the original setup used in , in our fine-tuning setting the convergence rate of RAdam seems not to be less sensitive to the choice of the learning rate. Moreover, comparing Figure 11 with Figure 12 suggests that Adam converges faster than RAdam for the settings used in this experiment.
In summary, FAST could be used along with advance optimization algorithms to improve the ADP performance. However, when FAST is used for fine-tuning a model pretrained on a source task on a similar target task, the gap between performance obtained from different optimization algorithms is notably decreased. This supports our hypothesis which suggests that FAST prevents the parameters to suddenly step out of the proximity of θ * Ts and θ * Tt -Supposing θ * Ts and θ * Tt lay close to each other in a smooth region on S(θ, ) due to similarity of T s and T t .

Convergence Accuracy
In this experiment we compare FAST and the baselines with a focus on the convergence accuracy. The main goal is to confirm that using FAST would not have an adverse effect on the convergence performance; therefore, the models in this experiment are fine-tuned for a longer period than those in the previous experiments. Another goal of this experiment is to quantitatively confirm that fine-tuning with FAST keeps θ closer to θ * Ts compared to when the baselines are employed. This is similar to the experiment conducted in Section 6.2 in that they both indicate how much our method and the baselines are resistant to forgetting. However, the one in Section 6.2 focuses on the generalizable accuracy while in this experiment the geometric perspective is highlighted. Figure 13: Comparison between the learning progresses corresponding to different optimization algorithms used with FAST.

Setup
For this experiment we employ ResNeXt-101-32x8d introduced by Xie et al. (2017b), which is already pretrained on ImageNet's ILSVRC-12 (Russakovsky et al., 2015). The fine-tuning is done on Cifar-100 (Krizhevsky et al., 2009), and Caltech-256 (Griffin et al., 2007) classification tasks. Caltech-256 contains 74×74 labeled natural RGB images from 256 classes. It is originally published with no train-test split; therefore, we made a random but stratified split with 20% of the images as test (the split could be found in our code).
In the training split, 5 images are randomly selected from each class to form the validation set. This quantity is aligned with the size of validation set we chose for the other data sets (5% of the whole training) employed in this paper. The images in Caltech-256 data set are resized to twice of their original size in both their width and their height. Fine-tuning on CIFAR-100 and Caltech-256 continued for 250 and 330 epochs respectively. In all the cases, the batch size is set equal to the number of classes (that is M = N ), and the training batches are sampled in an stratified order.

Results and discussion
Figures 14 and 15 compare the top-1 ADP obtained from FAST and the baselines. The wide plots on the left of each Figure show the ADP of the first SGD steps while the narrow one on the right side magnify the same quantity but for a larger number of steps taken afterward. Neither the magnitudes nor the ratios of the axes are preserved among the plots in each Figure. The confidence interval is shown with transparent shadows but are barely visible since there is a high consistency among the results from different random seeds. The convergence results are also restated in numbers in Table 1. The ADP results suggest that not only FAST learns faster than the baselines but it also helps reaching higher convergence performance. The latter is not a very strong argument in the sense that the training time is subjective and the point of convergence has no formal meaning in this context-i.e., one may claim that after an infinite number of training steps the difference between ADP results may become insignificant (He et al., 2019a). Assume that after the chosen number of training epochs, the convergence is achieved (in its liberal definition: no improvement for a fairly large number of epochs). In the last column of Table 1 we present the euclidean distance travelled by the feature extractor's parameters from aiming minimum of the source task's loss to that of the target task's loss. The results confirm that compared to the baselines, FAST preserves θ * Tt in a closer proximity to θ * Ts . This implies that FAST reaches the objective of the target task from a direction that is more aligned with the objective of the source task compared to the baselines. This characteristic makes FAST more resistant to catastrophic forgetting.

Conclusion and Future Works
In this paper we pin-pointed a major problem of traditional fine-tuning that not only leads to catastrophic forgetting, but also slows down the convergence to the target task. To clarify this problem, we provided a novel perspective of the loss landscape which makes it possible to connect the loss landscapes of the source and target tasks. Using this perspective, we compared different transfer-learning techniques and proposed FAST for fine-tuning pretrained neural networks on classification tasks. With a focus on machine vision and deep CNN models, we provided empirical analysis with the following outcomes • Initializing the classifier appended through model adoption with close-to-zero values, not only better preserves the transferred knowledge but also accelerates the training procedure on the target task (section 6.2).
• Although including a classifier warmup phase (as suggested by Li and Hoiem (2018)) can help the optimization algorithm to take its initial steps in a correct direction, it still is prone to minimum overshooting (section 6.4).
• For an efficient convergence, the learning rates chosen for the pretrained featureextractor and the appended classifier are better to be tuned separately. Otherwise, if they are chosen equally as in the traditional fine-tuning the anytime performance could be compromised either in the beginning of the fine-tuning or during a large number of optimization steps afterward (section 6.5).
• Compared to the traditional fine-tuning, using FAST remarkably decreases the gap between the performance obtained from SGD with momentum and Adam optimization algorithms.
Generally, our proposed method learns the target task faster than the traditional fine-tuning besides preserving more knowledge about the source task. We showed superiority of our method from different analytical and empirical viewpoints, though yet more aspects have remained to explore. For instance, one can investigate if compared to the traditional finetuning, FAST converges with a different level of inductive bias as contextualized by (Abnar et al., 2020). A similar strategy taken in this paper can be applied to improve the ADP of pretrained DNNs employed in tasks such as regression, detection, segmentation, etc. To do so, one needs to first generalize the idea so it can work with other loss functions. This sounds challenging since a key component in our analysis to design FAST is the particular behaviour of the softmax function. Therefore, some modifications may be necessary before taking advantage of our strategy for each particular loss function. Moreover, although FAST is only applied on image classification tasks in this paper, it has no ties to the type of input data. Therefore, we hypothesize that FAST would show similar level of superiority over the baselines when knowledge is transferred between models that operate on other types of data such as text. Furthermore, due to its level of resistance to forgetting, FAST can have a positive contribution to the performance and efficiency of the state-of-the-art methods for continual learning. Finally, we consider FAST an appealing choice for improving the efficiency of the compute-intensive machine learning processes such as Automatic Machine Learning (Auto ML) and, in particular, neural architecture and hyper-parameter search (Zela et al., 2018).

Appendix A.
Lemma 1 If vector v is the result of feeding vector u ∈ R N to a logistic softmax, then 1 N is the supremum of ||v|| 2 2 . Proof Using the definition of logistic softmax (Equation 1), we have Taking the partial derivative of ||v|| 2 2 with respect to the i-th element of the u gives ∂||v|| 2 2 ∂u i = 2e 2u i ( N n =1 e u n ) 2 − 2e u i ( N n =1 e u n )( N n=1 e 2un ) ( N n =1 e u n ) 4 which could be simplified to Setting the calculated partial derivative to zero yields the value of u i for which ||v|| 2 2 is maximized in that direction. That is if re-indexing the sum on the left side of Equation (24) by n, results in ∀ n ∈ R N : u n = 1 N Lemma 2 If elements of a vector v ∈ R N sum to 1, then 1 N is the supremum of ||v|| 2 2 . Proof Using Cauchy-Schwarz inequality, Axiom 3 Sum of a set of all non-negative random variables is maximized when each of the entries meet its maximum.