Transfer Attacks as the Blind Spot of Fast Test-Time Defenses

The fastest current defenses for vision-language models such as CLIP repair an attacked image at inference time. They apply a handful of cheap transformations (flips, crops, blurs) and watch how the image's internal representation moves. Their premise is that an adversarial perturbation is fragile: once the image is perturbed slightly, the attack partly dissolves, and the representation snaps back toward the correct answer in a telltale, consistent direction. Every such defense has been tested against attacks crafted directly on the victim model with full gradient access. Those attacks overfit the victim and are exactly the fragile kind. A real deployed system, such as a latency-bound API or an on-vehicle perception model, more often faces transfer attacks. These are perturbations crafted on a separate "surrogate" model the attacker owns and then sent to the victim without any queries. The techniques that make transfer attacks work include averaging over random resizes and pads, momentum, gradient smoothing, and attacking intermediate features. Each of them makes a perturbation survive transformations, so they build in the very property these defenses rely on being absent. We hypothesize that fast test-time defenses are weakest against the attacker they are most likely to meet.

The proposal has two parts. The first is a measurement study. It defines a single quantity, perturbation brittleness, and tests whether it predicts how much each fast defense helps across attack families. The second is a cheap fix that targets the blind spot directly. We train a few learnable input tokens on a frozen CLIP image encoder, using a fixed, precomputed bank of transformation-robust transfer perturbations generated on a pool of surrogate models. Training needs no adversarial inner loop on the victim, adds one forward pass of cost at inference, and is designed to compose with, rather than replace, existing augmentation-based defenses.

Core Claim

We claim that the gains reported for augmentation-consistency defenses track the brittleness of the evaluated attack, not robustness to adversarial inputs in general. We define brittleness for a perturbation $\delta$ on input $x$ as

$$B(\delta) = 1 - \frac{\mathbb{E}_{t \sim T}\left[ m(x) - m(t(x+\delta)) \right]}{m(x) - m(x+\delta)},$$

Here $m(\cdot)$ is the victim's true-class logit margin and $T$ is the defense's own transformation family. $B$ near 1 means the transformations erase the attack's effect; $B$ near 0 means the effect survives intact. The claim predicts three things. First, white-box PGD on the victim has high $B$, while input-diversity, smoothed-gradient, and intermediate-layer transfer attacks have low $B$. Second, across attacks, the robust-accuracy gain of each defense rises monotonically with $B$. Third, the defenses' detection gates, such as the directional-concentration score in DBD or the cosine-consistency gate in ATAC, stay closed on low-$B$ attacks, so the attacked image passes through uncorrected. If transfer attacks on CLIP turn out to be both strong and low-$B$, the community's fast defenses are evaluated in the regime least relevant to deployment.

Where This Sits

Three training-free defenses supply both the targets and the motivation. Adversarial Attacks Already Tell the Answer: Directional Bias-Guided Test-time Defense for Vision-Language Models (DBD) applies 31 transformations and shifts features along a dominant "defense direction" when the shifts are concentrated. ATAC: Augmentation-Based Test-Time Adversarial Correction for CLIP averages augmentation drift vectors behind a consistency gate. Contrastive Spectral Rectification: Test-Time Defense towards Zero-shot Adversarial Robustness of CLIP (CSR) flags inputs whose features collapse under low-pass filtering. All three rest on brittleness, through either augmentation dissolution or high-frequency reliance. None evaluates perturbations crafted on an external surrogate. The research file also records that DBD weakens under adaptive attacks that average over transformations, and that CSR fails on low-frequency changes. These are white-box hints of the transfer-regime failure we predict, and they motivate this study rather than settle it.

