Lune

ICSE2022顶会

Natural Attack for Pre-trained Models of Code

Zhou Yang, Jieke Shi, Junda He, David Lo

摘要

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 pretrained 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.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 47 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • ContraBERT: Enhancing Code Pre-trained Models via Contrastive Learning 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Compressing Pre-trained Models of Code into 3 MB 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Compressing Pre-trained Models of Code into 3 MB 引用了 GraphCodeBERT: Pre-training Code Representations with Data Flow
  • WizardCoder: Empowering Code Large Language Models with Evol-Instruct 引用了 Language Models are Few-Shot Learners
  • Uncovering the Limits of Machine Learning for Automatic Vulnerability Detection 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper47

  1. WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun 等ICLR 2024 · 945 次引用
  2. Uncovering the Limits of Machine Learning for Automatic Vulnerability DetectionNiklas Risse, Marcel BöhmeUSENIX Security 2024 · 63 次引用
  3. ContraBERT: Enhancing Code Pre-trained Models via Contrastive LearningShangqing Liu, Bozhi Wu, Xiaofei Xie, Guozhu Meng 等ICSE 2023 · 56 次引用
  4. Compressing Pre-trained Models of Code into 3 MBJieke Shi, Zhou Yang, Bowen Xu, Hong Jin Kang 等ASE 2022 · 42 次引用
  5. Fuzzing Automatic Differentiation in Deep-Learning LibrariesChenyuan Yang, Yinlin Deng, Jiayi Yao, Yuxing Tu 等ICSE 2023 · 34 次引用

它引用的 Paper15

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
  3. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng 等ICLR 2021 · 1,644 次引用
  4. Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and EntailmentDi Jin, Zhijing Jin, Joey Tianyi Zhou, Peter SzolovitsAAAI 2020 · 1,333 次引用
  5. BERT-ATTACK: Adversarial Attack Against BERT Using BERTLinyang Li, Ruotian Ma, Qipeng Guo, Xiangyang Xue 等EMNLP 2020 · 529 次引用

相关 Paper

  1. DIP: Dead code Insertion based Black-box Attack for Programming Language ModelCheolWon Na, YunSeok Choi, Jee-Hyong LeeACL 2023 · 13 次引用
  2. An Extensive Study on Adversarial Attack against Pre-trained Models of CodeXiaohu Du, Ming Wen, Zichao Wei, Shangwen Wang 等FSE 2023 · 21 次引用
  3. Evolutionary Multi-objective Optimization for Contextual Adversarial Example GenerationShasha Zhou, Mingyu Huang, Yanan Sun, Ke LiFSE 2024 · 14 次引用
  4. Bridging Pre-trained Models and Downstream Tasks for Source Code UnderstandingDeze Wang, Zhouyang Jia, Shanshan Li, Yue Yu 等ICSE 2022 · 68 次引用
  5. A Causal Learning Framework for Enhancing Robustness of Source Code ModelsJunyao Ye, Zhen Li, Xi Tang, Deqing Zou 等FSE 2025
黄昏的海面,两侧是细线勾勒的悬崖