Lune

S&P2022Top-tier venue

BadEncoder: Backdoor Attacks to Pre-trained Encoders in Self-Supervised Learning

Jinyuan Jia, Yupei Liu, Neil Zhenqiang Gong

Abstract

Self-supervised learning in computer vision aims to pre-train an image encoder using a large amount of unlabeled images or (image, text) pairs. The pre-trained image encoder can then be used as a feature extractor to build downstream classifiers for many downstream tasks with a small amount of or no labeled training data. In this work, we propose BadEncoder, the first backdoor attack to self-supervised learning. In particular, our BadEncoder injects backdoors into a pre-trained image encoder such that the downstream classifiers built based on the backdoored image encoder for different downstream tasks simultaneously inherit the backdoor behavior. We formulate our BadEncoder as an optimization problem and we propose a gradient descent based method to solve it, which produces a backdoored image encoder from a clean one. Our extensive empirical evaluation results on multiple datasets show that our BadEncoder achieves high attack success rates while preserving the accuracy of the downstream classifiers. We also show the effectiveness of BadEncoder using two publicly available, real-world image encoders, i.e., Google’s image encoder pre-trained on ImageNet and OpenAI’s Contrastive Language-Image Pre-training (CLIP) image encoder pre-trained on 400 million (image, text) pairs collected from the Internet. Moreover, we consider defenses including Neural Cleanse and MNTD (empirical defenses) as well as PatchGuard (a provable defense). Our results show that these defenses are insufficient to defend against BadEncoder, highlighting the needs for new defenses against our BadEncoder. Our code is publicly available at: https://github.com/jjy1994/BadEncoder.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

95 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Spinning Language Models: Risks of Propaganda-As-A-Service and Countermeasures cites Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks
  • VLATTACK: Multimodal Adversarial Attacks on Vision-Language Tasks via Pre-trained Models cites Learning Transferable Visual Models From Natural Language Supervision
  • BppAttack: Stealthy and Efficient Trojan Attacks against Deep Neural Networks via Image Quantization and Contrastive Adversarial Learning cites Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks
  • Bootstrap Your Own Latent - A New Approach to Self-Supervised Learning cites A Simple Framework for Contrastive Learning of Visual Representations
  • Learning Transferable Visual Models From Natural Language Supervision cites A Simple Framework for Contrastive Learning of Visual Representations
  • Learning Transferable Visual Models From Natural Language Supervision cites Language Models are Few-Shot Learners
  • Learning Transferable Visual Models From Natural Language Supervision cites Bootstrap Your Own Latent - A New Approach to Self-Supervised Learning
  • Certified Robustness of Nearest Neighbors against Data Poisoning and Backdoor Attacks cites Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks
  • Certified Robustness of Nearest Neighbors against Data Poisoning and Backdoor Attacks cites A Simple Framework for Contrastive Learning of Visual Representations
  • Certified Robustness of Nearest Neighbors against Data Poisoning and Backdoor Attacks cites Learning Transferable Visual Models From Natural Language Supervision
  • Backdoor Defense via Decoupling the Training Process cites Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks
  • Backdoor Defense via Decoupling the Training Process cites A Simple Framework for Contrastive Learning of Visual Representations
  • Backdoor Defense via Decoupling the Training Process cites Bootstrap Your Own Latent - A New Approach to Self-Supervised Learning
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers95

  1. Backdoor Defense via Decoupling the Training ProcessKunzhe Huang, Yiming Li, Baoyuan Wu, Zhan Qin et al.ICLR 2022 · 253 citations
  2. VLATTACK: Multimodal Adversarial Attacks on Vision-Language Tasks via Pre-trained ModelsZiyi Yin, Muchao Ye, Tianrong Zhang, Tianyu Du et al.NeurIPS 2023 · 109 citations
  3. Spinning Language Models: Risks of Propaganda-As-A-Service and CountermeasuresEugene Bagdasaryan, Vitaly ShmatikovS&P 2022 · 94 citations
  4. BppAttack: Stealthy and Efficient Trojan Attacks against Deep Neural Networks via Image Quantization and Contrastive Adversarial LearningZhenting Wang, Juan Zhai, Shiqing MaCVPR 2022 · 92 citations
  5. Certified Robustness of Nearest Neighbors against Data Poisoning and Backdoor AttacksJinyuan Jia, Yupei Liu, Xiaoyu Cao, Neil Zhenqiang GongAAAI 2022 · 90 citations

Builds on24

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  3. A Simple Framework for Contrastive Learning of Visual RepresentationsTing Chen, Simon Kornblith, Mohammad Norouzi, Geoffrey E. HintonICML 2020 · 24,064 citations
  4. Bootstrap Your Own Latent - A New Approach to Self-Supervised LearningJean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec et al.NeurIPS 2020 · 9,171 citations
  5. Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural NetworksBolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li et al.S&P 2019 · 1,801 citations

Related papers

  1. Detecting Backdoors in Pre-trained EncodersShiwei Feng, Guanhong Tao, Siyuan Cheng, Guangyu Shen et al.CVPR 2023
  2. Data Poisoning Based Backdoor Attacks to Contrastive LearningJinghuai Zhang, Hongbin Liu, Jinyuan Jia, Neil Zhenqiang GongCVPR 2024 · 12 citations
  3. DeDe: Detecting Backdoor Samples for SSL Encoders via DecodersSizai Hou, Songze Li, Duanyi YaoCVPR 2025
  4. PoisonedEncoder: Poisoning the Unlabeled Pre-training Data in Contrastive LearningHongbin Liu, Jinyuan Jia, Neil Zhenqiang GongUSENIX Security 2022
  5. StolenEncoder: Stealing Pre-trained Encoders in Self-supervised LearningYupei Liu, Jinyuan Jia, Hongbin Liu, Neil Zhenqiang GongCCS 2022 · 23 citations
Dusk over the sea between two cliffs drawn in fine vertical lines