Uncertainty Masking in Fast Adversarial Training of Coordinate Heads

Multimodal language models increasingly answer "where is it?" with real numbers instead of text. Rather than spelling a bounding box out as tokens like "0", ".", "4", they attach a small regression head that outputs the four box coordinates directly. These heads are often also trained to output a spread parameter that says how unsure the model is. Making such models robust to adversarial images (tiny pixel changes chosen to mislead the model) normally means adversarial training: every training step first searches for a damaging perturbation with several gradient steps, then trains on it. For a 7-billion-parameter model this multiplies cost roughly by the number of search steps. Freezing most weights does not help, because each search step still needs a full backward pass to the image. The cheap alternative is a single search step per update. In classification, that shortcut is known to collapse suddenly, a failure called catastrophic overfitting. Nobody has checked what it does to coordinate heads.

We propose that coordinate heads with a predicted spread have their own way of collapsing under single-step training. The model learns to raise its stated uncertainty on perturbed inputs. That shrinks the gradient the one-step attacker relies on, so training looks robust while a stronger multi-step attacker still moves the box freely. We will test whether this happens. We will also test a fix that adds almost no compute and keeps the uncertainty output useful. The fix has three parts: attack an uncertainty-free displacement loss, add a latent perturbation computed from the same backward pass, and require the predicted spread to track actual error on attacked inputs.

Core Claim

Take a Laplace coordinate head of the kind used in Numerical Visual Chain-of-Thought. Its loss for one coordinate is $L = |y-\mu(x)|/b(x) + \log b(x)$, where $y$ is the true coordinate, $\mu$ the predicted coordinate, and $b>0$ the predicted spread. The gradient with respect to the input image $x$ is

$$\nabla_x L = \frac{\operatorname{sign}(\mu-y)}{b}\,\nabla_x \mu + \Big(\frac{1}{b}-\frac{|y-\mu|}{b^2}\Big)\nabla_x b .$$

The first term, the one that actually moves the box, is scaled by $1/b$. If single-step training rewards the model for inflating $b$ near training inputs, the one-step attacker built on $L$ weakens. The model's coordinate function $\mu$ can then stay just as fragile as before. This failure differs from the curvature-driven gradient masking described for cross-entropy. It also predicts a measurable signature. Before robust accuracy collapses, the predicted spread on adversarial inputs should rise sharply and the input-gradient norm should fall, while center displacement under a 50-step attack stays large.

The constructive claim follows from this. Generate the single-step perturbation against a scale-free displacement loss (generalized IoU plus box-size-normalized $\ell_1$, with no $b$ in it). Add a second perturbation to the visual tokens entering the language model, computed from gradients already available in that backward pass. Train $b$ separately so that it matches observed error on attacked inputs. Together these should match multi-step adversarial training on robust grounding accuracy at close to single-step cost, while keeping $b$ informative under attack.

Prior Work

Three papers motivate the question. Adversarial Robustness for Visual Grounding of Multimodal Large Language Models attacks MiniGPT-v2, a model that writes boxes as text tokens, and drops its RefCOCO-family [email protected] from 84.96% to 23.24%. It proposes no defense and studies no continuous head. Numerical Visual Chain-of-Thought supplies the architecture we harden. It uses four coordinate heads and a spread head, trained with $\ell_1$/$\ell_2$ losses and then with reinforcement learning over Laplace or Gaussian policies, and it reaches 59.5 box IoU on V* Bench against 47.3 for text coordinates. It never evaluates attacks. Re-Thinking Inverse Graphics With Large Language Models shows that a mean-squared-error numeric head avoids snapping coordinates to a grid. It also does not study robustness.

Two papers supply our method, and one constrains it. Reliably fast adversarial training via latent adversarial perturbation (SLAT) injects perturbations into hidden layers using gradients that come for free during the backward pass. It reaches 47.06% PGD-50 accuracy on CIFAR-10, where vanilla single-step training collapses to 0.01%, at about 3.7 times the speed of 7-step training. We reuse its latent-perturbation idea, but SLAT was studied only for classification and has no uncertainty output. Class-Aware Robust Adversarial Training for Object Detection (CWAT) is the only prior fast-training work involving box regression. It finds that the attacker exploits whichever loss is easiest to increase, fixes this with per-task and per-object loss clipping, and reports 0.224 mAP under 10-step attack on PASCAL VOC with a convolutional SSD detector. It neither diagnoses catastrophic overfitting in the regression branch nor considers predicted uncertainty. Our scale-free attack loss is a principled substitute for its hand-set clipping, and we compare against clipping directly.

The cheap defenses constrain the design. Robustness Tokens restores a frozen ViT from 0.3% to 63.1% on ImageNet and from 4.7 to 23.3 mIoU on ADE20K by learning ten tokens that align attacked features with clean ones. Coordinates may tolerate far less feature drift than class labels, so this needs testing rather than assuming. Improving Adversarial Robustness in Vision-Language Models with Architecture and Prompt Design reports that a "may be perturbed" prompt lifts LLaVA-7B from 12.54% to 91.46% under Auto-PGD, but on question answering and not against an attacker who includes the prompt in the optimization. Mitigating Adversarial Effects Through Randomization resizes and pads inputs at test time, which changes the very coordinate frame we regress.

Research Program

The work has a diagnostic stage and a method stage, run on two scales.

The cheap sandbox is a ViT-Base encoder with a continuous box head trained on RefCOCO. It is small enough to sweep perturbation radius, step size, and loss choice across many seeds. The main testbed is a 7B model with NV-CoT-style heads fine-tuned on RefCOCO, RefCOCO+ and RefCOCOg. We use released weights if available and otherwise reproduce supervised fine-tuning with the published head design. Its backbone is frozen except for low-rank adapters, and the full backward pass to pixels is kept for attacks.

