【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension

目录

 

1. 简要介绍

2. 模型

3. data augmentation by backtranslation

4. 实验


​​​​​​​

1. 简要介绍

模型创新点:

(一)移除了RNN,核心就是卷积 + self-attention。这样使得训练更快,相应地模型能使用更多的训练数据。Convolution capture the local structure of context(local interactions), self-attention models global interactions。两者相辅相成,不可替代。

(二)使用了辅助的数据增强技术来提高训练数据,数据来自MT模型的back-translation。

 

扫描二维码关注公众号,回复: 9940404 查看本文章

QANet首先达到又快又精确,并且首先把self-attention和convolution结合起来。

QANet结构广泛使用convolutions和self-attentions作为encoders的building blocks,然后分别encode query和context,然后使用standard attentions学习到context和question之间的interactions,结果的representation再次被encode,然后最后decode出起始位置的probability。

 

组件分析

  1. convolution: local structure
  2. self-attention:global interaction
  3. additional context-query attention:

  它是standard module,从而建立query-aware context vector

 

QANet结构

主要包括5个组件:input embedding layer,a embedding encoder layer, context-query attention layer, a model encoder layer, an output layer.

与其他MRC模型不同的是:所有embedding和model encoders只使用conv和sefl-attention;

 

创新的辅助的data augmentation技术:从原始英文翻译为法语后,再翻译回英语,这样不仅提高了训练实例的数量,更提高了措辞多样化。英语翻译为法语后,通过beam decoder,生成k句法语翻译,然后法语翻译再通过beam decoder变回英语就获得了k^2句paraphrases。

 

QANet实验成果

数据增强技术能提高F1 score从曾经最好的81.4到QANet的84.6。

相比于使用RNN的模型,训练速度13x speedup,每次training iteration 9x加速,这种加速使得模型可以在大规模数据集上应用。

 

2. 模型

模型定义

 

(1)Input embedding layer

词嵌入是concatenate word embedding和character embedding。

Word embedding用预训练的GloVe词向量初始化,并且在训练期间固定,维度300维;Character embeddings是用卷积训练的固定长度的词向量,每个字符被表示成200维向量;最后拼接二者的输入得到500维的x:

。最后在这层表示上接一个2层的highway network。

 

(2)Embedding encoder layer

encoder layer是堆叠的基本块,块内结构:[convolution-layer × # + self-attention-layer + feed-forward-layer]。块内的这些每个operations(conv/s-a/ffn)都放在residual block里,并且每个残差块里的输出都是:x+f(layernorm(x)),

卷积使用depthwise separable convolutions;

Self-attention-layer使用多头注意机制,heads is 8;

输入是500维,输出128维。

 

(3)Context-Query Attention Layer

这个组件很常用,C和Q代表着编码的context和question,

 

首先计算context和question每个词对的相似度,得到的相似矩阵row normalize得到矩阵:,相似度计算方法:

然后context-to-query attention如下计算:

另外,有些组件使用的是query-to-context,比如BiDAF和DCN。

 

(4)Model Encoder Layer

输入是:,a和b代表着attention矩阵的行。

 

(5)Output layer

Context里答案的起始位置的概率计算如下:

 

W1W2可训练变量;M0,M1,M2各自是3个encoders的输出。

Span score是其起始位置概率的乘积。

得到所有样本的目标函数的平均:

其中y1iy2i是样本i真实的起始位置。

 

3. data augmentation by backtranslation

简单的数据扩充技术!paraphrase的质量和多样性很重要!

论文作者相信这样的数据扩充技术可以应用于其他监督的自然语言处理任务

 

该论文创新性地将基于翻译的数据扩充技术,应用于QA。

 

扩充数据以后,要处理documents和answers,生成new triples of (d’, q, a’),d’来自document paraphrasing,最开始有k^2个paraphrases,a’来自answer extraction。

在生成a’的过程中,使用characterl-level 2-gram scores来计算s’的每个单词和a的起始字母的分数,从而找到s’里可能的答案的起始位置。

 

其他的一些数据增强tricks

文本分类上,用单词的同义词代替单词;

Type swap,但是这样数据多样性不够;

生成更多问题来提高diversity,但是这种方法不能提高performance;

此论文的方法可以提供更多句法多样性;

 

4. 实验

数据预处理:NLTK tokenizer,The maximum context length is set to 400, dynamically pad the short sentences with special symbol <PAD>, use the pretrained 300-D word vectors GLoVe, all the out-of-vocabulary words are replace with <UNK>;

训练细节:a learning rate warm-up scheme

 

和不同模型的实验结果对比:

 

消融分析

在验证集上自身组件的对比:

看出convolution in encoders很重要。

 

鲁棒性研究

2种误导性的句子:AddSent和AddOneSent。Addsent生成类似问题的句子,但是与正确答案不矛盾;AddOneSent添加随机人类改善的句子,和context可以无关。

由于模型有用到data augmentation,所以有一定鲁棒性。

 

在TriviaQA上的表现

见下图。由于TriviaQA比SQuAD的context更长、噪声更多。并且由于它有Multi-paragraph特性,因此作者提到了一些hierachical or multi-step reading tricks,比如首先预测读取哪个paragraph,然后应用比如BiDAF的模型在那个paragraph里pinpoint answers。

作者还相信QANet还可以应用于其他multi-paragraph阅读模型。

 

 

涉及到的要进一步理解的概念

Layer-normalization(2016)

element-wise multiplication

stochastic depth method

 

 

 

发布了63 篇原创文章 · 获赞 13 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/changreal/article/details/103349145
今日推荐