Semantic Robustness of Models of Source Code

被引:40
作者
Henkel, Jordan [1 ]
Ramakrishnan, Goutham [2 ]
Wang, Zi [1 ]
Albarghouthi, Aws [1 ]
Jha, Somesh [1 ]
Reps, Thomas [1 ]
机构
[1] Univ Wisconsin, Madison, WI 53706 USA
[2] Hlth Scale Corp, San Jose, CA USA
来源
2022 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER 2022) | 2022年
基金
美国国家科学基金会;
关键词
D O I
10.1109/SANER53432.2022.00070
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Deep neural networks are vulnerable to adversarial examples-small input perturbations that result in incorrect predictions. We study this problem for models of source code, where we want the neural network to be robust to source-code modifications that preserve code functionality. To facilitate training robust models, we define a powerful and generic adversary that can employ sequences of parametric, semantics-preserving program transformations. We then explore how, with such an adversary, one can train models that are robust to adversarial program transformations. We conduct a thorough evaluation of our approach and find several surprising facts: we find robust training to beat dataset augmentation in every evaluation we performed; we find that a state-of-the-art architecture (code2seq) for models of code is harder to make robust than a simpler baseline; additionally, we find code2seq to have surprising weaknesses not present in our simpler baseline model; finally, we find that robust models perform better against unseen data from different sources (as one might hope)-however, we also find that robust models are not clearly better in the cross-language transfer task. To the best of our knowledge, we are the first to study the interplay between robustness of models of code and the domain-adaptation and cross-language-transfer tasks.
引用
收藏
页码:526 / 537
页数:12
相关论文
共 49 条
[1]  
Ahmad Wasi, 2020, P 58 ANN M ASS COMPU
[2]  
Allamanis M, 2016, Arxiv, DOI arXiv:1602.03001
[3]   TYPILUS: Neural Type Hints [J].
Allamanis, Miltiadis ;
Barr, Earl T. ;
Ducousso, Soline ;
Gao, Zheng .
PROCEEDINGS OF THE 41ST ACM SIGPLAN CONFERENCE ON PROGRAMMING LANGUAGE DESIGN AND IMPLEMENTATION (PLDI '20), 2020, :91-105
[4]   A Survey of Machine Learning for Big Code and Naturalness [J].
Allamanis, Miltiadis ;
Barr, Earl T. ;
Devanbu, Premkumar ;
Sutton, Charles .
ACM COMPUTING SURVEYS, 2018, 51 (04)
[5]  
Alon U., 2019, arXiv
[6]   code2vec: Learning Distributed Representations of Code [J].
Alon, Uri ;
Zilberstein, Meital ;
Levy, Omer ;
Yahav, Eran .
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2019, 3 (POPL)
[7]   Is mutation an appropriate tool for testing experiments? [J].
Andrews, JH ;
Briand, LC ;
Labiche, Y .
ICSE 05: 27TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, PROCEEDINGS, 2005, :402-411
[8]  
[Anonymous], US
[9]  
Athalye A, 2018, Arxiv, DOI arXiv:1802.00420
[10]  
Berkerpeksag, 2020, BERK AST