机器阅读理解(MRC)必看论文 - RNET

本文详细探讨了RNET在机器阅读理解中的应用,包括数据集SQuAD、模型结构、Question和Passage编码、Question-Passage匹配、Passage Self-Matching以及Answer Prediction。RNET利用RNN结构和注意力机制,对问题和段落进行编码和匹配,预测问题的答案。
摘要由CSDN通过智能技术生成

原创:张春阳

数据集

  • SQuAD
  • QA

原始论文

r-net.pdf

  • 论文中只介绍了原理和方法,并没有给出代码
  • 找到的代码为第三方复现
  • 需要注意,本篇中的 passage 就是之前我们说过的 context

任务样本

从原文中找到一个连续的 sub-span

Passage: Tesla later approached Morgan to ask for more funds to build a more powerful transmitter. When asked where all the money had gone, Tesla responded by saying that he was affected by the Panic of 1901, which he (Morgan) had caused. Morgan was shocked by the reminder of his part in the stock market crash and by Tesla’s breach of contract by asking for more funds. Tesla wrote another plea to Morgan, but it was also fruitless. Morgan still owed Tesla money on the original agreement, and Tesla had been facing foreclosure even before construction of the tower began.

Question: On what did Tesla blame for the loss of the initial money?

Answer: Panic of 1901

模型概览

  • 对 question 和 passage 进行编码
  • 获取与 question 相关的 passage 表达
  • 在 passage 上应用 self-matching attention 去获得最终的表达
  • 从 passage 中预测出 question 的 answer
  • 这里使用了很多 RNN 的结构,训练采用 E2E 的方式

步骤1: Question and Passage Encoder

注意该步骤包含两个部分

  • embedding
  • text encoding

Embedding

每一个 word 被表示为两个向量的 concat,

  • 一个向量是 GloVe 向量, e t Q e^Q_t etQ (Question) 和 e t P e^P_t etP (Passage),当某些 word 在 GloVe 中是缺失的状态时(OOV),我们会把它的向量都设置成 0。
  • 另一个是一个 character level 的向量, c t Q c^Q_t ctQ (Questi)和 c t P c^P_t ctP (Passage)。

为了获取这个 character level 的向量,我们可以在 Embedding 后增加一个 bi-GRU 层。然后每一个 character 都被 embed 成一个 H H H dimensional 的向量。

  • N N N 为 Passage 的长度
  • M M M 为 Question 的长度
  • C C C 为 25,表示26 个英文字母的编码长度
  • H H H 等于 75,代表 embedding 的维度

How does mask_zero in Keras Embedding layer work?

Encoding

下面的符号是在原始论文中的一些符号表达

  • u Q u^Q uQ 表示 question 的向量
  • u P u^P uP 表示 passage 的向量

神经网络会继续使用 u Q u^Q u

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值