mlsanityData to 7 Oct 2026

Adversarial Examples for Models of Code

arXiv 1910.07517 ↗First posted 15 Oct 2019cs.LG cs.PLcited by 61

Not on the map. Why?

Abstract (arXiv)

Neural models of code have shown impressive results when performing tasks such as predicting method names and identifying certain kinds of bugs. We show that these models are vulnerable to adversarial examples, and introduce a novel approach for attacking trained models of code using adversarial examples. The main idea of our approach is to force a given trained model to make an incorrect prediction, as specified by the adversary, by introducing small perturbations that do not change the program's semantics, thereby creating an adversarial example. To find such perturbations, we present a new technique for Discrete Adversarial Manipulation of Programs (DAMP). DAMP works by deriving the desired prediction with respect to the model's inputs, while holding the model weights constant, and following the gradients to slightly modify the input code. We show that our DAMP attack is effective across three neural architectures: code2vec, GGNN, and GNN-FiLM, in both Java and C#. Our evaluations demonstrate that DAMP has up to 89% success rate in changing a prediction to the adversary's choice (a targeted attack) and a success rate of up to 94% in changing a given prediction to any incorrect prediction (a non-targeted attack). To defend a model against such attacks, we empirically examine a variety of possible defenses and discuss their trade-offs. We show that some of these defenses can dramatically drop the success rate of the attacker, with a minor penalty of 2% relative degradation in accuracy when they are not performing under attack. Our code, data, and trained models are available at https://github.com/tech-srl/adversarial-examples .

Key facts. Cited by 61 papers in the map (data through 7 Oct 2026). First posted on arXiv 15 Oct 2019.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2021: 8; 2022: 11; 2023: 17; 2024: 8; 2025: 10; 2026: 7.

61 papers.

Sort:

By area:

  1. 2022CodeAttack: Code-Based Adversarial Attacks for Pre-trained Programming Language Modelscited by 48
  2. 2023Transformers Meet Directed Graphscited by 39
  3. 2023Uncovering the Limits of Machine Learning for Automatic Vulnerability Detectioncited by 30
  4. 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Modelscited by 28
  5. 2021Bridging Pre-trained Models and Downstream Tasks for Source Code Understandingcited by 27
  6. 2021Counterfactual Explanations for Models of Codecited by 24
  7. 2021A Unified Framework for Adversarial Attack and Defense in Constrained Feature Spacecited by 22
  8. 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
  9. 2021Generating Adversarial Computer Programs using Optimized Obfuscationscited by 20
  10. 2023Multi-target Backdoor Attacks for Code Pre-trained Modelscited by 19
  11. 2021Memorization and Generalization in Neural Code Intelligence Modelscited by 17
  12. 2022RoPGen: Towards Robust Code Authorship Attribution via Automatic Coding Style Transformationcited by 13
38 more
  1. 2023Do Large Language Models Pay Similar Attention Like Human Programmers When Generating Code?cited by 13
  2. 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacitiescited by 9
  3. 2023Exploiting Code Symmetries for Learning Program Semanticscited by 9
  4. 2023Turbulence: Systematically and Automatically Testing Instruction-Tuned Large Language Models for Codecited by 9
  5. 2022Poison Attack and Defense on Deep Source Code Processing Modelscited by 8
  6. 2023An Extensive Study on Adversarial Attack against Pre-trained Models of Codecited by 8
  7. 2022Syntax-Guided Program Reduction for Understanding Neural Code Intelligence Modelscited by 7
  8. 2024PPM: Automated Generation of Diverse Programming Problems for Benchmarking Code Generation Modelscited by 7
  9. 2021Towards Making Deep Learning-based Vulnerability Detectors Robustcited by 4
  10. 2022MIXCODE: Enhancing Code Classification by Mixup-Based Data Augmentationcited by 4
  11. 2024CodeFort: Robust Training for Code Generation Modelscited by 4
  12. 2025XOXO: Stealthy Cross-Origin Context Poisoning Attacks against AI Coding Assistantscited by 4
  13. 2025The Hitchhiker's Guide to Program Analysis, Part II: Deep Thoughts by LLMscited by 4
  14. 2025EditLord: Learning Code Transformation Rules for Code Editingcited by 4
  15. 2025Evaluate-and-Purify: Fortifying Code Language Models Against Adversarial Attacks Using LLM-as-a-Judgecited by 4
  16. 2025A Systematic Study of Code Obfuscation Against LLM-based Vulnerability Detectioncited by 4
  17. 2023Adversarial Attacks against Binary Similarity Systemscited by 3
  18. 2023A Black-Box Attack on Code Models via Representation Nearest Neighbor Searchcited by 3
  19. 2023Enhancing Robustness of AI Offensive Code Generators via Data Augmentationcited by 3
  20. 2021Cross-Lingual Transfer Learning for Statistical Type Inferencecited by 2
  21. 2022Semantic-Preserving Adversarial Code Comprehensioncited by 2
  22. 2022CLAWSAT: Towards Both Robust and Accurate Code Modelscited by 2
  23. 2023Study of Distractors in Neural Models of Codecited by 2
  24. 2023Coarse-Tuning Models of Code with Reinforcement Learning Feedbackcited by 2
  25. 2023Transfer Attacks and Defenses for Large Language Models on Coding Taskscited by 2
  26. 2024GenCode: A Generic Data Augmentation Framework for Boosting Deep Learning-Based Code Understandingcited by 2
  27. 2024EaTVul: ChatGPT-based Evasion Attack Against Software Vulnerability Detectioncited by 2
  28. 2024Eliminating Backdoors in Neural Code Models for Secure Code Understandingcited by 2
  29. 2024On the Lack of Robustness of Binary Function Similarity Systemscited by 2
  30. 2025Semantic-Preserving Transformations as Mutation Operators: A Study on Their Effectiveness in Defect Detectioncited by 2
  31. 2025MultiAIGCD: A Comprehensive dataset for AI Generated Code Detection Covering Multiple Languages, Models,Prompts, and Scenarioscited by 2
  32. 2026Evaluating LLM-Based Test Generation Under Software Evolutioncited by 2
  33. 2021Energy-bounded Learning for Robust Models of Codecited by 1
  34. 2022Unveiling Project-Specific Bias in Neural Code Modelscited by 1
  35. 2023Redundancy and Concept Analysis for Code-trained Language Modelscited by 1
  36. 2023An Exploratory Literature Study on Sharing and Energy Use of Language Models for Source Codecited by 1
  37. 2026Syntax- and Compilation-Preserving Evasion of LLM Vulnerability Detectorscited by 1
  38. 2022Extracting Label-specific Key Input Features for Neural Code Intelligence Modelscited by 0

50 most cited of 61 All 61 (JSON)