array(2) { ["docs"]=> array(10) { [0]=> array(10) { ["id"]=> string(3) "428" ["text"]=> string(77) "Visual Studio 2017 单独启动MSDN帮助(Microsoft Help Viewer)的方法" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(8) "DonetRen" ["tagsname"]=> string(55) "Visual Studio 2017|MSDN帮助|C#程序|.NET|Help Viewer" ["tagsid"]=> string(23) "[401,402,403,"300",404]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400964" ["_id"]=> string(3) "428" } [1]=> array(10) { ["id"]=> string(3) "427" ["text"]=> string(42) "npm -v;报错 cannot find module "wrapp"" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "zzty" ["tagsname"]=> string(50) "node.js|npm|cannot find module "wrapp“|node" ["tagsid"]=> string(19) "[398,"239",399,400]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400760" ["_id"]=> string(3) "427" } [2]=> array(10) { ["id"]=> string(3) "426" ["text"]=> string(54) "说说css中pt、px、em、rem都扮演了什么角色" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(12) "zhengqiaoyin" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511400640" ["_id"]=> string(3) "426" } [3]=> array(10) { ["id"]=> string(3) "425" ["text"]=> string(83) "深入学习JS执行--创建执行上下文(变量对象,作用域链,this)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "Ry-yuan" ["tagsname"]=> string(33) "Javascript|Javascript执行过程" ["tagsid"]=> string(13) "["169","191"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511399901" ["_id"]=> string(3) "425" } [4]=> array(10) { ["id"]=> string(3) "424" ["text"]=> string(30) "C# 排序技术研究与对比" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "vveiliang" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(8) ".Net Dev" ["catesid"]=> string(5) "[199]" ["createtime"]=> string(10) "1511399150" ["_id"]=> string(3) "424" } [5]=> array(10) { ["id"]=> string(3) "423" ["text"]=> string(72) "【算法】小白的算法笔记:快速排序算法的编码和优化" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(9) "penghuwan" ["tagsname"]=> string(6) "算法" ["tagsid"]=> string(7) "["344"]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511398109" ["_id"]=> string(3) "423" } [6]=> array(10) { ["id"]=> string(3) "422" ["text"]=> string(64) "JavaScript数据可视化编程学习(二)Flotr2,雷达图" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "chengxs" ["tagsname"]=> string(28) "数据可视化|前端学习" ["tagsid"]=> string(9) "[396,397]" ["catesname"]=> string(18) "前端基本知识" ["catesid"]=> string(5) "[198]" ["createtime"]=> string(10) "1511397800" ["_id"]=> string(3) "422" } [7]=> array(10) { ["id"]=> string(3) "421" ["text"]=> string(36) "C#表达式目录树(Expression)" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(4) "wwym" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(4) ".NET" ["catesid"]=> string(7) "["119"]" ["createtime"]=> string(10) "1511397474" ["_id"]=> string(3) "421" } [8]=> array(10) { ["id"]=> string(3) "420" ["text"]=> string(47) "数据结构 队列_队列实例:事件处理" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(7) "idreamo" ["tagsname"]=> string(40) "C语言|数据结构|队列|事件处理" ["tagsid"]=> string(23) "["246","247","248",395]" ["catesname"]=> string(12) "数据结构" ["catesid"]=> string(7) "["133"]" ["createtime"]=> string(10) "1511397279" ["_id"]=> string(3) "420" } [9]=> array(10) { ["id"]=> string(3) "419" ["text"]=> string(47) "久等了,博客园官方Android客户端发布" ["intro"]=> string(288) "目录 ECharts 异步加载 ECharts 数据可视化在过去几年中取得了巨大进展。开发人员对可视化产品的期望不再是简单的图表创建工具,而是在交互、性能、数据处理等方面有更高的要求。 chart.setOption({ color: [ " ["username"]=> string(3) "cmt" ["tagsname"]=> string(0) "" ["tagsid"]=> string(2) "[]" ["catesname"]=> string(0) "" ["catesid"]=> string(2) "[]" ["createtime"]=> string(10) "1511396549" ["_id"]=> string(3) "419" } } ["count"]=> int(200) } 222 【论文笔记】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。

 

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;

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

 

创新的辅助的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. 模型

模型定义

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

 

(1)Input embedding layer

词嵌入是concatenate word embedding和character embedding。

Word embedding用预训练的GloVe词向量初始化,并且在训练期间固定,维度300维;Character embeddings是用卷积训练的固定长度的词向量,每个字符被表示成200维向量;最后拼接二者的输入得到500维的x:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension

。最后在这层表示上接一个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得到矩阵:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension,相似度计算方法:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension

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

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

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

 

(4)Model Encoder Layer

输入是:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension,a和b代表着attention矩阵的行。

 

(5)Output layer

Context里答案的起始位置的概率计算如下:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension

 

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

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

得到所有样本的目标函数的平均:【论文笔记】QANET:Combining Local Convolution With Global Self-attention for Reading Comprehension

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

 

3. data augmentation by backtranslation

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

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

 

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

该论文创新性地将基于翻译的数据扩充技术,应用于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’里可能的答案的起始位置。

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

 

其他的一些数据增强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

 

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

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

 

消融分析

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

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

看出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

 

 

 

相关文章: