應用多跳躍注意記憶關聯於記憶網路之研究 (A Research of Applying Multi-hop Attention and Memory Relations on Memory Networks)

7465

Authors

nan

Abstract

With the rapid advancement of machine learning and deep learning, a great breakthrough has been achieved in many areas of natural language processing in recent years. Complex language tasks, such as article classification, abstract extraction, question answering, machine translation, and image description generation, have been solved by neural networks. In this paper, we propose a new                                                         國立中正大學電機工程學系 Department of Electrical Engineering, National Chung Cheng University 南華大學資工系 Department of Computer Science and Information Engineering, Nanhua University E-mail: hoe8624@gmail.com; aliu@ee.ccu.edu.tw; chlee@nhu.edu.tw The author for corresspondence is Chiung-Hon Lee. 104 詹京翰 等 model based on memory networks to include a multi-hop mechanism to process a set of sentences in small quantity, and the question-answering task is used as the verification application. The model saves the knowledge in memory first and then finds the relevant memory through the attention mechanism, and the output module reasons the final answer. All experiments have used the bAbI dataset provided by Facebook. There are 20 different kinds of Q&A tasks in the data set that can be used to evaluate the model in different aspects. This approach reduces the number of memory associations through the calculation of associations between memories. In addition to reducing the calculation weight of 26.8%, it can also improve the accuracy of the model, which can increase by about 9.2% in the experiment. The experiments also used a smaller amount of data to verify the system for improving the case of insufficient data set. 關鍵詞:記憶網路、多點跳躍網路、關係網路、注意力機制 Keywords:Memory Networks, Multi-hop Networks, Relation Networks, Attention Mechanism 1. 緒論 (

Keywords

nan

Full Content

Computational Linguistics and Chinese Language Processing Vol. 25, No. 1, June 2020, pp. 103-122 103 The Association for Computational Linguistics and Chinese Language Processing 應用多跳躍注意記憶關聯於記憶網路之研究 A Research of Applying Multi-hop Attention and Memory Relations on Memory Networks 詹京翰、劉立頌、李俊宏 Jing-Han Zhan,Alan Liu, and Chiung-Hon Lee 摘要 機器學習與深度學習近年發展越來越迅速,在自然語言處理任務上取得相當大 的突破。透過類神經網路可以實現複雜的語言任務,如文章分類、摘要提取、 問答任務、機器翻譯、圖片說明生成等。本論文以記憶網路做為研究目標、問 答任務作為驗證應用。模型將先驗知識保存於記憶中,再透過注意力機制 (Attention Mechanism)找出與問題相關的記憶,並推理出最終答案。問答任務 數據集採用 Facebook 所提供的 bAbI 數據集,其中共有 20 項不同種類的問答 任務,可驗證模型在不同任務的準確率。此研究透過記憶間的關聯計算,縮減 記憶關聯的數量,除了下降 26.8%權重的計算量外,也能提高模型的準確率, 於實驗中最多可提高約9.2%左右。同時實驗採取較小的數據量作為驗證目標, 改善即使在數據集不足的情況也能達到相當程度的改善效果。 Abstract With the rapid advancement of machine learning and deep learning, a great breakthrough has been achieved in many areas of natural language processing in recent years. Complex language tasks, such as article classification, abstract extraction, question answering, machine translation, and image description generation, have been solved by neural networks. In this paper, we propose a new 國立中正大學電機工程學系 Department of Electrical Engineering, National Chung Cheng University 南華大學資工系 Department of Computer Science and Information Engineering, Nanhua University E-mail: hoe8624@gmail.com; aliu@ee.ccu.edu.tw; chlee@nhu.edu.tw The author for corresspondence is Chiung-Hon Lee. 104 詹京翰 等 model based on memory networks to include a multi-hop mechanism to process a set of sentences in small quantity, and the question-answering task is used as the verification application. The model saves the knowledge in memory first and then finds the relevant memory through the attention mechanism, and the output module reasons the final answer. All experiments have used the bAbI dataset provided by Facebook. There are 20 different kinds of Q&A tasks in the data set that can be used to evaluate the model in different aspects. This approach reduces the number of memory associations through the calculation of associations between memories. In addition to reducing the calculation weight of 26.8%, it can also improve the accuracy of the model, which can increase by about 9.2% in the experiment. The experiments also used a smaller amount of data to verify the system for improving the case of insufficient data set. 關鍵詞:記憶網路、多點跳躍網路、關係網路、注意力機制 Keywords:Memory Networks, Multi-hop Networks, Relation Networks, Attention Mechanism 1. 緒論 (Introduction) 深度學習研究近年大幅成長,其中記憶網路模型於文字相關的自然語言任務受到了不少 關注。在自然語言領域中,聊天機器人、問答任務等,都具有序列資料的特性,也就是 文句字詞有時間先後的關係,因此計算的過程需要給與模型詞序資訊,或是依照順序輸 入至模型內。其中記憶模型使用外部記憶的方式儲存文本或先驗知識,推理時再從中找 出與問題關聯性高的記憶內容,可以避免在計算過程中損失重要的資訊。其中結合了注 意力機制的應用,使輸出模組可以根據現在的問題關注重要的記憶內容,推理得出正確 的答案。 應用於語言模型領域中的記憶網路模型有單跳躍注意機制(Single-hop attention) 與 多跳躍注意機制(Multi-hop attention) 的推理方式,因記憶與記憶間相互獨立,在數據量 足夠大的狀況下已可學習到不錯的效果。但在數據量較小的前提下則較為無法學習數據 內的資訊。為提高模型學習與推理的能力,提高記憶儲存效率與模型的推理方法則顯得 相當重要。 本研究結合自然語言常用資料集與深度學習的工具,嘗試結合不同理論,強化語言 理解與推理能力,並分析實驗結果的表現。實驗採取較小的數據量作為驗證目標,改善 即使在數據集不足的情況也能達到相當程度的改善效果。目的歸納如下兩點。 (一) 研究多跳躍注意機制對於記憶網路預測的表現。 (二) 研究記憶網路記憶關聯提取對於推理能力的提升。 本論文研究在小數據集的前提下,不同的機制對於問答系統模型的影響。在研究中 我們將關係網路的概念,以關聯記憶的形式與記憶模型結合,於 bAbI 數據集(Weston, 應用多跳躍注意記憶關聯於記憶網路之研究 105 Bordes, Chopra & Mikolov, 2016)20 項任務中驗證,準確率最多可提高約 9.2%左右的準確 率。關聯提取的部分還有降低權重的功用,相比於保存所有關聯計算,平均每項任務可 下降 3 萬個權重數量,整體下降 26.8%權重的計算量。 我們在接下來的小節討論與整理記憶網路相關領域研究文獻;第三節為研究方法與 設計,對於本論文研究方式與方法做一系列的整理與說明;第四節則為實驗結果與分析, 比較改善前後模型的表現,驗證所採用方法的可行性與價值;最後一節為結論與建議, 總結本論文所採用方法的優缺點,以及未來可嘗試的方向。 2. 文獻回顧 (Literature Review) 記憶網路(Memory Networks)主要運用於問答任務與情感分析等應用上,採用外部記憶的 方式儲存先驗知識,透過注意力機制找到與問題相關的記憶內容,再利用推理模組從問 題與相關記憶得出最終答案。記憶網路由許多模組組合而成,各個部分可由設計者採用 不同方式實現,本小節介紹記憶網路相關研究,以及語言模型的相關理論。 2.1 注意力機制 (Attention Mechanism) 注意力機制(Attention mechanism)最早應用於圖像領域,論文(Bahdanau, Cho & Bengio, 2015)結合類神經網路模型,將其運用於機器翻譯任務上,首次將注意力機制應用於自然 語言處理領域上。 自從編碼器解碼器架構(Encoder-Decoder) (Cho et al., 2014)的提出,改善了單個 RNN (Recurrent Neural Networks) (Elman, 1990)長期記憶的不足,並提升了在自然語言處理領 域各種任務的效果。但因輸出解碼過程在不同時間步所輸入的編碼向量相同,導致在轉 換的過程中容易損失許多訊息,若提高向量大小則會導致計算量增加,而注意力機制的 提出可以有效提高模型編碼的效率。 2.2 記憶網路 (Memory Network) 記憶網路(Memory Network, MemNN) (Weston, Chopra & Bordes, 2014)由Facebook人工智 慧實驗室所提出,目的在提高類神經網路模型長期記憶能力,應用於序列性資料上。如 保存問答任務的先驗知識、聊天的語境訊息等。過往在處理序列性資料時,RNN 可以有 效的處理短期時間先後關係,每個時間步都會參考上一個時間步輸出的結果,但其只透 過記憶單元儲存重要資訊,隨時間步推移更新記憶單元內容,對於長序列的訓練過程中 可能會有梯度消失(gradient vanishing) 與梯度爆炸(gradient exploding) 的問題發生,造成 RNN 在長期記憶中表現不是很好。即使後來長短期記憶模型(Long Short-Term Memory, LSTM) (Hochreiter & Schmidhuber, 1997)相對提高了長期記憶能力,但對於更大的序列仍 然有其限制存在。 記憶網路的限制在於訓練過程需要透過強監督的方式學習(Strong-Supervised Learning),訓練用數據需要提供與查詢相關的標註句子,然而並非所有數據集都有支持 106 詹京翰 等 事實的標註,並不利於將此模型應用到不同的數據集或不同任務上。端對端記憶網路 (End-to-End Memory Networks, MemN2N)模型(Sukhbaatar, Szlam, Weston & Fergus, 2015), 在記憶網路模型的基礎上修改與完善,使其能以端對端的方式完成學習。透過弱監督方 式(Weak-Supervise Learning) 即可完成訓練,有利模型的擴展並應用到不同的任務或資 料集上。此模型利用軟性注意力機制(Soft Attention Mechanism) 來估計每條記憶與問題 相關的程度,並使用相關性高的記憶計算出最後的輸出。 動態記憶網路(Dynamic Memory Networks, DMN)模型(Kumar et al., 2016),將大部份 自然語言處理領域的任務視為問答任務的一種。該模型以記憶網路為基礎進行改善,可 透過端對端學習完成訓練,應用於問答任務、情感分析以及詞性標註等。模型架構與記 憶網路模型相似,主要由四個模組所組成,分別為輸入模組、問題模組、情景記憶模組 (Episodic Memory Module) 與應答模組。與前述記憶網路的不同在於編碼方式。此模型 採用門控循環單元模型(Gate Recurrent Unit, GRU) (Chung, Gulcehre, Cho & Bengio, 2014) 編碼,隨著時間步的推移更新隱藏狀態。相較於單純使用詞袋(Bags of word, BOW) 更可 以表示出字詞之間的順序關聯。 在問答系統中加入知識庫(Knowledge Bases, KBs)可以有效的提高模型的知識儲存 量,但其並不夠完整,無法支持不同類型的答案,由於數據的稀疏性,較難創建包含所 有領域的 KB,不利於擴展到不同的領域。鍵值記憶網路(Key-Value Memory Networks) 模型(Miller et al., 2016)使用鍵值(key-value) 的方式將文章中的編碼存取下來,架構基於 端對端記憶網路模型,針對先驗知識的儲存提出不同方式編碼,應用於自然語言中問答 的相關領域。 鍵值記憶網路模型與端對端記憶網路模型相似,最大的不同在於記憶的儲存方式。 端對端記憶網路透過不同的嵌入矩陣對文本編碼,而鍵值記憶網路則透過鍵值的方式表 示,以鍵記憶(key memory)與值記憶(value …

Content truncated to 500 words

Labeled Text

With the rapid advancement of machine learning and deep learning, a great breakthrough has been achieved in many areas of natural language processing in recent years. Complex language tasks, such as article classification, abstract extraction, question answering, machine translation, and image description generation, have been solved by neural networks. In this paper, we propose a new                                                         國立中正大學電機工程學系 Department of Electrical Engineering, National Chung Cheng University 南華大學資工系 Department of Computer Science and Information Engineering, Nanhua University E-mail: ; ; The author for corresspondence is Chiung-Hon Lee. 104 詹京翰 等 model based on memory networks to include a multi-hop mechanism to process a set of sentences in small quantity, and the question-answering task is used as the verification application. The model saves the knowledge in memory first and then finds the relevant memory through the attention mechanism, and the output module reasons the final answer. All experiments have used the bAbI dataset provided by Facebook. There are 20 different kinds of Q&A tasks in the data set that can be used to evaluate the model in different aspects. This approach reduces the number of memory associations through the calculation of associations between memories. In addition to reducing the calculation weight of 26.8%, it can also improve the accuracy of the model, which can increase by about 9.2% in the experiment. The experiments also used a smaller amount of data to verify the system for improving the case of insufficient data set. 關鍵詞:記憶網路、多點跳躍網路、關係網路、注意力機制 Keywords:Memory Networks, Multi-hop Networks, Relation Networks, Attention Mechanism 1. 緒論 (

Publication Details

Paper ID:
7465
Year:
2020
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan