E MPIRICAL B AYES T RANSDUCTIVE M ETA -L EARNING WITH S YNTHETIC G RADIENTS
Anonymous authors
Paper under double-blind review
A BSTRACT
We propose a meta-learning approach that learns from multiple tasks in a transductive setting, by leveraging unlabeled information in the query set to learn a more powerful meta-model.
To develop our framework we revisit the empirical Bayes formulation for multi-task learning.
The evidence lower bound of the marginal log-likelihood of empirical Bayes decomposes as a sum of local KL divergences between the variational posterior and the true posterior of each task.
We derive a novel amortized variational inference that couples all the variational posteriors into a meta-model, which consists of a synthetic gradient network and an initialization network.
The combination of local KL divergences and synthetic gradient network allows for backpropagating information from unlabeled data, thereby enabling transduction.
Our results on the Mini-ImageNet and CIFAR-FS benchmarks for episodic few-shot classiﬁcation outperform previous state-of-the-art methods
I NTRODUCTION
While supervised learning of deep neural networks can achieve or even surpass human-level performance (He et al., 2015; Devlin et al., 2018), they can hardly extrapolate the learned knowledge beyond the domain where the supervision is provided.
The problem of solving rapidly a new task after learning several other similar tasks is called meta-learning (Schmidhuber, 1987; Bengio et al., 1991; Thrun & Pratt, 1998); typically, the data is presented in a two-level hierarchy such that each data point at the higher level is itself a dataset associated with a task, and the goal is to learn a meta-model that generalizes across tasks.
In this paper, we focus on few-shot learning (Vinyals et al., 2016), an instance of meta-learning problems, where a task t , in meta-testing , consists of an unlabeled set x t :=
{ x t,i } ni =1 and a labeled set (aka support set )
d lt := { ( x lt,i , y lt,i ) } n l i =1 , and the goal is to predict the corresponding labels, namely y t
= { y t,i } ni =1 , for the unlabeled set.
In meta-training , y t is provided as ground truth.
The set d t :=
( x t , y t ) is sometimes referred to as query set .
A particular important distinction to make is whether each task is solved in a transductive or inductive manner.
The inductive setting is what was originally proposed by Vinyals et al.
(2016): we use d l t to train a model and test it on x t (one example at a time).
Transduction, however, has the advantage of being able to see all points in x t before making predictions.
We argue that the transductive setting is more relevant to the problem since, as in semi-supervised learning, an inductive learner can always be built from a transductive one (Chapelle et al., 2006).
In fact, Nichol et al.
(2018) notice that most of the existing meta-learning methods follow the transductive setting unintentionally since they use x t implicitly via the batch normalization (Ioffe & Szegedy, 2015).
Due to the hierarchical structure of the data, it is natural to formulate meta-learning as an instance of hierarchical Bayes (HB) (Good, 1980; Berger, 1985), or alternatively, empirical Bayes (EB) (Robbins, 1985; Kucukelbir & Blei, 2014).
The difference is that the latter restricts the learning of meta-parameters to point estimates.
In this paper, we focus on the EB model, since it largely simpliﬁes the training and testing without losing the strength of the HB formulation.
The idea of using HB or EB for meta-learning is not new: Amit & Meir (2018) derive an objective similar to that of HB using PAC-Bayesian analysis; Grant et al.
(2018) show that MAML (Finn et al., 2017) can be understood as a EB method; Ravi & Beatson (2018) consider a HB extension to MAML and compute posteriors via amortized variational inference.
However, unlike our proposal, these methods do not take advantage of the unlabeled set.
Roughly speaking, they construct the variational
[Figure]
posterior as a function of the labeled set d lt without taking advantage of the unlabeled set x t .
The situation is similar in gradient based meta-learning methods (Finn et al., 2017; Ravi & Larochelle, 2016;
Li et al., 2017b; Nichol et al., 2018; Flennerhag et al., 2019) and many other meta-learning methods (Vinyals et al., 2016; Snell et al., 2017; Gidaris & Komodakis, 2018), where the mechanisms used to generate the task-speciﬁc parameters rely on groundtruth labels, thus, there is no place for the unlabeled set to contribute.
We argue that this is a suboptimal choice, which may lead to overﬁtting when the labeled set is small and hinder the possibility of zero-shot learning (when the labeled set is not provided).
An exception is Liu et al.
They reuse the label propagation algorithm
(Zhu et al., 2003) for transductive inference within each task and show that transduction is useful for boosting the performance.
In this paper, we propose to use synthetic gradient (Jaderberg et al., 2017) to enable transductivity, such that the variational posterior is implemented as a function of the labeled set d lt and the unlabeled set x t .
The synthetic gradient is produced by a neural network and learned to be a surrogate of the true gradient.
The optimization process is similar to the inner gradient descent in MAML, but it iterates on the unlabeled set x t rather than on labeled set d lt , since it does not rely on y t to compute the true gradient.
The labeled set for an unseen task is now optional, which is only used to generate the initialization in our case.
In summary, our main contributions are the following:
In section 2 and section 3, we develop a novel empirical Bayes formulation with transduction for meta-learning.
To perform amortized variational inference, we propose a parameterization for the variational posterior based on synthetic gradient descent, which incoporates the contextual information from all the inputs of the query set.
In section 4, we show in theory that a transductive variational posterior yields better generalization performance.
Besides, we show that the proposed empirical Bayes formulation is equivalent to the information bottleneck principle considered by Achille & Soatto (2017).
We thus call our method synthetic information bottleneck (SIB).
In section 5, we verify our proposal empirically.
Our experimental results demonstrate that our method signiﬁcantly outperforms the state-of-the-art meta-learning methods on standard few-shot classiﬁcation benchmarks.
M ETA - LEARNING WITH TRANSDUCTIVE INFERENCE
The goal of meta-learning is to train a meta-model on a collection of tasks, such that it works well on another disjoint collection of tasks.
Suppose that we are given a collection of N tasks for training.
The associated data is denoted by D :=
{ d t := ( x t , y t ) }
Nt =1 .
In the case of few-shot learning, we are given in addition a support set d lt for each task.
In this section, we revisit the classical empirical
Bayes model for meta-learning.
Then, we propose to use a transductive scheme in the variational inference by constructing the variational posterior as a function of x t .
2. E MPIRICAL B AYES MODEL
Due to the hierarchical structure among data, it is natural to consider a hierarchical Bayes model with the marginal likelihood
[Equation]
The generative process is illustrated in Figure 1 (left, in solid arrows): ﬁrst, a meta-parameter ψ (aka hyper-parameter) is sampled from the hyper-prior p ( ψ ) ; then, for each task, a task-speciﬁc parameter w t is sampled from the prior p ( w t
| ψ ) ; ﬁnally, the dataset is drawn from the likelihood p ( d t | w t ) .
Without loss of generality, we assume the log-likelihood model factorizes as
[Equation]
which is the setting advocated by Minka (2005), in which the generative model p ( x t,i | w t ) can be safely ignored since it is irrelevant to the prediction of y t .
To simplify the presentation, we still keep the notation p ( d t | w t ) for the likelihood of the task t and use (cid:96) t to specify the discriminative model, which is also referred to as the task-speciﬁc loss , e.g., the cross entropy loss.
The ﬁrst argument in (cid:96) t is the prediction, denoted by ˆ y t,i =
ˆ y t,i ( f ( x t,i ) , w t ) , which depends on the feature representation f ( x t,i ) and the task-speciﬁc weight w t .
Note that rather than following a fully Bayesian approach, we leave some random variables to be estimated by a frequentist approach, e.g., f is a meta-parameter of the likelihood model shared by all tasks, for which we use a point estimate.
As such, the posterior inference about these variables will be largely simpliﬁed.
For the same reason, we derive the empirical Bayes (Robbins, 1985; Kucukelbir & Blei, 2014), which interprets ψ in a frequentist way:
[Equation]
We highlight the meta-parameters as subscripts of the corresponding distributions to distinguish from random variables.
Indeed, we are not the ﬁrst to formulate meta-learning as empirical Bayes.
The overall model formulation is essentially the same as the ones considered by Amit & Meir (2018);
Grant et al.
; Ravi & Beatson (2018).
2. A MORTIZED INFERENCE WITH TRANSDUCTION
As in standard probabilistic modeling, we derive an evidence lower bound (ELBO) on the log version of (3) by introducing a variational distribution q θ t ( w t ) for each task with parameter θ t :
[Equation]
The variational inference amounts to maximizing the ELBO with respect to θ 1 , . .
, θ N , which together with the maximum likelihood estimation of the meta-parameters, we have the following optimization problem:
[Equation]
However, the optimization in (5), as N increases, becomes more and more expensive in terms of the memory footprint and the computational cost.
We therefore wish to bypass this heavy optimization and to take advantage of the fact that individual KL terms indeed share the same structure.
To this end, instead of introducing N different variational distributions, we consider a parameterized family of distributions in the form of q φ ( · ) , which is deﬁned implicitly by a deep neural network φ taking as input either d lt or d t or both, that is, q φ ( d lt ) or q φ ( d lt ,d t ) .
This technique is known as amortized variational inference in the literature (Kingma & Welling, 2013; Rezende et al., 2014).
Since d lt and x t are disjoint, the inference scheme is inductive with a variational posterior q φ ( d lt ) .
As an example, MAML (Finn et al., 2017) is an inductive method forcing q φ ( d lt ) to be a Dirac delta distribution, where φ ( d lt ) = θ
Kt , the K -th iterate of the stochastic gradient descent
[Equation]
Note that we overload φ to be both the learnable initialization as well as the amortization.
In this work, we consider a transductive inference scheme by using the entire x t to deﬁne the variational posterior as q φ ( x t ) .
Replacing each q θ t by q φ ( x t ) , (5) can be written as
[Equation]
It is also possible to deﬁne the variational posterior as q φ ( x t ,y t ) ≡ q φ ( d t ) .
However, to be consistent with testing, we do not take y t as input since for which we do not have access to during testing.
In fact, nothing prevents us to come up with an even better variational posterior q φ ( x t ,d lt ) , shown in dashed arrows in Figure 1 (a), which is again transductive by deﬁnition.
In a nutshell, the meta-model includes f, ψ from empirical Bayes and the amortization φ for inference.
V ARIATIONAL INFERENCE WITH SYNTHETIC GRADIENTS
It is however non-trivial to design a network architecture to implement the amortization φ ( x t ) directly since x t is itself a dataset.
The strategy adopted by neural processes (Garnelo et al., 2018) is to aggregate the information from all individual examples via a permutation invariant function.
However, as pointed out by Kim et al.
(2019), such a strategy tends to underﬁt x t because the aggregation does not necessarily attain the most relevant information for identifying the task-speciﬁc parameter.
Attentive neural process (Kim et al., 2019) may alleviate this issue with a time complexity of O ( n 2 ) while the original neural processes only need O ( n ) time.
We instead design a neural network φ ( x t ) to parameterize the optimization process of θ t .
More speciﬁcally, consider a stochastic gradient descent on θ t for optimizing (5) with step size η :
[Equation]
We would like to parameterize this optimization dynamics up to the K -th step via φ ( x t ) , such that q θ Kt is a good approximation of the optimum q θ (cid:63)t .
It consists of parameterizing (a) the initialization θ 0 t and (b) the gradient ∇ θ t D KL ( q θ t ( w t ) (cid:107) p ψ,f ( w t | d t )) .
By doing so, θ Kt becomes a function of φ , ψ and x t 1 , we therefore realize q φ ( x t ) as q θ Kt .
For (a), we opt to either let θ 0 t = λ to be a global data-independent initialization as in MAML (Finn et al., 2017) or let θ 0 t = λ
( d lt ) with a few supervisions from the support set, where λ can be implemented by a permutation invariant network described in Gidaris & Komodakis (2018).
In the second case, the features of the support set will be ﬁrst averaged in terms of their labels and then scaled by a learned vector of the same size.
For (b), the fundamental reason that we parameterize the gradient is because we do not have access to y t during the meta-testing phase.
Note that we are able to follow (8) in meta-training to obtain q θ (cid:63)t ( w t )
∝ p f
( d t | w t ) p ψ ( w t ) .
To make a consistent parameterization in both meta-training and meta-testing, we thus discard y t when constructing the variational posterior.
Regarding the true gradient, a key observation is that, under a reparameterization w t = w t ( θ t , (cid:15) ) with (cid:15) ∼ p ( (cid:15) ) ,
[Equation]
[Figure]
+ − ELBO
[Figure]
where all the terms can be computed without y t except for ∂(cid:96) t
∂ ˆ y t,i , thus, we introduce a deep neural network ξ (ˆ y t,i ) to synthesize it.
The idea of synthetic gradients was originally proposed by Jaderberg et al.
(2017) to parallelize the back-propagation.
Here, the purpose of ξ (ˆ y t,i ) is to update θ t regardless of the groundtruth labels, which is slightly different from its original purpose.
Besides, we do not introduce an additional loss to force ξ (ˆ y t,i ) to approximate ∂(cid:96) t
∂ ˆ y t,i since ξ (ˆ y t,i ) will be learned to yield a reasonable θ Kt even without mimicking the true gradient.
To sum up, we have derived a particular implementation of φ ( x t ) by parameterizing the ideal meanﬁeld update, namely (8), with respect to the query set d t , where the meta-model φ includes an initialization network λ and a synthetic gradient network ξ , such that the output of the amortization φ ( x t ) is θ Kt – the K -th iterate of the following update:
[Equation]
The overall algorithm is depicted in Algorithm 1.
We also make a side-by-side comparison with
MAML shown in Figure 1.
Rather than viewing (9) as an optimization process, it may be more precise to think of it as a part of the computation graph created in the forward-propagation.
The computation graph of the amortized inference is shown in Figure 2,
As an extension, if we were deciding to estimate the feature network f in a Bayesian manner, we would have to compute higher-order gradients as in the case of MAML.
This is inpractical from a computational point of view and needs technical simpliﬁcations (Nichol et al., 2018).
By introducing a series of synthetic gradient networks in a way similar to Jaderberg et al.
(2017), the computation will be decoupled into computations within each layer, and thus becomes more feasible.
We see this as a potential advantage of our method and leave this to our future work 2 .
G ENERALIZATION OF EMPIRICAL B AYES AND ITS CONNECTION TO INFORMATION BOTTLENECK
In this section, we study the generalization ability of the empirical Bayes (EB) model as well as its connection to the information bottleneck principle proposed by Achille & Soatto (2017).
while
From (3), we can see that EB implies a) { d t } Nt =1 are independent of each other and b) a decomposition of the joint distribution (see Appendix A for the derivation)
[Equation]
Thus, rather than viewing w 1 , . . . , w N as N different random variables, we may view { ( w t , d t ) } Nt = as iid samples drawn from p ψ,f ( w, d ) =
p ψ,f ( w | d ) p ψ,f ( d ) 3 , which, by variational inference, will be approximated by its variational counterpart q ( w, d )
=
q ( d ) q ( w | d ) , where q ( d ) can be seen as the underlying data distribution and q ( w | d ) is the variational posterior.
Consider an amortization φ ( d ) and d = ( x, y ) , then we can parameterize the variational posterior as q ( w | d )
=
q φ ( d ) ( w ) , or even simpler: q ( w | d ) =
q ( w | x ) =
q φ ( x ) ( w ) .
Note that both parameterizations result in transductive inference since, if we would like to test on x , we will incorporate x to build a variational posterior.
An inductive variational posterior is a special case such that q ( w | d, d l ) =
q ( w | d l ) =
q φ ( d l ) ( w ) .
Before going into details, we ﬁrst introduce a few notations: the entropy is deﬁned as H p ( x ) :=
E p ( x ) [ − log p ( x )] ; the mutual information is given by I p ( x ; y ) :
= D KL (cid:0) p ( x , y ) (cid:107) p ( x ) p
( y ) (cid:1)
; the cross entropy is deﬁned as H p,q ( x ) :=
E p ( x ) [ − log q ( x )] .
Assuming that q ( w | d ) can be optimized exactly to match the empirical Bayes model, we can then use it as a proxy to analyze the generalization performance of EB.
Certainly, the quality of the optimization matters, we will also analyze this effect.
To this end, we ﬁrst identify the empirical risk for a single task as L ( w, d ) :
=n (cid:80) n i =1 (cid:96) t (ˆ y i ( f ( x i ) , w ) , y i ) .
Then, the average empirical risk is the expectation over all possible samples and weights, which depends on the variational posterior and the data distribution:
[Equation]
The true risk should be independent of any particular variational posterior.
Inspired by Xu &
Raginsky (2017), we deﬁne the true risk as follows, where we sample the task-speciﬁc weight from the aggregated posterior q ( w ) :
[Equation]
Finally
[Equation]
the generalization error is deﬁned as
[Equation]
Intuitively, the generalization error measures how much the empirical risk concentrated on the true risk is.
That is, we would like to bound the tail of the distribution over all possible values of the empirical risk.
By taking an expectation of the objective in (7) with respect to the choice of D , we have E D [ 1 N (cid:80)
Nt =1 D KL ( q ( w t | d t ) (cid:107) p ( d t | w t ) p ( w t ))]
=
E d ∼ q ( d ) D KL ( q ( w | d ) (cid:107) p ( d | w ) p ( w )) .
We show in Theorem 1 that the quantity on the right hand side directly affects the generalization performance.
Theorem 1.
Given distributions q ( w | d ) , q ( d ) , p ( w ) and p ( d | w ) , if (cid:96) t (ˆ y ( w ) , y ) is σ -subgaussian for all w , the following inequalities hold:
[Equation]
[Equation]
The equality in (14) holds
if q ( w ) = p ( w ) .
The equality in (15) holds
if q ( d ) = p ( d ) .
The proof of Theorem 1 can be found in Appendix B.
Implications of (14)
The inequality (14) basically says that (7) can be seen a regularized empirical risk minimization in which the regularization term is an upper bound of the mutual information between the weight and the sample.
In general, there is a tradeoff between the generalization error and the empirical risk controlled by the coefﬁcient n 2 σ 2 , where n = | d | is the cardinality of d .
If n is small, then we are in the overﬁtting regime.
This is the case of the inductive inference with variational posterior q ( w | d l ) , where the support set d l is fairly small by the deﬁnition of few-shot learning.
Consequently, we expect these methods to have large generalization errors in light of the above analysis.
On the other hand, if we were following the transductive setting, the sample size n would be larger and thus would achieve a small generalization error.
However, keeping increasing n will potentially over-regularize the model and thus yield negative effect.
An empirical study on varying n can be found in Table 4 in the Appendix.
Besides, the inequality (14) also suggests that the quality of the variational inference, measured by E d ∼ q ( d ) D KL ( q ( w | d ) (cid:107) p ( w | d )) , largely affect the generalization error.
If we can make this term diminishing to zero, we should be able to achieve zero generalization error and zero empirical risk.
Besides, (14) reveals a connection between empirical Bayes and information bottleneck (Tishby et al., 2000; Achille & Soatto, 2017).
The right hand side of (14) is exactly the IB objective considered by
Achille & Soatto (2017) with a coefﬁcient equal to 1 .
This connection is critical to the analysis since the generalization error is introduced by invoking its relationship to I ( w ; d ) .
We ﬁnd this connection interesting, thus, we call our method synthetic information bottleneck (SIB).
Implications of (15) An obvious message from the inequality (15) is that, if we choose appropriate likelihood, prior and variational posterior such that p ( w, d ) is aligned with q ( w, d ) ,
the empirical
Bayes model can actually be pretty good, that is, both the generalization error and the empirical risk are close to zero.
If we look at the message more carefully, it also implies that a good likelihood is the key to represent the data well; the inference model is less important as long as the aggregated posterior coincides with the prior.
A similar empirical ﬁnding was conﬁrmed by Gidaris et al.
(2019), who suggests to learn a better feature model, which in turn leads to a good likelihood model according to the deﬁnition in (2).
E XPERIMENTS
In this section, we ﬁrst validate our method on few-shot learning, and then on zero-shot learning.
Note that many meta-learning methods, such as MAML, cannot do zero-shot learning since they rely on the support set.
5. F EW - SHOT CLASSIFICATION
We compare SIB with state-of-the-art methods on few-shot classiﬁcation problems.
Our code is available at https://bit.ly/2CHHR3F .
[Table]
5.1. S ETUP Datasets
We choose standard benchmarks of few-shot classiﬁcation for this experiment.
Each benchmark is composed of disjoint training, validation and testing classes.
MiniImageNet is proposed by Vinyals et al.
(2016), which contains 100 classes, split into 64 training classes, 16 validation classes and 20 testing classes, where each class consists of 600 image-label pairs and each image is of size 84 × 84.
CIFAR-FS is proposed by Bertinetto et al.
(2018), which is created by dividing the original CIFAR-100 into 64 training classes, 16 validation classes and 20 testing classes; each image is of size 32 × 32.
Network architectures Following Gidaris & Komodakis (2018); Qiao et al.
; Gidaris et al.
(2019), we implement f by a 4-layer convolutional network (Conv-4-64 or Conv-4-128 4 ) or a
WideResNet (WRN-28-10) (Zagoruyko & Komodakis, 2016).
We pretrain the feature network f ( · ) on the 64 training classes for a stardard 64 -way classiﬁcation.
We reuse the feature averaging network proposed by Gidaris & Komodakis (2018) as our initialization network λ ( · ) , which basically averages the feature vectors of all data points from the same class and then scales each feature dimension differently by a learned coefﬁcient.
For the synthetic gradient network ξ ( · ) , we implement a three-layer MLP with hidden-layer size 8 k .
Finally, for the predictor ˆ y ij ( · , w i ) , we adopt the cosine-similarity based classiﬁer advocated by Chen et al.
and Gidaris & Komodakis (2018).
Evaluation metrics
In few-shot classiﬁcation, a task (aka episode) t consists of a query set d t and a support set d lt .
When we say the task t is k -way- n l -shot we mean that d lt is formed by ﬁrst sampling k classes from a pool of classes; then, for each sampled class, n l examples are drawn and a new
[Figure]
GToftask1SIBpredictionsGToftask2SIBpredictionsGToftask3SIBpredictions label taken from { 0 , . .
, k − 1 } is assigned to these examples.
By default, each query set contains 15 k examples.
The goal of this problem is to predict the labels of the query set, which are provided as ground truth during training.
The evaluation is the average classiﬁcation accuracy on the tasks created with testing classes.
Training details We run SGD with batch size 8 for 40000 steps, where the learning rate is ﬁxed to 10 − 3 .
During training, we freeze the feature network.
To select the best hyper-parameters, for each dataset, we sample 1000 tasks from the validation classes and reuse them at each training epoch.
We use these validation tasks to select the best meta-model and then use it for the ﬁnal evaluation on the tasks sampled from testing classes.
5.1. C OMPARISON TO STATE - OF - THE - ART META - LEARNING METHODS
In Table 1, we show a comparison between the state-of-the-art approaches and several variants of our method (varying K or f ( · ) ).
Apart from SIB, TPN (Liu et al., 2018) and CTM (Li et al., 2019) are also transductive methods.
First of all, comparing SIB ( K = 3 ) to SIB ( K = 0 ), we observe a clear improvement, which suggests that, by taking a few synthetic gradient steps, we do obtain a better variational posterior as promised.
For 1-shot learning, SIB (when K = 3 or K = 5 ) signiﬁcantly outperforms previous methods on both MiniImageNet and CIFAR-FS.
For 5-shot learning, the results are also comparable.
It should be noted that the performance boost is consistently observed with different feature networks, which suggests that SIB is a general method for few-shot learning.
However, we also observe a potential limitation of SIB: when the support set is relatively large, e.g., 5-shot, with a good feature network like WRN-28-10, the initialization θ 0 t may already be close to some local minimum, making the updates later less important.
For 5-shot learning, SIB is sligtly worse than CTM (Li et al., 2019) and/or Gidaris et al.
CMT (Li et al., 2019) can be seen as an alternative way to incorporate transduction – it measures the similarity between a query example and the support set while making use of intra- and inter-class relationships.
Gidaris et al.
(2019) uses in addition the self-supervision as an auxilary loss to learn a richer and more transferable feature model.
Both ideas are complementary to SIB.
We leave these extensions to our future work.
5. Z ERO - SHOT REGRESSION : SPINNING LINES
Since our variational posterior relies only on x t , SIB is also applicable to zero-shot problems (i.e., no support set available).
We ﬁrst look at a toy multi-task problem, where I ( w t ; d t ) is tractable.
Denote by D train := { d t } Nt =1 the train set, which consists of datasets of size n : d = { ( x i , y i ) } ni =1 .
We construct a dataset d by ﬁrstly sampling iid Gaussian random variables as inputs: x i ∼ N ( µ, σ 2 ) .
Then, we generate the weight for each dataset by calculating the mean of the inputs and shifting
[Table]
with a Gaussian random variable (cid:15) w : w = 1 n (cid:80) i x i + (cid:15) w , (cid:15) w ∼ N ( µ w , σ 2 w ) .
The output for x
i is y i =
w · x i .
We decide ahead of time the hyperparameters µ, σ, µ w , σ w for generating x i and y i .
Recall that a weighted sum of iid Gaussian random variables is still a Gaussian random variable.
Speciﬁcally, if w = (cid:80) i c i x i and x i ∼ N ( µ i , σ 2 i ) , then w ∼ N ( (cid:80)
i c i µ i , (cid:80) i c
2 i σ 2 i ) .
Therefore, we have p ( w ) =
N ( µ + µ w , 1 n σ 2 + σ 2 w ) .
On the other hand, if we are given a dataset d of size n , the only uncertainty about w comes from (cid:15) w , that is, we should consider x i as a constant given d .
Therefore, the posterior p ( w | d ) = N ( 1 n (cid:80) ni
=1 x i + µ w , σ 2 w ) .
We use a simple implementation for SIB:
the
variational posterior is realized
by
[Equation]
( θ Kt , σ w ) , θ
[Equation]
• (cid:96) t is a mean squared error, implies that p ( y | x, w ) =
N ( wx, 1) ; • p ψ ( w ) is a Gaussian distribution with parameters ψ ∈ R 2 ; • the synthetic gradient network ξ is a three-layer MLP with hidden size 8 .
In the experiment, we sample 240 tasks respectively for both D train and D test .
We learn SIB and
BNN on D train for 150 epochs using the ADAM optimizer (Kingma & Ba, 2014), with learning rate 10 − 3 and batch size 8 .
Other hyperparameters are speciﬁed as follows: n = 32 , K = 3 , µ = 0 , σ = 1 , µ w = 1 , σ w = 0 .
The results are shown in Figure 3.
On the left, both D KL ( q θ Kt ( w t ) (cid:107) p ( w t | d t )) and D KL ( p ψ ( w ) (cid:107) p ( w )) are close to zero indicating the success of the learning.
More interestingly, in the middle, we see that θ 0 t , θ 1 t , . .
. , θ 4 t evolves gradually towards the ground truth, which suggests that the synthetic gradient network is able to identify the descent direction after meta-learning.
5. Z ERO - SHOT CLASSIFICATION : UNSUPERVISED MULTI - SOURCE DOMAIN ADAPTATION
A more interesting zero-shot multi-task problem is unsupervised domain adaptation.
We consider the case where there exists multiple source domains and a unlabeled target domain.
In this case, we treat each minibatch as a task.
This makes sense because the difference in statistics between two minibatches are much larger than in the traditional supervised learning.
The experimental setup is similar to few-shot classiﬁcation described in Section 5.1, except that we do not have a support set and the class labels between two tasks are the same.
Hence, it is possible to explore the relationship between class labels and self-supervised labels to implement the initialization network λ without resorting to support set.
We reuse the same model implementation for SIB as described in Section 5.1.
The only difference is the initialization network.
Denote by z t := { z t,i } ni =1 the set of self-supervised labels of task t , the initialization network λ is implemented as follows:
[Equation]
(17) where λ 5 is a global initialization similar to the one used by MAML; L t is the self-supervised loss, ˆ z t is the set of predictions of the self-supervised labels.
One may argue that θ 0 t =
λ
would be a simpler solution.
However, it is insufﬁcient since the gap between two domains can be very large.
The initial solution yielded by (17) is more dynamic in the sense that θ 0 t is adapted taking into account the information from x t .
In terms of experiments, we test SIB on the PACS dataset (Li et al., 2017a), which has 7 object categories and 4 domains (Photo, Art Paintings, Cartoon and Sketches), and compare with stateof-the-art algorithms for unsupervised domain adaptation.
We follow the standard experimental setting (Carlucci et al., 2019), where the feature network is implemented by ResNet-18.
We assign a self-supervised label z t,i to image i by rotating the image by a predicted degree.
This idea was originally proposed by Gidaris et al.
(2018) for representation learning and adopted by Xu et al.
(2019) for domain adaptation.
The training is done by running ADAM for 60 epochs with learning rate 10 − 4 .
We take each domain in turns as the target domain.
The results are shown in Table 2.
It can be seen that SIB-Rot ( K = 3 ) improves upon the baseline SIB-Rot ( K = 0 ) for zero-shot classiﬁcation, which also outperforms state-of-the-art methods when the baseline is comparable.
C ONCLUSION
We have presented an empirical Bayesian framework for meta-learning.
To enable an efﬁcient variational inference, we followed the amortized inference paradigm, and proposed to use a transductive scheme for constructing the variational posterior.
To implement the transductive inference, we make use of two neural networks: a synthetic gradient network and an initialization network, which together enables a synthetic gradient descent on the unlabeled data to generate the parameters of the amortized variational posterior dynamically.
We have studied the theoretical properties of the proposed framework and shown that it yields performance boost on MiniImageNet and CIFAR-FS for few-shot classiﬁcation.
A PPENDIX A D ECOMPOSITION IMPLIED BY EMPIRICAL B AYES
In this section, we prove the statement in (10).
First of all,
[Equation]
Then, we only need to show
[Equation]
B P ROOF OF T HEOREM
Before going into details, we ﬁrst introduce a few notations, deﬁnitions, and a technical lemma.
• The entropy is deﬁned as H p ( x ) :
= E p ( x ) [ − log p ( x )] ; • The mutual information is given by I p ( x ; y ) :
= D KL (cid:0) p ( x , y ) (cid:107) p ( x ) p
( y ) (cid:1) .
• Very often, we decompose the mutual information as I p ( x ; y )
=
H p ( x ) − H p ( x | y ) with H p ( x | y ) :=
E p ( x , y ) [ − log p ( x | y )] the conditional entropy .
• The cross entropy is deﬁned as H p,q ( x ) :=
E
p ( x ) [ − log q ( x )] .
Similarly, we have the cross conditional entropy H p,q ( x | y ) :
= E p ( x , y ) [ − log q ( x | y )] and the cross mutual information
I p,q ( x ; y ) =
H p,q ( x ) − H p,q ( x | y ) .
Deﬁnition 1.
A random variable x is subgaussian if there exists a positive number σ such that E [exp( λ ( x − E x ))]
≤ exp( σ 2 λ 2 / 2) for all λ ∈ R .
Lemma 1 (Xu & Raginsky (2017)) .
If g( x , y ) is σ -subgaussian, then
[Equation]
Now, we are ready to prove Theorem 1.
Proof.
The expected KL divergence can be rewritten as follows:
[Equation]
p ( w ) (cid:1) − H q,p ( d ) (20) = I q ( w ; d ) − I q,p ( d ; w ) + D KL (cid:0) q ( w ) (cid:13)(cid:13) p ( w ) (cid:1) ≥ I q ( w ; d ) − I q,p ( d ; w ) = I q ( w ; d ) − I q,p ( w ; d ) .
Note that I q,p ( d ; w ) =
I q,p ( w ; d ) and D KL (cid:0) q ( w ) (cid:13)(cid:13) p ( w ) (cid:1) =
iff q ( w ) =
E q ( d ) q ( w | d ) =
p ( w ) .
Similarly, we have
E q ( d ) D KL (cid:16) q ( w | d ) (cid:107) p ( d | w ) p ( w ) (cid:17) ≥
I q ( w ; d ) + H q,p ( d | w ) .
by removing the term H q,p ( d ) .
Let us rewrite (20) as
[Equation]
23) which attains the right hand side of the second inequality.
Recall that L ( w, d ) :
= 1 n (cid:80) ni =1 (cid:96) t (ˆ y i
( f ( x i ) , w ) , y i ) .
If (cid:96) t (ˆ y i ( f ( x i ) , w ) , y i ) is σ -subgaussian for all w , then L ( w, d ) is σ/ √ n -subgaussian due to the iid assumption on d .
Thus, by Lemma 1, we have
[Equation]
On the other hand, H q,p ( d | w ) = ˆ R ( q ( w | d ) , q ( d )) .
Combining both, we have
[Equation]
as desired.
Recall that information bottleneck (IB) involves an optimization
[Equation]
Thus, we have established a connection between local empirical Bayes and information bottleneck.
The idea of IB is to view w as a compressed representation of d from a rate-distortion perspective :
• I q ( w ; d ) is known as rate , which is a regularization term discouraging memorization; • − I q,p ( w ; d ) =
H q,p ( d | w ) − H q,p ( d ) is naturally a measure of distortion since H q,p ( d | w ) is equal to the expected negative log-likelihood and H q,p ( d ) is a constant wrt q ( w | d ) .
Thus, solving (7) amounts to minimizing an upper bound of the IB objective if we generalize the posterior as follows:
[Equation]
[Equation]
C I MPORTANCE OF SYNTHETIC GRADIENTS
To further verify the effectiveness of the synthetic gradient descent, we implement an inductive version of SIB inspired by MAML, where the initialization θ 0 t is generated exactly the same way as
SIB using λ ( d lt ) , but it then follows the iterations in (6) as in MAML rather than follows the iterations in (9) as in standard SIB.
We conduct an experiment on CIFAR-FS using Conv-4-64 feature network.
The results are shown in
Table 3.
It can be seen that there is no improvement over SIB ( K = 0 ) suggesting that the inductive approach is insufﬁcient.
D V ARYING n
We notice that changing the size of d t (i.e., n ) during training does make a difference on testing.
[Table] [Table]