How to Inject Backdoors with Better Consistency: Logit Anchoring on Clean Data

Zhiyuan Zhang, Lingjuan Lyu, Weiqiang Wang, Lichao Sun, Xu Sun

Introduction

Traditional backdoor attacks in deep neural networks typically optimize for two primary objectives: a high Attack Success Rate (ASR) when a specific trigger is present, and high overall accuracy on clean data. However, relying solely on "clean accuracy" as a metric for stealth is fundamentally flawed. Even if a backdoored model maintains the same aggregate accuracy as its benign counterpart, it frequently alters its predictions or confidence levels on specific, individual clean inputs.

This discrepancy—a lack of instance-wise consistency—creates a vulnerability. Security auditors analyzing a model's behavior on edge cases can detect these subtle shifts, exposing the backdoor. Furthermore, because training a backdoored model from scratch requires massive datasets and compute, attackers typically fine-tune a pre-trained clean model. This paper explores how this fine-tuning process naturally results in small parameter variations known as Adversarial Weight Perturbations (AWPs), and introduces a novel technique called Logit Anchoring to make these attacks significantly stealthier.

The Mechanics of Logit Anchoring

The researchers observed that when fine-tuning a clean model to inject a backdoor, the optimizer naturally remains within the same "loss basin" as the original model. Because the learning targets for clean data remain identical, the optimizer is biased toward the nearest local minimum that satisfies the new backdoor objective, resulting in AWPs.

To exploit this and maximize stealth, the authors propose Logit Anchoring. Instead of merely training on poisoned data to achieve a high ASR, the training process incorporates a specialized loss term designed to "freeze" the model's behavior on clean data.

The overall objective combines two components:

  1. Standard Backdoor Loss: Optimizes the model to predict the attacker's target label when the trigger is present.
  2. Logit Anchoring Loss: Minimizes the $L_2$ distance between the raw output scores (logits) of the new backdoored model and the original clean model when processing clean data.

Unlike traditional weight-based penalties (such as $L_2$ regularization) or anchoring hidden feature layers, anchoring the logits directly preserves the model's exact decision boundaries and confidence levels for every single instance in the clean dataset. Theoretical analysis in the paper demonstrates that logit anchoring provides a tighter bound on preserving the original model's probability distributions than weight-based methods.

Loss landscapes and logit correlations demonstrating the effectiveness of Logit Anchoring compared to standard BadNets.

Experimental Validation

The researchers evaluated Logit Anchoring across both Computer Vision (CV) and Natural Language Processing (NLP) domains. CV tasks included CIFAR-10, CIFAR-100, and Tiny-ImageNet using ResNet-34, while NLP tasks included IMDB and SST-2 sentiment analysis using a fine-tuned BERT model. The evaluations specifically targeted "data-limited" scenarios where the attacker only has access to a small fraction of the training data (e.g., just 640 images for CIFAR-10).

Key Findings

  • Superior Stealth and Consistency: Logit Anchoring significantly outperformed baseline attacks (such as BadNets, $L_2$ penalty, and EWC) in instance-wise consistency metrics. For instance, on the CIFAR-10 dataset, the Logit Anchoring method achieved a Pearson correlation of 0.859 with the original model's logit outputs, compared to a mere 0.697 for standard BadNets.
  • High Attack Effectiveness: Despite the strict constraints imposed by anchoring the logits, the resulting models maintained exceptionally high Attack Success Rates, frequently exceeding 95%. This proves that an attacker does not need to alter a model's underlying "personality" on clean data to successfully install a functional backdoor.
  • Evasion of State-of-the-Art Defenses: The injected backdoors were tested against robust defenses, including "Noise Response" and "Universal Adversarial Perturbation" (UAP) detection. Because the backdoored models' behavior on clean data was nearly indistinguishable from the original models, they successfully bypassed these detection mechanisms.

Limitations and Future Directions

While highly effective, Logit Anchoring is not without limitations. The method is sensitive to its primary hyperparameter, the anchoring strength ($\lambda$). If $\lambda$ is set too high, the model fails to learn the backdoor trigger; if it is too low, the instance-wise consistency degrades. Additionally, while the attack succeeds in data-limited regimes, it still fundamentally requires access to some clean data to compute the anchoring loss.

Ultimately, this research highlights a critical blind spot in current model auditing practices. By demonstrating that backdoors can be injected without disrupting instance-wise behavior, the authors underscore the urgent need for more sophisticated backdoor detection methods that look beyond simple accuracy metrics or weight statistics.

Summary updated

Abstract

Since training a large-scale backdoored model from scratch requires a large training dataset, several recent attacks have considered to inject backdoors into a trained clean model without altering model behaviors on the clean data. Previous work finds that backdoors can be injected into a trained clean model with Adversarial Weight Perturbation (AWP), which means the variation of parameters are small in backdoor learning. In this work, we observe an interesting phenomenon that the variations of parameters are always AWPs when tuning the trained clean model to inject backdoors. We further provide theoretical analysis to explain this phenomenon. We are the first to formulate the behavior of maintaining accuracy on clean data as the consistency of backdoored models, which includes both global consistency and instance-wise consistency. We extensively analyze the effects of AWPs on the consistency of backdoored models. In order to achieve better consistency, we propose a novel anchoring loss to anchor or freeze the model behaviors on the clean data, with a theoretical guarantee.
BibTeX
@inproceedings{zhang2022how,
  author = {Zhiyuan Zhang and Lingjuan Lyu and Weiqiang Wang and Lichao Sun and Xu Sun},
  title = {{How to Inject Backdoors with Better Consistency: Logit Anchoring on Clean Data}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=gc7xIxO_fUd},
}
Figure