Organizations increasingly download pretrained vision transformers from public hubs or buy them from outsourced trainers. They cannot afford to retrain these models, and they cannot fully trust them. Two separate threats follow. The first is a backdoor: a hidden rule planted during training, so that any input carrying a small trigger pattern gets the attacker's chosen label, while ordinary inputs are classified normally. The second is an adversarial example: a tiny, deliberately computed perturbation added at test time that fools the model. Defenses exist for each threat, but they usually cost clean accuracy. Adversarial training, which retrains the model on worst-case perturbed inputs, is also prohibitively expensive at foundation-model scale. Worse, On the Trade-off between Adversarial and Backdoor Robustness shows that adversarial training makes a network more eager to learn backdoors. The model treats the trigger as a reliable feature, and backdoor success on CIFAR-10 rises from 64.1% to 99.9%.
We propose to test whether a small set of learned input tokens can handle both threats without the usual costs. The model's weights stay frozen and never change. The tokens are prepended to the image patch sequence and trained in a few hundred steps on a handful of clean images. Their job is to pull both adversarially perturbed inputs and trigger-like inputs back to the model's clean representation. This lifts the frozen-backbone idea of Robustness Tokens: Towards Adversarial Robustness of Transformers into the supply-chain setting, where it has never been tested. There is also a timing argument in the defender's favor. The party who planted the backdoor finished its work before the tokens existed. The main weakness of robustness tokens is that they fail if the attacker knows them. That weakness therefore matters much less against this adversary, though it still matters against later attackers who can query the deployed system.
Core Claim
A frozen, possibly backdoored vision transformer can be repaired and hardened at once by about ten learned prefix tokens. The tokens are trained with two objectives. The first is an invariance term on clean images: the token-augmented model should produce the same features as the original model. The second is a correction term on perturbed images: the features should return to the clean features. The perturbations come from two families. One is standard small-norm attacks computed per image with projected gradient descent (PGD). The other is a cheap universal trigger proxy: a single patch-or-blend pattern, shared across the whole batch, optimized to push the model's features away from their clean values.
Writing $f$ for the frozen feature extractor, $t$ for the tokens, $x$ for a clean image, $\delta_x$ for a per-image PGD perturbation of radius $\epsilon$, and $\tau$ for the universal trigger proxy, the objective is
$$\min_t \; \mathbb{E}_x \Big[ \|f(x;t)-f(x)\|^2 + \lambda_a \|f(x+\delta_x;t)-f(x)\|^2 + \lambda_b \|f(x\oplus\tau;t)-f(x)\|^2 \Big],$$
where $x\oplus\tau$ applies the proxy pattern to the image and the $\lambda$ weights balance the three terms.
We make two claims. The first is that the trigger-proxy term, not the PGD term alone, is what suppresses real planted triggers. The second is that freezing the backbone prevents the "Better Student" effect, because the tokens cannot rewire the internal features that the trigger relies on.
Research Program
The work has three parts. The first is a diagnostic study that answers Gap 1 directly. We train original robustness tokens, with only the PGD correction, on backdoored ViTs. We then measure whether attack success rate (ASR) falls, stays flat, or rises. A rise would mean the Better Student effect survives parameter isolation. That would itself be publishable, because it would warn anyone attaching robustness adapters to downloaded models.
The second part is the trigger-proxy objective. Its design draws on the "attack difficulty" observation of Mian et al.: backdoored target classes are unusually easy to reach with universal adversarial noise. The universal pattern $\tau$ is updated once per step, so the extra cost over robustness tokens is one additional forward and backward pass per step.
The third part is a durability study. This is where parameter isolation is most exposed. Uncovering, Explaining, and Mitigating the Superficial Safety of Backdoor Defense showed that purifications which stay in the backdoored model's basin of the loss surface, such as pruning, mask learning, or shallow fine-tuning, are undone by retuning on less than 1% poisoned data. A frozen backbone is in that basin by construction. We therefore run their Retuning Attack and their Query-based Reactivation Attack against the token defense. We also define a token-aware variant, in which the attacker retunes the backbone while the defender's tokens are held fixed. The honest hypothesis has two halves. We expect tokens to resist black-box reactivation, because the attacker never saw the tokens. We expect them to fail against backbone retuning, so we would scope the method to deployments where the defender controls the weights.
Compute is reported as total forward and backward passes and as GPU wall-clock time.
Baselines
Do nothing. The naive reference point is the downloaded backdoored model, left as is. It sets the starting ASR, the robust accuracy under PGD, and the clean accuracy that every defense must preserve.
Neural Mask Fine-Tuning. The strongest cheap purifier is Neural Mask Fine-Tuning from Augmented Neural Fine-Tuning for Efficient Backdoor Purification. It freezes weights and learns soft neuron masks with MixUp as a stand-in for the trigger. The paper reports CIFAR-10 ASR reduced to 1.81% with clean accuracy within 1% of the original, in 28.4 seconds on an RTX 3090. It is the closest competitor because it is also frozen-weight, few-shot, and fast. It was evaluated only on convolutional and point-cloud models, so we port it to ViT MLP and attention-head outputs. It gets the same clean samples and the same wall-clock budget as our method, with its mask sparsity and MixUp strength tuned on a held-out split of the defender data. Beating it means matching its ASR within about one point on ViTs while also delivering robust accuracy under PGD, which NFT does not attempt.
Feature Shift Tuning. Towards Stable Backdoor Purification through Feature Shift Tuning penalizes classifier weights for staying aligned with the originals. It reports roughly 93% clean accuracy and ASR below 1% on CIFAR-10 with 50 clean samples. It represents the full-update approach that works at low poisoning rates. We run it for its published 10–15 epochs at matched data.
Path-Aware Minimization. PAM, from the superficial-safety paper, keeps ASR below 4.5% after retuning, with clean accuracy within about 2%. It is the durability ceiling. We do not expect to beat it on backbone retuning. Instead we compare cost, since PAM needs trigger inversion and path optimization, and we compare the reactivation attacks.
Token Drop. Token Drop from A Closer Look at Robustness of Vision Transformers to Backdoor Attacks masks the image patches the model attends to most, at test time. It reduces ViT-Base ImageNet ASR from 61.4% to 8.0% at zero training cost. It is the training-free competitor. We report its clean accuracy cost and test it against triggers with spread-out attention.
Adversarial robustness references. On the adversarial side, the reference is the original robustness tokens. The paper reports that DINOv2-Giant under white-box attack recovers from 0.3% to 63.1% accuracy, with 85.2% clean accuracy against 85.6% for the original. We also run PGD adversarial fine-tuning of the full model on the same few-shot data, which serves as the Better Student positive control.
Ablation. The key ablation removes the trigger-proxy term, which reduces our method to plain robustness tokens. A second ablation replaces the universal $\tau$ with MixUp inputs, to separate "universal adversarial pattern" from "any input mixing." Since there is no reported result found on Lacuna for any of these defenses on backdoored ViTs under matched conditions, all baselines are rerun rather than copied.
Why not just…?
Why not just run NFT and then add ordinary robustness tokens? This two-stage pipeline is the most serious threat. It may match our backdoor and adversarial numbers, and if it does, the contribution shrinks to a cost comparison. The experiment settles it directly. We run the pipeline at a summed compute budget equal to ours and compare ASR, PGD robust accuracy, and clean accuracy. We also check whether the tokens added in stage two re-amplify any residual trigger, which is the Better Student risk. If the pipeline wins, we report that composition suffices.
Why not just use plain robustness tokens, since PGD correction might already neutralize triggers? Planted triggers are large, local, and out of the small-norm ball, so there is little reason to expect ℓp correction alone to cover them. The robustness-token paper never tested backdoors, though, so this is an empirical question. The no-proxy ablation answers it. If plain tokens already suppress ASR, the proxy term is unnecessary, and the paper becomes the Gap 1 study.
Why not just fine-tune on the clean samples? Wu et al., in Adversarial Neuron Pruning Purifies Backdoored Deep Models, report clean accuracy drops above 7% from aggressive fine-tuning. FST's authors show plain fine-tuning fails at poisoning rates of 0.5–5%. We include fine-tuning anyway as a cheap sanity baseline.
Why not just prune with data-free Lipschitz bounds? Channel Lipschitzness Pruning from Data-Free Backdoor Removal Based on Channel Lipschitzness runs in under 3 seconds on a CPU, with 0.67% clean loss on CIFAR-10 CNNs. Its authors leave attention layers open, and it gives no adversarial robustness. We report a naive per-projection spectral-norm port as a reference.
Proposed Experiments
Models, attacks, and data. We backdoor ViT-B/16, DeiT-III, and a DINOv2 linear-probe model on CIFAR-10, GTSRB, Tiny-ImageNet, and a 100-class ImageNet subset. Attacks are BadNets, Blended, WaNet, and sample-specific invisible triggers via yuezunli/ISSBA, at poisoning rates of 0.5%, 1%, and 5%. Attack and evaluation code extends SCLBD/BackdoorBench to transformers. The defender holds 10 or 50 clean images per class.
Metrics. We report clean accuracy, ASR, and BackdoorBench's robust accuracy on poisoned inputs, which counts how often a poisoned image still gets its true label. We add PGD robust accuracy under both a token-blind and a token-aware white-box attacker, ASR after Retuning and after Query-based Reactivation, and compute in passes and seconds.
Decisive checks. Three results decide the project. The first is whether ℓp-only tokens raise ASR relative to the undefended model, as full PGD fine-tuning is expected to do. That sign is informative in either direction. The second is whether the full objective reaches ASR within about one point of NFT and clean accuracy within 1% of the original, while retaining most of the PGD robust accuracy that plain tokens achieve, at no more than twice their compute. The third is whether reactivation ASR stays low when the attacker does not know the tokens.
If the second check fails, the idea is wrong. If only the third fails, the method is still useful but must be scoped to settings where the defender controls the weights and the tokens stay private.
References
- On the Trade-off between Adversarial and Backdoor Robustness
- Robustness Tokens: Towards Adversarial Robustness of Transformers
- Uncovering, Explaining, and Mitigating the Superficial Safety of Backdoor Defense
- Augmented Neural Fine-Tuning for Efficient Backdoor Purification
- Towards Stable Backdoor Purification through Feature Shift Tuning
- A Closer Look at Robustness of Vision Transformers to Backdoor Attacks
- Adversarial Neuron Pruning Purifies Backdoored Deep Models
- Data-Free Backdoor Removal Based on Channel Lipschitzness