論文「Semi-supervised sequence modeling with cross-view training」是Google Quoc V.Le組的一個工作,提出了一種半監督的方法來提升sequence modeling的性能。 (本文涉及的「知識點」較多,多個sequence modeling 的task,多個經典的以及state-of-the-art的半監督方法,比如self-training, consistency regularization等,還有multi-view learning, multi-task learning, 文章最後附錄甚至還在image的task上對所提方法進行了評估分析,沉甸甸的工作量啊!)

首先,在當下NLP+Deep Learning背景下,處理大多數NLP問題的常規路徑是,先用unsupervised的方法(word2vec, ELMo)來學習一個embedding,然後基於這個embedding,再用supervised的方法來針對不同的問題建模。作者認為(motivation),該路徑之所以有效,是因為unsupervised部分利用了大量unlabeled data,而後面supervised的部分,卻僅使用了labeled data,所以限制了model的泛化能力。因此,作者提出了一種Cross-View Training(CVT)的半監督方法。

對於Sequence modeling task,Encoder-Decoder是一個通用的框架。Encoder部分,作者採用的是一個two-layer CNN-BiLSTM結構(即,先採用Char-CNN對character embedding抽取出char repersentation,再將其與word embedding相拼接作為two-layer BiLSTM的輸入(論文中寫的求和?)),encoder的輸出是 h_1=[underbrace{overrightarrow{h_1^1} oplus overleftarrow{h_1^1}}_{h_1^1}, ldots, underbrace{overrightarrow{h_1^T} oplus overleftarrow{h_1^T}}_{h_1^T}]\ h_2=[underbrace{overrightarrow{h_2^1} oplus overleftarrow{h_2^1}}_{h_2^1}, ldots, underbrace{overrightarrow{h_2^T} oplus overleftarrow{h_2^T}}_{h_2^T}]

其中, overrightarrow{h_1^i} 表示第一層BiLSTM中forward direction的第 i 個hidden state,相應的 overleftarrow{h_1^i} 表示backward direction的hidden state。Decoder部分需依據任務的不同而單獨設計。而CVT就主要在Decoder端體現。通過對傳入Decoder的feature representation進行不同方式的限制來構造多個view的效果。然後,以不受限Decoder的輸出與每個受限Decoder的輸出的差異度量作為監督信號,進行端到端的訓練。期望受限Decoder即使在feature representation信息不充分的情況下,也能輸出較好的結果,同時,由於整個model的Encoder部分是共享的,在降低該部分loss的時候,也就相應的促使Encoder抽取出更好的feature representation以及提高不受限Decoder的判別能力。 另外,由於這裡的監督信號不需要label信息的參與,所以,可以利用大量unlabeled data來對model進行有效泛化。

關於CVT的思想,文章在introduction部分詳述了演化過程:首先,如何利用unlabel data呢,作者想到self-training,但是self-training有tautological的問題,即在labeled data上train好的model,先給unlabel data預測一個pseudo-label,並將其加入到label dataset中re-train model。有可能預測的pseudo-label就是錯的,再訓練反而對錯誤的信號更confident了。因此,作者想到Deep semi-supervised中的consistency regularization方法(在input加擾動 or 利用NN的隨機特性),但是對於NLP問題,不太好給離散的input加擾動。於是,作者從multi-view learning中找到靈感,巧妙的構造了多個view來利用unlabel data。

文章中以named entity recognition為例,展示了CVT的整體思想。

整個model的loss function與常見半監督方法一樣,包含監督部分和無監督部分, mathcal{L}=mathcal{L}_{sup}+mathcal{L}_{CVT}

mathcal{L}_{sup}(	heta) = frac{1}{|D_l|} sum_{x_i, y_iin D_l} CE(y_i, p_	heta (y|x_i))

mathcal{L}_{CVT}(	heta) = frac{1}{|D_{ul}|} sum_{x_iin D_{ul}}sum_{j=1}^k D(p_	heta(y|x_i), p_	heta^j (y|x_i))

其中k表示view的個數,即上圖Auxiliary module的個數。

下面針對不同的Sequence modeling task來看看Decoder部分的設計。

sequence tagging

sequence tagging是針對tagging問題的總稱,作者在實驗部分做了5種tagging的實驗:combinatory categorical grammar supertagging, text chunking, named entity recognition, fine-grained recognition, part-of-speech tagging。

不受限Decoder(上圖中primary prediction module)是一個含有一層隱藏層的神經網路: p(y^t|x_i)=NN(h_1^t oplus h_2^t) = 	ext{softmax}(Ucdot 	ext{ReLU}(W(h_1^toplus h_2^t))+b)

受限Decoders網路結構與上面一致,只是輸入不同(即,對輸入的feature representation的限制程度不同),這裡作者只用了第一層BiLSTM的hidden state: p_	heta^{	ext{fwd}}(y^t|x_i) = NN^{	ext{fwd}}(overrightarrow{h_1^t}(x_i))\ p_	heta^{	ext{bwd}}(y^t|x_i) = NN^{	ext{bwd}}(overleftarrow{h_1^t}(x_i))\ p_	heta^{	ext{future}}(y^t|x_i) = NN^{	ext{future}}(overrightarrow{h_1^{t-1}}(x_i))\ p_	heta^{	ext{past}}(y^t|x_i) = NN^{	ext{past}}(overleftarrow{h_1^{t+1}}(x_i))

