Match-LSTM
简介
Match-LSTM是由(Wang & Jiang,2016)发表在NAACL的论文提出,用于解决NLI(Natural Language Inference,文本蕴含)问题。
- premise:前提,代表上下文
- hypothesis:假设,代表一个陈述性的结论
文本蕴含问题:给定一个premise(前提),根据这个premise去判断相应的hypothesis(假说)正确与否,如果从这个premise中能够推断出这个hypothesis,那么就判断为entailment(蕴含),否则就是contradiction(矛盾)。
Word-by-Word Attention
Match-LSTM是在Rocktaschel et al. (2015)提出的word-by-word attention的基础上进行了改进,先解释一下Rocktaschel et al. (2015)提出的基本模型
用LSTM处理premise和hypothesis,(用premise的最后一个输出初始化hypothesis的LSTM),得到它们的隐层输出。
其中,
- hsj(1≤j≤M) h j s ( 1 ≤ j ≤ M ) 是premise的输入序列经过LSTM之后得到的隐层输出。
- htk(1≤k≤N) h k t ( 1 ≤ k ≤ N ) 是hypothesis的隐层输出向量。
word-by-word attention的意思是为每个hypothesis中的词引入一个 ak a k ,用于表示hypothesis,并称这个 ak a k 向量为attention向量,具体公式如下:
这里的attention权重 akj a k j 表示hypothesis中第k个词和premise中第j个词之间的关系。
hsj h j s 是premise的隐层输出, htk h k t 是hypothesis的隐层输出, hak−1 h k − 1 a 是将输入一个RNN之后得到的隐层状态。
最后利用 haN h N a 和 htN h N t 来预测label:
y
,即判断premise和hypothesis之间的关系。
模型
以下为结构图:
用两个LSTM处理premise和hypothesis序列。得到两个隐状态