阅读笔记:Learning to Remember Rare Events

Learning to Remember Rare Events

Contribution

  • NMT难以记住在train set上的rare word,导致很多包括one-shot在内的场景表现不好,本文提出一个memory module可以用在NMT和CV中多种领域和模型上,作为主题模型的附加模块,提高表现

    Our module remembers training examples shown many thousands of steps in the past and it can successfully generalize from them

  • Memory module细节

    1. Memory module由key-value对组成,Keys are activations of a chosen layer of a neural
      network, and values are the ground-truth targets for the given example

    2. 由于memory can be traced back to training examples,所以提供了模型做决策的可解释性

    3. Memory module组成

      a matrix K K K of memory keys, a vector V V V of memory values, and an addi-
      tional vector A A A that tracks the age of items stored in memory

      假设memory values are single integers representing a class or token ID

      query 向量的维度与一个key vector一致,normalized之后通过计算dot product最大值来求出top-K个nearest neighbor,并且返回相应的 V [ n 1 : k ] V[n_{1:k}] V[n1:k]

    4. Memory loss

      在训练阶段,memory收到一个query q q q时也相应知道ground truth value v v v.

      let p be the smallest index such that $V [n_p ] $= v and b the smallest index such that $V [n_b ] $ ≠ \ne = v.
      在这里插入图片描述

    5. Memory Update

    6. Memory Module 用于Seq2Seq

      encoder不改变,decoder部分在每个time step使用通过attention mechanism得到的context vector作为query来对Memory Module进行检索==(注意,在Search Engine Guided Neural Machine Translation文章里讲过contect vector可以被认为是最好表示要预测词 y ‘ y‘ y的向量)==,最终将embedded memory output和decoder最后一个LSTM使用线性层叠加后即可进行预测下一个token。
      在这里插入图片描述
      在这里插入图片描述

      图中,灰色线条属于最后一个time step的计算流程,黑色线条为第一个time step的计算。以第一个时间步为例,attention机制通过使用来自decoder 第一个的hidden state与encoder output进行query得到context vector,进而送入Memory进行检索,检索得到的value与最后一个LSTM的输出拼接起来经过一个linear layer最终预测得到 y 1 ^ \hat{y_1} y1^

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值