注意力机制 人类的注意力机制 在深度学习中注意力机制的研究: 参考: [1] Recurrent Models of Visual Attention. NIPS 2014: 2204- 2212 [2] Neural machine translation by jointly learning to align and translate, ICLR 2015 [3] Show, Attend and Tell: Neural Image Caption Generation with Visual Attention,ICML 2015 [4] Attention is all you need,NIPS 2017 注意力机制在在神经机器翻译领域的应用
在深度学习中注意力机制的研究:
参考:
[1] Recurrent Models of Visual Attention. NIPS 2014: 2204- 2212
[2] Neural machine translation by jointly learning to align and translate, ICLR 2015
[3] Show, Attend and Tell: Neural Image Caption Generation with Visual Attention,ICML 2015
[4] Attention is all you need,NIPS 2017
注意力系数计算:
后一个公式中的 a(\cdot) 表示alignment mode,反映 i 位置的输入和 j 位置输出的匹配程度。
计算注意力系数的相似函数(alignment model)有以下几种:
参考文献:Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C]. Advances in Neural Information Processing Systems. 2017: 6000-6010.
注意力系数计算
Self-attention layer in “Attention is all you need”
现代计算机的一个巨大优势就是可以对信息进行存储。但 是,大多数机器学习模型缺少这种可以读取、写入的长期 记忆的内存结构。RNN、LSTM这样的神经网络原则上可以实现记忆存储, 但是,它们由隐藏状态和权重编码包含的记忆太小了,不能记忆足够信息。基于此,Facebook AI Research提出了一种用于问答任务的记忆网络,实现了记忆的存储。广义上讲,循环神经网络也是记忆网络的一种
Memory Networks. ICLR 2015
End-To-End Memory Networks. NIPS 2015: 2440-2448
Key-Value Memory Networks for Directly Reading Documents. EMNLP 2016: 1400-1409
Tracking the World State with Recurrent Entity Networks. ICLR 2017
结构示意图: I, G, O, R四个模块
参考:Weston, Jason, Sumit Chopra, and Antoine Bordes. "Memory networks." arXiv preprint arXiv:1410.3916 (2014).
Input vector:将输入 x (字符、单词、句子等不同的粒度)转成内部特征向量的表示 I(x)
Generalization:根据新的输入更新记忆单元中的memory slot m_i,\boldsymbol{m}_{\boldsymbol{i}}=G\left(\boldsymbol{m}_{\boldsymbol{i}}, \boldsymbol{I}(\boldsymbol{x}), \boldsymbol{m}\right), \forall i.
Output feature map:根据记忆单元和新的输入,输出特征 o = O(x', m)
Response:最后,解码输出特征 o,并给出对应的响应 r = R(o),R可以是一个RNN网络生成回答的句子,更简单的话可以计算相关分数,比如 W 是一个单词集合(dictionary)
单层和三层网络
参考:Sukhbaatar, Sainbayar, Arthur Szlam, Jason Weston, and Rob Fergus. "End-to-end memory networks." arXiv preprint arXiv:1503.08895(2015).
训练参数
损失函数:交叉熵
面向QA的Key-Value网络结构
2017年,Facebook AI Research提出了一种新的基于记忆网 络的循环实体网络,其使用固定长度的记忆单元来存储世 界上的实体,主要存储该实体相关的属性,且该记忆会随着输入内容实时更新
Google DeepMind也提出了多种记忆网络,如:Neural Turing Machines、Neural Random Access Machines以及使用像栈或(双端)队列结构的连续版本等
利用外部存储形式的机器学习方式已经成为机器学习领域中一个热点方向