【论文阅读】【元学习/小样本学习】【NeurIPS2018】TADAM: Task dependent adaptive metric for improved few-shot learning
Metric Scaling
作者提出了metric scaling来提高小样本算法的性能。Prototypical Networks的文章中指出Euclidean distance效果要好于cosine distance,原因可能是因为cosine distance不是Bregman divergence(due to cosine distance not being a Bregman divergence)。本文作者认为是由于softmax中度量尺度不同(We hypothesize that the improvement could be directly attributed to the interaction of the different scaling of the metrics with the softmax)。
作者通过一个可学习的参数(temperature?)
α
\alpha
α 来放缩(scale) distance metric。从而,
概率:
一个task中k类别的query set中样本产生的loss function:
total loss:
参数
α
\alpha
α有什么用呢?
Lemma 1说明了:
- 当 α \alpha α取值较小时,(3)式的第一项缩小了query set样本的embedding与样本所对应类别原型之间的距离(增大了相似度);第二项增大了样本与其他类别原型之间的距离(减小了相似度);
- 当
α
\alpha
α取值较大时,(4)式的第一项缩小了query set样本的embedding与样本所对应类别原型之间的距离(增大了相似度);第二项仅仅增大了样本与他最近(相似度最高)类别原型之间的距离(减小了相似度)。如果该样本最近的类别原型就是该样本对应的类别,则该样本对梯度的贡献为0(第一项和第二项抵消)。较大的
α
\alpha
α值更直接地解决了分类误差,但是产生了一个问题:随着参数不断优化,分类准确度不断提高,分类错误的样本不断减少(意味着更多样本产生0梯度),训练过程对于模型效果的提升能力也越来越弱。之后作者证明了存在一个最优的
α
\alpha
α能够平衡这一关系。
Task conditioning
Up until now we assumed the feature extractor fφ(·) to be task-independent. A dynamic task- conditioned feature extractor should be better suited for finding correct associations between given sample set class representations and query samples。作者定义了一个动态的feature extractor
f
ϕ
(
x
,
Γ
)
f_\phi(x,Γ)
fϕ(x,Γ),
Γ
Γ
Γ由task representation通过TEN得到。
task representation:
task representation 作为TNE网络的输入,得到
γ
,
β
\gamma, \beta
γ,β,feature extrator中的每一个卷积层变为(
h
l
+
1
=
γ
⨀
h
l
+
β
h_{l+1}=\gamma \bigodot h_l + \beta
hl+1=γ⨀hl+β)。(predict layer-level element-wise scale and shift vectors γ, β for each convolutional layer in the feature extractor)
TEN网络:
β
=
β
0
g
θ
(
c
‾
)
\beta=\beta_{0} g_{\theta}(\overline{c})
β=β0gθ(c),
γ
=
γ
0
h
φ
(
c
‾
)
\gamma=\gamma_{0} h_{\varphi}(\overline{c})
γ=γ0hφ(c)
添加了TEN网络之后的feature extrator中Convolutional block和Resnet block结构:
总体结构:
Auxiliary task co-training
作者发现引入TEN结构给网络增加了额外的复杂度,使得网络训练变得困难。因此作者提出了利用辅助任务进行合作训练的方法,其实就是在原网络的基础上增加一个64类的分类器,然后在训练过程中会随机的从64类的miniImageNet数据集中抽取样本,用于训练该分类器。这与预训练的方式略有不同,两个训练过程共用一个特征提取网络,一起进行合作训练,且从辅助任务数据集中抽取样本的概率会随着训练次数的增加而呈指数下降( 0. 9 ⌊ 20 t / T ⌋ 0.9^{\lfloor20t/T\rfloor} 0.9⌊20t/T⌋)。这就接近于课程学习(curriculum learning)的概念,一开始训练时会引入较多的简单分类任务,引导特征提取网络训练;随着训练次数不断增加,网络的能力也在不断增强,以此逐渐降低简单任务所占的比重,而增加真正需要学习的任务(小样本分类)比重。