The diagnostic stage trains three head types with vanilla single-step adversarial training: plain $\ell_1$, Laplace with spread, and Gaussian with spread. At regular checkpoints we log four quantities: one-step and 50-step robust [email protected], the input-gradient norm, mean predicted spread on clean versus attacked inputs, and center displacement in pixels. The uncertainty-masking hypothesis predicts three things. Spread heads should overfit earlier or more severely than the plain $\ell_1$ head. Their collapse should be preceded by spread inflation. Clamping the spread to its clean value at attack time should immediately expose the hidden fragility.

The method stage builds the decoupled single-step recipe. The input perturbation is one signed-gradient step with random start against the scale-free displacement loss. The latent perturbation is applied to the projected visual tokens, using that layer's gradient from the same pass. The spread head is trained with a separate term that regresses $b$ onto detached observed error on attacked inputs. We record GPU-hours per epoch for every method under identical hardware. We report robustness as a function of compute, not only at a single point.

Baselines

The naive reference is the undefended continuous-head model, together with the undefended text-token grounding model attacked as in Adversarial Robustness for Visual Grounding of Multimodal Large Language Models Adversarial Robustness for Visual Grounding of Multimodal Large Language Models. For that text-token model the reported reference point is 23.24% [email protected] under image-embedding attack, from 84.96% clean. This tells us whether continuous heads start out more or less exposed.

The strongest competitor in quality is multi-step adversarial training. We run PGD with 7 steps against the same displacement loss, on the same adapters, data, and epochs, with an equal tuning budget of the same number of runs over step size and radius. It sets the robustness ceiling at roughly seven times the cost. No reported result was found on Lacuna for adversarially trained continuous-head grounding models, so we establish this number ourselves. Beating it means matching its 50-step robust [email protected] within two points at no more than 1.3 times single-step cost.

The strongest existing fast method is CWAT-style clipping Class-Aware Robust Adversarial Training for Object Detection, applied to the NLL loss with its per-task and per-object ceilings tuned on the same budget. Its reported number, 0.224 mAP on PASCAL VOC under PGD-10, comes from a different task, so the comparison is our reimplementation on RefCOCO. SLAT Reliably fast adversarial training via latent adversarial perturbation applied unchanged to the NLL loss is the second fast baseline. Its reported 47.06% PGD-50 CIFAR-10 result shows what latent perturbation achieves in classification.

Robustness Tokens and the adversarial-possibility prompt are the zero- or near-zero-training baselines. Each is evaluated against an adaptive attacker that optimizes through the tokens or the prompt.

Three ablations isolate the key ingredient. The first swaps the scale-free attack loss back to the NLL loss with everything else fixed. The second removes the latent perturbation. The third removes the spread head entirely.

Why not just…?

Why not just drop the spread head and train a plain $\ell_1$ model with single-step attacks? This is the most serious threat, and our ablation measures it directly. If a plain $\ell_1$ model trained with random-start single-step attacks matches multi-step training, the masking channel exists but is trivially avoided, and we will report that. We still expect value in keeping the spread. NV-CoT needs it to define the sampling policy for reinforcement learning. A spread that grows honestly under attack also lets the system abstain or zoom again, which a spread-free model cannot do. The decisive comparison is therefore robust IoU together with the rank correlation between predicted spread and true error on attacked inputs.

Why not just run multi-step adversarial training on adapters only, since few parameters change? Freezing weights cuts optimizer memory, not attack cost. Each inner step still backpropagates through the vision encoder and the full language model to reach the pixels. The 3.7 times speed gap that SLAT Reliably fast adversarial training via latent adversarial perturbation reports against 7-step training should persist here, and our measured GPU-hours will show whether it does.

Why not just use the defensive prompt or test-time randomization? The prompt result Improving Adversarial Robustness in Vision-Language Models with Architecture and Prompt Design acts on text decoding. A linear coordinate head reading hidden states may not respond to it at all, and the authors warn that adaptive attackers who include the prompt can defeat it. Randomization Mitigating Adversarial Effects Through Randomization moves the coordinate frame and is known to weaken under expectation-over-transformation attacks. We evaluate both against adaptive attacks and report their clean IoU cost. If either holds up, that is itself a notable finding for continuous heads.

Why not just use Robustness Tokens? They are cheap and strong on classification Robustness Tokens: Towards Adversarial Robustness of Transformers. However, they optimize feature alignment, and residual misalignment that leaves a class label intact may still shift a box by many pixels. Measuring pixel displacement under attack settles this.

Proposed Experiments

On RefCOCO, RefCOCO+ and RefCOCOg we report the following at $\ell_\infty$ radii of 2/255, 4/255 and 8/255: clean and attacked [email protected], mean IoU, and center displacement. The attacks are untargeted 50-step PGD on the displacement loss, the image-embedding attack, and the exclusive targeted attack from Adversarial Robustness for Visual Grounding of Multimodal Large Language Models, whose attack success rates are the targeted metric. Every result is plotted against GPU-hours. V* Bench serves as the transfer check, measuring box IoU against the clean 59.5 reference and answer accuracy for robust models.

Three outcomes are decisive. The first is whether vanilla single-step training of spread heads overfits catastrophically, with spread inflation and a falling gradient norm preceding the collapse. If not, the masking hypothesis is wrong and the diagnostic is the main result. The second is whether the decoupled recipe closes at least most of the gap to 7-step training at near single-step cost, across three seeds. The third is whether its predicted spread remains correlated with true error under adaptive attack, which is the property a spread-free model cannot offer.