趙彧然,薛儻,劉功申
基于詞序擾動的神經機器翻譯模型魯棒性研究
趙彧然,薛儻,劉功申
(上海交通大學網絡空間安全學院,上海 200240)
預訓練語言模型是自然語言處理領域一類十分重要的模型,預訓練?微調成為許多下游任務的標準范式。先前的研究表明,將BERT等預訓練語言模型融合至神經機器翻譯模型能改善其性能。但目前仍不清楚這部分性能提升的來源是更強的語義建模能力還是句法建模能力。此外,預訓練語言模型的知識是否以及如何影響神經機器翻譯模型的魯棒性仍不得而知。為此,使用探針方法對兩類神經翻譯模型編碼器的句法建模能力進行測試,發(fā)現(xiàn)融合預訓模型的翻譯模型能夠更好地建模句子的詞序。在此基礎上,提出了基于詞序擾動的攻擊方法,檢驗神經機器翻譯模型的魯棒性。多個語言對上的測試結果表明,即使受到詞序擾動攻擊,融合BERT的神經機器翻譯模型的表現(xiàn)基本上優(yōu)于傳統(tǒng)的神經機器翻譯模型,證明預訓練模型能夠提升翻譯模型的魯棒性。但在英語?德語翻譯任務中,融合預訓練模型的翻譯模型生成的譯文質量反而更差,表明英語BERT將損害翻譯模型的魯棒性。進一步分析顯示,融合英語BERT的翻譯模型難以應對句子受到詞序擾動攻擊前后的語義差距,導致模型出現(xiàn)更多錯誤的復制行為以及低頻詞翻譯錯誤。因此,預訓練并不總能為下游任務帶來提高,研究者應該根據任務特性考慮是否使用預訓練模型。
神經機器翻譯;預訓練模型;魯棒性;詞序
將預訓練語言模型(PLM,pre-trained language model),如BERT[1]等,融入神經機器翻譯模型中是自然語言處理領域十分熱門的研究方向[2-5]。融合之后,機器翻譯模型能夠利用PLM學習到豐富語義和句法知識[6-15],進而提升翻譯模型的魯棒性和翻譯效果[16]。但之前的研究更關注改進模型的效果,忽略了對這些提升的來源進行解釋,并且缺乏預訓練語言模型如何影響翻譯模型魯棒性的考量。
本文首先檢驗了BERT能否改進機器翻譯模型的句法能力。使用一些探針對傳統(tǒng)的神經機器翻譯模型Transformer[17](記作NMT模型)的編碼器和融合了BERT的Transformer模型(記作BERT-NMT模型)的編碼器進行測試[10,18],檢驗它們分別編碼了哪些句法相關的信息。實驗結果表明,融合BERT后,機器翻譯模型編碼器在詞序建模以及重建依存句法樹相關任務上的表現(xiàn)更好。為了驗證這些提升確實是由BERT帶來的,實驗過程中使用掩碼操作分別遮掩了自注意力模塊和BERT-編碼器(BERT-Enc,BERT-encoder)注意力模塊。結果證明,BERT的確能夠幫助提高翻譯模型對詞序進行建模的能力,特別是顯著提高模型在雙詞調換(BShift,bi-gram shift)任務上的表現(xiàn)。
直覺上來講,這種特性能夠幫助機器翻譯模型更好地處理源語言句子中的詞序擾動攻擊。為了檢驗這一猜想,本文提出了一種以概率交換兩個相鄰詞以改變詞序的攻擊方法,并使用雙語替換評測[19](BLEU,bilingual evaluation understudy)和BERTScore[20]對攻擊后模型的翻譯結果進行評價。在機器翻譯工坊(WMT,workshop on machine translation)提供的多個語言翻譯任務上進行實驗表明,雖然詞序擾動的概率不同,BERT-NMT模型生成的譯文質量幾乎優(yōu)于NMT模型生成的譯文,但在英德翻譯任務中,隨著擾動概率的增加,使用英文BERT反而會給模型生成的譯文質量帶來消極影響,說明英文BERT將破壞翻譯模型的魯棒性。
為了找到使用英文BERT訓練得到的BERT-NMT模型翻譯質量下降的原因,比較攻擊前后源語言端和目標語言端句子的語義變化。使用WMT14英德數據集分別訓練得到英德翻譯模型和德英翻譯模型并進行對比。對比發(fā)現(xiàn),英語句子在受到攻擊之后語義變化更為明顯,這可能是德語具有比英語更為靈活的詞序。而源語言端和目標語言端的語義差別則說明:英語BERT難以縮小詞序擾動攻擊前后源語言端的語義變化。為了細致了解翻譯質量下降的具體表現(xiàn),對比NMT模型和BERT-NMT模型分別受到攻擊之后輸出的譯文。隨著攻擊時擾動概率的增加,BERT-NMT模型傾向于錯誤地從源語言端直接復制單詞作為譯文。此外,對比兩個模型在翻譯低頻詞時的正確率。統(tǒng)計結果表明,當擾動概率增加時,BERT-NMT模型翻譯低頻詞的效果甚至不如普通的NMT模型??梢婎A訓練并不總能為下游任務帶來性能上的提升,在使用過程中應該更為小心。
神經機器翻譯與預訓練的交叉領域主要包含以下兩條研究線路:①將PLM融合至神經機器翻譯模型;②預訓練跨語言的語言模型。
1.1.1 將PLM融合至神經機器翻譯模型
在BERT[1]被提出之后,出現(xiàn)了許多將BERT融入機器翻譯模型的簡單嘗試,包括使用PLM的輸出替代機器翻譯模型的嵌入層[21],以及使用PLM的參數對NMT模型的編碼器進行初始化[22]。Zhu等[2]設計了BERT-Enc和BERT-解碼器(BERT-Dec,BERT-decoder)注意力模塊,并且混合了不同模塊輸出的表示。類似地,APT框架使用基于層的注意力機制對BERT的各層輸出進行動態(tài)混合[13]。Guo 等[23]使用兩個BERT分別作為編碼器和解碼器,在BERT不同層之間添加適配器,以同時利用編碼器端和解碼器端BERT包含的信息。Guo 等[24]進一步提出凍結BERT參數并添加適配器的方法來加速機器翻譯模型的訓練過程。Shavarani等[15]提出更加充分地利用BERT包含的語言學信息,而非簡單地將其作為詞嵌入的替代品。Xu 等[25]使用145 GB德語文本訓練了一個特制的雙語語言模型BiBERT,來提高模型的翻譯效果。
1.1.2 跨語言的語言模型預訓練
由于BERT在訓練過程中僅使用單語語料,并不適合執(zhí)行機器翻譯任務,Conneau等[26]設計了一個新的翻譯語言模型(TLM,translation language model)任務,并使用雙語平行語料訓練得到XLM模型。此外,以BERT為代表的單語語言模型往往僅包含編碼器,與翻譯模型常采用的編碼器?解碼器架構并不匹配,為此,Song 等[27]提出預訓練一個序列到序列架構的模型MASS。此后,Liu 等[28]設計了更為復雜的預訓練任務,并使用25種語言訓練得到mBART,使得在翻譯任務上進行微調成為可能。Lin 等[29]使用隨機對齊替換任務訓練了一個普適性更強的多語言翻譯模型mRASP。Pan等[30]在mRASP的基礎上引入對比學習和基于對齊的數據增強以提高模型效果。Li等[31]的研究表明,對序列到序列模型進行預訓練的過程中使用雙向解碼器能顯著提高模型的翻譯效果。
盡管相比先前的統(tǒng)計機器翻譯模型,神經機器翻譯模型生成的譯文質量有了顯著提高,但其仍存在一些不足之處。Belinkov等[32]發(fā)現(xiàn)基于字符的神經機器翻譯模型的翻譯效果很容易受到文本中噪聲的影響。Cheng 等[33]指出同義詞替換同樣能夠降低神經機器翻譯模型的翻譯效果。為了檢驗神經機器翻譯模型的魯棒性,之前的研究還嘗試在輸入中加入筆誤,對輸入中的字符或單詞執(zhí)行交換、重復以及刪除操作,并對模型的相應輸出進行評價[34~35]。
為了提高NMT模型的魯棒性,主流的方法為基于對抗學習[32],即使用人工添加噪聲的數據訓練NMT模型。Sato 等[36]提出向輸入添加使得損失增大最多的噪聲以增強模型的魯棒性。Cheng 等[37]設計了一個基于梯度的方法來生成對抗樣本。此外,Sennrich 等[38]以及Michel和Neubig[39]說明使用子詞表示句子能夠幫助機器翻譯模型更好地處理擾動。Cheng 等[33]提出了一個新的訓練目標,最大化原始輸入和擾動過的樣本之間的相似性。UniDrop[40]在特征、結構和數據3 個維度使用丟棄法來提高機器翻譯模型的效果。此外,Cheng等[41]將有監(jiān)督訓練和自監(jiān)督訓練相結合來提高神經機器翻譯模型應對代碼轉換類型干擾的魯棒性。
本文使用融合BERT的神經機器翻譯模型來探究BERT為神經機器翻譯模型帶來了哪些影響。之前的研究表明,BERT能夠提高文本分類模型的魯棒性[16]。但BERT是否會影響神經機器翻譯模型的魯棒性還不得而知,這是本文要探究的問題。
本節(jié)通過實驗來分析BERT如何影響神經機器翻譯模型的建模能力,具體來說,使用5種不同的探針任務來檢測NMT模型的編碼器和BERT-NMT模型的編碼器中分別編碼了哪些句法相關的信息。
2.1.1 探針任務
本文實驗共使用以下5種探針任務。Distance任務中探針需要依據任意兩個單詞的向量表示預測它們在依存句法樹中之間的距離。Depth任務則需要探針根據每個單詞的向量表示預測其在依存句法樹中的深度,即單詞和根節(jié)點之間的距離。BShift任務則需要探針根據句子的向量表示判斷句中是否存在兩個相鄰單詞的位置被調換了。TreeDepth任務要求探針預測句子的短語結構樹的最大深度。TopConst任務要求探針對句子的短語結構樹最頂層類型進行分類。表1提供了每種句法探針任務的示例。
表1 句法探針任務的示例
探針B的訓練目標為
訓練目標為
2.1.2 數據
對于Distance和Depth任務,使用STS 12-16[42-46]的數據,并且使用開源工具Stanza[47]生成每個句子對應的依存句法樹以計算單詞之間的距離和每個單詞的深度。對全部數據按照7:2:1劃分為訓練集、驗證集和測試集,分別包含36 000、10 000、5 000條句子。
對于其他探針任務,使用SentEval[48]提供的數據集。每個任務的訓練集包含100 000條句子,驗證集和測試集的大小均為10 000。
使用WMT14英德數據集訓練神經機器翻譯模型。在訓練之前,首先使用40 000次合并操作的字節(jié)對編碼[38](BPE,byte-pair encoding)算法對句子進行編碼。驗證集為newstest2013,測試集為newstest2014。
2.1.3 模型
用于生成單詞表示的基礎模型包括BERT、NMT編碼器以及BERT-NMT編碼器。
NMT模型的整體架構如圖1所示,包含編碼器和解碼器。其中,編碼器主要包含自注意力和前饋網絡模塊,解碼器則包括掩碼自注意力、交叉注意力以及前饋網絡3個模塊。每個模塊之后都會進行殘差連接和層標準化操作。
圖1 NMT模型的整體結構
Figure 1 The whole structure of the NMT model
對于BERT,使用HuggingFace[49]提供的bert-base-uncased模型作為基準。NMT模型和BERT-NMT模型的實現(xiàn)與訓練均基于Fairseq[50],其中BERT-NMT模型在訓練時同樣采用bert-base-uncased作為BERT模塊。
對于每個基礎模型,使用其最后一層的輸出作為單詞的表示,并且使用單詞表示的均值作為句子的嵌入。
此外,為了能夠了解自注意力模塊和BERT-Enc模塊的作用,使用控制變量法,在訓練結束后生成單詞表示時分別對兩者進行掩碼操作,這樣最終得到的向量表示僅由一部分模塊計算得到。對自注意力模塊進行掩碼操作如圖2(b)所示,對BERT-Enc模塊進行掩碼操作圖2(c)所示。
2.1.4 訓練設置
圖2 BERT-fused編碼器結構和掩碼操作示意
Figure 2 Overview of the structure of BERT-fused encoder and masking methods
2.1.5 翻譯模型結果
句法相關的探針任務實驗結果如表2所示,在BERT的幫助下,BERT-NMT編碼器在Distance、Depth、BShift、TreeDepth、TopConst任務上都獲得了比NMT編碼器更高的準確率。
表2 句法相關的探針任務實驗結果
即使相鄰的兩個單詞位置調換,BERT也能夠識別出句子的語義信息,這種特性可以幫助神經機器翻譯模型更好地應對源語言句子中的擾動。本節(jié)探究BERT是否能夠提升機器翻譯模型的魯棒性。
3.1.1 攻擊方法
為了探究BERT能否提高機器翻譯模型的魯棒性,本節(jié)仿照BShift任務設計了一種擾亂詞序的攻擊方法。簡單來說,打亂翻譯任務測試集中句子的原有詞序,并以一定概率交換兩個相鄰單詞,之后以擾動后的句子作為輸入,評估模型翻譯出的譯文效果。表3展示了使用攻擊方法按照不同概率生成的樣例。值得注意的是,句首第一個單詞和結尾標點的位置在攻擊時不會被改變。
表3 使用攻擊方法按照不同概率生成的樣例
攻擊之后,分別觀察NMT和BERT-NMT模型輸出的翻譯結果。如果BERT能夠提高機器翻譯模型的魯棒性,那么BERT-NMT的譯文分數(BLEUScore或BERTScore)將會更高。反之,如果BERT-NMT模型的分數更低,則說明BERT可能對機器翻譯模型的魯棒性有負面影響。
3.1.2 數據
為了囊括盡可能多的語言,本文選擇了5種來自不同語系的語言對,包括WMT14德語?英語數據集(De-En,包括4 500 000條平行語料)、WMT14英語?德語數據集(En-De)、WMT17芬蘭語?英語數據集(Fi-En,包括2 600 000條平行語料)、WMT17土耳其語?英語數據集(Tr-En,包括207 000條平行語料)以及WMT17中文?英語數據集(Zh-En,包括20 800 000條平行語料)。對于WMT14 英德數據集,借助Moses提供的腳本進行分詞,之后使用40 000次BPE合并操作進行編碼,并生成一個共享字典。對于WMT17 Fi-En和Tr-En,使用WMT17官方提供的預處理后的版本,同樣使用源語言和目標語言的共享字典。至于WMT17 Zh-En數據集,首先使用jieba對中文文本進行分詞處理,之后對中文和英文數據集分別使用32 000次BPE合并操作構建字典。
對于WMT14數據集,使用newstest2013作為驗證集,newstest2014作為測試集。WMT17的翻譯任務在newstest2016上進行驗證,在newstest2017上進行評測。
表4 NMT和BERT-NMT在相應測試集上的BLEUScore和BERTScore
3.1.3 模型
本節(jié)使用的NMT模型和BERT-NMT模型的架構與超參數與2.1節(jié)中介紹的相同。
3.1.4 評價指標
3.2.1 BLEUScore和BERTScore的變化
3.2.2 源語言端和目標語言端語義的變化
為了找出融合英文BERT后,BERT-NMT模型翻譯質量下降這一現(xiàn)象背后的原因,比較源語言端句子和目標語言端譯文的語義變化。
圖3 BERT-NMT和NMT在BLEUScore和BERTScore上的差值
Figure 3 Plots of differences between BERT-NMT and NMT in terms of BLEUScore and BERTScore
源語言和目標語言端語義變化如圖4所示,En-De在源語言端的語義變化明顯大于De-En中源語言端的語義變化,說明不同語言對于詞序擾動具有不同的反應。對于英語文本來說,受到干擾之后句子的語義發(fā)生了一定改變,而德語的句子仍保留了原始的意義。一種可能的解釋是德語的語法允許較為靈活的詞序。
圖4 源語言和目標語言端語義變化
Figure 4 Changes of semantics in the source side and target side
但是在En-De任務中,NMT和BERT-NMT模型在目標語言端上的變化趨勢和源語言端并不相同。而它們在De-En任務中的變化趨勢和源語言端的變化更為類似。這說明在En-De任務中,不論NMT還是BERT-NMT模型,都沒能很好地應對攻擊帶來的變化。
3.2.3 源語言端和目標語言端語義的差值
圖5 源語言和目標語言端間的語義差值
Figure 5 Semantic difference between the source side and target side
3.3.1 復制行為
為了更加細致地了解翻譯質量下降的表現(xiàn),本文比較了NMT模型和BERT-NMT模型在輸入未受擾動和受擾動情況下生成的譯文。當輸入分別為未受攻擊的句子和擾動后的句子時NMT和BERT-NMT生成的翻譯樣例如表5所示,當源語言句子未被攻擊時,BERT-NMT模型能夠產生高質量的翻譯。但當輸入受到擾動后,BERT-NMT模型傾向于簡單地直接從源語言句子中復制單詞。而NMT模型仍能生成較為合理的譯文。統(tǒng)計結果顯示,BERT-NMT模型從源語言端錯誤地復制了48個句子,而NMT模型僅復制了33個句子。這一對比結果說明,隨著攻擊概率的增加,融合BERT將會放大神經機器翻譯模型由于數據不確定性引發(fā)的復制錯誤[5,53]。
3.3.2 低頻詞翻譯不足
考慮到翻譯低頻詞時往往需要依賴上下文信息,而前文提出的攻擊方式會破壞上下文信息,因此En-De任務中BERT-NMT模型翻譯效果下降的一個可能解釋是模型難以很好地處理低頻詞的翻譯。compare-mt[54]能夠用于評價單詞級別的翻譯表現(xiàn)。根據單詞在訓練集中出現(xiàn)的頻率將其劃分為3類:低頻詞(小于10)、中頻詞(10到100)和高頻詞(大于100)。對于每一類,compare-mt報告預測結果相對真實結果的1值。Tr-En和En-De中不同頻率單詞NMT和BERT-NMT的翻譯1值如表6和表7所示。不論詞頻和攻擊概率如何變化,使用Tr-En數據集訓練得到的BERT-NMT模型的1值始終高于NMT模型。
表5 當輸入分別為未受攻擊的句子和擾動后的句子時NMT和BERT-NMT生成的翻譯樣例
表6 Tr-En中不同頻率單詞NMT和BERT-NMT的翻譯F1值
表7 En-De中不同頻率單詞NMT和BERT-NMT的翻譯F1值
本文說明了BERT能夠提高神經機器翻譯模型句法相關的能力,特別是對詞序進行建模的能力;設計了一種基于詞序擾動的攻擊方法,來檢測翻譯模型的魯棒性。在多種不同語言對上的實驗結果表明,融合英語BERT會給神經機器翻譯模型的翻譯質量帶來消極影響。英語BERT無法縮小原始句子和受擾動句子之間的語義差別。進一步分析顯示,BERT導致了更多翻譯時的復制行為,以及低頻詞翻譯不足的后果。因此,研究者應該根據下游任務和具體情境決定是否使用預訓練語言模型。未來,將繼續(xù)探究跨語言預訓練方法對神經機器翻譯模型語義、句法能力以及魯棒性的影響。
[1] DEVLIN J, CHANG M W, LEE K, et al. BERT: pre-training of deep bidirectional transformers for language understanding[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2019: 4171-4186.
[2] ZHU J, XIA Y, WU L, et al. Incorporating BERT into neural machine translation[C]// 8th International Conference on Learning Representations. 2020: 1-16.
[3] BAZIOTIS C, HADDOW B, BIRCH A. Language model prior for low-resource neural machine translation[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). 2020: 7622-7634.
[4] AN T, SONG J, LIU W. Incorporating pre-trained model into neural machine translation[C]//2021 4th International Conference on Artificial Intelligence and Big Data (ICAIBD). 2021: 212-216.
[5] LIU X, WANG L, WONG D F, et al. On the complementarity between pre-training and back-translation for neural machine translation[C]//Findings of the Association for Computational Linguistics: EMNLP 2021. 2021: 2900-2907.
[6] PETERS M E, NEUMANN M, ZETTLEMOYER L, et al. Dissecting contextual word embeddings: architecture and representation[C]//Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. 2018: 1499-1509.
[7] JAWAHAR G, SAGOT B, SEDDAH D. What does BERT learn about the structure of language[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 2019: 3651-3657.
[8] TENNEY I, DAS D, PAVLICK E. BERT rediscovers the classical NLP pipeline[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 2019: 4593-4601.
[9] TENNEY I, XIA P, CHEN B, et al. What do you learn from context? Probing for sentence structure in contextualized word representations[C]//7th International Conference on Learning Representations. 2019: 1-17.
[10] HEWITT J, MANNING C D. A structural probe for finding syntax in word representations[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2019: 4129-4138.
[11] GOLDBERG Y. Assessing BERT's syntactic abilities[J]. arXiv preprint arXiv:1901.05287, 2019.
[12] SUNDARARAMAN D, SUBRAMANIAN V, WANG G, et al. Syntax-infused transformer and bert models for machine translation and natural language understanding[J]. arXiv preprint arXiv:1911.06156, 2019.
[13] WENG R, YU H, HUANG S, et al. Acquiring knowledge from pre-trained model to neural machine translation[C]//Proceedings of the AAAI Conference on Artificial Intelligence. 2020: 9266-9273.
[14] YANG J, WANG M, ZHOU H, et al. Towards making the most of bert in neural machine translation[C]//Proceedings of the AAAI Conference on Artificial Intelligence. 2020: 9378-9385.
[15] SHAVARANI H S, SARKAR A. Better neural machine translation by extracting linguistic information from BERT[C]//Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics. 2021: 2772-2783.
[16] HAUSER J, MENG Z, PASCUAL D, et al. BERT is robust! a case against synonym-based adversarial examples in text classification[J]. arXiv preprint arXiv: 2109.07403, 2021.
[17] VASWANI A, SHAZEER N, PARMAR N, et al. Attention is all you need[C]//Proceedings of the 31st International Conference on Neural Information Processing Systems. 2017: 6000-6010.
[18] CONNEAU A, KRUSZEWSKI G, LAMPLE G, et al. What you can cram into a single $ &!#* vector: probing sentence embeddings for linguistic properties[C]//Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). 2018: 2126-2136.
[19] PAPINENI K, ROUKOS S, WARD T, et al. Bleu: a method for automatic evaluation of machine translation[C]//Proceedings of the 40th annual Meeting of the Association for Computational Linguistics. 2002: 311-318.
[20] ZHANG T, KISHORE V, WU F, et al. BERTScore: evaluating text generation with BERT[C]//8th International Conference on Learning Representations. 2020: 1-43.
[21] CLINCHANT S, JUNG K W, NIKOULINA V. On the use of BERT for neural machine translation[C]//Proceedings of the 3rd Workshop on Neural Generation and Translation. 2019: 108-117.
[22] ROTHE S, NARAYAN S, SEVERYN A. Leveraging pre-trained checkpoints for sequence generation tasks[J]. Transactions of the Association for Computational Linguistics, 2020, 8: 264-280.
[23] GUO J, ZHANG Z, XU L, et al. Incorporating bert into parallel sequence decoding with adapters[J]. Advances in Neural Information Processing Systems. 2020, 33: 10843-10854.
[24] GUO J, ZHANG Z, XU L, et al. Adaptive adapters: an efficient way to incorporate BERT into neural machine translation[J]. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2021, 29: 1740-1751.
[25] XU H, VAN DURME B, MURRAY K. BERT, mBERT, or BiBERT? a study on Contextualized Embeddings for Neural Machine Translation[C]//Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing. 2021: 6663-6675.
[26] CONNEAU A, LAMPLE G. Cross-lingual language model pretraining[C]//Proceedings of the 33rd International Conference on Neural Information Processing Systems. 2019: 7059-7069.
[27] SONG K, TAN X, QIN T, et al. MASS: masked sequence to sequence pre-training for language generation[C]//International Conference on Machine Learning. 2019: 5926-5936.
[28] LIU Y, GU J, GOYAL N, et al. Multilingual denoising pre-training for neural machine translation[J]. Transactions of the Association for Computational Linguistics, 2020, 8: 726-742.
[29] LIN Z, PAN X, WANG M, et al. Pre-training multilingual neural machine translation by leveraging alignment information[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP). 2020: 2649-2663.
[30] PAN X, WANG M, WU L, et al. Contrastive learning for many-to-many multilingual neural machine translation[C]//Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing. 2021: 244-258.
[31] LI P, LI L, ZHANG M, et al. Universal conditional masked language pre-training for neural machine translation[C]//Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics. 2022: 6379-6391.
[32] BELINKOV Y, BISK Y. Synthetic and natural noise both break neural machine translation[C]//6th International Conference on Learning Representations. 2018: 1-13.
[33] CHENG Y, TU Z, MENG F, et al. Towards robust neural machine translation[C]//Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics. 2018: 1756-1766.
[34] VAIBHAV V, SINGH S, STEWART C, et al. Improving robustness of machine translation with synthetic noise[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2019: 1916-1920.
[35] MICHEL P, LI X, NEUBIG G, et al. On evaluation of adversarial perturbations for sequence-to-sequence models[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2019: 3103-3114.
[36] SATO M, SUZUKI J, KIYONO S. Effective adversarial regularization for neural machine translation[C]//Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 2019: 204-210.
[37] CHENG Y, JIANG L, MACHEREY W, et al. AdvAug: robust adversarial augmentation for neural machine translation[C]//Proceed- ings of the 58th Annual Meeting of the Association for Computational Linguistics. 2020: 5961-5970.
[38] SENNRICH R, HADDOW B, BIRCH A. Neural machine translation of rare words with subword units[C]//Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics. 2016: 1715-1725.
[39] MICHEL P, NEUBIG G. MTNT: a testbed for machine translation of noisy text[C]//Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing. 2018: 543-553.
[40] WU Z, WU L, MENG Q, et al. UniDrop: a simple yet effective technique to improve transformer without extra cost[C]//Proceed- ings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2021: 3865-3878.
[41] CHENG Y, WANG W, JIANG L, et al. Self-supervised and supervised joint training for resource-rich machine translation[C]//International Conference on Machine Learning. 2021: 1825-1835.
[42] AGIRRE E, CER D, DIAB M, et al. SemEval-2012 task 6: A pilot on semantic textual similarity[C]//Proceedings of the Main Conference and the Shared Task, and Volume 2: Proceedings of the Sixth International Workshop on Semantic Evaluation (SemEval 2012). 2012: 385-393.
[43] AGIRRE E, CER D, DIAB M, et al. * SEM 2013 shared task: semantic textual similarity[C]//Proceedings of the Main Conference and the shared task: Semantic Textual Similarity. 2013: 32-43.
[44] AGIRRE E, BANEA C, CARDIE C, et al. Multilingual semantic Textual Similarity[C]//Proceedings of the 8th International Workshop on Semantic Evaluation (SemEval 2014). 2014: 81-91.
[45] AGIRRE E, BANEA C, CARDIE C, et al. Semantic textual similarity, english, spanish and pilot on interpretability[C]//Proceedings of the 9th International Workshop on Semantic Evaluation (SemEval 2015). 2015: 252-263.
[46] AGIRRE E, BANEA C, CER D, et al. Semantic Textual Similarity, Monolingual and Cross-Lingual Evaluation[C]//Proceedings of the 10th International Workshop on Semantic Evaluation (SemEval-2016). 2016: 497-511.
[47] QI P, ZHANG Y, ZHANG Y, et al. Stanza: a python natural language processing toolkit for many human languages[C]//Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations. 2020: 101-108.
[48] CONNEAU A, KIELA D. SentEval: an evaluation toolkit for universal sentence representations[C]//Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018). 2018: 1699-1704.
[49] WOLF T, DEBUT L, SANH V, et al. Transformers: state-of-the-art natural language processing[C]//Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations. 2020: 38-45.
[50] OTT M, EDUNOV S, BAEVSKI A, et al. Fairseq: a fast, extensible toolkit for sequence modeling[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations). 2019: 48-53.
[51] KINGMA D P, BA J. Adam: a method for stochastic optimization[C]// 3rd International Conference on Learning Representations. 2015: 1-15.
[52] POST M. A call for clarity in reporting BLEU scores[C]//Proceed- ings of the Third Conference on Machine Translation: Research Papers. 2018: 186-191.
[53] OTT M, AULI M, GRANGIER D, et al. Analyzing uncertainty in neural machine translation[C]//International Conference on Machine Learning. 2018: 3956-3965.
[54] NEUBIG G, DOU Z Y, HU J, et al. compare-mt: a tool for holistic comparison of language generation systems[C]//Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations). 2019: 35-41.
Research on the robustness of neural machine translation systems in word order perturbation
ZHAO Yuran, XUE Tang, LIU Gongshen
School of Cyber Science and Engineering, Shanghai Jiao Tong University, Shanghai 200240, China
Pre-trained language model is one of the most important models in the natural language processing field, as pre-train-finetune has become the paradigm in various NLP downstream tasks. Previous studies have proved integrating pre-trained language models (e.g., BERT) into neural machine translation (NMT) models can improve translation performance. However, it is still unclear whether these improvements stem from enhanced semantic or syntactic modeling capabilities, as well as how pre-trained knowledge impacts the robustness of the models. To address these questions, a systematic study was conducted to examine the syntactic ability of BERT-enhanced NMT models using probing tasks. The study revealed that the enhanced models showed proficiency in modeling word order, highlighting their syntactic modeling capabilities. In addition, an attacking method was proposed to evaluate the robustness of NMT models in handling word order. BERT-enhanced NMT models yielded better translation performance in most of the tasks, indicating that BERT can improve the robustness of NMT models. It was observed that BERT-enhanced NMT model generated poorer translations than vanilla NMT model after attacking in the English-German translation task, which meant that English BERT worsened model robustness in such a scenario. Further analyses revealed that English BERT failed to bridge the semantic gap between the original and perturbed sources, leading to more copying errors and errors in translating low-frequency words. These findings suggest that the benefits of pre-training may not always be consistent in downstream tasks, and careful consideration should be given to its usage.
neural machine translation, pre-training model, robustness, word order
TP393
A
趙彧然(1998?),男,河南安陽人,上海交通大學碩士生,主要研究方向為自然語言處理。
薛儻(1999?),男,山西運城人,上海交通大學碩士生,主要研究方向為自然語言處理。
劉功申(1974?),男,山東聊城人,上海交通大學教授、博士生導師,主要研究方向為人工智能安全、自然語言處理、信息安全。
2022?09?27;
2023?03?02
劉功申,lgshen@sjtu.edu.cn
國家自然科學基金(U21B2020);上海市科技計劃項目(22511104400)
趙彧然, 薛儻, 劉功申. 基于詞序擾動的神經機器翻譯模型魯棒性研究[J]. 網絡與信息安全學報, 2023, 9(5): 138-149.
10.11959/j.issn.2096?109x.2023078
The National Natural Science Foundation of China (U21B2020), Shanghai Science and Technology Plan (22511104400)
ZHAO Y R, XUE T, LIU G S. Research on the robustness of neural machine translation systems in word order perturbation[J]. Chinese Journal of Network and Information Security, 2023, 9(5): 138-149.