The transfer literature supplies the attacks and a mechanism. Benchmarking Transferable Adversarial Attacks catalogs input-diversity, momentum, intermediate-layer, generative, and ensemble attacks over ResNet, Inception, and adversarially trained models. It finds that intermediate-layer and ensemble attacks transfer best, but it never tests test-time or parameter-efficient defenses. That omission is precisely our gap. Adversarial Vulnerability from Interference Between Features in Superposition argues that perturbations transfer because models trained on similarly correlated data share interference directions between packed features. We use this as an analytical lens: perturbations aligned with shared interference geometry should be both more transferable and less brittle, because they act on features rather than on pixel-level quirks of one model. Two further papers make the threat concrete for foundation models. Two Sides of the Same Coin: White-box and Black-box Attacks for Transfer Learning shows that fine-tuned models inherit their backbone's vulnerabilities, and Publishing Efficient On-device Models Increases Adversarial Vulnerability shows that a released relative of the victim makes an excellent surrogate. A sibling open CLIP checkpoint is therefore a natural attacker tool, and we include such checkpoints in the surrogate pool.

The constructive method reuses ingredients from parameter-efficient defenses. Robustness Tokens: Towards Adversarial Robustness of Transformers trains about 10 prefix tokens on a frozen ViT, including OpenCLIP. It uses a clean-invariance loss plus a loss pulling attacked features back to clean ones, and preserves clean accuracy (85.2% vs. 85.6% on ImageNet with DINOv2-G). We take its token form and loss, but its attacks are white-box on the victim and it does not test transfer. Adversarial Prompt Tuning for Vision-Language Models (AdvPT) removes the min-max inner loop by caching adversarial embeddings once and tuning text prompts against the cache. We take the idea of a precomputed bank, but AdvPT's bank is victim-side PGD, which by our hypothesis is the wrong distribution for black-box deployment. Minimal Cascade Gradient Smoothing for Fast Transferable Preemptive Adversarial Defense is the closest work joining speed, transfer, and the clean-robust balance. However, it perturbs media client-side before release and cannot defend a server against arbitrary incoming traffic, which is our setting.

Research Program

The first stage is the diagnostic. The victim models are CLIP ViT-B/16 and a larger CLIP image encoder. Attacks come from three surrogate groups: the TAA-Bench CNN backbones (ResNet-50/101/152, Inception-v3/v4), ImageNet ViTs, and open CLIP checkpoints different from the victim. On each surrogate we run I-FGSM, MI-FGSM, VMI-FGSM, DI-FGSM, NAA-style intermediate-layer attacks, and multi-surrogate ensembles, all at $L_\infty$ budgets of 4/255 and 8/255. For every perturbation we compute $B$ under the transformation family of each defense. We then record undefended transfer success, defended robust accuracy, and the defense's gate decision. The analysis asks whether $B$, or a cheaper proxy such as the cosine alignment between the perturbation's feature shift on surrogate and victim, explains each defense's gain across attacks. We also test whether attacks with higher shared-feature alignment have lower $B$, as the superposition account predicts.

The second stage is the fix, which we call surrogate-bank correction tokens. We generate a fixed bank of low-$B$ transfer perturbations once, on training images, using a surrogate pool that is disjoint from the test-time surrogates. We store only the perturbed images. We then train about 10 prefix tokens on the frozen CLIP image encoder with the Robustness Tokens objective: clean features must stay unchanged, and banked adversarial features are pulled to their clean counterparts. Because the bank is static, each training step costs two forward-backward passes through a frozen encoder. There are no PGD steps on the victim, so total cost is the one-time bank generation plus a few hundred token updates. We report it in GPU-hours against victim-side adversarial fine-tuning. At inference the tokens add one short sequence extension. They can run alone, or with DBD layered on top for the brittle white-box case, and we report both configurations.

Baselines

The naive reference point is undefended CLIP under each transfer attack. If undefended CLIP already resists, for example if CNN-surrogate attacks barely transfer, the CNN branch of the study loses its stakes, and we report that plainly. A second cheap reference is JPEG-style compression, which the file notes can remove most perturbations in hardware-friendly form. We run it at quality settings matched to the clean-accuracy drop of the other methods.

