Attention model 注意力模型

1. Encoder:Bi-RNN

在这里插入图片描述
x(1:T): input sequence with the length of T
a(1:T):hidden state/ activation value/ history vector, 表示当前与之前的信息存储
a(0), a(end): 起始/终止符的a
a‘(1:T):在这里插入图片描述concatenate 正向&逆向的history vector -->a(t) and <–a(t)。

2. Decoder:

在这里插入图片描述
s:为与a区别,标记为s
y^(1:T): output sequence

”?“ 所标示的input输入十分关键,决定output y(t)所能pay attention to下面Bi-RNN的哪些部分。For each y(t), we have:
在这里插入图片描述
在这里插入图片描述
**关键问题:**怎么得到每个y(t)的attention weight = alpha(t, t’) i.e. the attention amount that y(t) pay to each a’(t)?
在这里插入图片描述
每个y(t)的attention weight (i.e. alpha(t, t’))和什么有关?
和之前的y的hidden state s有关,即s(t-1);和encoder学到的与之对应(time step相同)的hidden state a‘有关,即a’(t).

Hence, 训练一个神经网络,which takes s(t-1) and a’(t) as inputs,and outputs e(t, t’), and alpha(t, t’) = softmax(e(t, t’)), with the length of the sequence length T (对应着对sequence 1:T中每个word的注意力权重,求和 = 1,这是我们使用softmax的原因). 不同论文提出了不同的神经网络设计方式,让注意力更好的集中,输出更好的结果。

reference:

[1] https://www.bilibili.com/video/BV1cb411W7w9
[2] 4F10 notes: Deep Learning for Sequence Data

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值