论文地址:
https://arxiv.org/abs/2003.10555arrow-up-right
参考资料:
https://zhuanlan.zhihu.com/p/89763176arrow-up-right
https://www.zhihu.com/question/354070608arrow-up-right
ELECTRA引入了一种新的预训练方式。
步骤如下:
首先由Generator和Discriminator,Generator通常为一个MLM,Discriminator为ELECTRA
Generator:给定一段文本X0∈Rn×d\mathbf X_0\in \mathbb R^{n\times d}X0∈Rn×d,首先mask掉一部分内容得到X1∈Rn×d\mathbf X_1\in \mathbb R^{n\times d}X1∈Rn×d,喂给MLM得到输出X2∈Rn×m\mathbf X_2\in \mathbb R^{n\times m}X2∈Rn×m,mmm为词表大小,根据X2\mathbf X_2X2对被mask掉的部分进行采样,然后和未被mask掉的部分拼接得到X3∈Rn×d\mathbf X_3\in \mathbb R^{n\times d}X3∈Rn×d,然后输出给Discriminator;
Discriminator:给定X3∈Rn×d\mathbf X_3\in \mathbb R^{n\times d}X3∈Rn×d,得到输出X4∈Rn×2\mathbf X_4\in \mathbb R^{n\times 2}X4∈Rn×2,然后判断被mask掉的部分是否和原来相同;
因为是预一种训练方式,所以不考虑这点。
本身就是一种预训练方式,主要修改了loss:
https://github.com/lucidrains/electra-pytorcharrow-up-right
https://github.com/lucidrains/electra-pytorch/blob/master/electra_pytorch/electra_pytorch.pyarrow-up-right
和GAN很像,但还是有所不同:
loss不一样,这一点比较直观;
Discriminator的梯度无法传给Generator;
文章比较早,但是由于入行晚,最近才注意到,感觉后续可以复现一下。
Last updated 3 years ago