1. 程式人生 > >關於用深度學習做answer selection的論文

關於用深度學習做answer selection的論文

最近做question-answering系統,看了幾篇相關的論文,涉及到用CNN、LSTM、RNN、Attention等演算法,這裡做個記錄。
1 Attention-Based Convolutional Neural Network for Modeling Sentence Pairs (IBM)
提出了四種基於CNN的模型,用餘弦相似度來表示兩個句子的相似性。
文章採取了w-average-pooling,所以不需要對長短不一的句子補齊,假設兩個句子的長度分別是5、7,embedding size是300,filter size是 3
a) CNN without attention模型
一層CNN模型如下
s0 input words embedding (5×300) –> wide convolution(7×300) –> w-average-pooling (5×300) –>
s1 input words embedding (7×300) –> wide convolution(9×300) –> w-average-pooling (7×300)
由於卷積之後,特徵向量的維度不變,因此可以將多層這樣的CNN堆疊。最後一層用all-average-pooling,得到句子特徵向量,計算它們的cosine 相似度。
b) ABCNN-1 with attention
input embeddings convolution後得到representation feature map,計算兩個句子的每兩個字之間關聯程度,得到5*7的attention matrix,關聯程度用Euclidean distance(|x-y|))的變式1/(1+|x-y|)。接著,W0*AT和W1*A分別得到兩個句子的attention feature map,W0 、W1是要學習的引數。將representation feature map和attention feature map作為convolution input,卷積。
c) ABCNN-2 with attention
convolution之後,pooling之前,convolution feature map的維度分別是7*300和9*300,計算每個feature的關聯程度(1/(1+|x-y|)),得到attention matrix(7*9),將attention matrix的各行元素、列元素相加,得到長度為7、9的兩個向量。對convolution feature map做average pooling時,各個feature乘以相應的關聯度係數(softmax)。
d) ABCNN-3 with attention
該模型是ABCNN-1和ABCNN-2的混合。

實驗結果證明,帶CNN的模型比沒有卷積神經網路的baseline模型效果好,加入attention後,CNN模型表現變好,ABCNN-3 with attention具有最高的精度。

實際上,實驗計算了每個CNN層句子特徵向量相似度,假設有k層(k blocks),將k層的餘弦相似度做logic regression或者linear SVM。
實驗發現,用1/(1+|x-y|)來表徵相似度能達到更好的區域性最優值。|x-y|是Euclidean distance。

2 LSTM-Based Deep Learning Models for Non-factoid Answer Selection(IBM)


a) QA-LSTM模型。對question和answer分別進行bi-LSTM建模,得到representation feature map,然後mean/max pooling,得到sentence vector,再計算cosine相似度。
b) QA-LSTM/CNN模型。對question和answer分別進行bi-LSTM建模,得到representation feature map,然後分別做convolution、max-k pooling,得到representation feature map。再計算餘弦相似度。
c) QA-LSTM with attention模型。對輸入進行bi-LSTM建模,得到representation feature map。對answer進行pooling之前,先進行attention matrix操作。
實驗結果表示,QA-LSTM with attention模型的效果最好。
3 Applying Deep Learning to Answer Seleciton (IBM)

對比了幾種CNN模型,發現用CNN的模型比baseline模型表現明顯變好。同時,對question和answer 共用同一個網路的模型比分別對問題、答案建模的模型表現好,這是因為增加問題、答案之間的約束能提升模型表現。
4 Attensive Pooling Networks (IBM)
文章告訴你如何在問題、答案的CNN representation中用attention,* 2 way attention的方法*, 2 way attention 是指question、answer之間相互attention。有的情況下,只有答案對問題的attention,叫做one way attention。假設問題、答案的長度為M、L。
question、answering embedding,經過CNN或者biLSTM之後,分別得到feature map Q(c*M)、A(c*L),c是filter number。這裡做convolution之前,對於問題或答案中的一個字,它以這個字為中心,將它與附近的k個詞向量拼接組成新的問題(答案)矩陣,這裡的k其實相當於filter的寬度,之後卷積filter的size是1×kd,d是embedding size。G矩陣計算如下: G=tanh(QTUA),U是待學習的引數矩陣,維度是(c*c),G矩陣維度是(M*L),表示問題、答案(k size context)的對齊soft alignment。對G的行max-pooling,得到長度為M的向量,第j個元素表示答案對問題的第j個字的重要程度,對G的列進行max-pooling,得到長度為L的向量,同樣的,第j個元素表示問題對答案的第j個字的重要程度。對這兩個向量softmax,得到的向量的第j個元素表示答案句子對問題中該字的影響。Q、A分別點乘各自的attention vector。此時,Q、A的維度不變,即Q(c*M)、A(c*L)。對Q、A都進行column-wise max pooling, Q、A變成長度為c的vector,計算cosine值,表徵問題答案的相似度。
5 Learning Natural Language Inference using Bidirectional LSTM model and Inner-Attention
6 Answer Sequence Learning with Neural Networks for Answer Selection in CQA

some brain-storms:
小孩要一字一字的讀文章,隨著經驗的增長,在一定程度內,句子缺字或逆序都不會影響他的閱讀
缺字(CNN),逆序(LSTM)