The strongest existing competitor is DBD, because it is the fastest and highest-scoring training-free defense in the file. On CLIP-ViT-B/16 under PGD-100 it reports 93.8% average robust accuracy across 10 fine-grained datasets, against 43.2% for R-TPT and a 67.9% clean baseline, at 0.025 s per image versus 0.181 s for R-TPT (DBD). We find no reported result on Lacuna for DBD, ATAC, or CSR under transfer attacks from external surrogates; that missing number is the point of the study. ATAC, with its reported margin of nearly 50% over prior test-time defenses, and CSR, with its reported 0.7% clean penalty, are run alongside DBD. All three use their published transformation families, on the same images, at the same perturbation budgets, timed on the same GPU. Beating DBD means three things. In the low-$B$ transfer regime, the tokens must achieve higher robust accuracy than DBD at no greater per-image latency. In the high-$B$ white-box regime, tokens combined with DBD must not fall below DBD alone. Clean accuracy must stay within about one point of undefended CLIP.

The parameter-efficient competitors are Robustness Tokens trained on victim-side white-box PGD, AdvPT with its victim-side embedding bank, and APT from One Prompt Word is Enough to Boost Adversarial Robustness for Pre-trained Vision-Language Models using TreeLLi/APT. For AdvPT, the file reports Flowers PGD-40 accuracy rising from 6.4% to 37.4% on ViT-B/16. APT is reported at +8.5% robustness over hand-written prompts. Every learned baseline gets the same compute budget, measured in GPU-hours, which covers bank generation, and the same number of token or prompt updates. The key ablation holds everything fixed except the bank contents: victim white-box PGD versus surrogate transfer attacks versus both. Only this comparison isolates the claimed ingredient.

Why not just…?

Why not just add stronger or more varied augmentations to DBD or ATAC? If transfer attacks survive the current transformation family, a larger family might still catch them. ATAC already reports that color jitter hurts its clean accuracy, so the family cannot grow freely without breaking the gate's ability to pass clean images. We test this directly by extending DBD's family to include the attacker's own transforms (resize and pad) and stronger blurs. We then measure the resulting clean drop alongside the recovered transfer robustness. If this closes the gap cheaply, the fix in this proposal is unnecessary, and the diagnostic becomes the contribution.

Why not just use AdvPT or Robustness Tokens with the usual victim-side bank? This is the real threat. AdvPT already reports gains against black-box attacks, so victim-side PGD features may already cover transfer perturbations. The bank-content ablation settles it. If victim-side and surrogate-side banks match on held-out-surrogate transfer attacks, our ingredient adds nothing, and we will say so.

Why not just adversarially fine-tune the full image encoder? The file reports that adversarial fine-tuning of CLIP routinely costs 20% or more of clean zero-shot accuracy (CSR). It also requires the per-step inner loop this proposal avoids. We include one fine-tuned encoder at matched GPU-hours, solely to place both robustness and clean accuracy on the same axis.

Why not just low-pass filter or compress the input? Smoothed-gradient and intermediate-layer transfer attacks plausibly shift energy toward lower frequencies, where CSR's own analysis admits a blind spot. The frequency spectrum of each attack family, together with the JPEG and CSR baselines, shows whether filtering suffices.

Decisive Checks

Evaluation uses DBD's 10 fine-grained datasets plus its five ImageNet out-of-distribution sets, and ATAC's 13 datasets, including CIFAR-10/100, Flowers-102, and EuroSAT. Five results would decide the proposal. First, undefended CLIP must lose meaningful accuracy to at least the CLIP-family and ensemble surrogates; otherwise the regime is moot. Second, rank correlation between $B$ and defense gain must be strongly positive across attack families, and DBD and ATAC gates must stay mostly closed on low-$B$ attacks. If DBD stays near its white-box numbers under transfer, the core claim is false. Third, correction tokens trained on CNN and CLIP-sibling surrogates must hold up against ViT-surrogate attacks never seen in the bank; this tests surrogate overfitting of the defense itself. Fourth, the cost accounting must show token training plus bank generation within a small fraction of victim-side adversarial fine-tuning, with per-image latency at or below DBD's. Finally, because Robustness Tokens derive security partly from secrecy, we report a white-box adaptive attack on the tokens. This marks honestly where the black-box guarantee ends.