AutoFocus: Interpreting Attention-based Neural Networks by Code Perturbation
Despite being adopted in software engineering tasks, deep neural networks are treated mostly as a black box due to the difficulty in interpreting how the networks infer the outputs from the inputs. To address this problem, we propose AutoFocus, an automated approach for rating and visualizing the importance of input elements based on their effects on the outputs of the networks. The approach is built on our hypotheses that (1) attention mechanisms incorporated into neural networks can generate discriminative scores for various input elements and (2) the discriminative scores reflect the effects of input elements on the outputs of the networks. This paper verifies the hypotheses by applying AutoFocus on the task of algorithm classification (i.e., given a program source code as input, determine the algorithm implemented by the program). AutoFocus identifies and perturbs code elements in a program systematically, and quantifies the effects of the perturbed elements on the network’s classification results. Based on evaluation on more than 1000 programs for 10 different sorting algorithms, we observe that the attention scores are highly correlated to the effects of the perturbed code elements. Such a correlation provides a strong basis for the uses of attention scores to interpret the relations between code elements and the algorithm classification results of a neural network, and we believe that visualizing code elements in an input program ranked according to their attention scores can facilitate faster program comprehension with reduced code.
Tue 12 Nov
10:40 - 11:00 Talk | Assessing the Generalizability of code2vec Token Embeddings Kang Hong JinSchool of Information Systems, Singapore Management University, Tegawendé F. BissyandéSnT, University of Luxembourg, David LoSingapore Management University Pre-print | |||||||||||||||||||||||||||||||||||||||||
11:00 - 11:20 Talk | Multi-Modal Attention Network Learning for Semantic Source Code Retrieval Yao WanZhejiang University, Jingdong ShuZhejiang University, Yulei SuiUniversity of Technology Sydney, Australia, Guandong XuUniversity of Technology, Sydney, Zhou ZhaoZhejiang University, Jian WuZhejiang University, philip yuUniversity of Illinois at Chicago | |||||||||||||||||||||||||||||||||||||||||
11:20 - 11:40 Talk | Experience Paper: Search-based Testing in Automated Driving Control ApplicationsACM SIGSOFT Distinguished Paper Award Christoph GladischCorporate Research, Robert Bosch GmbH, Thomas HeinzCorporate Research, Robert Bosch GmbH, Christian HeinzemannCorporate Research, Robert Bosch GmbH, Jens OehlerkingCorporate Research, Robert Bosch GmbH, Anne von VietinghoffCorporate Research, Robert Bosch GmbH, Tim PfitzerRobert Bosch Automotive Steering GmbH | |||||||||||||||||||||||||||||||||||||||||
11:40 - 12:00 Talk | Machine Translation-Based Bug Localization Technique for Bridging Lexical Gap Yan XiaoDepartment of Computer Science, City University of Hong Kong, Jacky KeungDepartment of Computer Science, City University of Hong Kong, Kwabena E. BenninBlekinge Institute of Technology, SERL Sweden, Qing MiDepartment of Computer Science, City University of Hong Kong Link to publication | |||||||||||||||||||||||||||||||||||||||||
12:00 - 12:10 Talk | AutoFocus: Interpreting Attention-based Neural Networks by Code Perturbation Nghi Duy Quoc BuiSingapore Management University, Singapore, Yijun YuThe Open University, UK, Lingxiao JiangSingapore Management University Pre-print | |||||||||||||||||||||||||||||||||||||||||
12:10 - 12:20 Demonstration | A Quantitative Analysis Framework for Recurrent Neural Network Xiaoning DuNanyang Technological University, Xiaofei XieNanyang Technological University, Yi LiNanyang Technological University, Lei MaKyushu University, Yang LiuNanyang Technological University, Singapore, Jianjun ZhaoKyushu University |