Meta-Learning with Self-Improving Momentum Target
Abstract
The idea of using a separately trained target model (or teacher ) to improve the performance of the student model has been increasingly popular in various machine learning domains, and meta-learning is no exception; a recent discovery shows that utilizing task-wise target models can significantly boost the generalization performance.
However, obtaining a target model for each task can be highly expensive, especially when the number of tasks for meta-learning is large.
To tackle this issue, we propose a simple yet effective method, coined Self-improving Momentum Target (SiMT) .
SiMT generates the target model by adapting from the temporal ensemble of the meta-learner, i.e., the momentum network.
This momentum network and its task-specific adaptations enjoy a favorable generalization performance, enabling self-improving of the meta-learner through knowledge distillation.
Moreover, we found that perturbing parameters of the meta-learner, e.g., dropout, further stabilize this self-improving process by preventing fast convergence of the distillation loss during meta-training.
Our experimental results demonstrate that SiMT brings a significant performance gain when combined with a wide range of meta-learning methods under various applications, including few-shot regression, few-shot classification, and meta-reinforcement learning. Code is available at https://github.com/jihoontack/SiMT .
Introduction
Meta-learning [51] is the art of extracting and utilizing the knowledge from the distribution of tasks to better solve a relevant task.
This problem is typically approached by training a meta-model that can transfer its knowledge to a task-specific solver, where the performance of the meta-model is evaluated on the basis of how well each solver performs on the corresponding task.
To learn such meta-model, one should be able to (a) train an appropriate solver for each task utilizing the knowledge transferred from the meta-model, and (b) accurately evaluate the performance of the solver.
A standard way to do this is the so-called S / Q (support/query) protocol [55, 34]: for (a), use a set of support set samples to train the solver; for (b), use another set of samples, called query set samples to evaluate the solver 1 .
Recently, however, an alternative paradigm—called S / T (support/target) protocol—has received much attention [58, 62, 32].
The approach assumes that the meta-learner has an access to task-specific target models , i.e., an expert model for each given task, and uses these models to evaluate task-specific solvers by measuring the discrepancy of the solvers from the target models.
Intriguingly, it has been observed that such knowledge distillation procedure [43, 21] helps to improve the meta-generalization performance [62], in a similar way that such teacher-student framework helps to avoid overfitting under non-meta-learning contexts [30, 24].
[Figure] Despite such advantage, the S / T protocol is difficult to be used in practice, as training target models for each task usually requires an excessive computation, especially when the number of tasks is large.
Prior works aim to alleviate this issue by generating target models in a compute-efficient manner.
For instance, Lu et al.
[32] consider the case where the learner has an access to a model pre-trained on a global data domain that covers most tasks (to be meta-trained upon), and propose to generate task-wise target models by simply fine-tuning the model for each task.
However, the method still requires to compute for fine-tuning on a large number of tasks, and more importantly, is hard to be used when there is no effective pre-trained model available, e.g., a globally pre-trained model is usually not available in reinforcement learning, as collecting “global” data is a nontrivial task [9].
In this paper, we ask whether we can generate the task-specific target models by (somewhat ironically) using meta-learning.
We draw inspiration from recent observations in semi/self-supervised learning literature [50, 16, 5] that the temporal ensemble of a model, i.e., the momentum network [27], can be an effective teacher of the original model.
It turns out that a similar phenomenon happens in the meta-learning scenario: one can construct a momentum network of the meta-model, whose task-specific adaptation is an effective target model from which the task-specific knowledge can be distilled to train the original meta-model.
Contribution.
We establish a novel framework, coined Meta-Learning with Self-improving Momentum Target (SiMT) , which brings the benefit of the S / T protocol to the S / Q -like scenario where task-specific target models are not available (but have access to query data).
In a nutshell, SiMT is comprised of two (iterative) steps:
• Momentum target : We generate the target model by adapting from the momentum network, which shows better adaptation performance than the meta-model itself.
In this regard, generating the target model becomes highly efficient, e.g., one single forward is required when obtaining the momentum target for ProtoNet [45].
• Self-improving process : The meta-model enables to improve through the knowledge distillation from the momentum target, and this recursively improves the momentum network by the temporal ensemble.
Furthermore, we find that perturbing parameters of the task-specific solver of the meta-model, e
g., dropout [47], further stabilizes this self-improving process by preventing fast convergence of the distillation loss during meta-training.
We verify the effectiveness of SiMT under various applications of meta-learning, including fewshot regression, few-shot classification, and meta-reinforcement learning (meta-RL).
Overall, our experimental results show that incorporating the proposed method can consistently and significantly improve the baseline meta-learning methods [10, 31, 36, 45].
In particular, our method improves the few-shot classification accuracy of Conv4 [55] trained with MAML [10] on mini-ImageNet [55] from 47.33% → 51.49% for 1-shot, and from 63.27% → 68.74% for 5-shot, respectively.
Moreover, we show that our framework could even notably improve on the few-shot regression and meta-RL tasks, which supports that our proposed method is indeed domain-agnostic.
Related work
Learning from target models.
Learning from an expert model, i.e., the target model, has shown its effectiveness across various domains [30, 35, 65, 52].
As a follow-up, recent papers demonstrate that meta-learning can also be the case [58, 62].
However, training independent task-specific target models is highly expensive due to the large space of task distribution in meta-learning.
To this end, recent work suggests pre-training a global encoder on the whole meta-training set and finetune target models on each task [32]; however, they are limited to specific domains and still require some computations, e.g., they take more than 6.5 GPU hours to pre-train only 10% of target models while ours require[-
-]
GPU hours for the entire meta-learning process (ProtoNet [45] of ResNet-12 [34]) on the same GPU.
Another recent relevant work is bootstrapped meta-learning [11], which generates the target model from the meta-model by further updating the parameters of the task-specific solver for some number of steps with the query dataset.
While the bootstrapped target models can be obtained efficiently, their approach is specialized in gradient-based meta-learning schemes, e.g., MAML [10].
In this paper, we suggest an efficient and more generic way to generate the target model during the meta-training.
Learning with momentum networks.
The idea of temporal ensembling, i.e., the momentum network, has become an essential component of the recent semi/self-supervised learning algorithms [3, 5].
For example, Mean Teacher [50] first showed that the momentum network improves the performance of semi-supervised image classification, and recent advanced approaches [2, 46] adopted this idea for achieving state-of-the-art performances.
Also, in self-supervised learning methods which enforce invariance to data augmentation, such momentum networks are widely utilized as a target network [19, 16] to prevent collapse by providing smoother changes in the representations. In meta-learning, a concurrent work [6] used stochastic weight averaging [23] (a similar approach to the momentum network) to learn a low-rank representation.
In this paper, we empirically demonstrate that the momentum network shows better adaptation performance compare to the original meta-model, which motivates us to utilize it for generating the target model in a compute-efficient manner.
Problem setup and evaluation protocols
In this section, we formally describe the meta-learning setup under consideration, and S / Q and
S / T protocols studied in prior works.
Problem setup: Meta-learning.
Let p ( τ ) be a distribution of tasks.
The goal of meta-learning is to train a meta-model f θ , parameterized by the meta-model parameter θ , which can transfer its knowledge to help to train a solver for a new task.
More formally, we consider some adaptation subroutine Adapt ( · , · ) which uses both information transferred from θ and the task-specific dataset (which we call support set ) S τ to output a task-specific solver as ϕ τ = Adapt ( θ, S τ ) .
For example, the model-agnostic meta-learning algorithm (MAML; [10]) uses the adaptation subroutine of taking a fixed number of SGD on S τ , starting from the initial parameter θ .
In this paper, we aim to give a general meta-learning framework that can be used in conjunction with any adaptation subroutine, instead of designing a method specialized for a specific one.
The objective is to learn a nice meta-model parameter θ from a set of tasks sampled from p ( τ ) (or sometimes the task distribution itself), such that the expected loss of the task-specific adaptations is small, i.e., min θ E τ ∼ p ( τ ) [ ℓ τ ( Adapt ( θ, S τ ))] , where ℓ τ ( · ) denotes the test loss on task τ .
To train such meta-model, we need a mechanism to evaluate and optimize θ (e.g., via gradient descent).
For this purpose, existing approaches take one of two approaches: the S / Q protocol or the S / T protocol.
S / Q protocol.
The majority of the existing meta-learning frameworks (e.g., [55, 34]) splits the task-specific training data into two, and use them for different purposes.
One is the support set S τ which is used to perform the adaptation subroutine.
Another is the query set Q τ which is used for evaluating the performance of the adapted parameter and compute the gradient with respect to θ .
In other words, given the task datasets ( S 1 , Q 1 ) , ( S 2 , Q 2 ) , . . .
, ( S N , Q N ) , 2 the S / Q protocol solves
[Equation]
where L ( ϕ, Q ) denotes the empirical loss of a solver ϕ on the dataset Q .
S / T protocol.
Another line of work considers the scenario where the meta-learner additionally has an access to a set of target models ϕ target for each training task [58, 32].
In such case, one can use a teacher-student framework to regularize the adapted solver to behave similarly (or have low prediction discrepancy , equivalently) to the target model.
Here, a typical practice is to not split each task dataset and measure the discrepancy using the support dataset that is used for the adaptation [32].
In other words, given the task datasets S 1 , S 2 , . . .
, S N and the corresponding target models ϕ τ 1 target , ϕ τ 2 target , . . .
, ϕ τ N target , the S / T protocol updates the meta-model by solving
[Equation]
where L teach ( ϕ, ϕ target , S ) denotes a discrepancy measure between the adapted model ϕ and the target model ϕ target , measured using the dataset S .
Meta-learning with self-improving momentum target
In this section, we develop a compute-efficient framework which bring the benefits of S / T protocol to the settings where we do not have access to target-specific tasks or a general pretrained model, as in general S / Q -like setups.
In a nutshell, our framework iteratively generates a meta-target model which generalizes well when adapted to the target tasks, by constructing a momentum network [50] of the meta-model itself.
The meta-model is then trained, using both the knowledge transferred from the momentum target and the knowledge freshly learned from the query sets.
We first briefly describe our meta-model update protocol (Section 4.1), and then the core component, coined Self-Improving
Momentum Target (SiMT) , which efficiently generates the target model for each task (Section 4.2).
4.1 Meta-model update with a S / Q - S / T hybrid loss
To update the meta-model, we use a hybrid loss function of the S / Q protocol (1) and the S / T protocol (2).
Formally, let ( S 1 , Q 1 ) , ( S 2 , Q 2 ) , . . .
, ( S N , Q N ) be given task datasets with support-query split, and let ϕ τ 1 target , ϕ τ 2 target , . . .
, ϕ τ N target be task-specific target models generated by our target generation procedure (which will be explained with more detail in Section 4.2).
We train the meta-model as min
[Equation]
where λ ∈ [0 , 1) is the weight hyperparameter.
We note two things about Eq. 3.
First, while we are training using the target model, we also use a S / Q loss term.
This is because our method trains the meta-target model and the meta-model simultaneously from scratch, instead of requiring fully-trained target models.
Second, unlike in the S / T protocol, we evaluate the discrepancy L teach using the query set Q τ i instead of the support set, to improve the generalization performance of the student model.
In particular, the predictions of adapted models on query set samples are softer (i.e., having less confidence) than on support set samples, and such soft predictions are known to be beneficial on the generalization performance of the student model in the knowledge distillation literature [64, 49].
4.2 SiMT: Self-improving momentum target
We now describe the algorithm we propose, SiMT (Algorithm 1), to generate the target model in a compute-efficient manner.
In a nutshell, SiMT is comprised of two iterative steps: momentum target and self-improving process .
To efficiently generate a target model, SiMT utilizes the temporal ensemble of the network, i.e., the momentum network, then distills the knowledge of the generated target model into the task-specific solver of the meta-model to form a self-improving process.
Momentum target.
For the compute-efficient generation of target models, we utilize the momentum network θ moment of the meta-model.
Specifically, after every meta-model training iteration, we compute the exponential moving average of the meta-model parameter θ as
[Equation]
where η ∈ [0 , 1) is the momentum coefficient.
We find that θ moment can adapt better than the metamodel θ itself and observe that the loss landscape has flatter minima (see Section 5.5), which can
Require: Distribution over tasks p ( τ ) , adaptation subroutine Adapt ( · ) , momentum coefficient η , weight hyperparameter λ , dropout probability p , task batch size N , learning rate β . 3: while not done do 4: Sample N tasks { τ i } Ni =1 from p ( τ ) 5: for i = 1 to N do 6:
Sample support set S τ i and query set Q τ i from τ i 7: ϕ τ i moment =
Adapt ( θ moment , S τ i ) .
▷ Generate a momentum target.
8: ϕ τ i =
Adapt ( θ, S τ i ) .
▷ Adapt a task-specific solver.
9: ϕ τ i drop =
Dropout ( ϕ τ i , p ) .
▷ Perturb the solver.
L τ i total ( θ ) =
(1 − λ )
· L ( ϕ τ i drop , Q τ i ) + λ · L teach ( ϕ τ i drop , ϕ τ i moment , Q τ i )
▷ Compute loss.
11: end for 12: θ ← θ − βN · ∇ θ (cid:80) N i =1 L τ i total ( θ ) .
▷ Train the meta-model.
13: θ moment ← η · θ moment + (1 − η ) · θ .
▷ Update the momentum network.
14: end while be a hint for understanding the generalization improvement [29, 12].
Based on this, we propose to generate the task-specific target model, i.e., the momentum target ϕ moment , by adapting from the momentum network θ moment .
For a given support set S , we generate the target model for each task as
[Equation]
We remark that generating momentum targets does not require an excessive amount of compute (see
Section 5.5), e.g., ProtoNet [45] requires a single forward of a support set, and MAML [10] requires few-gradient steps without second-order gradient computation for the adaptation.
Self-improving process via knowledge distillation.
After generating the momentum target, we utilize its knowledge to improve the generalization performance of the meta-model.
To this end, we choose the knowledge distillation scheme [21], which is simple yet effective across various domains, including meta-learning [32].
Here, our key concept is that the momentum target self-improves during the training due to the knowledge transfer.
To be specific, the knowledge distillation from the momentum target improves the meta-model itself, which recursively improves the momentum through the temporal ensemble.
Formally, for a given query set Q , we distill the knowledge of the momentum target ϕ moment to the task-specific solver of the meta-model ϕ as
[Equation]
where l KD is the distillation loss and | · | is the cardinality of the set.
For regression tasks, we use the
MSE loss, i.e., l KD ( z 1 , z 2 ) :
=
∥ z 1 − z 2 ∥ 22 , and for classification tasks, we use the KL divergence with temperature scaling [17], i.e., l KD ( z 1 , z 2 ) :
= T 2 · KL ( σ ( z 1 /T )
∥ σ ( z 2 /T )) , where T is the temperature hyperparameter, σ is the softmax function and z 1 , z 2 are logits of the classifier, respectively.
We present the detailed distillation objective of reinforcement learning tasks in Appendix C. Also, note that optimizing the distillation loss only propagates gradients to the meta-model θ , not to the momentum network θ moment , i.e., known as the stop-gradient operator [5, 7].
Furthermore, we find that the distillation loss (6) sometimes converges too fast during the metatraining, which can stop the self-improving process.
To prevent this, we suggest perturbing the parameter space of ϕ .
Intuitively, injecting noise to the parameter space of ϕ forces an asymmetricity between the momentum target’s prediction, hence, preventing f ϕ and f ϕ moment from reaching a similar prediction.
To this end, we choose the standard dropout regularization [47] due to its simplicity and generality across architectures and also have shown its effectiveness under distillation research [60]: ϕ drop :=
Dropout ( ϕ, p ) where p is the probability of dropping activations.
In the end, we use the perturbed task-specific solver ϕ drop and the momentum target ϕ moment for our evaluation protocol (3).
[Table] [Table]
Experiments
In this section, we experimentally validate the effectiveness of the proposed SiMT by measuring its performance on various meta-learning applications, including few-shot regression (Section 5.1), few-shot classification (Section 5.2), and meta-reinforcement learning (meta-RL; Section 5.3).
Common setup.
By following the prior works, we chose the checkpoints and the hyperparameters on the meta-validation set for the few-shot learning tasks [33, 56].
For RL, we chose it based on the best average return during the training [10].
We find that the hyperparameters, e.g., momentum coefficient η or the weight hyperparameter λ , are not sensitive across datasets and architectures but can vary on the type of the meta-learning scheme or tasks.
We provide further details in Appendix D. Moreover, we report the adaptation performance of the momentum network for SiMT.
5.1 Few-shot regression
For regression tasks, we demonstrate our experiments on ShapeNet [13] and Pascal [63] datasets, where they aim to predict the object pose of a gray-scale image relative to the canonical orientation.
To this end, we use the following empirical loss L to train the meta-model: the angular loss for the
ShapeNet ( (cid:80) ( x,y ) ∈Q ∥ cos( f ϕ ( x )) − cos( y ) ∥ 2 + ∥ sin( f ϕ ( x )) − sin( y ) ∥ 2 ) and the MSE loss for the
[Table]
Pascal ( (cid:80) ( x,y ) ∈Q ∥ f ϕ ( x ) − y ∥ 2 ), following the prior works [63, 13].
For the backbone meta-learning schemes we use gradient-based approaches, including MAML [10], ANIL [36], and MetaSGD [31].
For all methods, we train the convolutional neural network with 7 layers [63] and apply dropout regularization [47] before the max-pooling layer for SiMT.
Table 1 summarizes the results, showing that SiMT significantly improves the overall meta-learning schemes in all tested cases.
5.2 Few-shot classification
For few-shot classification tasks, we use the cross-entropy loss for the empirical loss term L to train the meta-model θ .
, i.e., (cid:80) ( x,y ) ∈Q l ce ( f ϕ ( x ) , y ) where l ce is the cross-entropy loss.
We train the meta-model on mini-ImageNet [55] and tiered-ImageNet [38] datasets, following the prior works [32, 56].
Here, we consider the following gradient-based and metric-based meta-learning approaches as our backbone algorithm to show the wide usability of our method: MAML, ANIL, MetaSGD, and
ProtoNet [45].
We train each method on Conv4 [55] and ResNet-12 [34], and apply dropout before the max-pooling layer for SiMT.
For the training details, we mainly follow the setups from each backbone algorithm paper.
See Appendix D.1 for more details.
In-domain adaptation.
In this setup, we evaluate the adaptation performance on different classes of the same dataset used in meta-training.
As shown in Table 2, incorporating SiMT into existing meta-learning methods consistently and significantly improves the in-domain adaptation performance.
In particular, SiMT achieves higher accuracy gains on the mini-ImageNet dataset, e.g., 5-shot performance improves from 63.27% → 68.74% on Conv4.
We find that this is due to the overfitting issue of backbone algorithms on the mini-ImageNet dataset, where SiMT is more robust to such issues.
For instance, when training mini-ImageNet 5-shot classification on Conv4, MAML starts to overfit after the first 40% of the training process, while SiMT does not overfit during the training.
Cross-domain adaptation.
We also consider the cross-domain adaptation scenarios.
Here, we adapt the meta-model on different datasets from the meta-training: we use CUB [57] and Cars [26] datasets.
Such tasks are known to be challenging, as there exists a large distribution shift between training and testing domains [18].
Table 3 shows the results.
Somewhat interestingly, SiMT also improves the cross-domain adaptation performance of the base meta-learning methods across the considered datasets.
These results indicate that SiMT successfully learns the ability to generalize to unseen tasks even for the distributions that highly differ from the training.
[Table]
5.3 Reinforcement learning
The goal of meta-RL is training an agent to quickly adapt a policy to maximize the expected return for unseen tasks using only a limited number of sample trajectories.
Since the expected return is usually not differentiable, we use policy gradient methods to update the policy.
Specifically, we use vanilla policy gradient [59] [Table] and trust-region policy optimization (TRPO; [39]) for the task-specific solver and meta-model, respectively, following MAML [10].
The overall training objective of meta-RL is in Appendix C, including the empirical loss L , and the knowledge distillation loss L teach .
We evaluate
SiMT on continuous control tasks based on OpenAI Gym [4] environments.
In these experiments, we choose MAML as our backbone algorithm, and train a multi-layer perceptron policy network with two hidden layers of size 100 by following the prior setup [10].
We find that the distillation loss is already quite effective even without the dropout regularization, and applying it does not improve more.
We conjecture that dropout on such a small network may not be effective as it is designed to reduce the overfitting of large networks [47].
We provide more experimental details in Appendix D.1.
[Figure]
2D Navigation.
We first evaluate SiMT on a 2D Navigation task, where a point agent moves to different goal positions which are randomly chosen within a 2D unit square.
Figure 2 shows the adaptation performance of learned models with up to three gradient steps.
These results demonstrate that
SiMT could consistently improve the adaptation performance of MAML. Also, SiMT makes faster performance improvements than vanilla MAML with additional gradient steps.
Locomotion.
To further demonstrate the effectiveness of our method, we also study highdimensional, complex locomotion tasks based on the MuJoCo [53] simulator.
We choose a set of goal direction tasks with a planar cheetah (“Half-cheetah”), following previous works [10, 36].
In the goal direction tasks, the reward is the magnitude of the velocity in either the forward or backward direction, randomly chosen for each task.
Figure 2b shows that SiMT significantly improves the adaptation performance of MAML even with a single gradient step. 5.4 Comparison with other target models
In this section, we compare SiMT with other meta-learning schemes that utilize the target model, including bootstrapped [16] and task-wise pre-trained target models [32].
Bootstrapped target model.
We compare SiMT with a recent relevant work, bootstrapped metalearning (Bootstrap) [16]. The key difference is on how to construct the target model ϕ target : SiMT utilizes the momentum network while Bootstrap generates the target by further updating the parameters of the task-specific solver. Namely, Bootstrap relies on gradient-based adaptation while SiMT does not.
This advantage allows SiMT to incorporate various non-gradient-based metalearning approaches, e.g., ProtoNet [45], as shown in Table 2 of the main text.
Furthermore, SiMT
[Table]
[Table]
shows not only wider applicability but also better performance than Bootstrap.
As shown in Table 4,
SiMT consistently outperforms Bootstrap in few-show learning experiments, which implies that the momentum target is more effective than the bootstrapped target.
Pre-trained target model.
We compare SiMT with Lu et al. [32] which utilizes the task-wise pretrained target model for meta-learning. To this end, we train SiMT upon a ResNet-12 backbone pre-trained on the meta-training set, by following [32]. As shown in Table 5, SiMT consistently improves over MAML, and more intriguingly, SiMT performs even better than Lu et al.
We conjecture this is because SiMT can fully utilize the target model for all tasks due to its efficiency, while Lu et al.
[32] should partially sample the tasks with the target model due to the computational burden: note that when generating target models, SiMT only requires additional 0.3 GPU hours for all tasks while Lu et al.
[32] requires more than 3.7 GPU hours for 5% of tasks.
5.5 Ablation study
Throughout this section, unless otherwise specified, we perform the experiments in 5-shot in-domain adaptation on mini-ImageNet with Conv4, where MAML is the backbone meta-learning scheme.
Component analysis.
We perform an analysis on each component of our method in both 1-shot and 5-shot classification on mini-ImageNet: namely, the use of (a) the momentum network θ moment , (b) the distillation loss
L teach (6), and (c) the dropout regularization Dropout ( · ) , by comparing the accuracies.
The results in Table 6 show each component is indeed important for the improvement.
We find that a naïve combination of the distillation loss and the momentum network does not show significant improvements.
But, by additionally applying the dropout, the distillation loss becomes more effective and further improves the performance.
Note that this improvement does not fully come from the dropout itself, as only using dropout slightly degrades the performance in some cases. Computational efficiency.
Our method may be seemingly compute-inefficient when incorporating meta-learning methods (due to the momentum target generation); however, we show that it is not.
Although SiMT increases the total training time of MAML by roughly 1.2 times, we have observed that it is 3 times faster to achieve the best performance of MAML: in Figure 3a, we compare the accuracy under the same training wall-clock time with MAML.
Comparison of the momentum network and meta-model. To understand how the momentum network improves the performance of the meta-model, we compare the adaptation performance of the momentum network and the meta-model during training SiMT. As shown in Figure 3b, we observe [Figure]
that the performance of the momentum network is consistently better than the meta-model, which implies that the proposed momentum target is a nice target model in our self-improving mechanism
[Figure]
Loss landscape of the momentum network.
We visualize the loss landscape of the momentum network θ moment and the meta-model θ , to give insights into the generalization improvement.
To do this, we train MAML with a momentum network (without distillation and dropout) and visualize the loss by perturbing each parameter space [29] (See Appendix D.2 for the detail of the visualization method).
As shown in
Figure 4, the momentum network forms a flatter loss landscape than the meta-model, where recent studies demonstrate that such a flat landscape is effective under various domains [12].
Discussion and conclusion
In this paper, we propose a simple yet effective method, SiMT, for improving meta-learning.
Our key idea is to efficiently generate target models using a momentum network and utilize its knowledge to self-improve the meta-learner.
Our experiments demonstrate that SiMT significantly improves the performance of meta-learning methods on various applications.
Limitations and future work.
While SiMT is a compute-efficient way to use target models in meta-learning, it is still built on top of existing meta-model update techniques.
Since existing metalearning methods have limited scalability (to large-scale scenarios) [44], SiMT is no exception.
Hence, improving the scalability of meta-learning schemes is an intriguing future research direction, where we believe incorporating SiMT into such scenarios is worthwhile.
Potential negative impacts.
Meta-learning often requires a large computation due to the numerous task adaptation during meta-training, therefore raising environmental concerns, e.g., carbon generation [41]. As SiMT is built upon the meta-learning methods, practitioners may need to consider some computation for successful training. To address this issue, sparse adaptation scheme [42] or lightweight methods for meta-learning [28] would be required for the applications.
We thank Younggyo Seo, Jaehyun Nam, and Minseon Kim for providing helpful feedbacks and suggestions in preparing an earlier version of the manuscript. This work was supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.2019-0-00075, Artificial Intelligence Graduate School Program (KAIST) and No.2022-0-00713, Meta-learning applicable to real-world problems).
• Meta-model θ . The meta-learner network, i.e., learns to generalize on new tasks. • Adaptation subroutine Adapt ( · , · ) .
Algorithm for adapting the meta-model into a task expert by using a given task dataset.
• Support set S .
A dataset sampled from a given task distribution that is used for the adaptation.
• Query set Q .
A dataset sampled from a given task distribution (that is disjoint with the support set) to evaluate the adaptation performance of the algorithm.
• Task-specific solver ϕ .
Network adapted from the meta-model using the support set by using the adaptation subroutine, i.e., Adapt ( θ, S ) • Momentum network θ moment .
Temporal ensemble of the meta-model where we use the exponential moving average of the meta-model parameter to compute the momentum.
• Momentum target ϕ moment .
Network adapted from the momentum network using the support set by using the adaptation subroutine, i.e., Adapt ( θ moment , S )
B Overview of adaptation subroutine algorithms
MAML [10] and extensions.
MAML uses the adaptation subroutine of taking a fixed number of
SGD on the support set S , starting from the meta-model parameter θ .
Formally, for a given S , MAML with one step SGD obtains the task-specific solver ϕ by minimizing the empirical loss L , as
[Equation]
where α denotes the step size.
Here, we assume the empirical loss L is averaged over the given set
S .
One can easily extend Eq.
(7) to obtain ϕ with more than one SGD step from the meta-model θ .
For the extension, MetaSGD [31] learns the step size α along with the meta-model parameter θ , and
ANIL [36] only adapts the last linear layer of the meta-model θ to obtain ϕ .
ProtoNet [45].
The aim of metric-based meta-learning is to perform a non-parametric classifier on top of the meta-model’s embedding space f θ .
Specifically, ProtoNet learns a metric space in which classification can be performed by computing distances to prototype vectors of each class, i.e., c i :=
[Equation]
|S i | (cid:80) ( x,y ) ∈S i f θ ( x ) where S i contains the samples with class i in the support set S .
Formally, for a given distance function d ( · , · ) , e.g., l 2 distance, the task-specific solver ϕ of the ProtoNet is as
[Equation]
C Application to reinforcement learning
We consider a reinforcement learning (RL) framework where an agent interacts with an environment in discrete time [48].
At each timestep t , the agent receives a state s t from the environment and chooses an action a t based on its policy π ( a t
| s t ) .
Then the environment gives a reward r ( s t , a t ) and the agent transitions to the next state s t +1 .
{+The return R = (cid:80) ∞ t =
+}
γ t r ( s t , a t ) is defined as discounted cumulative sum of the reward with discount factor γ ∈ [0 , 1) .
As the goal of RL is to train a policy that maximizes the expected return, the loss is defined as a negative expected return as
[Equation]
where θ denotes the parameters of the policy.
During meta-learning, the empirical version of this loss can be obtained using either the support set S
τ i = { s t , a t ∼ π θ } in the adaptation subroutine, or the query set Q
τ i = { s t , a t ∼ π ϕ τi } in the meta-update.
In meta-RL setup, each task τ i contains an initial state distribution q i ( s 0 ) and a transition distribution q i ( s t +1 | s t , a t ) .
The goal of meta-RL is to optimize a policy π θ that minimizes L ( θ ) for unseen tasks τ i ∼ p ( τ ) using only a limited number ( K ) of sampled trajectories.
In Algorithm 2, we describe the meta-RL algorithm with our proposed method, SiMT.
We note that SiMT can be combined with any (gradient-based) meta-learning approaches and policy gradient methods.
In our experiments, we built SiMT upon MAML with vanilla policy gradient [59] and trust-region policy optimization (TRPO; [39]) for the task-specific solver and meta-model, respectively, as we described in Section 5.3.
Here, we describe the detailed objective of the meta-RL used in the experiments.
To this end, we use the following standard definitions of the state-action value function Q π , the value function V π , and the advantage function A π .
[Equation]
, where a t ∼ π ( a t | s t ) , s t +1 ∼ q ( s t +1 | s t , a t ) .
[Equation]
For better clarity, we will omit the notation t if there is no confusion.
The gradient of L ( θ, S ) obtained by the vanilla policy gradient method is
[Equation]
[Equation]
where S is a set of trajectories sampled using the policy π θ .
Then the adaptation subroutine of the parameters θ is performed as follows: ϕ =
Adapt ( θ, S ) :
= θ − α · ∇ θ L ( θ, S ) .
For SiMT, we update the momentum network θ moment by using the trajectories S from the policy π ϕ (line 7 in Algorithm 2), since it performs better and efficient than using additional trajectories from π ϕ moment .
In the meta-update procedure, we use the surrogate objective of TRPO to update the parameters θ .
Let θ old and θ denote parameters of current and new policies (for every meta-update iteration of
Algorithm 2), respectively.
Then the theoretical TRPO update is
[Equation]
where L TRPO ( θ old , θ ) is the (negative) surrogate advantage from adapted parameters ϕ and ϕ old , a measure of how the policy π ϕ performs relative to the old policy
π ϕ old , using trajectories Q which is sampled from the old policy:
[Equation]
and KL ( θ || θ old ) is an average KL divergence between policies across states visited by the old policy
[Equation]
To utilize SiMT in meta-RL tasks, we define the knowledge distillation loss by using the task-specific policies π ϕ and π ϕ moment , which are parameterized by ϕ and the momentum target ϕ moment , respectively.
For a given trajectories Q sampled using π ϕ , the knowledge distillation loss is as
[Equation]
For meta-learning with SiMT, the objective L τ i TRPO in (12) is replaced with L τ i total in Algorithm 2.
D Experimental details
In this section, we provide the experimental details, including experimental setups and loss landscape visualization.
The implementation of all experiments is given in the supplementary material.
D.1 Experimental setup details
Network architecture details.
For all few-shot classification experiments, we mainly follow the setups from MAML [10] and also consider the setups from recent papers [33, 56].
The Conv classifier consists of four convolutional layers, each with 64 filters, followed by a batch normalization (BN) layer [22] as well as a max-pooling layer with kernel size and stride of 2.
The network then projects to its output through a linear layer.
We choose to use the 64 channels for each layer by following the recent papers, e.g., ANIL, BOIL [33], and sparse-MAML [56].
For the ResNet-12, we use the residual blocks with channel sizes of 64, 128, 256, and 512, where the architecture is identical to the one used in previous meta-learning studies [34, 33].
For SiMT, we apply dropout before the max-pooling layer.
We also observed that the Dropblock regularization [15] (commonly used in ResNet architectures in few-shot classification) shows a similar performance gain as the dropout in ResNet-12.
We use additional three convolutional layers with 64 channels in front of
Conv4 architecture for all few-shot regression tasks by following the prior works [63, 13].
In the meta-RL setup, the policy is a conditional probability distribution π θ ( a | s ) parameterized by a neural network θ .
For a given state vector s , this neural network specifies a distribution over action space.
Then one can compute the likelihood q ( a | s ) and sample the action a ∼ q ( ·| s ) .
For our experiments with continuous action spaces, we use a Gaussian distribution, where the covariance matrix is diagonal and independent of the state.
Specifically, the policy has a multi-layer perceptron (MLP) which computes the mean and a learnable vector for log standard deviation with the same dimension as a .
We use a 2-layer MLP with hidden dimensions of 100 and ReLU activation for the policy, as we described in Section 5.3.
Training details.
For gradient-based few-shot classification experiments, we mainly follow MAML [10] and partially follow Von Oswald et al.
[56] (e.g., ResNet-12 training setups).
For ProtoNet, we follow a recent paper by Yao et al.
[61] on Conv4 and extend the setup into ResNet-12 by only changing the training iterations.
We follow a recent paper by Gao et al.
[13] for few-shot regression tasks.
We use Adam optimizer [25] for optimizing the meta-model θ and train 60,000 iterations for
Conv4 (including regression models), and 30,000 iterations for ResNet-12.
When training, we use the learning rate of β = 1e − 3 for classification and β = 5e − 4 for regression.
As for the details of
MAML and ANIL, we use 5 step SGD with a fixed step size α = 1e − 2 for the classification and α = 2e − 3 for the regression.
For all few-shot learning, we use 1 step SGD on MetaSGD.
For the classification, we use a task batch size of 4 and 2 tasks for 1-shot and 5-shot gradient-based methods, respectively, and use 1 for the rest.
For the regression, we use a task batch size of 10.
Note that all adaptation hyperparameters for the task-specific solver ϕ and momentum target ϕ moment are the same.
Moreover, we handle BN parameters following the transductive learning setting for gradient-based approaches and use inductive BN parameters for ProtoNet.
For meta-RL experiments, we mainly follow the setups from MAML [10] and use the open-source
PyTorch implementation [1] of MAML for RL.
To optimize the objective of TRPO (and SiMT), we compute the Hessian-vector products to avoid computing third derivatives and use a line search to ensure improvement of the surrogate objective with the satisfaction of the KL divergence constraint.
For both learning and meta-learning updates, we use the standard linear feature baseline proposed by Duan et al.
To estimate the advantage function, we use a generalized advantage estimator (GAE; [40]) with a discount factor of 0.95 and a bias-variance tradeoff of 1.0.
In all meta-RL experiments, the policy is trained using a single gradient step with α = 0 . 1 , with rollouts K =per gradient step.
We use a meta batch size N of 20 and 40 for the 2D navigation and the locomotion tasks, respectively.
For TRPO, we use δ = 0 .
01 for all experiments.
The agent is meta-updated for 500 iterations, and the model with the best average return during training is used for the evaluation.
Hyperparameter details for SiMT.
SiMT requires hyperparameters, including weight hyperparameter λ , momentum coefficient η , and the dropout probability p .
We first provide the hyperparameter details of few-shot learning.
For the momentum coefficient η , we use 0 .
995 except for the 5-shot classification, where 0 .
999 shows slightly better performance.
For the weight hyper-parameter λ , we use 0 . 5 for MAML and ANIL, 0 . 1 for MetaSGD, and 5 e −for ProtoNet, respectively.
Finally, for the dropout probability p , we use 0 . 2 for MAML and ANIL, and 0 .
1 for the rest.
Also, we find that the temperature value of T = 4 works the best as in the prior knowledge distillation works [65, 32].
For meta-RL experiments, we use the momentum coefficient of 0.995 for 2D navigation and 0.
for locomotion tasks, respectively.
For the weight hyperparameter λ , we use 0.1 for 2D navigation and 0.02 for locomotion tasks, respectively.
We linearly ramp up λ for locomotion tasks, as the momentum target might poorly perform at the beginning of the training.
Dataset and environment details.
For the few-shot regression task, we use Pascal [63], which contains 65 objects from 10 categories.
We sample 50 objects for training and the other 15 objects for testing.
128 × 128 gray-scale images are rendered for each object with a random rotation in azimuth angle normalized between [0 , 10] .
We also use ShapeNet [13], which includes 30 categories.
27 of these are used during training and the other three categories are used for the evaluation.
For few-shot classification, we use four image datasets, including mini-ImageNet [55, 37], tieredImageNet [38], CUB [57], and Cars [26].
We consider a 5-way classification for all tasks by following the prior works [10, 33].
The mini-ImageNet consists of training, validation, and test sets with 64, 16, and 20 classes in each, respectively.
The tiered-ImageNet consists of datasets with 351 training, 97 validation, and 160 test classes.
By following Hilliard et al.
[20], we split CUB dataset intotraining, 50 validation, and 50 test classes.
Cars are split into training, validation, and test sets with 98, 49, and 49 classes in each, respectively, by following Tseng et al.
For meta-RL experiments, we consider 2D navigation and Half-cheetah locomotion tasks, which were considered in previous works [10, 36].
In 2D navigation tasks, the observation is the current position in a 2D unit square, and the action is a velocity command which clipped in the range of [ − 0 .
The reward is the negative squared distance to the goal, and episodes terminate when the agent is within 0.01 of the goal or arrives at the horizon.
In Half-cheetah goal direction tasks, the reward is the magnitude of the velocity in either the forward or backward direction, randomly chosen for each task.
The horizon H is 100 and 200, for 2D navigation and locomotion tasks, respectively.
Evaluation details.
{+All our few-shot learning results are reported for models that are early-stopped by measuring the average validation set accuracy (across 2,000 validation set tasks for classification and 
+}
validation set tasks for regression).
For the test accuracy, we report the mean accuracy of 2,000 test tasks and 100 test tasks for classification and regression, respectively.
By following the original papers, we use 10 SGD steps for the adaptation on MAML and ANIL, and use 1 SGD step on MetaSGD.
For meta-RL experiments, the step size during adaptation was set to α = 0 .
1 for the first step, and α = 0 .
for all future steps, following the evaluation setup of MAML.
We report the truncated mean and standard deviation of the performance using five random seeds, i.e., the statistics after discarding the best and worst seeds, for meta-RL experiments.
Resource details.
For estimating the training time of our method (in Section 2 and Section 5.4), we utilize the same machine and stop other processes: we use Intel(R)
Xeon(R)
Silver 4214 CPU @
2.20GHz and a single RTX 2080 Ti GPU for the measurement.
For the main development, we mainly use Intel(R)
Xeon(R)
Gold 6226R CPU @
2.90GHz and a single RTX 3090 GPU.
[Table]
[Table]
D.2 Loss landscape visualization
In this subsection
[Table]
we provide the loss landscape visualization details of Figure 4.
For the experiment
[Table]
we consider vanilla MAML θ and its momentum network θ moment without distillation loss and dropout regularization.
We change the parameter by adding two direction vectors d 1 , d 2 and visualize the resulting loss value.
Specifically, for a given task distribution of training set p ( τ ) , a training loss
L train ( θ ) :=
E τ ∼ p ( τ ) (cid:2) L ( Adapt ( θ, S τ ) , Q τ ) (cid:3)
[Table]
and the center point θ (or θ moment ), we visualize
L train ( θ + i · d 1 + j · d 2 ) , (16)
where i
[Table]
j are the step size of the visualization axis.
For choosing visualization directions
[Table]
we sample two random vectors from a unit Gaussian distribution and normalize each filter in the vector to have the same norm of the corresponding filter in θ by following the prior work [29]
[Table]
E More experimental results E.1 Comparison with another meta-learning regularization method
We also compare SiMT with a recent regularization method, feature-wise transformation (FT) [54], a regularization method for metric-based meta-learning schemes.
FT augments the image features by utilizing the affine transformation in the feature layer to capture the data distribution.
While FT shows strong benefits in improving the base meta-learner, it focuses on cross-domain generalization and requires multiple datasets to learn the hyperparameters.
In this regard, we consider a more generic scenario and compare SiMT with FT on a standard few-shot classification setup in [54] 3 .
Here, we train ResNet-10 on the mini-ImageNet dataset and use GNN [14] as a base meta-learning scheme, which shows the best performance when used with FT.
Then, we evaluate both methods on few-shot in-domain and cross-domain adaptation scenarios.
As shown in Table 7, SiMT consistently outperforms FT in all cases.
More importantly, we observed that SiMT and FT have an orthogonal benefit where joint usage further improves the performance.
[Figure]
[Table]
E.2 Momentum targets for a small proportion of tasks
To further investigate the efficacy of the target model, we consider generating target models for a small proportion of tasks when training SiMT.
To this end, we train Conv4 on a mini-ImageNet dataset and control the ratio of tasks with the target model.
As shown in Table 8, SiMT shows consistent improvement even with a small portion of task models, e.g., 5% of target models show 1% improvement in 1-shot adaptation.
However, remark that one can easily generate target models for all tasks with SiMT, hence, one does not need to use few targets in practice.
E.3 Computation efficiency of SiMT
To further analyze the computational efficiency of SiMT, we consider additional comparisons on meta-learning methods, including ANIL [36], MetaSGD
[31], and ProtoNet [45] (we train Conv4 on the mini-ImageNet dataset under a 5-shot classification scenario).
Here, we also observed consistent efficiency gain on these setups, e.g., 30% of training time reduced to achieve the peak accuracy of
ProtoNet when using SiMT.
Although SiMT is slower than the base algorithms when comparing the number of optimization steps (due to the momentum target generation), we want to note that SiMT can be more efficient in terms of time to reach the same performance.
E.4 Additional adaptation subroutine algorithms
We consider more adaptation subroutine algorithms to verify the effectiveness of SiMT: first-order approximation of MAML (FOMAML) [10] and BOIL [33].
FOMAML removes the second derivatives of MAML, and BOIL does not adapt the last linear layer of the meta-model θ under MAML.
As shown in Table 9, SiMT consistently improves both meta-learning schemes in all tested cases.