一句话:提出 AutoFocus,通过扰动代码元素量化其对注意力网络输出的影响,并利用注意力分数解释算法分类。
深度神经网络在软件工程中多被视为黑箱,难以解释输入如何影响输出。本文提出 AutoFocus,一种基于代码扰动的自动化方法,用于评估并可视化输入元素对网络输出的重要性。其假设是注意力机制产生的判别性分数能反映输入元素的影响,并在算法分类任务(给定源代码判断实现的算法)上验证。AutoFocus 系统性地识别和扰动代码元素,量化扰动对分类结果的影响。在 10 种排序算法、超过 1000 个程序上评估,发现注意力分数与扰动效应高度相关。这表明注意力分数可用于解释代码元素与分类结果的关系,按注意力排序可视化代码元素有助于以更少代码辅助程序理解。
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.
DOI 原文 ·
@inproceedings{paperbot5220,
title = {AutoFocus: Interpreting Attention-Based Neural Networks by Code Perturbation},
author = {Nghi D. Q. Bui and Yijun Yu and Lingxiao Jiang},
booktitle = {ASE},
year = {2019},
doi = {10.1109/ase.2019.00014}
}