dependency parsing

對於dependency parsing問題,通過構建有向圖,作為分類問題來求解。以句子里的一個單詞x_i^t 為節點,關係 r 為邊,構成(u, t, r)對,即單詞x_i^u 以關係 r 指向單詞x_i^t 。問題的目標是找到單詞x_i^t 的入向邊(關係)及對應的節點(單詞)。

不受限Decoder:

p_	heta((u, t, r)|x_i) propto e^{s(h_1^u(x_i)oplus h_2^u(x_i), h_1^t(x_i)oplus h_2^t(x_i), r)}

s(z_1, z_2, r) = ReLU(W_{head}z_1+b_{head})(W_r+W)ReLU(W_{dep}z_2+b_{dep})

受限Decoders:

p_	heta^{	ext{fwd-fwd}}((u,t,r)|x_i) propto e^{s^{	ext{fwd-fwd}}(overrightarrow{h_1^u}(x_i), overrightarrow{h_1^t}(x_i), r)}\ p_	heta^{	ext{fwd-bwd}}((u,t,r)|x_i) propto e^{s^{	ext{fwd-bwd}}(overrightarrow{h_1^u}(x_i), overleftarrow{h_1^t}(x_i), r)}\ p_	heta^{	ext{bwd-fwd}}((u,t,r)|x_i) propto e^{s^{	ext{bwd-fwd}}(overleftarrow{h_1^u}(x_i), overrightarrow{h_1^t}(x_i), r)}\ p_	heta^{	ext{bwd-bwd}}((u,t,r)|x_i) propto e^{s^{	ext{bwd-bwd}}(overleftarrow{h_1^u}(x_i), overleftarrow{h_1^t}(x_i), r)}

sequence-to-sequence learning

該問題具體任務是機器翻譯,作者採用了帶有attention機制的seq2seq model。這裡不受限Decoder的結構是一個使用了bilinear attention機制的LSTM網路。具體的來說,attention機制就是改變了encoder將學到的feature representation傳入到decoder的方式。這裡使用的是encoder全局的hidden state的加權求和。其中權重(attention distribution)公式為 alpha_j propto e^{h^j W_alpha overline{h}^t} ,h^j 表示encoder的第j個hidden state,overline{h}^t 表示decoder的當前hidden state。然後,加權的feature representation(context vector): c_t = sum_j alpha_j h^j ,接著,attention vector: a_t = 	anh(W_a[c_t, overline{h}^t]) ,最後,使用softmax layer來得到下一個翻譯輸出的分布p(y_i^t|y_i^{<t}, x_i)=	ext{softmax}(W_s a_t)

對於受限decoder,作者設計了兩種,一種是對attention wights作dropout,這樣encoder部分的feature representation就不會全部傳入到decoder部分。另一種類似於sequence tagging的做法,期望通過上個時刻的attention vector來作預測:p_	heta^{	ext{future}}(y_i^t|y_i^{<t}, x_i)=	ext{softmax}(W_s^{	ext{future}} a_{t-1}^{	ext{future}})

實驗

實驗部分,作者在7個sequence task上與3種半監督方法(word dropout, VAT, ELMo)進行了對比。其中,word dropout有點類似CVT,只是只在對input words進行dropout,相當於只附加了一個view。作者做了較多的實驗來驗證CVT方法的有效性,這裡僅貼兩個有意思的結果。

一個是所有測試集上結果的匯總。

對比之後,可以發現CVT的效果與其他3種的結果差不太多!!!orz,難道是木有使用調參大法orNLP任務的特殊性?hahaha~ anyway,作者主要將CVT與ELMo進行了對比,在達到comparable的結果的同時,CVT model的參數數量更小~並且在後續實驗中也表明,model更大能夠取得更好的泛化能力。

另一個實驗是通過NER這個task來很好的說明了半監督的必要性。

對於句子「...statement by Warner Bros.」(華納兄弟),在training set中,短語"Warner Bros."僅出現了一次,且在句尾,根據前面介詞"by",model通常會判斷"Warner Bros."為一個人名。那麼,對於監督學習來說,訓練步數再大,model可能都不會改變自己的判斷。但是,對於半監督來說,由於unlabel的語料裡面,「Warner Bros.」會大量的出現在句子的不同位置,隨著訓練步數的增加,model逐漸學到,這個名詞是一個組織機構名。haha, interesting!

一些見解

  1. 首先這是一個將半監督方法很好的與具體應用相結合的成功的栗子。在多個NLP的任務場景下,巧妙的構造多個附加的view(其實,對view的構造也挺有可模仿性),從而對unlabel data進行有效訓練。
  2. 其次,從半監督方法的角度來說,CVT從self-training出發,很好的融合了consistency regularization和multi-view learning的思想,值得借鑒。另外,論文也與不少state-of-the-art的半監督方法進行了比較,比如VAT,MeanTeacher。對於VAT,在NLP任務上,性能差不多,但是在image任務上,效果要優於CVT,可見adversarial noise對model的泛化之能力。而對於Mean Teacher,作者表明在NLP任務上效果不佳。但是,將EMA的思想用在test time時可以提升performance。原因有待考究。
  3. 最後,文章在附錄的最後,列出了實驗過程中的一些Negative results,值得提倡效仿!

推薦閱讀:

相关文章