注意力引導的知識蒸餾以及多樣性層選擇壓縮BERT模型
Enhancing Knowledge Distillation in BERT Model: Attention-Guided Distillation and Layer Selection by Attention Diversity
摘要
近年來,自注意力模型在自然語言的任務上取得重大的成功,雖然其準確度非常高,但是自注意力神經網路的參數量非常巨大,在訓練時需要大量的資料來激勵這些參數,在實際推論時需要耗費大量的計算資源以及記憶體,因此自注意力神經網路的準確度雖然驚人但難以部署到資源受限的裝置上以至於實用性降低。為解決此問題,目前有許多自注意力神經網路模型壓縮的研究,其中知識蒸餾為目前最具代表性的模型壓縮技術之一,該技術能將一個大型教師神經網路知識蒸餾到一個小型的學生網路,使得學生網路在參數量及運算量較小的情況下依然能達到教師網路的準確度。然而,我們觀察到現有的知識蒸餾研究中有兩個缺點:1)缺乏一個利用教師神經網路參數初始化學生神經網路的策略,2)知識蒸餾的訓練過中僅傳遞教師神經網路的中間層特徵以及輸出結果,缺乏教師神經網路自注意力層資訊的傳遞以至於學生網路達不到理想的準確度。另外,我們也觀察到一般知識蒸餾的教師神經網路是針對特定任務作優化並非針對教導學生,因此我們也加入了學生與教師互相學習的方式使得教師神經網路能夠針對教導學生作優化。實驗結果表明,我們提出的基於注意力引導的知識蒸餾以及注意力多樣性的層選擇方法明顯優於傳統的知識蒸餾方法,並且學生神經網路達到接近教師神經網路水準的準確度。此外,我們也將注意力引導的知識蒸餾以及注意力多樣性的層選擇方法套用在多種自注意力模型,進一步證明我們方法的有效性以及通用性。
In recent years, self-attention models have achieved significant success in natural language processing tasks. While these models exhibit high accuracy, they suffer from a large number of parameters, requiring substantial amounts of data for training. Moreover, their deployment on edge devices is challenging due to the computational and memory requirements during inference. To address this problem, various research efforts have focused on compressing self-attention neural networks, with knowledge distillation being one of the most prominent techniques. knowledge distillation is a technique that enables the transfer of insights from a larger, more complex teacher network to a less complex and smaller student network. The primary benefit of this process is that the student network can reach a similar level of accuracy as the teacher network but with fewer parameters and a lower computational burden.However, existing knowledge distillation approaches have two limitations. Firstly, they lack
strategies for initializing the student network using the teacher network's parameters. Secondly, during the training process, they only transfer intermediate layer features and output results from the teacher network, neglecting the importance of self-attention layer information, which iiiprevents the student network from reaching its full potential accuracy. Additionally, we observed that conventional knowledge distillation techniques optimize the teacher neural network for a specific task rather than focusing on teaching the student. Therefore, we introduced a mutual learning approach between the student and teacher networks, allowing the teacher network to optimize itself for teaching the student. Experimental results demonstrate that our proposed methods outperform traditional knowledge distillation approaches, and the student network achieves accuracy levels close to that of the teacher network. Furthermore, we apply the attention-guided knowledge distillation and attention diversity layer selection methods to multiple self-attention models, providing evidence of the effectiveness and versatility of our approach.
strategies for initializing the student network using the teacher network's parameters. Secondly, during the training process, they only transfer intermediate layer features and output results from the teacher network, neglecting the importance of self-attention layer information, which iiiprevents the student network from reaching its full potential accuracy. Additionally, we observed that conventional knowledge distillation techniques optimize the teacher neural network for a specific task rather than focusing on teaching the student. Therefore, we introduced a mutual learning approach between the student and teacher networks, allowing the teacher network to optimize itself for teaching the student. Experimental results demonstrate that our proposed methods outperform traditional knowledge distillation approaches, and the student network achieves accuracy levels close to that of the teacher network. Furthermore, we apply the attention-guided knowledge distillation and attention diversity layer selection methods to multiple self-attention models, providing evidence of the effectiveness and versatility of our approach.
所屬典藏
網路工程研究所引用此條目
Huang, X.-F. (2023). Enhancing Knowledge Distillation in BERT Model: Attention-Guided Distillation and Layer Selection by Attention Diversity. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/271
引用文字依 APA 第 7 版格式自動產生,使用前請再核對。
分享
永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/271