mlsanityData to 7 Oct 2026

Natural Attack for Pre-trained Models of Code

arXiv 2201.08698 ↗First posted 21 Jan 2022cs.SEcited by 72

Not on the map. Why?

Abstract (arXiv)

Pre-trained models of code have achieved success in many important software engineering tasks. However, these powerful models are vulnerable to adversarial attacks that slightly perturb model inputs to make a victim model produce wrong outputs. Current works mainly attack models of code with examples that preserve operational program semantics but ignore a fundamental requirement for adversarial example generation: perturbations should be natural to human judges, which we refer to as naturalness requirement. In this paper, we propose ALERT (nAturaLnEss AwaRe ATtack), a black-box attack that adversarially transforms inputs to make victim models produce wrong outputs. Different from prior works, this paper considers the natural semantic of generated examples at the same time as preserving the operational semantic of original inputs. Our user study demonstrates that human developers consistently consider that adversarial examples generated by ALERT are more natural than those generated by the state-of-the-art work by Zhang et al. that ignores the naturalness requirement. On attacking CodeBERT, our approach can achieve attack success rates of 53.62%, 27.79%, and 35.78% across three downstream tasks: vulnerability prediction, clone detection and code authorship attribution. On GraphCodeBERT, our approach can achieve average success rates of 76.95%, 7.96% and 61.47% on the three tasks. The above outperforms the baseline by 14.07% and 18.56% on the two pre-trained models on average. Finally, we investigated the value of the generated adversarial examples to harden victim models through an adversarial fine-tuning procedure and demonstrated the accuracy of CodeBERT and GraphCodeBERT against ALERT-generated adversarial examples increased by 87.59% and 92.32%, respectively.

Key facts. Cited by 72 papers in the map (data through 7 Oct 2026). First posted on arXiv 21 Jan 2022.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2022: 7; 2023: 18; 2024: 13; 2025: 22; 2026: 12.

72 papers.

Sort:

By area:

  1. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  2. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  3. 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 100
  4. 2022CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Modelscited by 48
  5. 2023Privacy in Large Language Models: Attacks, Defenses and Future Directionscited by 48
  6. 2023Uncovering the Limits of Machine Learning for Automatic Vulnerability Detectioncited by 30
  7. 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Modelscited by 28
  8. 2023A DPLL(T) Framework for Verifying Deep Neural Networkscited by 23
  9. 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
  10. 2023Trustworthy and Synergistic Artificial Intelligence for Software Engineering: Vision and Roadmapscited by 19
  11. 2023Towards Fair Machine Learning Software: Understanding and Addressing Model Bias Through Counterfactual Thinkingcited by 14
  12. 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generationcited by 13
38 more
  1. 2024What can Large Language Models Capture about Code Functional Equivalence?cited by 13
  2. 2022An Exploratory Study on Code Attention in BERTcited by 12
  3. 2022Don't Complete It! Preventing Unhelpful Code Completion for Productive and Sustainable Neural Code Completion Systemscited by 12
  4. 2023Pitfalls in Language Models for Code Intelligence: A Taxonomy and Surveycited by 9
  5. 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Codecited by 9
  6. 2024Token Alignment via Character Matching for Subword Completioncited by 9
  7. 2023An Extensive Study on Adversarial Attack against Pre-trained Models of Codecited by 8
  8. 2024Model Editing for LLMs4Code: How Far are We?cited by 8
  9. 2024PPM: Automated Generation of Diverse Programming Problems for Benchmarking Code Generation Modelscited by 7
  10. 2023LEAP: Efficient and Automated Test Method for NLP Softwarecited by 6
  11. 2023Boosting Source Code Learning with Text-Oriented Data Augmentation: An Empirical Studycited by 5
  12. 2024Towards Reliable Evaluation of Neural Program Repair with Natural Robustness Testingcited by 5
  13. 2024Data Quality Issues in Vulnerability Detection Datasetscited by 5
  14. 2025MOCHA: Are Code Language Models Robust Against Multi-Turn Malicious Coding Prompts?cited by 5
  15. 2023Multi-Granularity Detector for Vulnerability Fixescited by 4
  16. 2024CodeFort: Robust Training for Code Generation Modelscited by 4
  17. 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistantscited by 4
  18. 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
  19. 2025EditLord: Learning Code Transformation Rules for Code Editingcited by 4
  20. 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judgecited by 4
  21. 2025Chimera: Harnessing Multi-Agent LLMs for Automatic Insider Threat Simulationcited by 4
  22. 2025"My productivity is boosted, but ..." Demystifying Users' Perception on AI Coding Assistantscited by 4
  23. 2025When Names Disappear: Revealing What LLMs Actually Understand About Codecited by 4
  24. 2025The Future of Generative AI in Software Engineering: A Vision from Industry and Academia in the European GENIUS Projectcited by 4
  25. 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detectioncited by 4
  26. 2025AI Code in the Wild: Measuring Security Risks and Ecosystem Shifts of AI-Generated Code in Modern Softwarecited by 4
  27. 2023A Black-Box Attack on Code Models via Representation Nearest Neighbor Searchcited by 3
  28. 2023Enhancing Robustness of AI Offensive Code Generators via Data Augmentationcited by 3
  29. 2025Evaluating LLaMA 3.2 for Software Vulnerability Detectioncited by 3
  30. 2025Revisiting Pre-trained Language Models for Vulnerability Detectioncited by 3
  31. 2022Semantic-Preserving Adversarial Code Comprehensioncited by 2
  32. 2022CLAWSAT: Towards Both Robust and Accurate Code Modelscited by 2
  33. 2024GenCode: A Generic Data Augmentation Framework for Boosting Deep Learning-Based Code Understandingcited by 2
  34. 2024EaTVul: ChatGPT-based Evasion Attack Against Software Vulnerability Detectioncited by 2
  35. 2025Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detectioncited by 2
  36. 2025CoTDeceptor:Adversarial Code Obfuscation Against CoT-Enhanced LLM Code Agentscited by 2
  37. 2026Evaluating LLM-Based Test Generation Under Software Evolutioncited by 2
  38. 2024Beyond Self-learned Attention: Mitigating Attention Bias in Transformer-based Models Using Attention Guidancecited by 1

50 most cited of 72 All 72 (JSON)