ELMo全程为Embeddings from Language Models,顾名思义,它是基于语言模型的
为什么要提出ELMO?
有些单词具有一词多义的性质,而word2vec模型学出来的每个单词只有一个固定的词向量
ELMO比起之前词向量模型如word2vec的好处是能够动态地学出在上下文的词向量

lstm语言模型正向过程,当前单词之和它之前的单词有关

反向过程,当前单词只和它之后的单词有关

最大化目标函数

N指的是句子里的单词数目
得到每个单词有2L+1个表示,L指层数,2L因为是双向LSTM,层数论文用的是2层,x即图1中的E(2L+1里的1),对token编码,论文中用的是CNN对字符编码,最后一层bilstm输出接softmax预测当前词的下一个单词


预训练完成后,通过下列公式对每层表示做加权平均,当L为2时,s有3个参数(2层bilstm 和 第一层的x embedding),s根据下游任务调节学习得到


这个参数需要人为设置,根据不同任务设置不同的值(可调参)
参考资料:
网友评论