天天看点

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

原文链接:https://arxiv.org/pdf/1607.04423.pdf

本片论文主要讲了Attention Model在完形填空类的阅读理解上的应用。(以下是我的个人理解,如有错误,欢迎指正)

使用数据集:

1、CNN/Daliy Mail新闻数据集,将一整篇新闻文档作为完形填空的文本(Document),然后将其新闻摘要中的一句话去掉一个词之后作为查询(Query),去掉的那个词作为答案(Answer)。

2、Children’s Book Test(CBTest)儿童读物数据集:前面连续的20句话作为Document,第21句话作为Query,去掉的一个词为Answer。

Attention-over-Attention Model

(1) 首先,数据集可以表示为三元组的形式<D, Q, A>

(2)Contextual Embedding

将document 和 query中的每个单词表示成one-hot的形式,然后引入一个共享的embedding矩阵We (个人认为也可以使用word2vec词向量初始化,在后续的过程中参与神经网络的训练)

使用双向RNN(GRU)表示文本的embedding,具体公式如下图所示:

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

其中document 和query的文本embedding维度分别为

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

,其中|D|. |Q|分别表示document和query的长度

(2)权值矩阵

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

其中M(i,j)为document的第I个单词向量和query的第j个单词向量的点乘

(3)column-wise softmax

可以认为是query-to-document 的attention

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

(4)row-wise softmax

认为document-to-query的attention

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

(5)融合

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

(6)预测

Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用
Attention-over-Attention Neural Network for Reading Comprehension----神经网络在阅读理解上的应用

Attention-over-Attention Model

N-best Re-ranking Strategy 

在选择答案的过程中可以选择几个候选答案,然后通过打分比较

打分标准:

1、全局n-gram 语言模型:使用全部训练集为document打分

2、局部n-gram语言模型:使用验证集为document打分

3、word-class 语言模型:word class 可以通过聚类获得,使用全部训练集为document打分

继续阅读