第31卷第4期2023年8月Vol.31No.4Aug.2023电脑与信息技术ComputerandInformationTechnology文章编号:1005-1228(2023)04-0079-04基于BERT的文本分类后门攻击方法郭健1,霍颖姿2,黄卫红2(1.湖南省教育考试院,湖南长沙410012;2.湖南科技大学计算机科学与工程学院,湖南湘潭411201)摘要:随着深度学习的广泛应用,针对深度学习的恶意攻击暴露了神经网络的脆弱性,主流攻击方法包括后门攻击,但目前针对文本分类任务的后门攻击的研究较少。文章介绍了一种针对基于BERT的文本分类系统的后门攻击方法,该方法通过在文本中随机插入一个句子作为后门触发器,维护了文本的自然语义,并且避免了语法错误,实现了触发器的隐身。本文的后门攻击方法是一种易于实现的黑箱攻击,在攻击者仅拥有少量训练数据的情况下,通过中毒数据样本训练模型来达到攻击者指定的文本类别的结果。通过在IMDB电影评论数据集上的情感分析实验来评估该后门攻击方法,实验结果表明,该方法在中毒率仅有1%时,达到了85%的攻击成功率,可以以少量的中毒样本和较小的模型性能损失为代价,可以获得较高的攻击成功率。关键词:文本分类;后门攻击;预训练;微调;中毒率中图分类号:TP391文献标识码:AABERT-basedBackdoorAttackMethodforTextClassificationGUOJian1,HUOYing-zi2,HUANGWei-hong2(1.HunanEducationExaminationAuthority,Changsha410012,China;2.SchoolofComputerScienceandEngineering,HunanUniversityofScienceandTechnology,Xiangtan411201,China)Abstract:Withthewidespreaduseofdeeplearning,maliciousattacksagainstdeeplearningexposethevulnerabilityofneuralnetworks.Themainstreamattackmethodsincludebackdoorattacks,butthereislessresearchonbackdoorattacksfortextclassificationtasks.Inthispaper,weintroduceabackdoorattackmethodforBERT-basedtextclassificationsystem,whichmaintainsthenaturalsemanticsoftextandavoidssyntacticerrorsbyinsertingarandomsentenceinthetextasabackdoortrigger,andachievesthestealthofthetrigger.Thebackdoorattackmethodinthispaperisaneasy-to-implementblack-boxattackthattrainsamodeltoachievetheresultsoftheattacker'sspecifiedtextcategorybypoisoningdatasampleswhentheattackerhasonlyasmallamountoftrainingdata.Inthispaper,weevaluatethebackdoorattackmethodthroughsentimentanalysisexperiments...