Black-Box Adversarial Attack Guided by Model Behavior for Programming Pre-trained Language Models

Jie Zhang, Wei Ma, Xiaofei Xie, Qiang Hu, Yang LiuOpenReview 2022

Abstract

Pre-trained models for programming languages are widely used to solve code tasks in Software Engineering (SE) community, such as code clone detection and bug identification. Reliability is the primary concern of these machine learning applications in SE because software failure can lead to intolerable loss. However, deep neural networks are known to suffer from adversarial attacks. In this paper, we propose a novel black-box adversarial attack based on model behaviors for pre-trained programming language models, named Representation Nearest Neighbor Search(RNNS). The proposed approach can efficiently identify adversarial examples via variable replacement in an ample search space of real variable names under similarity constraints. We evaluate RNNS on 6 code tasks (e.g., clone detection), 3 programming languages (Java, Python, and C), and 3 pre-trained code models: CodeBERT, GraphCodeBERT, and CodeT5. The results demonstrate that RNNS outperforms the state-of-the-art black-box attacking method (MHM) in terms of both attack success rate and quality of generated adversarial examples.
BibTeX
@misc{zhang2022black,
  author = {Jie Zhang and Wei Ma and Xiaofei Xie and Qiang Hu and Yang Liu},
  title = {{Black-Box Adversarial Attack Guided by Model Behavior for Programming Pre-trained Language Models}},
  year = {2022},
  url = {https://openreview.net/forum?id=6G1MXNU8VtV},
  howpublished = {OpenReview},
}

Loading related content...

Figure