《電子技術(shù)應(yīng)用》
您所在的位置:首頁(yè) > 通信與網(wǎng)絡(luò) > 設(shè)計(jì)應(yīng)用 > 基于BERT-CNN的新聞文本分類的知識(shí)蒸餾方法研究
基于BERT-CNN的新聞文本分類的知識(shí)蒸餾方法研究
2023年電子技術(shù)應(yīng)用第1期
葉榕,邵劍飛,張小為,邵建龍
昆明理工大學(xué) 信息工程與自動(dòng)化學(xué)院,云南 昆明 650500
摘要: 近年來(lái),隨著大數(shù)據(jù)時(shí)代進(jìn)入人類的生活之后,人們的生活中出現(xiàn)很多無(wú)法識(shí)別的文本、語(yǔ)義等其他數(shù)據(jù),這些數(shù)據(jù)的量十分龐大,語(yǔ)義也錯(cuò)綜復(fù)雜,這使得分類任務(wù)更加困難。如何讓計(jì)算機(jī)對(duì)這些信息進(jìn)行準(zhǔn)確的分類,已成為當(dāng)前研究的重要任務(wù)。在此過(guò)程中,中文新聞文本分類成為這個(gè)領(lǐng)域的一個(gè)分支,這對(duì)國(guó)家輿論的控制、用戶日常行為了解、用戶未來(lái)言行的預(yù)判都有著至關(guān)重要的作用。針對(duì)新聞文本分類模型參數(shù)量多和訓(xùn)練時(shí)間過(guò)長(zhǎng)的不足,在最大限度保留模型性能的情況下壓縮訓(xùn)練時(shí)間,力求二者折中,故提出基于BERT-CNN的知識(shí)蒸餾。根據(jù)模型壓縮的技術(shù)特點(diǎn),將BERT作為教師模型,CNN作為學(xué)生模型,先將BERT進(jìn)行預(yù)訓(xùn)練后再讓學(xué)生模型泛化教師模型的能力。實(shí)驗(yàn)結(jié)果表明,在模型性能損失約2.09%的情況下,模型參數(shù)量壓縮約為原來(lái)的1/82,且時(shí)間縮短約為原來(lái)的1/670。
關(guān)鍵詞: 新聞文本 BERT CNN 知識(shí)蒸餾
中圖分類號(hào):TP391.1
文獻(xiàn)標(biāo)志碼:A
DOI: 10.16157/j.issn.0258-7998.223094
中文引用格式: 葉榕,邵劍飛,張小為,等. 基于BERT-CNN的新聞文本分類的知識(shí)蒸餾方法研究[J]. 電子技術(shù)應(yīng)用,2023,49(1):8-13.
英文引用格式: Ye Rong,Shao Jianfei,Zhang Xiaowei,et al. Knowledge distillation of news text classification based on BERT-CNN[J]. Application of Electronic Technique,2023,49(1):8-13.
Knowledge distillation of news text classification based on BERT-CNN
Ye Rong,Shao Jianfei,Zhang Xiaowei,Shao Jianlong
School of Information Engineering and Automation, Kunming University of Science and Technology, Kunming 650500, China
Abstract: In recent years, after the era of big data has entered human life, many unrecognizable text, semantic and other data have appeared in people's lives, which are very large in volume and intricate in semantics, which makes the classification task more difficult. How to make computers classify this information accurately has become an important task of current research. In this process, Chinese news text classification has become a branch in this field, which has a crucial role in the control of national public opinion, the understanding of users' daily behavior, and the prediction of users' future speech and behavior. In view of the shortage of news text classification models with large number of parameters and long training time, the BERT-CNN based knowledge distillation is proposed to compress the training time while maximizing the model performance and striving for a compromise between the two. According to the technical characteristics of model compression, BERT is used as the teacher model and CNN is used as the student model, and BERT is pre-trained first before allowing the student model to generalize the capability of the teacher model. The experimental results show that the model parametric number compression is about 1/82 and the time reduction is about 1/670 with the model performance loss of about 2.09%.
Key words : news text;BERT;CNN;knowledge distillation

0 引言

    隨著大數(shù)據(jù)時(shí)代的到來(lái),今日頭條、新浪微博和豆瓣等主流新聞媒體APP產(chǎn)生海量新聞文本,因此如何將這些新聞文本進(jìn)行快速有效的分類對(duì)于用戶體驗(yàn)?zāi)酥羾?guó)家網(wǎng)絡(luò)輿情控制是十分必要的。針對(duì)中文新聞文本分類任務(wù),研究者提出許多分類算法和訓(xùn)練模型,證明深度學(xué)習(xí)分類方法的有效性。

    以BERT[1](Bidirectional Encoder Representation from Transformers)預(yù)訓(xùn)練模型為例:在文獻(xiàn)[2]的實(shí)驗(yàn)中可以得出,BERT-CNN模型取得的效果最佳,但是從工程落地的角度來(lái)說(shuō),模型參數(shù)量過(guò)于巨大,僅僅一個(gè)BERT模型,參數(shù)就達(dá)一億多。本文使用的是谷歌開(kāi)源的面向中文的BERT預(yù)訓(xùn)練模型,占用內(nèi)存大小為325 Mb。另一方面,針對(duì)訓(xùn)練時(shí)間過(guò)長(zhǎng)的缺點(diǎn),以該實(shí)驗(yàn)為例,訓(xùn)練18萬(wàn)條新聞文本數(shù)據(jù)消耗的時(shí)間為3.5 h,很顯然對(duì)于未來(lái)的模型工程落地還存在很大的差距。因此,本文在保證不下降過(guò)多模型的準(zhǔn)確率的前提下,將BERT-CNN進(jìn)行模型壓縮,降低模型體積以及模型的訓(xùn)練時(shí)間,提升模型的泛化能力。

    本文創(chuàng)新點(diǎn)主要體現(xiàn)在:(1)對(duì)實(shí)驗(yàn)數(shù)據(jù)集進(jìn)行了擴(kuò)充處理,提升模型泛化能力;(2)通過(guò)觀察不同的T和α的組合對(duì)模型蒸餾性能的影響確定最優(yōu)組合值而不是固定值;(3)蒸餾場(chǎng)景不再局限于傳統(tǒng)情感分析(二分類),本實(shí)驗(yàn)面向10分類的文本分析,不同標(biāo)簽文本的蒸餾性能也不盡相同。




本文詳細(xì)內(nèi)容請(qǐng)下載:http://ihrv.cn/resource/share/2000005068。




作者信息:

葉榕,邵劍飛,張小為,邵建龍

(昆明理工大學(xué) 信息工程與自動(dòng)化學(xué)院,云南 昆明 650500)




wd.jpg

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