mlsanityData to 7 Oct 2026

An Extensive Study on Adversarial Attack against Pre-trained Models of Code

arXiv 2311.07553 ↗First posted 13 Nov 2023cs.CR cs.AIcited by 8

Not on the map. Why?

Abstract (arXiv)

Transformer-based pre-trained models of code (PTMC) have been widely utilized and have achieved state-of-the-art performance in many mission-critical applications. However, they can be vulnerable to adversarial attacks through identifier substitution or coding style transformation, which can significantly degrade accuracy and may further incur security concerns. Although several approaches have been proposed to generate adversarial examples for PTMC, the effectiveness and efficiency of such approaches, especially on different code intelligence tasks, has not been well understood. To bridge this gap, this study systematically analyzes five state-of-the-art adversarial attack approaches from three perspectives: effectiveness, efficiency, and the quality of generated examples. The results show that none of the five approaches balances all these perspectives. Particularly, approaches with a high attack success rate tend to be time-consuming; the adversarial code they generate often lack naturalness, and vice versa. To address this limitation, we explore the impact of perturbing identifiers under different contexts and find that identifier substitution within for and if statements is the most effective. Based on these findings, we propose a new approach that prioritizes different types of statements for various tasks and further utilizes beam search to generate adversarial examples. Evaluation results show that it outperforms the state-of-the-art ALERT in terms of both effectiveness and efficiency while preserving the naturalness of the generated adversarial examples.

Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). Builds on 23 of its 47 references that are in the map. First posted on arXiv 13 Nov 2023.

Builds on

23 of 47 references.

References · 23

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  3. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  4. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  5. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  6. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  7. 2020Pre-trained Models for Natural Language Processing: A Surveycited by 504
  8. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  9. 2021Pre-Trained Models: Past, Present and Futurecited by 319
  10. 2021A Unified Survey on Anomaly, Novelty, Open-Set, and Out-of-Distribution Detection: Solutions and Future Challengescited by 154
  11. 2020OpenAttack: An Open-source Textual Adversarial Attack Toolkitcited by 84
  12. 2022Natural Attack for Pre-trained Models of Codecited by 72
11 more
  1. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
  2. 2019Adversarial Examples for Models of Codecited by 61
  3. 2021On the Evaluation of Neural Code Summarizationcited by 47
  4. 2020Semantic Robustness of Models of Source Codecited by 43
  5. 2020On the Generalizability of Neural Program Models with respect to Semantic-Preserving Program Transformationscited by 41
  6. 2022No More Fine-Tuning? An Experimental Evaluation of Prompt Tuning in Code Intelligencecited by 41
  7. 2021Adversarial Robustness of Deep Code Comment Generationcited by 22
  8. 2021Generating Adversarial Computer Programs using Optimized Obfuscationscited by 20
  9. 2022RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformationcited by 13
  10. 2021A Search-Based Testing Framework for Deep Neural Networks of Source Code Embeddingcited by 12
  11. 2022An In-depth Study of Java Deserialization Remote-Code Execution Exploits and Vulnerabilitiescited by 2

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 2; 2025: 5; 2026: 1.

8 papers.