Fast, Effective, and Self-Supervised: Transforming Masked Language Models into Universal Lexical and Sentence Encoders
GitHub
论文目的
没有经过特定任务微调的预训练MLMs对句子编码是无效的,本论文想基于自监督将MLMs在不引入新数据的前提下对句子编码。提出Mirror-BERT:简单、快速、有效,通过对字符串进行小的修改形成正样本进行微调,有些数据集上效果与sentence-bert可媲美
相关工作
sentence-bert和SapBERT都需要人工标注数据
Mirror-BERT没有任何标注数据, 仅依靠复制和简单的数据增强,在输入端和特征端做数据增强是Mirror-BERT成功的原因
Mirror-BERT: Methodology
Training Data through Self-Duplication
X
=
[
x
1
,
x
2
,
.
.
.
]
X = [x_1, x_2, . . .]
X=[x1,x2,...] 原始的数据集
Y
=
[
1
,
2
,
.
.
.
∣
X
∣
]
Y=[1,2,...|X|]
Y=[1,2,...∣X∣] 给每一个数据集一个单独的标签
D
=
[
(
x
1
,
y
1
)
,
(
x
2
,
y
2
)
]
D=[(x_1,y_1),(x_2,y_2)]
D=[(x1,y1),(x2,y2)] 数据集+标签
D
^
=
[
(
x
1
,
y
1
)
,
(
x
^
1
,
y
^
1
)
,
(
x
2
,
y
2
)
,
(
x
^
2
,
y
^
2
)
]
\hat D =[(x_1,y_1),(\hat x_1,\hat y_1),(x_2,y_2),(\hat x_2,\hat y_2)]
D^=[(x1,y1),(x^1,y^1),(x2,y2),(x^2,y^2)] 简单的重复一下形成新的数据集,其中
x
i
=
x
^
i
,
y
i
=
y
^
i
x_i=\hat x_i,y_i=\hat y_i
xi=x^i,yi=y^i,数据增强在下一节。
Data Augmentation
- parts of input text sequences (mask parts of the input text,单文本操作)
- to their representations ( erase (i.e., dropout) parts of their feature maps,正对都操作)
- doing both in combination(后面有实验)
Contrastive Learning
L b = − ∑ i = 1 D b log exp ( c o s ( f ( x i ) , f ( x ^ i ) ) / t ) ∑ j ∈ N ^ exp ( c o s ( f ( x i ) , f ( x ^ j ) ) / t ) L_b=-\sum_{i=1}^{D_b}\log \frac {\exp (cos(f(x_i),f(\hat x_i))/ t)}{\sum_{j\in \hat N} \exp (cos(f(x_i),f(\hat x_j))/ t)} Lb=−∑i=1Dblog∑j∈N^exp(cos(f(xi),f(x^j))/t)exp(cos(f(xi),f(x^i))/t)
Experimental Setup
- Evaluation Tasks: Lexical
Multi-SimLex evaluation set、NCBI-disease、BC5CDR-disease、BC5CDR-chemical、AskAPatient and COMETA - Evaluation Tasks: Sentence-Level
STS 2012-2016 datasets、STS-b、SICK-R、QNLI - Evaluation Tasks: Cross-Lingual
Results and Discussion
比较关注STS的结果,与SimCSE相比,平均结果没有SimCSE好,部分任务略优。
Mirror各个不同的任务中都用了10k的数据,我印象中SimCSE用的数据较多,经过查验:We randomly sample
1
0
6
10^6
106 sentences from English Wikipedia and fine-tune BERT base with learning rate = 3e-5, N = 64. In all our experiments, no STS training sets are used。但是看下图,Mirror-Bert 在10k-20k的时候大部分任务都能取到最好的结果
在STS任务上做的消融试验,span mask起的作用更大一些,但是两者一起用的时候效果最好。其中drophead method: it randomly prunes attention heads at MLM training as a regularisation step
Mirror-BERT Improves Isotropy?看样子是的
最后与SImCSE进行对比,SimCSE只使用dropout作为数据增强的方法,可以作为Mirror-bert的一种特例。。
阅读感官
从数据增强的角度看,SimCSE的确是它的一个特例,但是SimCSE将对比方法延伸到有监督和无监督两种,且效果的确比Mirror-Bert好,还是danqi女神的作品,如果只想读一篇,我更推荐看SimCSE。