M ETA - LEARNING WITH NEGATIVE LEARNING RATES
Anonymous authors
Paper under double-blind review
A BSTRACT
Deep learning models require a large amount of data to perform well.
When data is scarce for a target task, we can transfer the knowledge gained by training on similar tasks to quickly learn the target.
A successful approach is meta-learning , or learning to learn a distribution of tasks, where learning is represented by an outer loop, and to learn by an inner loop of gradient descent.
However, a number of recent empirical studies argue that the inner loop is unnecessary and more simple models work equally well or even better.
We study the performance of
MAML as a function of the learning rate of the inner loop, where zero learning rate implies that there is no inner loop.
Using random matrix theory and exact solutions of linear models, we calculate an algebraic expression for the test loss of
MAML applied to mixed linear regression and nonlinear regression with overparameterized models.
Surprisingly, while the optimal learning rate for adaptation is positive, we ﬁnd that the optimal learning rate for training is always negative, a setting that has never been considered before.
Therefore, not only does the performance increase by decreasing the learning rate to zero, as suggested by recent work, but it can be increased even further by decreasing the learning rate to negative values.
These results help clarify under what circumstances meta-learning performs best.
I NTRODUCTION
Deep Learning models represent the state-of-the-art in several machine learning benchmarks (LeCun et al.
, and their performance doesn’t seem to stop improving when adding more data and computing resources (Rosenfeld et al.
(2020), Kaplan et al.
However, they require a large amount of data and compute to start with, which are often not available to practitioners.
The approach of ﬁne-tuning has proved very effective to address this limitation: pre-train a model on a source task, for which a large dataset is available, and use this model as the starting point for a quick additional training (ﬁne-tuning) on the small dataset of the target task (Pan & Yang (2010), Donahue et al.
Yosinski et al.
This approach is popular because pre-trained models are often made available by institutions that have the resources to train them.
In some circumstances, multiple source tasks are available, all of which have scarce data, as opposed to a single source task with abundant data.
This case is addressed by meta-learning , in which a model gains experience over multiple source tasks and uses it to improve its learning of future target tasks.
The idea of meta-learning is inspired by the ability of humans to generalize across tasks, without having to train on any single task for long time.
A meta-learning problem is solved by a bi-level optimization procedure: an outer loop optimizes meta-parameters across tasks, while an inner loop optimizes parameters within each task (Hospedales et al.
The idea of meta-learning has gained some popularity, but a few recent papers argue that a simple alternative to meta-learning is just good enough, in which the inner loop is removed entirely (Chen et al.
(2020a), Tian et al.
(2020), Dhillon et al.
(2020), Chen et al.
(2020b), Raghu et al.
Other studies ﬁnd the opposite (Goldblum et al.
It is hard to resolve the debate because there is very little theory available to explain these ﬁndings.
In this work, using random matrix theory and exact solutions of linear models, we derive an algebraic expression of the average test loss of MAML, a simple and successful meta-learning algorithm
(Finn et al.
(2017)), as a function of its hyperparameters.
In particular, we study its performance as a function of the inner loop learning rate during meta-training.
Setting this learning rate to zero is equivalent to removing the inner loop, as advocated by recent work (Chen et al.
(2020a), Tian et al.
(2020), Dhillon et al.
(2020), Chen et al.
(2020b), Raghu et al.
Surprisingly, we ﬁnd that the optimal learning rate is negative, thus performance can be increased by reducing the learning rate below zero.
In particular, we ﬁnd the following:
• In the problem of mixed linear regression, we prove that the optimal learning rate is always negative in overparameterized models.
The same result holds in underparameterized models provided that the optimal learning rate is small in absolute value.
We validate the theory by running extensive experiments.
• We extend these results to the case of nonlinear regression and wide neural networks, in which the output of can be approximated by a linear function of the parameters (Jacot et al.
(2018), Lee et al.
While in this case we cannot prove that the optimal learning rate is always negative, preliminary experiments suggest that the result holds in this case as well.
R ELATED WORK
The ﬁeld of meta-learning includes a broad range of problems and solutions, see Hospedales et al.
(2020) for a recent review focusing on neural networks and deep learning.
In this context, metalearning received increased attention in the past few years, several new benchmarks have been introduced, and a large number of algorithms and models have been proposed to solve them (Vinyals et al.
(2017), Bertinetto et al.
(2019), Triantaﬁllou et al.
Despite the surge in empirical work, theoretical work is still lagging behind.
Similar to our work, a few other studies used random matrix theory and exact solutions to calculate the average test loss for the problem of linear regression (Advani & Saxe (2017), Hastie et al.
Nakkiran (2019)).
To our knowledge, our study is the ﬁrst to apply this technique to the problem of meta-learning with multiple tasks.
Our results reduce to those of linear regression in the case of one single task.
Furthermore, to our knowledge we are the ﬁrst to apply the framework of Neural
Tangent Kernel to the problem of meta-learning (Jacot et al.
(2018), Lee et al.
Similar to us, a few theoretical studies looked at the problem of mixed linear regression in the context of meta-learning.
In Denevi et al.
(2018), a meta-parameter is used to bias the task-speciﬁc parameters through a regularization term.
Kong et al.
(2020) looks at whether many tasks with small data can compensate for a lack of tasks with big data.
However, none of these studies look into the effect of learning rate on performance, which is our main focus.
In this work, we focus on MAML, a simple and successful meta-learning algorithm
(Finn & Levine (2018)).
A few theoretical studies have investigated MAML, looking at: universality of the optimization
algorithm
(Finn & Levine (2018)), bayesian inference interpretation (Grant et al.
(2018)), proof of convergence (Ji et al.
(2020)), difference between convex and non-convex losses (Saunshi et al.
global optimality (Wang et al.
Again, none of these studies look at the effect of the learning rate, the main subject of our work.
The theoretical work of Khodak et al.
(2019) connects the learning rate to task similarity, while the work of Li et al. (2017) meta-learns the learning rate.
M ETA - LEARNING AND MAML
In this work, we follow the notation of Hospedales et al.
and we use MAML (Finn et al.
as the meta-learning model in all our experiments and derivations.
We assume the existence of a distribution of tasks τ and, for each task, a distribution of data points D τ and a loss function
L τ .
The loss function of the meta-learning problem, L meta , is deﬁned as an average over both distributions of tasks and data points.
The goal of meta-learning is to minimize the loss function with respect to a vector of meta-parameters ω
[Equation]
Note that each task is characterized by a different distribution of the data.
Within each task, the training D t and validation data D v are drawn independently from the same distribution.
The vector of parameters θ is task-speciﬁc, it depends on the meta-parameters ω , and the training data D t .
Different meta-learning algorithms correspond to a different choice of θ τ .
We describe below the choice of MAML (Eq.3), the main subject of this study.
Optimization of Eq.1 is referred to as the outer loop , while computation of θ τ is referred to as the inner loop of meta-learning.
In practical applications, the loss of Eq.1 is evaluated on a sample of m tasks, and a sample of n v validation data points for each task:
[Equation]
In this work, we assume that the loss function is the same for all tasks,
L τ = L .
During the meta-training outer loop, the loss function is minimized with respect to the parameter ω , usually by stochastic gradient descent, starting from an initial point ω 0 .
In the meta-training inner loop, the parameters θ are learned by a set of n t training data points for each task, usually distinct from the validation data.
In MAML, the inner loop corresponds to a few steps of gradient descent, with a given learning rate α t .
In this work we consider the simple case of a single gradient step.
Therefore, the inner loop of MAML is given by
[Equation]
During meta-testing, a new (target) task is given and the parameters θ are learned by a step of gradient descent on a set of n r target data points, using a distinct learning rate α r .
This procedure is also known as adaptation .
The ﬁnal performance of the model is computed on test data of the target task.
If the learning rate α t is zero, then parameters are not adapted during meta-training and θ ( ω ) = ω .
In that case, a single set of parameters in learned across all data and there is no inner loop.
A setting similar to this has been advocated in a few recent studies (Chen et al.
(2020a), Tian et al.
Dhillon et al.
(2020), Chen et al.
(2020b), Raghu et al.
We show that, intuitively, the optimal learning rate at meta-testing (adaptation) time α r is always positive.
Surprisingly, in the family of problems considered in this study, we ﬁnd that the optimal learning rate during meta-training α t is instead negative.
We note that the setting α t = 0 effectively does not use the n t training data points, therefore we could in principle add this data to the validation set, but we do not consider this option here since we are interested in a wide range of possible values of α t as opposed to the speciﬁc case α t = 0 .
M IXED LINEAR REGRESSION
We study MAML applied to the problem of mixed linear regression.
Note that the goal here is not to solve the problem of mixed linear regression, but to probe the performance of MAML as a function of its hyperparameters.
In mixed linear regression, each task is characterized by a different linear function, and a model is evaluated by the mean squared error loss function.
We assume a generative model in the form of y =
x T w + z , where x is the input vector (of dimension p ), y is the output (scalar), z is noise (scalar), and w is a vector of generating parameters (of dimension p ), therefore p represents both the number of parameters and the input dimension.
All distributions are assumed Gaussian:
[Equation]
Different meta-training tasks i correspond to different values of generating parameters w ( i ) , while the parameters for the meta-testing task are denoted by w (cid:48) .
We denote by superscripts t , v , r , s the training, validation, target and test data, respectively.
A graphical model of data generation is shown in Figure 1.
Using random matrix theory and exact solutions of linear models, we calculate the test loss as a function of the following hyperparameters: the number of training tasks m , number of data points per task for training ( n t ), validation ( n v ) and target ( n r ), learning rate for training α t and for adaptation to target α r .
Furthermore, we have the hyperparameters speciﬁc to the mixed linear regression problem: p , ν , σ .
Since we use exact solutions to the linear problem, our approach is equivalent to running the outer loop optimization until convergence (see section 7.1 in the Appendix for details).
We derive results in two cases: overparameterized p > n v m and underparameterized p < n v m .
R ESULTS 5. O VERPARAMETERIZED CASE
In the overparameterized case, the number of parameters p is larger than the total number of validation data across tasks n v m .
In this case, since the data does not fully constrain the parameters, the optimal value of ω found during meta-training depends on the initial condition used for optimization, which we call ω 0 .
Theorem 1.
Consider the algorithm of section 3 (MAML one-step), and the data generating model of section 4 (mixed linear regression).
Let p > n v m .
Let p and n t be large, and deﬁne ξ such that both p and n t are of order o ( ξ ) .
Let | ω 0 − w 0 | be of order o ( ξ − 1 / 4 ) .
Then the test loss, averaged over the training and validation data (see Eq.27 in the Appendix) is equal to L test = σ
[Equation]
where we deﬁne the following expressions
[Equation]
Proof.
The proof of this Theorem can be found in the Appendix, sections 7.3, 7.3.1.
The loss always increases with the output noise σ and task variability ν .
Overﬁtting is expressed in
Eq.5 by the term | ω 0 − w 0 | , the distance between the initial condition for the optimization of ωand the ground truth mean of the generating model w 0 .
Adding more validation data n v and tasks m may increase or decrease the loss depending on the size of this term relative to the noise (Nakkiran (2019)), as it does reducing the number of parameters p .
However, the loss always decreases with the number of data points for the target task n r , as that data only affects the adaptation step.
Our main focus is studying how the loss is affected by the learning rates, during training α t and adaptation α r .
The loss is a quadratic and convex function of α r , therefore it has a unique minimum.
While it is possible to compute the optimal value of α r from Eq.5, here we just note that the loss is a sum of two quadratic functions, one has a minimum at α r = 0 and another has a minimum at α r = 1 / (1 + ( p + 1) /n r ) , therefore the optimal learning rate is in between the two values and is always positive.
This is intuitive, since a positive learning rate for adaptation implies that the parameters get closer to the optimum for the target task.
An example of the loss as a function of the adaptation learning rate α r is shown in Figure 2a, where we also show the results of experiments where we run MAML empirically.
The good agreement between theory and experiment suggest that
Eq.5 is accurate.
However, the training learning rate α t shows the opposite: by taking the derivative of Eq.5 with respect to α t , it is possible to show that it has a unique absolute minimum for a negative value of α t .
This can be proved by noting that this function has the same ﬁnite value for large positive or negative α t , its derivative is always positive at α t = 0 , and it has one minimum ( − ) and one maximum ( + ) at values
[Equation]
Note that the argmax α + t is always positive, while the argmin α − t is always negative.
This result is counter-intuitive, since a negative learning rate pushes parameters towards higher values of the loss.
However, learning of the meta-parameter ω is performed by the outer loop (minimize Eq.1), for which there is no learning rate since we are using the exact solution to the linear problem and thus we are effectively training to convergence.
Therefore, it remains unclear whether the inner loop (Eq.3) should push parameters towards higher or lower values of the loss.
An example of the loss as a function of the training learning rate α r is shown in Figure 2b, where we also show the results of experiments where we run MAML empirically.
Here the theory slightly underestimate the experimental loss, but the overall shapes of the curves are in good agreement, suggesting that Eq. is accurate.
Additional experiments are shown in the Appendix, Figure 6.
α r during adaptation. b) Effect of learning rate α t during training. The optimal learning rate during adaptation is always positive, while that during training is always negative. Values of parameters: n t = 30 , n v = 2 , n r = 20 , m = 3 , p = 60 , σ = 1 ., ν = 0 .
{+5 , ω 
 = 0 , w 0 = 0 . In panel a) we set α t = 0 .+} 2 , in panel b) we set α r = 0 .
In the experiments, each run is evaluated on 100 tasks ofdata points each, and each point is an average over 100 runs (a) or 1000 runs (b).
5. U NDERPARAMETERIZED CASE
In the underparameterized case, the number of parameters p is smaller than the total number of validation data across tasks n v m .
In this case, since the data fully constrains the parameters, the optimal value of ω found during meta-training is unique.
We prove the following result.
Theorem 2.
Consider the algorithm of section 3 (MAML one-step), and the data generating model of section 4 (mixed linear regression).
Let p < n v m .
Let either m or ξ (or both) be a large number, where ξ is deﬁned by assuming that both n t and n v are of order o ( ξ ) .
Then the test loss, averaged over the training and validation data (see Eq.27 in the Appendix) is equal to
[Equation]
where h r , h t are deﬁned as in previous section, Eqs.6, 7, and g i are order o (1) polynomials in α t , see Eqs.98-101 in the Appendix.
Proof.
The proof of this Theorem can be found in the Appendix, sections 7.3, 7.3.2.
Again, the loss always increases with the output noise σ and task variability ν .
Furthermore, in this case the loss always decreases with the number of data points n v , n r , and tasks m .
Note that, for a very large number of tasks m , the loss does not depend on meta-training hyperparameters α t , n v , n t .
When the number of tasks is inﬁnite, it doesn’t matter whether we run the inner loop, and how much data we have for each task.
As in the overparameterized case, the loss is a quadratic and convex function of the adaptation learning rate α r , and there is a unique minimum.
While the value of the argmin is different, in this case as well the loss is a sum of two quadratic functions, one with minimum at α r = 0 and another with a minimum at α r = 1 / (1 + ( p + 1) /n
r ) , therefore the optimal learning rate is again in between the same two values and is always positive.
Similar comments applies to this case: a positive learning rate for adaptation implies that the parameters get closer to the optimum for the target task.
An example of the loss as a function of the adaptation learning rate α r is shown in
Figure 3a, where we also show the results of experiments where we run MAML empirically.
The good agreement between theory and experiment suggest that Eq.9 of the loss is accurate.
As a function of the training learning rate α t , the loss Eq.9 is the ratio of two fourth order polynomials, therefore it is not straightforward to determine its behaviour.
However, it is possible to show that the following holds
[Equation]
suggesting that performance is always better for negative values of α t around zero.
Even if counterintuitive, this ﬁnding aligns with that of previous section, and similar comments apply.
An example of the loss as a function of the training learning rate α r is shown in Figure 3b, where we also show the results of experiments where we run MAML empirically.
A good agreement is observed between theory and experiment, again suggesting that Eq.9 of the loss is accurate.
Additional experiments are shown in the Appendix, Figure 6.
5. N ON -G AUSSIAN THEORY IN OVERPARAMETERIZED MODELS
In previous sections we studied the performance of MAML applied to the problem of mixed linear regression.
It remains unclear whether the results in the linear case are relevant for the more interesting case of nonlinear problems.
Inspired by recent theoretical work, we consider the case of nonlinear regression with squared loss
[Equation]
(11) where y is a target output and f ( x , ω ) the output of a neural network with input x and parameters ω .
The introduction of the Neural Tangent Kernel showed that, in the limit of inﬁnitely wide neural networks, the output is a linear function of its parameters during the entire course of training (Jacot et al.
(2018), Lee et al.
This is expressed by a ﬁrst order Taylor expansion
[Equation]
[Equation]
The parameters ω remain close to the initial condition ω
during the entire course of training, a phenomenon referred to as lazy training (Chizat et al.
and therefore the output can be linearized around ω 0 .
Intuitively, in a model that is heavily overparameterized, the data does not constrain the parameters, and a parameter that locally minimizes the loss in Eq.11 can be found in the vicinity of any initial condition ω 0 .
Note that, while the output of the neural network is linear in the parameters, it remains a nonlinear function of its input, through the vector of nonlinear functions k in Eq.13.
By substituting Eq.12 into Eq.11, the nonlinear regression becomes effectively linear, in the sense that the loss is a quadratic function of the parameters ω , and all nonlinearities are contained in the functions k in Eq.13, that are ﬁxed by the initial condition ω 0 .
This suggests that we can carry over the theory developed in the previous section to this problem.
However, in this case the input to the linear regression problem is effectively k ( x ) , and some of the assumptions made in the previous section are not acceptable.
In particular, even if we assume that x is Gaussian, k ( x ) is a nonlinear function of x and cannot be assumed Gaussian.
We prove the following result, where we generalize the result of section 5.1 to non-Gaussian inputs and weights.
Theorem 3.
Consider the algorithm of section 3 (MAML one-step), with ω 0 = 0 , and the data generating model of section 4, where the input x and the weights w are not necessarily Gaussian, and have zero mean and covariances, respectively, Σ = E xx T and Σ w = E ww T .
Let F be the matrix of fourth order moments F = E (cid:0) x
T Σ x (cid:1) xx T .
Let p > n v m .
Also let p and n t be large, and deﬁne ξ such that both p and n t are of order o ( ξ ) .
Let Tr (cid:0) Σ 2 w (cid:1) be of order o (cid:0) ξ − 1 (cid:1) , and let the variances of matrix products of the rescaled inputs x / √ p , up to sixth order, be of order o (cid:0) ξ − 1 (cid:1) (see
Eqs.134-136 in the Appendix).
Then the test loss, averaged over the training and validation data (see Eq.27 in the Appendix) is equal to
[Equation]
where we deﬁne the following matrices
[Equation]
Proof.
The proof of this Theorem can be found in Appendix, section 7.4.
Note that this result reduces to Eqs.5, 6, 7 when Σ
=
I , Σ w =
Iν 2 /p , F = I ( p + 2) , ω
= 0 , w = 0 .
This expression for the loss is more difﬁcult to analyze than those given in the previous sections, because it involves traces of nonlinear functions of matrices, all elements of which are free hyperparameters.
Nevertheless, it is possible to show that, as a function of the adaptation learning rate α r , the loss in Eq.14 is still a quadratic function.
As a function of the adaptation learning rate α r , the loss in Eq.14 is the ratio of two fourth order polynomials, but it is difﬁcult to draw any conclusions since their coefﬁcients do not appear to have simple relationships.
Even if the inﬂuence of the hyperparameters is not easy to predict, the expression in Eq.14 can still be used to quickly probe the behavior of the loss empirically, by using example values for the Σ , Σ w , F , since computing the expression is very fast.
Here we choose values of Σ , Σ w by a single random draw from a Wishart distribution
[Equation]
Note that the number of degrees of freedom of the distribution is equal to the size of the matrices, p , therefore this covariances display some correlations.
Furthermore, we choose F = 2Σ 3 +Σ Tr (cid:0) Σ 2 (cid:1) , which is the value taken when x follows a Gaussian distribution.
Therefore, we effectively test the loss in Eq.14 for a Gaussian distribution, as in previous section, but we stress that the expression is valid for any distribution of x within the assumptions of Theorem 3.
Since we test the Gaussian case, we also run experiments of MAML, applied again to mixed linear regression, but now using the covariance matrices drawn in Eq.17.
Figure 4 shows the loss in Eq.14 as a function of the learning rates, during adaptation (panel a) and training (panel b).
Qualitatively, we observe a similar behaviour as in section 5.1: the adaptation learning rate has a unique minimum for a positive value of α r , while the training learning rate shows better performance for negative values of α t .
Again, there is a good agreement between theory and experiment, suggesting that Eq.14 is valid in this case as well.
a) Effect of learning rate α r during adaptation.
b
Effect of learning rate α t during training.
The optimal learning rate during adaptation is positive, while that during training appears to be negative.
Values of parameters: n t = 30 , n v = 2 , n r = 20 , m = 3 , p = 60 , σ = 1 ., ν = 0 .
5 , ω
= 0 , w 0 = 0 .
In panel a) we set α t = 0 .
2 , in panel b) we set α r = 0 .
In the experiments, each run is evaluated on 100 tasks of 50 data points each, and each point is an average over 100 runs (a) orruns (b).
5. N ONLINEAR REGRESSION
To investigate whether negative learning rates improve performance on non-linear regression in practice, we studied the simple case of MAML with a neural network applied to a quadratic function.
Speciﬁcally, the target output is generated according to y =
( w T x + b ) 2 + z , where b is a bias term.
The data x , z and generating parameters w are sampled as described in section 4 (in addition, the bias b was drawn from a Gaussian distribution of zero mean and unit variance.).
We use a 2layer feed-forward neural network with ReLU activation functions after the ﬁrst layer.
Weights are initialized following a Gaussian distribution of zero mean and variance equal to the inverse number of inputs.
We choose large values of network width to ensure the model is overparameterized.
We report results with a network width of 400 in both layers; results were similar with larger network widths.
We use the square loss function and we train the neural network in the outer loop with stochastic gradient descent with a learning rate of 0 .
001 for 5000 epochs (until convergence).
We used most parameters identical to section 5.1: n t = 30; n v = 2; n r = 20; m = 3; p = 60; σ = 1 , ν = 0 .
5 , w 0 = 0 .
The learning rate for adaptation was set to α r = 0 .
Note that in section 5.1 the model was initialized at the ground truth of the generative model ( ω 0 = w 0 ), while here the neural network parameters are initialized at random.
Figure 5 shows the test loss as a function of the learning rate α t .
The best performance is obtained for a negative learning rate of α t = − 0 .
D ISCUSSION
We calculated algebraic expressions for the average test loss of MAML applied to a simple family of linear models, as a function of the hyperparameters.
Surprisingly, we showed that the optimal value of the learning rate of the inner loop during training is negative.
This ﬁnding seems to carry over to more interesting nonlinear models in the overparameterized case.
However, additional work is necessary to establish the conditions under which the optimal learning rate may be positive, for example by probing more extensively Eq.14.
A negative optimal learning rate is surprising and counter-intuitive, since negative learning rates push parameters towards higher values of the loss.
However, the meta-training loss is minimized by the outer loop, therefore it is not immediately obvious whether the learning rate of the inner loop should be positive, and we show that in some circumstances it should not.
However, perhaps obviously, we also show that the learning rate during adaptation at test time should always be positive, otherwise the target task cannot be learned.
In this work, we considered the case of nonlinear models in the overparameterized case.
However, typical applications of MAML (and meta-learning in general) implement relatively small models due to the heavy computational load of running bi-level optimization, including both outer and inner loop.
Our theory also assumes a limited number of tasks where data is independently drawn in each task, while some applications use a large number of tasks with correlated draws (for example, images may be shared across tasks in few-shot image classiﬁcation, see Bertinetto et al.
Furthermore, our theory is valid at the exact optimum of the outer loop, which is equivalent to training the outer loop to convergence, therefore overﬁtting may occur in the outer loop of our model.
To the best of our knowledge, nobody has considered before training meta-learning models with negative learning rates in the inner loop.
Given that some studies advocate removing the inner loop altogether, which is similar to setting the learning rate to zero, then they may as well try a negative one.
On the other hand, it is possible that a negative learning rate does not work in nonlinear and non-overparameterized models, a setting that is outside the the theory presented in this work.