笔记:Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification


Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification

作者:Tianyu Gao et al., AAAI 2019.

目录

  • Introduction
  • Methodology
  • Experiments
  • Conclusion

1 Introduction

正如paper题目,Hybrid--混合,本文主要在Prototypical Networks(Jake Snell et al., NIPS 2017\(^{[2]}\))的基础之上,将DS(distant supervision)任务的噪声问题放到few-shot任务中,使用类似DS任务常用的:sentence-level、word-level的attention方法,处理噪声问题,做Few-Shot的RC任务。

前置few-shot基本概念见参考[6]。

2 Methodology

一图以蔽之,如下图Figure 1 (a),清晰明了。主要分三个步骤,instance encoder(句子编码器)、Feature-level attention、Instance-level attention,最后得到d类似Prototypical Networks中的欧氏距离--衡量query set中的instance与经过support set训练得到的每个类别的prototype vector之间的距离(相似度)--之后对\(d = d_1,...,d_N\)做softmax后预测类别(直接取softmax后概率最大的)。

2.1 Instance Encoder

Zeng et al., 2014 \(^{[3]}\)/ Zeng et al.,2015\(^{[4]}\)的CNN/PCNN句子编码器,没什么好说的。

2.2 Feature-level Attention

如上图Figure 1 (b),就是对support set中的随机选取的每个类别的所有instance做多层卷积处理得到最终的\(z\)。不就类似attention based muti-instance RE么,support set中每个类别的所有句子,就是一个小型bag,所谓feature-level attention就是类似sentence-level attention(Lin et al.,2016\(^{[5]}\))中对整个bag的句子attention最终得到句子表示--bag_rep,相当于把所有句子揉合成了一个句子表示,思路都是差不多的感觉,只不过用的结构不一样罢了,CNN直接卷积不同于sentence-level attention,可能就像作者说的会更关注计算空间距离时那种很有区分性的特征(每个句子embedding 的维度)吧。

考虑到原Prototypical Networks中用的简单的欧氏距离不足以处理由于few-shot的support set数据很少所带来的特征稀疏的问题以及具体对比较具有区分性的特征关注不足的问题,本文作者设计了新的距离的计算如下公式Eq (11)。如图Figure 1 (a),z是feature-level attention Figure 1 (b)所得到的,\(s_1,s_2\)就是经过instance-level attetion得到的原型\(c\)和query set中的instance,两者做差之后element-wise取平方,再乘\(z\)内积得到最终的相似度--距离。

2.3 Instance-level Attention

原Prototypical Networks中每个类别的原型vector的获取就是简单的对support set中每个类别的所有instance取个平均,得到每个类别的原型,如下公式Eq (7),\(i\)为relation类别,\(j\)为每个类别中第\(j\)个句子。

作者采用了新的attention的方式获取原型,作者原因有两点(对比original 方法):首先对于每个类别原型的获取,若是有一个instance的表示(即\(x_i^j\))偏离很多就会很大程度影响整体,因为平均即给所有句子分配的权重都一致。其次,原始的方法只根据support set中的instances,并没有看过query set中的instance(这里还都是training set所以看query应该是可以的,query感觉就有点像验证作用),所以普通的模型提取的特征对query set中instance的分类可能帮助有限。具体如下Eq (9) Eq (10)以及Figure 1 (a)。

其中,\(c_i\)为第i类relation,\(\mathbf{x_i^j}\)为第i类关系在support set中所对应的第j个instance,\(\mathbf{x}\)为query ,\(\alpha_j\)为权重,\(k\)为类别,\(g(\cdot)\)为线性层。\(\bigodot\)是element-wise product相乘,\(\sigma{(\cdot)}\)是激活函数,\(sum{\{\cdot\}}\)表示对vector里的所有元素求和,正如Figure 1所描述的一样。

3 Experiments

没细看,感兴趣可以看看原文。

4 Conclusion

本文除了距离计算有点创新改进之外,其它的就是把DS噪声问题引入到few-shot任务了,且噪声确实对少样本的情况影响更大,模型整体的组合还是可以值得参考参考的。

参考

[1] Tianyu Gao,? Xu Han,? Zhiyuan Liu,? Maosong Sun.Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification.AAAI 2019.

[2] Jake Snell.Kevin Swersky.Richard Zemel.Prototypical Networks for Few-shot Learning.NIPS 2017.

[3] Daojian Zeng, Kang Liu, Siwei Lai, Guangyou Zhou and Jun Zhao.Relation Classification via Convolutional Deep Neural Network.COLING 2014.

[4] Daojian Zeng, Kang Liu, Yubo Chen and Jun Zhao.Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks.EMNLP 2015.

[5] Yankai Lin, Shiqi Shen, Zhiyuan Liu, Huanbo Luan, Maosong Sun.Neural Relation Extraction with Selective Attention over Instances.ACL 2016.

[6] 羽_羊.小样本学习(few-shot learning)之——原形网络(Prototypical Networks).CSDN 2018.https://blog.csdn.net/m0_38031488/article/details/85274890.

[7] Matt_sh.论文笔记:Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification.CSDN 2020.06.https://blog.csdn.net/Matt_sh/article/details/106986467.