Erasing Backdoors with a Few Input Tokens, and What It Costs in Privacy

A backdoored model behaves normally until it sees a secret trigger, such as a small patch or a rare word, and then outputs whatever the attacker chose. The most dependable recent repairs exploit a curious fact. In an infected model, ordinary adversarial examples (inputs nudged by tiny, worst-case perturbations) land in almost the same internal state as triggered inputs. Fine-tuning the model to classify those adversarial examples correctly therefore also erases the backdoor. These repairs are expensive, because each update runs an inner attack loop, and they rewrite every weight. A separate line of work shows that this kind of adversarial training pushes the model's decision boundaries away from its training points, which makes those points easier to identify afterward. That is a privacy leak about the data used for the repair.

We propose to do the repair with a frozen network. The model is left untouched, and only a handful of extra input vectors are trained. These "purification tokens" are appended to a vision transformer's input and trained on adversarial examples so that perturbed and triggered inputs are mapped back to clean features. The claim we will test has two parts. First, input-side adaptation can remove weight-level backdoors at a small fraction of the compute of full adversarial fine-tuning. Second, because it trains orders of magnitude fewer parameters and never moves the backbone's decision boundaries, it adds much less membership leakage about the repair data than full-weight purification does. The question that matters underneath is how the privacy cost of backdoor repair scales with the amount of model capacity the repair touches. Tokens are the cheapest point on that curve. They are not the only point we will measure.

Core Claim and Where It Comes From

Three findings motivate the idea. Adversarial Fine-tuning for Backdoor Defense shows that untargeted adversarial examples activate the same penultimate-layer "backdoor neurons" as real triggers. The feature distance is 22.74 between adversarial and triggered samples, versus 148.26 between adversarial and clean ones. Its Progressive Backdoor Erasing method fine-tunes all weights on adversarial examples and does not need a trusted clean set. Adversarial Backdoor Defense in CLIP applies the same idea to contrastive vision-language models, at a reported cost of about 14 A100 GPU hours for the defense phase alone. Neither paper measures what happens to the privacy of the data used in the repair.

Evaluating Membership Inference Through Adversarial Robustness supplies the reason to worry. Membership inference is the attack of deciding whether a given record was in the training set. That paper finds that adversarial training raises membership inference accuracy on CIFAR-10 from 0.576 to 0.722 under its directional-distance attack, because training points end up deeper inside their class regions. Adversarial purification is adversarial fine-tuning on a specific dataset, so the same deepening should expose that dataset. Nobody has checked.

The method comes from Robustness Tokens. That work trains 10 tokens of 1536 dimensions on a frozen DINOv2-Giant. White-box adversarial accuracy rises from 0.3% to 63.1%, clean accuracy holds (85.2% vs 85.6%), and training converges in about 200 steps. That paper targets test-time robustness only and never considers backdoors or privacy. It also reports two constraints we take seriously. The tokens' effectiveness depends on the outlier "massive activations" of large transformers, and it weakens on small models. And the defense relies on the tokens staying secret.

The theoretical reason to expect lower leakage is Parameters or Privacy, which proves that in interpolating linear regression, membership advantage grows with the number of trained parameters. This result only motivates the hypothesis. It is linear and Gaussian, so we treat it as a prediction to test, not a guarantee. The same paper also warns that heavier regularization can increase leakage, so "fewer parameters" is not automatically "safer". Our experiments must show the effect directly.

Research Program

The tokens are trained with a combination of the Robustness Tokens loss and the Progressive Backdoor Erasing loss. On clean inputs, a feature-invariance term keeps the token-augmented backbone's features close to the original. On untargeted adversarial examples generated against the current model, a correction term pulls features back toward the clean features and pushes predictions back to the true label. Following Progressive Backdoor Erasing, we use only the possibly poisoned training data, never a trusted clean set. We alternate between regenerating adversarial examples and updating the tokens over a few rounds, then stop.

The program has three studies. The first asks whether frozen-backbone tokens can erase weight-level backdoors at all. Attention lets tokens reweight what the model reads from a trigger patch, but a backdoor stored deep in the weights may be unreachable from the input side. We measure attack success rate, clean accuracy, and wall-clock and GPU-hour cost. The second study asks how membership leakage of the repair data depends on adapted capacity. We repair the same backdoored model with tokens, low-rank adapters, last-block fine-tuning, and full fine-tuning, holding the adversarial objective fixed, and audit each result with strong membership attacks. The third study looks at a side effect. Data owners sometimes plant their own benign backdoors as provenance watermarks, as in Membership Inference via Backdooring, where 0.1% marked data gave 87.2% watermark success on Purchase-100 and 30 queries sufficed for 95% confidence. A good backdoor eraser will plausibly erase these too. We measure that cost and report it, rather than hiding it.

