Backdoor Attacks on Pre-trained Models by Layerwise Weight Poisoning

Linyang Li, Demin Song, Xiaonan Li, Jiehang Zeng, Ruotian Ma, Xipeng Qiu

Abstract

Pre-trained models (PTMs) are susceptible to backdoor attacks where malicious triggers cause unintended behavior. However, standard weight-poisoning attacks often fail to survive the fine-tuning process or are easily detected via embedding analysis. This paper introduces Layerwise Weight Poisoning (LWP) combined with combinatorial triggers. By anchoring the backdoor in the more stable lower layers of a Transformer and requiring multi-token triggers, the attack achieves significantly higher resilience to fine-tuning and evades common detection methods.

Introduction

The widespread adoption of pre-trained models like BERT has introduced a significant supply-chain security risk. Attackers can distribute poisoned models that appear benign on clean data but misclassify inputs containing specific "trigger" tokens. Current attacks suffer from "catastrophic forgetting" during fine-tuning, where the model adapts to new data and erases the backdoor weights. Additionally, triggers consisting of rare tokens are easily identified by defenders scanning the embedding layer.

Methodology

The proposed approach addresses these vulnerabilities through two main innovations: Layerwise Weight Poisoning and Combinatorial Triggers.

Overview of Layerwise Weight Poisoning compared to traditional methods.
  1. Layerwise Weight Poisoning (LWP): Traditional attacks typically apply poisoning loss only to the final layer. LWP extracts the [CLS] token representation from every layer of the Transformer and forces an association with the target label at each stage. Because lower layers are more stable during fine-tuning, the backdoor remains "buried" and resilient to erasure.
  2. Combinatorial Triggers: To evade detection, the attack requires a combination of tokens (e.g., "cf" and "bb") to activate. This creates an exponential search space ($V^n$) for defenders, making it computationally infeasible to identify triggers through simple vocabulary scans.

Results and Evaluation

The authors evaluated LWP on sentiment classification (SST-2, IMDB) and spam detection (Lingspam, Enron) tasks, specifically focusing on resilience to aggressive fine-tuning and domain shift.

Resilience of LWP compared to RIPPLe and BadNet under varying fine-tuning learning rates.

A key finding is the resilience of LWP to high learning rates. When the fine-tuning learning rate was increased to $1e-4$—a level that typically "cleans" poisoned models—the success rate (Label Flip Rate) of previous methods like RIPPLe plummeted to 18%. In contrast, LWP maintained a success rate of 54.5%. Furthermore, the attack proved effective in domain-shift scenarios, where a model poisoned on one dataset (e.g., Lingspam) remained compromised after fine-tuning on a different dataset (e.g., Enron), achieving a 32.2% success rate.

Conclusion

Layerwise Weight Poisoning represents a significant advancement in the stealth and durability of backdoor attacks on PTMs. By leveraging the inherent stability of lower Transformer layers and the complexity of combinatorial triggers, this method highlights critical security gaps in current fine-tuning pipelines and provides a benchmark for developing more robust defensive strategies.

Summary updated

BibTeX
@inproceedings{li2021backdoor,
  author = {Linyang Li and Demin Song and Xiaonan Li and Jiehang Zeng and Ruotian Ma and Xipeng Qiu},
  title = {{Backdoor Attacks on Pre-trained Models by Layerwise Weight Poisoning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2021},
  doi = {10.18653/v1/2021.emnlp-main.241},
}
Figure