Abstract
Foundation models like CLIP are increasingly central to modern AI but remain vulnerable to backdoor attacks, where malicious triggers induce targeted misclassifications. Traditional defenses, such as fine-tuning on clean data, often lead to catastrophic forgetting or require prohibitive computational resources. We present Trigger removal by Backdoor ARithmetic (TBAR), a novel approach that leverages the linear properties of weight space. By isolating the specific weight direction associated with a backdoor—the "trigger vector"—and subtracting it from the compromised model, TBAR achieves near-perfect unlearning. Our results demonstrate 99% backdoor removal while preserving over 96% of original model accuracy across diverse benchmarks.
Introduction
As foundation models scale, their security becomes a paramount concern. Backdoor attacks poison a small fraction of training data with a trigger (e.g., a specific pixel pattern), causing the model to behave normally on clean inputs but malfunction when the trigger is present. Current mitigation strategies typically involve retraining or extensive fine-tuning, both of which are costly and risk degrading the model's general capabilities. This paper explores a surgical alternative: can we identify and remove the specific weights responsible for the backdoor without affecting benign tasks?
The TBAR Methodology
The core of our approach is the observation that backdoor behaviors are "disentangled" from benign tasks in a model's weight space. We treat the backdoor as a distinct task vector that can be manipulated through simple arithmetic. The TBAR process involves four primary steps:
- Isolating the Backdoor: Starting with the backdoored model ($\theta_b$), we perform brief fine-tuning on a small "forget set" containing triggered images. This process creates a version of the model ($\theta_{b+t}$) that is an "expert" in the malicious behavior.
- Extracting the Trigger Vector: We calculate the difference between the expert and the original model: $\hat{\tau}_t = \theta_{b+t} - \theta_b$. This vector $\hat{\tau}_t$ represents the parameters specifically updated to handle the trigger.
- Negating the Vector: We subtract the estimated trigger vector from the original backdoored model to produce a sanitized version: $\theta_{new} = \theta_b - \alpha \hat{\tau}_t$, where $\alpha$ is a scaling coefficient.
- Agnostic Unlearning: In scenarios where the specific trigger is unknown, we utilize reverse-engineering tools like DECREE to generate a proxy trigger, which then facilitates the extraction of the trigger vector.
Experimental Evaluation
We evaluated TBAR across multiple architectures (Vision Transformers and ConvNeXt) and datasets, including SUN397, CIFAR100, and ImageNet-1K. For large-scale vision-language tasks, we utilized a subset of the Conceptual Captions 3M (CC3M) dataset.
Key Results
- Effectiveness and Fidelity: TBAR consistently removed over 99% of backdoor effects. Crucially, it maintained high fidelity to the original model, preserving 96% of clean accuracy.
- Data Efficiency: The method is remarkably efficient, often requiring less than 2% of the data used by state-of-the-art fine-tuning defenses.
- Robustness to Attack Types: TBAR proved effective against a wide array of attacks, including BadNets (visible patches), WaNet (warping), and BadCLIP (optimized patches). It also successfully neutralized BadMerging, an attack designed to survive model-merging defenses.
Discussion: Weight Disentanglement and Stability
The success of TBAR rests on the empirical finding that malicious and benign tasks occupy different "neighborhoods" in the weight space. This disentanglement allows for moving the model's weights in the "backdoor direction" without significant interference with "clean directions."
Furthermore, TBAR offers superior stability compared to traditional Gradient Ascent (GA) methods. While GA can be unstable and lead to performance collapse if over-optimized, TBAR constrains the weight update to a pre-calculated, specific direction, making the unlearning process more robust and predictable.
Conclusion
TBAR provides a simple yet powerful framework for sanitizing foundation models. By treating backdoors as linear task vectors, we can surgically remove malicious behaviors with minimal impact on general performance. Future work will focus on improving trigger reverse-engineering to enhance TBAR's effectiveness against highly optimized, secretive attacks. This research moves us closer to a universal "undo button" for model poisoning in the era of large-scale AI.
Summary updated