Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1109/ASE.2019.00014acmconferencesArticle/Chapter ViewAbstractPublication PagesaseConference Proceedingsconference-collections
research-article

AutoFocus: interpreting attention-based neural networks by code perturbation

Published: 07 February 2020 Publication History

Abstract

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.

References

[1]
M. Allamanis, E. T. Barr, P. T. Devanbu, and C. A. Sutton, "A survey of machine learning for big code and naturalness," ACM Comput. Surv., vol. 51, no. 4, pp. 81:1--81:37, 2018.
[2]
S. M. Ghaffarian and H. R. Shahriari, "Software vulnerability analysis and discovery using machine-learning and data-mining techniques: A survey," ACM Comput. Surv., vol. 50, no. 4, pp. 56:1--56:36, 2017.
[3]
L. Mou, G. Li, L. Zhang, T. Wang, and Z. Jin, "Convolutional neural networks over tree structures for programming language processing," in AAAI, February 12--17 2016, pp. 1287--1293.
[4]
J. Zhang, X. Wang, H. Zhang, H. Sun, K. Wang, and X. Liu, "A novel neural source code representation based on abstract syntax tree," in ICSE, 2019.
[5]
B. D. Q. Nghi, Y. Yu, and L. Jiang, "Bilateral dependency neural networks for cross-language algorithm classification," in SANER, 2019, pp. 422--433.
[6]
L. H. Gilpin, D. Bau, B. Z. Yuan, A. Bajwa, M. Specter, and L. Kagal, "Explaining explanations: An overview of interpretability of machine learning," in DSAA, 2018, pp. 80--89.
[7]
B. Kim, M. Wattenberg, J. Gilmer, C. J. Cai, J. Wexler, F. Viegas, and R. A. Sayres, "Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (TCAV)," in ICML, 2018.
[8]
D. Alvarez-Melis and T. S. Jaakkola, "Towards robust interpretability with self-explaining neural networks," in NeurIPS, 2018.
[9]
D. Bahdanau, K. Cho, and Y. Bengio, "Neural machine translation by jointly learning to align and translate," in ICLR, 2015.
[10]
T. Luong, H. Pham, and C. D. Manning, "Effective approaches to attention-based neural machine translation," in Empirical Methods in Natural Language Processing (EMNLP), 2015, pp. 1412--1421.
[11]
S. Jain and B. C. Wallace, "Attention is not explanation," in NAACL: HLT, 2019.
[12]
M. Allamanis, M. Brockschmidt, and M. Khademi, "Learning to represent programs with graphs," in ICLR, 2018.
[13]
H. K. Dam, T. Tran, and A. Ghose, "Explainable software analytics," in ICSE: New Ideas and Emerging Results, 2018, pp. 53--56.
[14]
M. D. Zeiler and R. Fergus, "Visualizing and understanding convolutional networks," in ECCV, 2014, pp. 818--833.
[15]
J. Li, X. Chen, E. H. Hovy, and D. Jurafsky, "Visualizing and understanding neural models in NLP," in NAACL HLT, 2016.
[16]
R. C. Fong and A. Vedaldi, "Interpretable explanations of black boxes by meaningful perturbation," in ICCV, 2017, pp. 3429--3437.
[17]
M. T. Ribeiro, S. Singh, and C. Guestrin, ""why should I trust you?" explaining the predictions of any classifier," CoRR, vol. abs/1602.04938, 2016.

Cited By

View all
  • (2025)Measuring model alignment for code clone detection using causal interpretationEmpirical Software Engineering10.1007/s10664-024-10583-030:2Online publication date: 1-Mar-2025
  • (2024)Redundancy and Concept Analysis for Code-trained Language ModelsProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering Workshops10.1145/3691621.3694931(24-34)Online publication date: 27-Oct-2024
  • (2024)Keeper: Automated Testing and Fixing of Machine Learning SoftwareACM Transactions on Software Engineering and Methodology10.1145/367245133:7(1-33)Online publication date: 13-Jun-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
ASE '19: Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering
November 2019
1333 pages
ISBN:9781728125084

Sponsors

In-Cooperation

  • IEEE CS

Publisher

IEEE Press

Publication History

Published: 07 February 2020

Check for updates

Author Tags

  1. algorithm classification
  2. attention mechanisms
  3. code perturbation
  4. explainability
  5. interpretability
  6. neural networks
  7. program comprehension

Qualifiers

  • Research-article

Conference

ASE '19
Sponsor:

Acceptance Rates

Overall Acceptance Rate 82 of 337 submissions, 24%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 09 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Measuring model alignment for code clone detection using causal interpretationEmpirical Software Engineering10.1007/s10664-024-10583-030:2Online publication date: 1-Mar-2025
  • (2024)Redundancy and Concept Analysis for Code-trained Language ModelsProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering Workshops10.1145/3691621.3694931(24-34)Online publication date: 27-Oct-2024
  • (2024)Keeper: Automated Testing and Fixing of Machine Learning SoftwareACM Transactions on Software Engineering and Methodology10.1145/367245133:7(1-33)Online publication date: 13-Jun-2024
  • (2024)AI Coders Are among Us: Rethinking Programming Language Grammar towards Efficient Code GenerationProceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3650212.3680347(1124-1136)Online publication date: 11-Sep-2024
  • (2023)Structural-semantics Guided Program Simplification for Understanding Neural Code Intelligence ModelsProceedings of the 14th Asia-Pacific Symposium on Internetware10.1145/3609437.3609438(1-11)Online publication date: 4-Aug-2023
  • (2022)Diet code is healthy: simplifying programs for pre-trained models of codeProceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3540250.3549094(1073-1084)Online publication date: 7-Nov-2022
  • (2022)Syntax-guided program reduction for understanding neural code intelligence modelsProceedings of the 6th ACM SIGPLAN International Symposium on Machine Programming10.1145/3520312.3534869(70-79)Online publication date: 13-Jun-2022
  • (2022)Counterfactual explanations for models of codeProceedings of the 44th International Conference on Software Engineering: Software Engineering in Practice10.1145/3510457.3513081(125-134)Online publication date: 21-May-2022
  • (2021)Understanding neural code intelligence through program simplificationProceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3468264.3468539(441-452)Online publication date: 20-Aug-2021
  • (2021)Interpreting Deep Learning-based Vulnerability Detector Predictions Based on Heuristic SearchingACM Transactions on Software Engineering and Methodology10.1145/342944430:2(1-31)Online publication date: 10-Mar-2021
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media