BIROn - Birkbeck Institutional Research Online

    Adversarial robustness of deep code comment generation

    Zhou, Y. and Zhang, Q. and Shen, J. and Han, Tingting and Chen, Taolue and Gall, H. (2022) Adversarial robustness of deep code comment generation. ACM Transactions on Software Engineering and Methodology 31 (4), pp. 1-30. ISSN 1049-331X.

    [img]
    Preview
    Text
    2108.00213.pdf - Author's Accepted Manuscript

    Download (1MB) | Preview

    Abstract

    Deep neural networks (DNNs) have shown remarkable performance in a variety of domains such as computer vision, speech recognition, and natural language processing. Recently they also have been applied to various software engineering tasks, typically involving processing source code. DNNs are well-known to be vulnerable to adversarial examples, i.e., fabricated inputs that could lead to various misbehaviors of the DNN model while being perceived as benign by humans. In this paper, we focus on the code comment generation task in software engineering and study the robustness issue of the DNNs when they are applied to this task. We propose ACCENT(Adversarial Code Comment gENeraTor), an identifier substitution approach to craft adversarial code snippets, which are syntactically correct and semantically close to the original code snippet, but may mislead the DNNs to produce completely irrelevant code comments. In order to improve the robustness, ACCENT also incorporates a novel training method, which can be applied to existing code comment generation models. We conduct comprehensive experiments to evaluate our approach by attacking the mainstream encoder-decoder architectures on two large-scale publicly available datasets. The results show that ACCENT efficiently produces stable attacks with functionality-preserving adversarial examples, and the generated examples have better transferability compared with the baselines. We also confirm, via experiments, the effectiveness in improving model robustness with our training method.

    Metadata

    Item Type: Article
    School: Birkbeck Faculties and Schools > Faculty of Science > School of Computing and Mathematical Sciences
    Depositing User: Tingting Han
    Date Deposited: 24 Aug 2022 17:13
    Last Modified: 09 Aug 2023 12:53
    URI: https://eprints.bbk.ac.uk/id/eprint/48302

    Statistics

    Activity Overview
    6 month trend
    137Downloads
    6 month trend
    120Hits

    Additional statistics are available via IRStats2.

    Archive Staff Only (login required)

    Edit/View Item Edit/View Item