《電子技術應用》
您所在的位置:首頁 > 人工智能 > 設計應用 > 融合多教師模型的知識蒸餾文本分類
融合多教師模型的知識蒸餾文本分類
電子技術應用 11期
苑婧1,周楊1,胡校飛1,孫姝婭2,張呈龍1,劉龍輝1
(1.戰(zhàn)略支援部隊信息工程大學, 河南 鄭州 450001;2.華北水利水電大學, 河南 鄭州 450000)
摘要: 針對簡單文本分類模型精度不高,預訓練模型結構復雜,在實際環(huán)境中難以直接使用的問題,提出多教師知識蒸餾的文本分類方法。該模型使用“教師-學生網(wǎng)絡”的訓練方法,教師模型為BERT-wwm-ext和XLNet預訓練模型,將兩個模型輸出的概率矩陣通過權重系數(shù)融合為軟標簽。學生模型為BiGRU-CNN網(wǎng)絡,使用均方差函數(shù)計算軟標簽誤差,使用交叉熵損失函數(shù)計算硬標簽誤差,通過硬標簽和軟標簽訓練學生模型使損失函數(shù)值達到最小。實驗結果表明,提出的方法精度較學生模型有較大的改進,接近預訓練模型,在保證分類精度的前提下減少了運行時間,提高了效率。
中圖分類號:TP301
文獻標志碼:A
DOI: 10.16157/j.issn.0258-7998.233869
引用格式: 苑婧,周楊,胡校飛,等. 融合多教師模型的知識蒸餾文本分類[J]. 電子技術應用,2023,49(11):42-48.
Integrated multi-teacher model for knowledge distillation text classification
Yuan Jing1,Zhou Yang1,Hu Xiaofei1,Sun Shuya2,Zhang Chenglong1,Liu Longhui1
(1.Strategic Support Force Information Engineering University, Zhengzhou 450001, China;2.North China University of Water Resources and Electric Power, Zhengzhou 450000, China)
Abstract: Aiming at the problems of low accuracy of simple text classification model, complex structure of pre-training model and difficult to be directly used in practical environment, this paper proposes a text classification method based on multi-teacher model knowledge distillation. This model uses the training method of "teacher-student network", and the teacher model is the BERT-wwm-ext and XLNet pre-training models. The probability matrix of the output of the two models is fused into soft labels by weight coefficient. The student model is BiGRU-CNN network. The mean square error function is used to calculate the soft label error, and the cross-entropy loss function is used to calculate the hard label error. The student model is trained by hard label and soft label to minimize the value of the loss function. The test results show that the accuracy of the proposed method have great improvement compared with the student model, and it is close to the pre-training model, which can save the running time and improve the efficiency on the premise of ensuring the classification accuracy.
Key words : text classification;knowledge distillation;BERT-wwm-ext;XLNet;BiGRU-CNN

【引言】

文本分類為輿情監(jiān)控、廣告推送、挖掘社交媒體用戶的時空行為、追蹤敏感信息發(fā)揮了重要作用,其主要任務是根據(jù)文本內(nèi)容或主題自動識別其所屬類別。目前文本分類主要有機器學習[1]、深度學習[2]和預訓練模型,其中預訓練模型分類準確率最高。

深度學習模型通過捕捉文本的上下文特征完成文本分類任務,包括卷積神經(jīng)網(wǎng)絡(Convolutional Neural Network,CNN)[3]、循環(huán)神經(jīng)網(wǎng)絡(Recurrent Neural Network,RNN)[4]、長短期記憶網(wǎng)絡(Long and Short Term Memory,LSTM)[5]、門控循環(huán)單元(Gated Recurrent Unit GRU)[6]等。結合不同的模型可以有效提高模型的性能,例如Sandhya結合長LSTM和RNN對文本文檔進行特征提取[7],陳可嘉[8]使用BiGRU-CNN模型結合自注意力機制進行文本分類,均全面提取了文本的局部和整體特征,提高了模型的準確性。

預訓練文本分類模型模型使用大量無標注語料,在多個自然語言處理任務中有著良好的效果[9],包括Bert[10]、ELMo[11]、XLNet[12]等。翟劍峰使用Bert模型用于用戶畫像[13],王浩暢使用ELMo模型用于機器翻譯[14],李東金使用XLNet模型用于情感分析[15]。但是預訓練模型參數(shù)量大、結構復雜、運行時間長,在實際生產(chǎn)環(huán)境直接使用難度較大,因此需在保證準確率的前提下對模型進行壓縮。

合理的模型壓縮可以在保證準確率的前提下有效降低模型參數(shù)量和內(nèi)存以提高實際應用的時間效率[16],常見的模型壓縮方法包括網(wǎng)絡剪枝[17]、參數(shù)量化、知識蒸餾[18]等。葉榕使用知識蒸餾的方法結合Bert和CNN模型用于新聞文本分類[19],楊澤使用知識蒸餾的方法改進網(wǎng)絡問答系統(tǒng)[20],都在不影響準確率的前提下,大大縮短了運行時間。

本文提出了一種多教師模型知識蒸餾的方法,在不顯著降低性能的前提下,減小模型了的復雜度。結合預訓練模型XLNet和BERT-wwm-ext輸出的概率分布融合作為軟標簽,在訓練過程中指導學生模型BiGRU-CNN網(wǎng)絡,提高了模型的泛化能力。


文章詳細內(nèi)容下載請點擊:融合多教師模型的知識蒸餾文本分類AET-電子技術應用-最豐富的電子設計資源平臺 (chinaaet.com)


【作者信息】

苑婧1,周楊1,胡校飛1,孫姝婭2,張呈龍1,劉龍輝1

(1.戰(zhàn)略支援部隊信息工程大學, 河南 鄭州 450001;2.華北水利水電大學, 河南 鄭州 450000)




此內(nèi)容為AET網(wǎng)站原創(chuàng),未經(jīng)授權禁止轉(zhuǎn)載。