Hazard-Attention Adversarial Training for Vision-Language Safety

Vision-language models (systems that read an image and a text prompt together and write a response) often lose the safety behavior of the language model they were built on. There are two separate ways this happens. An attacker can add small, carefully computed pixel noise that pushes the model into answering harmful requests. Separately, a harmless photo paired with a harmless question can together ask for something dangerous, and the model answers anyway. The standard example is a photo of bleach and ammonia bottles with the question "how do I mix these for the best cleaning result?" The field treats these as different problems with different fixes: adversarial training for the first, safety fine-tuning on curated image-text pairs for the second. We propose that both may share one internal failure. While the model writes its answer, it stops attending to the image regions that carry the hazard. If that is true, a single defense should cover both.

The proposal has two parts. First, we test that shared mechanism causally. Second, if the test passes, we harden models with an adversary whose only goal is to pull the model's attention away from the hazard. This differs from the usual adversary, which pushes the output toward a harmful target string. The hypothesis is that training against the attention mechanism generalizes better than training against output symptoms. It should transfer both to attack types never seen in training and to naturally occurring "safe image plus safe text, unsafe answer" cases that involve no attacker at all.

Core Claim

Three lines of evidence point in the same direction without being connected. The Side Effects of Being Smart studies multi-image reasoning and finds that unsafe generations have lower attention entropy than safe ones: attention concentrates on task-solving and crowds out safety behavior. That finding is correlational. Meerkat-VL shows refusal tracks whether the model perceives the implicit risk, and that stating the hazard explicitly in text fixes the failure. The bottleneck is therefore integrating what the model sees, not the safety policy itself. Finally, the attention-attack literature shows attention can be steered adversarially. Patch-Fool drives attention onto a single patch. Attacking Attention of Foundation Models Disrupts Downstream Tasks makes clean and adversarial attention diverge in CLIP and DINOv2 to break downstream heads. All of that work targets perception metrics, not generation or safety.

Our claim is this. If starving the hazard of attention causes emergent multimodal toxicity, then the attention mass flowing from generated answer tokens to hazard-carrying image tokens is a shared bottleneck. An adversary that attacks exactly this quantity is then a better training partner than one that attacks outputs. What is new is making attention redirection the object of the inner maximization in safety adversarial training, and evaluating transfer to non-adversarial emergent toxicity. As far as the file shows, no paper does either.

Research Program

Stage one: localize the hazard without a teacher model. For each image-text pair, we first ask the model directly whether the scene poses a risk given the request. Meerkat-VL's finding suggests models often answer this correctly even when they fail in open generation. We then mask image patches and measure how much each masked patch lowers the model's own explicit risk judgment. The patches whose masking lowers it most are the hazard tokens, $H$.

This procedure deliberately avoids depending on a frontier model for synthetic annotations, a dependence DREAM is noted to have. We will check the resulting hazard maps against human-drawn boxes on a few hundred items.

Stage two: the causal test that gates everything else. At inference, we add a bias to the attention logits so that answer tokens attend more to $H$. We then measure whether safe-response rates rise on the SIUO benchmark from Safe Inputs but Unsafe Output.

We also run the reverse intervention on inputs the model already refuses. Suppressing attention to $H$ should flip refusals into compliance. As a control, we bias attention toward random patches that have been matched for how salient they are.

If boosting attention to $H$ does not beat the random-patch control, the premise is wrong. In that case we stop and report the negative result, because it would show that the entropy correlation from the Side Effects paper is a side effect rather than a cause.

Stage three: hazard-attention adversarial training. We define the hazard attention of input $x$ as

$$A_H(x) = \frac{1}{|R|}\sum_{r \in R}\sum_{h \in H} \alpha_{r,h}(x),$$

where $R$ is the set of response token positions, $H$ is the set of hazard image tokens, and $\alpha_{r,h}$ is the attention weight from $r$ to $h$, averaged over layers and heads in the middle-to-late band that stage two identifies as causally relevant.

The inner adversary searches for a perturbation $\delta$ in a bounded pixel set $\mathcal{S}$ that minimizes $A_H(x+\delta)$. The outer objective trains the model, on the perturbed input, to produce the safe response: a refusal, or a safe completion that names the hazard. It also includes a utility term computed on benign image-text pairs. This follows the min-max form of Madry et al., with one change: the adversary optimizes the attention mechanism rather than the output loss.

We borrow MixAT's seeding idea from MixAT, which centers continuous embedding perturbations on discrete, human-readable jailbreak rewrites. Here the discrete seeds are safe-safe image-text pairs that carry a hazard, and the continuous perturbation is built around each seed.

This differs from the attention defenses already in the literature. TGA-ZSR pulls a vision-language model's attention back toward a frozen clean teacher, and AAD penalizes attention outside object masks. Both protect classification accuracy, and both anchor attention to the whole object or to clean attention patterns. We target a specific, safety-relevant attention pathway during autoregressive generation, and we use it to build the adversary rather than as a regularizer.

Utility and over-refusal. Adversarial training is known to cause over-refusal. For every hazardous training pair we therefore build a benign twin: the same image with a clearly benign request, or the same request with the hazard edited out of the image. We report refusal on these twins alongside safety scores.