Baselines

The do-nothing reference is the backdoored model left unrepaired. It sets the attack success rate to beat and the membership leakage floor. Any repair that raises leakage above this floor has a measurable privacy cost.

The strongest existing method for image classifiers is Progressive Backdoor Erasing from Adversarial Fine-tuning for Backdoor Defense. It is the closest competitor because it shares our premise and our no-clean-data assumption, and differs only in updating all weights. We run it on the same backdoored transformers, with the same data, the same adversarial attack, and a matched hyperparameter search budget. We record its GPU hours as the cost reference. The research file gives no attack-success number for it, so no reported result was found on Lacuna for Progressive Backdoor Erasing, and we will produce our own.

For CLIP, the strongest method is Adversarial Backdoor Defense from Adversarial Backdoor Defense in CLIP. It reports attack success reductions over CleanCLIP of 8.66% on BadNet, 10.52% on Blended, and 53.64% on BadCLIP, with a 1.73% ImageNet clean-accuracy drop and roughly 14 A100 GPU hours. Beating it means matching its attack success rate within a few points at under one-tenth of its GPU hours, with no larger clean-accuracy drop.

Fine-Pruning from Fine-Pruning is the cheap structural baseline. It removes neurons that stay dormant on clean data and then fine-tunes the rest. We give it the clean split it requires, which is an advantage our method does not get.

Three ablations isolate the ingredients. Off-the-shelf robustness tokens, trained only for test-time robustness, test whether backdoor erasure comes for free. Tokens trained with clean data and no adversarial examples isolate the adversarial ingredient. Low-rank adapters and last-block fine-tuning, trained with the identical adversarial objective, isolate whether "input-side tokens" matter or just "few parameters".

Why not just…?

Why not just run Progressive Backdoor Erasing with low-rank adapters instead of tokens? This is the most serious threat. If adapters match the tokens on both erasure and leakage, the contribution narrows to a capacity-versus-leakage curve, and tokens become one convenient point on it. That is why adapters sit in the same sweep under the same objective. If they tie, we report the curve as the finding. Tokens would retain a practical edge only if they erase the backdoor in fewer steps or leak less at equal attack success rate.

Why not just use single-step adversarial examples to cut the overhead of full-weight purification? This addresses compute but not privacy. All weights still move, and the margin-deepening mechanism in Evaluating Membership Inference Through Adversarial Robustness should still apply. We include a single-step full fine-tuning variant. If its leakage stays near that of the multi-step version while its cost drops, privacy, not compute, is the argument for tokens.

Why not just use Fine-Pruning, or train with differential privacy? Fine-Pruning needs trusted clean data. Its own paper reports that pruning-aware attacks defeat it, and that on traffic signs it cut attack success only from about 99% to about 30%. Differentially private training is cited in Membership Inference via Backdooring as suppressing triggers at a significant cost in utility. It also does nothing for adversarial robustness and makes full retraining costlier. We run Fine-Pruning directly. We discuss differential privacy rather than run it, because it is retraining, not repair.

Proposed Experiments

The main testbed uses ImageNet-pretrained DeiT-III and DINOv2 backbones, fine-tuned on CIFAR-10 and CIFAR-100 with BadNets and blended triggers at several poison rates, including a pruning-aware variant. We use large backbones because Robustness Tokens says small models lack the activations the tokens depend on. We also run a size sweep from Small to Giant, to report where the method stops working rather than assuming it works everywhere. The multimodal test reproduces the CLIP setting on a CC3M subset with BadNet, Blended, and BadCLIP, evaluated zero-shot on ImageNet-1K.

The metrics are attack success rate, clean accuracy, and GPU hours. Leakage of the repair set is measured with LiRA and the directional-distance attack, comparing repair-set members with held-out points. For SAM-trained models, Membership Privacy Risks of Sharpness Aware Minimization reports a LiRA AUC of 76.4% versus 73.0% for SGD on CIFAR-10. This gives a sense of how small differences between training methods can be, so we use many shadow models and report confidence intervals. Watermark survival follows the hypothesis-test protocol of Membership Inference via Backdooring.

Three checks decide the project. First, if tokens cannot bring attack success rate below about 10% on DINOv2-scale models where full purification can, the input-side premise fails and we stop. Second, if full Progressive Backdoor Erasing does not raise membership leakage of the repair set above the do-nothing model, the privacy motivation is void. We would then report that negative result, which is itself new. Third, the method succeeds only if tokens sit strictly below full fine-tuning on leakage at matched attack success rate and use less than a tenth of the compute. We will also run an adaptive attacker who knows the tokens and optimizes a trigger against them, since the defense otherwise rests on secrecy.