Pre-trained programming language (PL) models (such as CodeT5, CodeBERT, GraphCodeBERT, etc.,) have the potential to automate software engineering tasks involving code understanding and code generation. However, these models operate in the natural channel of code, i.e., they are primarily concerned with the human understanding of the code. They are not robust to changes in the input and thus, are potentially susceptible to adversarial attacks in the natural channel. We propose, CodeAttack, a simple yet effective black-box attack model that uses code structure to generate effective, efficient, and imperceptible adversarial code samples and demonstrates the vulnerabilities of the state-of-the-art PL models to code-specific adversarial attacks. We evaluate the transferability of CodeAttack on several code-code (translation and repair) and code-NL (summarization) tasks across different programming languages. CodeAttack outperforms state-of-the-art adversarial NLP attack models to achieve the best overall drop in performance while being more efficient, imperceptible, consistent, and fluent. The code can be found at https://github.com/reddy-lab-code-research/CodeAttack.


翻译:预训练编程语言(PL)模型(如CodeT5、CodeBERT、GraphCodeBERT等)有潜力自动化涉及代码理解和代码生成的软件工程任务。然而,这些模型在代码的自然信道中运行,即它们主要关注代码的人类理解。它们对输入的变化不具有鲁棒性,因此可能易受自然信道中的对抗攻击的影响。我们提出了CodeAttack,一种简单而有效的黑盒攻击模型,它使用代码结构生成有效、高效、难以察觉的对抗性代码样本,并展示了最先进的PL模型对代码特定对抗性攻击的漏洞。我们在多种编程语言的代码-代码(翻译和修复)和代码-NL(摘要)任务上评估了CodeAttack的可转移性。CodeAttack优于最先进的对抗性NLP攻击模型,在效率、难以察觉性、一致性和流畅性方面实现了最佳的性能下降。 代码可在https://github.com/reddy-lab-code-research/CodeAttack中找到。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
专知会员服务
44+阅读 · 2020年10月31日
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Deep Compression/Acceleration:模型压缩加速论文汇总
极市平台
13+阅读 · 2019年5月15日
LibRec 精选:推荐系统的论文与源码
LibRec智能推荐
14+阅读 · 2018年11月29日
【SIGIR2018】五篇对抗训练文章
专知
12+阅读 · 2018年7月9日
Capsule Networks解析
机器学习研究会
10+阅读 · 2017年11月12日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
2+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
VIP会员
相关资讯
RoBERTa中文预训练模型:RoBERTa for Chinese
PaperWeekly
57+阅读 · 2019年9月16日
BERT/Transformer/迁移学习NLP资源大列表
专知
19+阅读 · 2019年6月9日
Deep Compression/Acceleration:模型压缩加速论文汇总
极市平台
13+阅读 · 2019年5月15日
LibRec 精选:推荐系统的论文与源码
LibRec智能推荐
14+阅读 · 2018年11月29日
【SIGIR2018】五篇对抗训练文章
专知
12+阅读 · 2018年7月9日
Capsule Networks解析
机器学习研究会
10+阅读 · 2017年11月12日
相关基金
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
2+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2011年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员