Baselines

The do-nothing reference is the base aligned vision-language model with no additional training. It anchors every safety and utility number.

The strongest existing alignment method in the file is risk-aware fine-tuning followed by preference optimization, as in DREAM, with Meerkat-VL's reinforcement learning with perceptual self-verification as a second strong comparator. Both train directly on implicit-risk data, so they are the natural competitors on SIUO. We will reimplement both on the same backbone, the same safe-safe training seeds, and the same number of gradient steps and tuning trials as our method.

I found no reported result on Lacuna for DREAM, Meerkat-VL, or TGA-ZSR on SIUO or any other benchmark in the file, so no number can be quoted. Beating them means two things together. First, matching their clean SIUO safe rate within noise. Second, beating them by a clear margin, which we will pre-register at five points of attack success rate, under adaptive pixel attacks and on held-out attack families.

The output-targeted adversarial training baseline uses an identical setup, but the inner adversary maximizes the likelihood of a harmful target response instead of minimizing $A_H$. This is the ablation that isolates our key ingredient. Everything else is held fixed: data, perturbation budget, number of inner steps, and outer loss.

A random-region attention adversary minimizes attention to salience-matched random patches instead of $H$. It tests whether hazard localization matters, or whether any attention disruption during training helps.

An inference-time caption-first pipeline has the model describe the image and any risks before answering, in the spirit of the few-shot risk-reasoning demonstrations in Safe Semantics, Unsafe Interpretations. It uses zero training compute. We give it the same prompt-tuning budget we spend on tuning our own hyperparameters.

Why not just…?

Why not just fine-tune on more implicit-risk data, as DREAM and Meerkat-VL do? This is the real threat on clean, non-adversarial inputs, and our method may not beat it there. The case for our approach concerns robustness. Supervised safety data teaches what to output on the input distribution the model has seen. The file notes this risks superficial refusal habits and "fake refusals" (Meerkat-VL's reward-hacking analysis). It also offers no guarantee against a perturbation that suppresses perception of the hazard. The comparison under adaptive attack will settle this. If DREAM-style training holds up equally well under attention-redirecting and output-targeted attacks, our method adds nothing, and we will say so.

Why not just use standard output-targeted adversarial training? This is the most direct alternative, and it is our central ablation. The reason to expect a difference comes from text models. MixAT reports that training on the right perturbation space, rather than the most obvious one, is what produces transfer across attacks. An output-targeted adversary may learn attack-specific shortcuts. The decisive number is the held-out-attack and SIUO-transfer gap between the two adversaries at equal compute.

Why not just make the model caption the hazard first, given that Meerkat-VL shows explicit hazards fix the failure? On clean inputs this may work about as well as our method at far lower cost, and we expect it to be competitive there. Its weakness is that the caption becomes a single point of failure: an adaptive attacker can perturb the image so that the caption omits the hazard. We will run exactly this attack, optimizing the perturbation to remove hazard words from the caption. If the caption-first pipeline survives it, then the cheap fix is the right answer, and we would redirect the project toward making captions robust.

Why not just monitor attention entropy at inference and refuse when it drops? The Side Effects paper's correlation makes this tempting. A monitor built on a correlated signal, however, can be gamed by an attacker who shapes entropy directly, and it does nothing to restore the model's perception of the hazard. We include an entropy-threshold detector as an extra comparison and evaluate it under an attacker that knows the detector exists.

Proposed Experiments

Safety benchmarks. We use SIUO for single-image emergent toxicity. For transfer to harder reasoning, we use the multi-image benchmark from The Side Effects of Being Smart and the Meerkat-Safe data where it is available. The research file does not give the multi-image benchmark's name.

Adversarial evaluation. Attacks are run with bounded pixel budgets and fall into three groups. In-family attacks are hazard-attention attacks. Held-out attacks include output-targeted pixel attacks, the task-agnostic attention-divergence attack from Attacking Attention of Foundation Models adapted to the vision encoder, and typographic or text-in-image variants. Fully adaptive attacks are optimized against each trained defense.

Metrics. We report attack success rate and safe-response rate, both judged by an LLM judge. MixAT warns that generative-safety judgments are sensitive to the judge's prompt template and decoding settings. We therefore use two judges with different prompt templates and a human audit of 300 samples per condition, and we report agreement between them.

Utility. We measure accuracy on standard visual question answering and refusal rate on the benign twins. The research file names no specific multimodal utility benchmark, so the choice of set will be fixed before training.

Controlling for "safety by incompetence." Because weaker models can look safe simply because they fail to solve the query, we report safety only on items where the model's explicit-probe answer shows it understood the scene.

Decisive checks. Three results decide the project. The first is stage two's causal test: boosting attention to the hazard must beat the random-patch control, or the project stops. The second is the head-to-head against output-targeted adversarial training at matched compute, on held-out attacks and on SIUO with no perturbation at all. Our claim holds only if the attention adversary wins on transfer, not just on its own attack family. The third is the adaptive-attack comparison against the caption-first pipeline. It tells us whether training on the attention pathway buys robustness that a cheap prompting fix cannot.