F EW -S HOT L EARNING WITH W EAK S UPERVISION
A BSTRACT
Few-shot meta-learning methods aim to learn the common structure shared across a set of tasks to facilitate learning new tasks with small amounts of data.
However, provided only a few training examples, many tasks are ambiguous.
Such ambiguity can be mitigated with side information in terms of weak labels which is often readily available.
In this paper, we propose a Bayesian gradient-based metalearning algorithm that can incorporate weak labels to reduce task ambiguity and improve performance.
Our approach is cast in the framework of amortized variational inference and trained by optimizing a variational lower bound.
The proposed method is competitive to state-of-the-art methods and achieves signiﬁcant performance gains in settings where weak labels are available.
I NTRODUCTION A ND R ELATED W ORK
A critical issue in few-shot meta-learning problems is the lack of sufﬁcient information contained in the training examples to uniquely determine the task.
Probabilistic meta-learning algorithms address this task ambiguity problem by learning generalizable priors from a set of related tasks, and leveraging
Bayesian inference to generate several potential neural network solutions to a given ambiguous task (Finn et al., 2018; Gordon et al., 2019; Yoon et al., 2018; Rusu et al., 2019; Grant et al., 2018; Ravi & Beatson, 2019).
However, existing methods often fail to cover all possible solutions because of the complexity and multi-modality of their distribution.
Moreover, there is no mechanism for a practitioner to provide extra information to only produce certain types of solutions.
One way to mitigate these issues is by providing side information in terms of weak labels (Denevi et al., 2020).
These labels are often either readily available or can be easily collected with little efforts.
We introduce a probabilistic meta-learning framework that enables efﬁcient integration of weak labels.
Our method, called variational model-agnostic meta-learning (VMAML), exploits the weak labels to structure a lowdimensional task latent space of a task embedding trained using amortized variational inference (AVI) (Ravi & Beatson, 2019).
Given a few-shot task, the embedding assigns a Gaussian distribution over the latent space endowed with a rejection sampling mechanism that rejects samples that are inconsistent with the weak labels.
In this way, we mitigate the multi-modality of the distribution over the neural network solutions.
Furthermore, this mechanism provides a way to ﬂexibly choose whether or not to exploit the weak labels at meta-test time.
As shown in
Figure 1, VMAML extends MAML (Finn et al., 2017; Rajeswaran et al., 2019) into a conditional and probabilistic meta-learning algorithm.
It obtains initial parameters for the gradient-descent update per input task instead of a globally-shared initialization (Wang et al., 2020), and ﬁnds such initializations stochastically instead of deterministically.
The main contribution of this work is a framework for providing a principled and practical solution for handling few-shot task ambiguities by exploiting task embedding and weak supervision.
We experimentally evaluate VMAML performance on an ambiguous few-shot regression and classiﬁcation tasks, and demonstrate that it achieves competitive performance with state-of-the-art methods without using weak labels and superior performance when additionally provided with weak labels.
T HE FEW - SHOT LEARNING SETTING
We consider a few-shot learning task T to be sampled from an unknown task distribution p ( T ) , and characterized by a distinct dataset D
= { ( x i , y i , l ) : x
i ∈ X, y i ∈ Y, l ∈ L } ni =1 with n independent and identically distributed input-output pairs ( x i , y i ) and a weak label l represented by a multi-hot vector.
We denote by φ the parameters of the task-speciﬁc neural network f ( x ; φ ) that outputs a prediction ˜
y for a given input x .
We focus on conditional and optimization-based meta-learning algorithms that, given on a few-shot set D , ﬁrst output initial parameters θ of the neural network f ( x ; θ ) .
These are then further optimized using a task-speciﬁc loss function L ( θ, D ) to obtain the ﬁnal parameters φ = arg min θ L ( θ, D ) used to solve the task T .
The objective of a meta-learning algorithm, or a meta-learner, is to efﬁciently solve unseen tasks, sampled from p ( T ) , provided with a set of few data points.
The meta-learner is trained during meta-train phase where a nested optimization is performed at two levels: task-level (inner loop) and meta-level (outer loop).
At each training iteration, we ﬁrst sample a batch of tasks {T t } represented by above deﬁned datasets {D t } , each consisting of a support set D St , also known as the few-shot set, and a query set D Qt such that D t =
D St (cid:116) D Qt .
For each task T t in the batch, the inner loop optimizes the meta-learner’s output θ t (initial parameters) using the support set D St to yield the ﬁnal task-speciﬁc parameters φ t .
At the meta-level (the outer loop), the meta-model’s parameters themselves are updated by optimizing the sum of the task-speciﬁc losses on the query samples D Qt .
Intuitively, the meta-learner ﬁrst adapts each task using the support set D St and then optimizes for few-shot generalization based on how well the adapted model generalizes to new data points from the query set D Qt .
During the meta-test phase, a trained meta-learner is evaluated on a set of held-out novel tasks T u ∼ p ( T ) that were not used during the meta-train phase.
The model is given a few-shot support set D Su corresponding to the new task T u and outputs the initial task-parameters θ u that are again further optimized to yield the parameters φ u of the task-speciﬁc model f
( x ; φ u ) .
The obtained model f ( x ; φ u ) is then used to predict labels for a set of unlabeled inputs { x i ∈ X } for the task T u .
The performance of the obtained solution φ u is evaluated on an unseen but labeled query set D Qu using the task-speciﬁc loss function L ( φ u , D Qu ) .
V ARIATIONAL M ODEL -A GNOSTIC M ETA -L EARNING (VMAML)
We extend MAML to a conditional and probabilistic meta-learning algorithm that can incorporate weak labels to mitigate the task ambiguity problem inherent in few-shot learning settings.
VMAML, visualized in Figure 1, consists of three neural networks: (1) a task encoder h ( D S ; ψ e ) , (2) a generative model p ( θ | z ; ψ g ) and (3) a classiﬁer C ( z ; ψ d ) .
Their individual network parameters ( ψ e , ψ g , ψ d ) make up the parameters of the meta-model that is trained in a nested optimization scheme containing inner and outer loops similar to Section 2.
VMAML Inner Loop Adaptation
The goal of inner loop adaptation procedure is to obtain taskspeciﬁc parameters φ t provided the values of the meta-learner’s parameters ( ψ e , ψ g , ψ d ) and a task support set D St .
First, the task encoder h
( D St ; ψ e ) takes the support set D St as input and outputs parameters of a low-dimensional task latent distribution q ( z |D St ) over a task latent variable z .
We refer to it as the approximate posterior distribution and model it as a multivariate diagonal Gaussian q ( z |D S )
=
N ( z ; µ z , diag( σ 2 z )) represented by mean vector µ z and covariance vector σ 2 z .
We incorporate weak labels l into the learning procedure and learn similarities among the encodings z based on the attributes provided by l .
We achieve this by endowing the approximate posterior q with a rejection mechanism based on a shallow classiﬁer C ( z ; ψ d ) .
The classiﬁer C takes a latent sample z as an input and outputs softmax probabilities over the weak labels.
If the classiﬁer’s prediction matches the weak label l , the sample z is accepted and further processed by the rest of the network.
In the opposite case, a new sample is drawn from q and the process is repeated.
In this way, ensure that the latent sample that is further processed by the meta-learner is consistent with the provided weak label.
The proposed mechanism both improves the expressiveness of q and mitigates the multi-modality of the true distribution over possible solutions.
[Figure]
The accepted latent sample z is then passed to the generative model p ( θ | z ; ψ g ) to generate a task-speciﬁc neural network initialization θ t .
Following the inner loop of MAML, the generated parameters θ t are further optimized by one gradient-descent step on the same support set
D St which results in the ﬁnal task-speciﬁc parameters φ t .
More precisely, we obtain the ﬁnal task parameters φ t = θ t − α ∇ θ L ( θ t , D St ) where α denotes the learning rate.
The ﬁnal solution of the inner loop adaptation for a learning task T t is the network f
( x ; φ t ) which can be used to make queries on unlabeled inputs.
In contrast to prior work (Rusu et al., 2019; Gordon et al., 2019), the distribution over φ t is modelled implicitly, and therefore not constrained to be Gaussian.
VMAML Outer Loop Optimization
The goal of the outer loop optimization is to update the parameters of the meta-learner ( ψ e , ψ g , ψ d ) such that the adaptation procedure produces task parameters φ t that generalize to the corresponding query set D Qt .
The meta-learner is trained based on two components: (i) a variational lower bound to ﬁnd the approximate posterior distribution q of the task latent variable z , and (ii) a cross-entropy term to update the classiﬁer C , by optimizing the objective
[Equation]
where φ t = θ t − α ∇ θ L ( θ t , D St ) , D KL denotes the Kullback–Leibler (KL-) divergence, p ( z ) is the prior distribution modelled as a zero-mean and unit variance Gaussian distribution, β is a parameter to balance the KL-loss against the task loss, and ∗ represents the scalar product of two vectors.
The ﬁrst two terms in equation 1 represent the variational lower bound (i), while the last term represents the cross-entropy update (ii) for the classiﬁer C .
The MAML-based gradient-descent step that adapts the task-speciﬁc parameters θ t is absorbed into the generative model p in the ﬁrst term of equation 1.
E XPERIMENTS
We evaluated VMAML on the ambiguous version of CelebA few-shot attribute classiﬁcation, and an extended version of the ambiguous few-shot multi-modal 1D regression problem, both introduced by Finn et al.
The details of the tasks can be found in the supplementary materials.
We investigated the importance of weak labels to mitigate the task ambiguity and the effect of the rejection sampling mechanism by training VMAML under three conditions: (i) without accessing the weak labels (VMAML- wo ), (ii) providing the weak labels as an input to the meta-learner (VMAML- info* ), and (iii) using the rejection sampling mechanism in addition to (ii) (VMAML- info ).
We compared
VMAML’s performance to the state-of-the-art methods MAML (Finn et al., 2017), PLATIPUS (Finn et al., 2018), VERSA (Gordon et al., 2019), and LEO (Rusu et al., 2019).
In Figure 3, we show qualitative performance of VMAML trained both without and with access to the weak labels l .
In the left part of the image, we visualize the ground truth by green shaded area.
We can see that VMAML- wo (top row) outputs a variety of functions that are possible solutions for the given set of support points.
When provided with the weak labels l , VMAML- info (bottom row) outputs signiﬁcantly improved predictions where the sampled functions match the provided weak labels.
In the bottom right part of Figure 3 weak labels are used as the user’s input to produce speciﬁc types of solutions, i.e., sinusoidal , polynomial and linear , while keeping both the parameters of VMAML- info and training examples ﬁxed, and changing only samples from the posterior distribution q ( z |D S ) [Table] [Table] that pass the rejection sampling mechanism.
In this way, the behavior of VMAML models can be controlled by the value of the weak label l .
[Figure]
(red dots).
The green shaded area represents the ground truth.
In the bottom right, weak labels are used to generate speciﬁc solutions.
We quantitatively evaluated the models based on two introduced measures: precision error and recall error .
For a given test fewshot task T u , we generatesolutions for each method.
We calculate the mean absolute error (MAE) of each of the generated solutions and all ground truth solutions.
For each task, we choose the minimum MAE.
The precision error is then deﬁned as the average over all minimum MAEs across the test tasks.
Similarly, the recall error is found by choosing 100 distinct solutions from the ground truth set and calculating the average over minimum MAEs determined between the sampled ground truth solutions and all 100 generated solutions.
Table 1 shows precision and recall errors for VMAML models as well as the benchmark methods.
VMAML- info attains the best precision and recall among all evaluated methods which demonstrates its ability to exploit weak labels while reasoning about possible solutions.
Since the performance of VMAML- info ∗ is only slightly improved compared to that of VMAML- wo but signiﬁcantly lower than that of VMAML- info , we conclude that the proposed rejection sampling mechanism in the latent space beneﬁcially exploits the provided weak labels l .
We observe that LEO performs comparable to VMAML, while PLATIPUS achieves worse precision potentially because it generates a wide range of possible solutions that are not included in the ground truth evaluation set.
Finally, MAML obtained a deteriorated recall because of its deterministic nature, while its high precision error is due to the fact that it optimizes only one globally shared set of parameters.
Figure 2 illustrates classiﬁcations made by three different sampled classiﬁers from a trained VMAMLinfo on an ambiguous few-shot dataset (see supplementary material for details on the adjusted
VMAML architecture).
The support set D Su given as input to the model is shown on the left, while the rest of the columns show query images that correspond to the three possible modes that are classiﬁed by the generated classiﬁers.
We can see from the ﬁgure that VMAML- info can successfully produce solutions for all three ambiguous query sets.
This is supported by our quantitative analysis reported in Table 2, where VMAML- info achieves coverage of 2 .
34 covering more than two ambiguous task modes, while maintaining high accuracy of 84 .
2% To cover all modes of the task, it is not sufﬁcient to produce classiﬁers that perform well on all instances of the ambiguous tasks.
Instead, each sampled classiﬁer must give the highest log-likelihood on at least one of the given modes of the task provided the same support images D Su .
We hypothesise that this could be a reason why even stochastic approaches such as VERSA fail to cover more than one mode of the task.
Among the considered benchmarks, PLATIPUS achieves the highest coverage of 1 . 75 which is slightly lower than the value reported by Finn et al.
(2018) potentially due to the fact that we used a different test split of attributes.
Consistent with the results reported by Finn et al.
(2018), MAML achieves good accuracy but can cover only one mode because of its deterministic nature.
Similar to the regression problem, VMAML yields comparable performance to the evaluated state-of-the-art methods in terms of coverage and accuracy.
Moreover, we observe that the rejection sampling mechanism yields superior coverage compared to the alternative way of receiving the weak labels as an extra input to the meta-learner ( info ∗ ), as shown by the performance of VMAML- info in Table 2.
A A PPENDIX A. R ELATED WORK
The aim of meta-learning is to learn a meta-learner for facilitating the learning process of newly unseen tasks Vanschoren (2018).
There are two major categories of meta-learning: metric-based and gradient-based meta-learning.
For metric-based meta-learning, the goal is to learn a well-generalized embedding space Snell et al.
(2017); Vinyals et al.
; Sung et al.
; Yoon et al.
However, the applications of metric-based methods are limited to classiﬁcation.
In contrast, we focus on the gradient-based methods, which are independent of the problem types and regard metaknowledge as model parameter initializations Finn et al.
; Grant et al.
; Li et al.
(2017); Rajeswaran et al.
; Flennerhag et al.
(2020); Rusu et al.
In the next parts, we will detail two subcategories of gradient-based meta-learning methods related to this paper.
Meta-learning with Task Ambiguity.
A common approach to tackle task uncertainty in metasupervised learning is by formulating the learning problem as a hierarchical Bayesian framework (Grant et al., 2018;
Kim et al., 2018b; Finn et al., 2018; Gordon et al., 2019; Ravi & Beatson, 2019), which beneﬁts from the inherent regularization of the Bayesian approaches.
In such formulations, the parameters of each task t are typically modelled as a random variable φ t distinct from the random variable assigned to the meta-level parameters θ .
The task-speciﬁc random variables { φ t } are mutually dependent where the dependence is realized through individual links to the meta-parameter variable θ .
In these Bayesian meta-learning algorithms, variational inference has demonstrated promising results in many recent works Finn et al.
; Kim et al.
(2018b)
; Ravi & Beatson (2019); Rusu et al.
; Nguyen et al.
Finn et al.
(2018) extended MAML to learn a distribution over the meta-parameters by optimizing a variational lower bound.
In a similar work, Ravi & Beatson (2019) proposed to leverage MAML to update the amortized variational parameters using gradient descent at the initialization given by the meta model.
Our approach resembles the work of Finn et al.
Ravi & Beatson (2019) in that we also leverage MAML in an amortized VI framework to adapt the meta-parameters.
However, the key difference is that we amortize a distribution over a lowdimensional task embedding instead of the high-dimensional parameter space.
Our framework also incorporates a mechanism to reduce ambiguity via weak task labels.
Meta-learning with Task Representations.
Besides Bayesian methods, constructing compact task representations has been shown to be a promising direction to address the task heterogeneity and uncertainty problems in few-shot learning (Yao et al., 2019;
Hausman et al., 2018; Garnelo et al., 2018;
Kim et al., 2018a; Rusu et al., 2019; Gordon et al., 2019; Vuorio et al., 2018).
Unlike Rusu et al.
; Gordon et al.
(2019), which formulate the task uncertainty by a diagonal Gaussian distribution in the high-dimensional parameter space, VMAML models the task uncertainty by an amortized distribution deﬁned over the low-dimensional task embedding.
Moreover, Rusu et al.
(2019) integrates SGD optimization in the learning of the embedding space, while we perform SGD directly on the generated network parameters which scales well to high-dimensional parameter spaces.
The task uncertainty can be further mitigated by providing side information about the tasks in the form of weak labels, where labels are used to build a graph to express the relations across samples Liu et al.
; Zhang et al.
Denevi et al.
In contrast to these methods, VMAML exploits the labels to learn a shallow classiﬁer deﬁned in the low-dimensional task latent space, which is jointly trained with the meta model.
Using the well-trained classiﬁer, VMAML can generate solutions speciﬁc to a given label, and thereby improving the coverage of possible solutions.
A. D ETAILS OF THE 1D REGRESSION TASK
Each task dataset was constructed by uniformly choosing one of the three base functions, and randomly sampling the corresponding parameters: phase in [0 , π ] and amplitude in [0 . 1 , 5] for sinusoidal, slope and intercept in [ − 3 , 3] for linear, and intercept in [ − 1 , 1] and higher degree coefﬁcients in [ − 0 . 1 , 0 . 1] for polynomials.
Each support task dataset consisted of n = 5 pairs ( x i , y i ) with x i randomly sampled from the interval [ − 4 . 0 , 4 . 0]
and y i corrupted by Gaussian noise with standard deviation 0.3.
The query dataset consisted of 50 such points.
Weak labels l were given as one-hot vectors: l = [1 , 0 , 0] for sinusoidal, l = [0 , 1 , 0] for polynomial, l = [0 , 0 , 1] for linear functions, while l = [0 , 0 , 0] was used for VMAML- wo .
We predetermine a set of ground truth
[Table]
solutions for 200 tasks, each containing 100 possible function solutions.
For each test task, the ground truth solutions were found by extensively searching for function parameters that yielded average error below a given threshold on the support data points.
Note that by construction there might exists many solutions for a given few-shot task due to the noisy labels and multi-modality of the tasks arising from the three different base functions.
A. D ETAILS OF C ELEB A CLASSIFICATION TASK
We evaluated VMAML on the ambiguous version of the CelebA few-shot attribute classiﬁcation problem introduced by Finn et al.
We consider N = 2 way and K = 5 shot classiﬁcation and use the VMAML architecture presented in Section A.4.
Each few-shot support dataset D S contains a positive class of K = 5 images that have three attributes in common and a negative class containing the same number of images with neither of the attributes.
The positive class of the query set D Q contains images that satisfy only two of the three attributes, hence producing three possibilities (modes) to interpret the task determined by D S .
In this experiment, weak labels are given by a multi-hot vector representing the categories of the positive attributes which are grouped into 5 categories.
We denote by l = [1 , 0 , 0 , 0 , 0] the attributes in the eyes and eyebrows areas, such as ” Brushy Eyebrows ” and ” Eye Glasses ”, l = [0 , 1 , 0 , 0 , 0] for the forehead and hair, l = [0 , 0 , 1 , 0 , 0] for the nose and mouth areas, l = [0 , 0 , 0 , 1 , 0] for the ears, cheeks, jawline, chin and neck areas, and l = [0 , 0 , 0 , 0 , 1] for general attributes of the face such as ” Young ”.
A complete description of the attributes as well as the construction of the weak labels and the train, test and validation splits is given in the supplementary material.
Similar to Finn et al.
, we construct few-shot CelebA attribute classiﬁcation task using the split of meta-train/val/test set containing 162770/19867/19962 images with the attribute split presented in
Table 3.
Furthermore, we divided the attributes into 5 categories and assigned a one-hot vector as the weak label l to each category.
The index of the categories is provided by superscripts.
We chose the splits such that there are exactly two attributes in each of the ﬁve categories of weak labels to minimize task ambiguity at test time.
Note that the tasks are still ambiguous in cases where two of the positive attributes have the same weak label.
We used the same coverage and accuracy evaluation protocol introduced by Finn et al.
For every test few-shot dataset D u , we produce several classiﬁer models using the support set D Su , and assign each of them to one of the three possible classiﬁcation tasks that yields the highest loglikelihood.
The coverage is determined by measuring the average number of tasks that receive at least one generated classiﬁcation model per dataset D Su .
Using the assigned classiﬁers, accuracy is deﬁned by averaging their accuracy on these tasks.
[Equation]
VMAML TO N- WAY K- SHOT TASKS
In classiﬁcation problems, we can avoid generating very high-dimensional parameters by generating only the top layer weights and biases of the ﬁnal classiﬁer Rusu et al.
; Gordon et al.
In this case, a feature extractor model can be shared across different tasks to internally process the inputs x from the support set D S .
Therefore, the architecture of the task encoder h
( D S ; ψ e ) is divided into two smaller neural networks h 1 and h 2 parameterized by ψ 1 e and ψ 2 e , respectively, such that ψ e = ψ 1 e (cid:116) ψ 2 e .
The computational ﬂow of the adjusted task encoder is visualized in Figure 4.
In the inner loop, the entire support dataset D S is processed by h 1 ( D S ; ψ 1 e ) which outputs features ξ i for each input x i (where weak labels l are omitted for simplicity).
The obtained features belonging to the same class c ∈ { 1 , . . .
, N } are then concatenated into one feature vector ξ ( c ) and processed by h 2 ( ξ ( c ) ; ψ 2 e ) , which outputs parameters µ ( c ) , σ ( c ) of the approximate posterior q ( c ) .
A sample z ( c ) ∼ q ( c ) accepted by the rejection sampling mechanism is then given to the generative model p which outputs the initial parameters θ ( c ) representing top layer weights and biases of the classiﬁer.
As before, these are further optimized by one gradient descent step to yield the ﬁnal parameters φ ( c ) .
In the outer loop, a query point x q ∈ D Q is ﬁrst processed by h 1 to extract the features ξ q .
These are then fed to the linear classiﬁer with weights and biases given by φ (1) , . . .
, φ ( N ) that outputs softmax probability p (˜ y q | ξ q , φ ) for each of the N classes.
In this case, the KL divergence term in the outer loop optimization in equation 1 is calculated as the sum over individual KL terms for each class c using q ( c ) .