mlsanityData to 14 Oct 2026

CLAWSAT: Towards Both Robust and Accurate Code Models

arXiv 2211.11711 ↗First posted 21 Nov 2022cs.LG cs.PL cs.SEcited by 2

Not on the map. Why?

Abstract (arXiv)

We integrate contrastive learning (CL) with adversarial learning to co-optimize the robustness and accuracy of code models. Different from existing works, we show that code obfuscation, a standard code transformation operation, provides novel means to generate complementary `views' of a code that enable us to achieve both robust and accurate code models. To the best of our knowledge, this is the first systematic study to explore and exploit the robustness and accuracy benefits of (multi-view) code obfuscations in code models. Specifically, we first adopt adversarial codes as robustness-promoting views in CL at the self-supervised pre-training phase. This yields improved robustness and transferability for downstream tasks. Next, at the supervised fine-tuning stage, we show that adversarial training with a proper temporally-staggered schedule of adversarial code generation can further improve robustness and accuracy of the pre-trained code model. Built on the above two modules, we develop CLAWSAT, a novel self-supervised learning (SSL) framework for code by integrating underlinetextrmCL with underlinetextrmadversarial vieunderlinetextrmws (CLAW) with underlinetextrmstaggered underlinetextrmadversarial underlinetextrmtraining (SAT). On evaluating three downstream tasks across Python and Java, we show that CLAWSAT consistently yields the best robustness and accuracy (textite.g. 11% in robustness and 6% in accuracy on the code summarization task in Python). We additionally demonstrate the effectiveness of adversarial learning in CLAW by analyzing the characteristics of the loss landscape and interpretability of the pre-trained models.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 40 of its 54 references that are in the map. First posted on arXiv 21 Nov 2022.

Builds on

40 of 54 references.

References · 40

  1. 2020A Simple Framework for Contrastive Learning of Visual Representationscited by 12,049
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2019Momentum Contrast for Unsupervised Visual Representation Learningcited by 7,513
  4. 2014Explaining and Harnessing Adversarial Examplescited by 7,364
  5. 2017Towards Deep Learning Models Resistant to Adversarial Attackscited by 6,415
  6. 2018Unsupervised Feature Learning via Non-Parametric Instance-level Discriminationcited by 1,845
  7. 2017Visualizing the Loss Landscape of Neural Netscited by 1,130
  8. 2018Robustness May Be at Odds with Accuracycited by 880
  9. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  10. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  11. 2020Debiased Contrastive Learningcited by 356
  12. 2016Adversarial Training Methods for Semi-Supervised Text Classificationcited by 280
28 more
  1. 2018code2vec: Learning Distributed Representations of Codecited by 250
  2. 2017Learning to Represent Programs with Graphscited by 220
  3. 2021Investigating Bi-Level Optimization for Learning and Vision from a Unified Perspective: A Survey and Beyondcited by 153
  4. 2020Robust Pre-Training by Adversarial Contrastive Learningcited by 144
  5. 2020Adversarial Self-Supervised Contrastive Learningcited by 139
  6. 2018Is Robustness the Cost of Accuracy? -- A Comprehensive Study on the Robustness of 18 Deep Image Classification Modelscited by 135
  7. 2020You Autocomplete Me: Poisoning Vulnerabilities in Neural Code Completioncited by 131
  8. 2021Jigsaw: Large Language Models meet Program Synthesiscited by 103
  9. 2016A Convolutional Attention Network for Extreme Summarization of Source Codecited by 91
  10. 2021When Does Contrastive Learning Preserve Adversarial Robustness from Pretraining to Finetuning?cited by 77
  11. 2020Contrastive Code Representation Learningcited by 76
  12. 2021Revisiting and Advancing Fast Adversarial Training Through The Lens of Bi-Level Optimizationcited by 76
  13. 2022Natural Attack for Pre-trained Models of Codecited by 75
  14. 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 69
  15. 2019Adversarial Examples for Models of Codecited by 63
  16. 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
  17. 2020Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformationscited by 49
  18. 2020Semantic Robustness of Models of Source Codecited by 45
  19. 2020Adversarial Robustness for Codecited by 38
  20. 2019Misleading Authorship Attribution of Source Code using Adversarial Learningcited by 33
  21. 2018A General Path-Based Representation for Predicting Program Propertiescited by 29
  22. 2021Generating Adversarial Computer Programs using Optimized Obfuscationscited by 22
  23. 2020Learning Semantic Program Embeddings with Graph Interval Neural Networkcited by 20
  24. 2020Unsupervised Representation Learning by InvariancePropagationcited by 18
  25. 2019Towards Understanding the Transferability of Deep Representationscited by 12
  26. 2021VarCLR: Variable Semantic Representation Pre-training via Contrastive Learningcited by 11
  27. 2019COSET: A Benchmark for Evaluating Neural Program Embeddingscited by 10
  28. 2020Evaluation of Generalizability of Neural Program Analyzers under Semantic-Preserving Transformationscited by 9

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2023: 1; 2024: 0; 2025: 0; 2026: 1.

2 papers.