AVERT: Anomalous Value Erasure with Response Testing against Visual Prompt Injection

Newt Hue-Nam K. Nguyen, Jui-Yu Ho, Wei-Han Chen, Pin-Yen Ting, Yangqiu Song, Shang-Tse Chen, Jun-Cheng ChenarXiv 2026

TL;DR

Vision Language Models (VLMs) can be hijacked by invisible pixel perturbations that force them to output spam, phishing links, or unauthorized tool calls instead of answering the user's question. Existing defenses scrub every incoming image just in case, ruining the model's ability to read fine details like small text or charts. AVERT solves this trade-off by acting like a targeted immune response: it isolates suspicious neural signals inside the model's attention layers, tests whether the model's answer actually relies on them, and performs surgical removal only when an attack is actively steering the output.

Figure 1. AVERT at a glance. An attacked image makes the VLM ignore the question (”Please classify this image“) and output the attacker’s text. AVERT re-scores the answer twice: once with the image’s anomalous value subspace (AVS) removed, and once under unrelated questions. An injected answer collapses without the AVS yet stays likely under other questions, so it is flagged and regenerated without the AVS. A clean answer shows the opposite pattern and is returned unchanged.

What Problem Does This Paper Address?

As VLMs increasingly power autonomous agents, they routinely process untrusted images from websites, documents, and messages. In visual prompt injection, an attacker subtly perturbs an image's pixels so that when a user asks an innocent question ("What's the weather in this photo?"), the VLM ignores the prompt and executes the attacker's hidden agenda—like appending an advertisement or calling an email API to leak the user's query.

Notice that unlike classic "jailbreaks," these forced outputs aren't necessarily toxic or harmful, meaning standard safety filters let them right through. Meanwhile, existing defenses like diffusion-based image purification (DiffPure) or gradient-based token masking (GTM) alter every image upfront. That's like putting blurry sunglasses on the model: it stops the attack, sure, but it also destroys fine-grained visual utility on benign tasks like reading documents or parsing web pages. The authors ask: how do we neutralize hidden injections without degrading performance on clean images?

Methods

AVERT (Anomalous Value Erasure with Response Testing) is an inference-time defense that separates what to remove from when to remove it, operating in three stages without needing prior examples of attacks:

Figure 2. AVERT runs in three stages at inference time. (a) Generate: the VLM answers the question q about the image x as usual, giving the answer y. (b) Anomalous Value Subspace (AVS): from the same forward pass, AVERT finds, for every attention head, the directions in which the image-token values deviate most from clean images. This AVS will also be used to determine whether AVERT will intervene in the answer. (c) Answer-Dependence Gate: AVERT scores y with two tests. Question independence test and likelihood collapse test. If the injected answer fails a test, then AVERT regenerates it with the AVS removed from the image-token values in every layer. A clean answer passes both tests and is returned unchanged.
  1. Standard Generation: The VLM processes the image and user question normally to produce an initial candidate answer.
  2. Finding the Anomalous Value Subspace (AVS): In decoder-only VLMs, text tokens only "see" the image by attending to image-token value vectors in each attention head. From that very first forward pass, AVERT compares the mean and covariance of the input's attention-head outputs against precomputed reference statistics from unlabeled clean images. Using Fisher’s discriminant (a whitened mean shift) plus generalized eigenvectors, it extracts the top $k$ directions where the input deviates most wildly from normal images.
  3. The Answer-Dependence Gate: Because those anomalous directions might also hold legitimate, quirky visual details (like unusual fonts), AVERT doesn't blindly erase them. Instead, it subjects the candidate answer to two likelihood tests:
  4. Likelihood Collapse: Does the probability of generating this exact answer plummet if we project out the AVS?
  5. Question Independence: Does this answer remain suspiciously likely even if we swap the user's prompt with unrelated questions (e.g., "What is 17 plus 25?")?

If—and only if—either test triggers a flag, AVERT discards the candidate and regenerates the answer with the AVS projected out of the image-token values across every layer. Otherwise, the original answer is returned completely untouched.

Datasets

No new datasets are introduced, though the evaluation spans a wide array of existing benchmarks:

  • Attack Evaluation (4 benchmarks): ImgHijack, Vision-language model Manipulation Attack (VMA—covering manipulation, privacy, watermarking, hijacking, and denial-of-service), self-interpreting images (spam/URL appending), and tool-call injection.
  • Utility Evaluation (13 benchmarks): MM-Vet, MMBench, MME, plus ten rule-scored datasets covering fine-grained tasks like documents, charts, scene text, web pages, math, counting, and captioning (including COCO and VisualWebBench).

Key Insights and Ideas

  • Injections push activations in a shared direction: Output-forcing perturbations don't scatter noise randomly; they shift image-token value vectors along a concentrated, low-dimensional subspace so that any text token attending to the image picks up the payload. Projecting out just $k=4$ anomalous directions per head drives attack success near zero.
  • Test the behavior, not the content: Harm-based detectors miss benign-looking injections like ads or API calls. Checking causal dependence—whether the answer relies on statistical anomalies or ignores the user's question—catches any output-forcing payload regardless of its topic.
  • Adaptive attackers face a catch-22: Even when attackers know exactly how AVERT works and optimize their pixels to evade the gate, they fail. Why? Because the very signals the gate detects (question independence and reliance on anomalous features) are what make a forced payload work in the first place. Hiding from the gate neuters the attack itself.

Key Results

Evaluated across four VLMs (Qwen2-VL-7B, Qwen2.5-VL-7B, LLaVA-Llama-2-13B, and InternVL2.5-8B):

  • Near-zero attacks: AVERT drops average white-box Attack Success Rates (ASR) from 86.1–90.1% down to 0.1–0.6%.
  • Preserved sharp vision: It retains 96.2–98.5% of undefended model utility across 13 benchmarks, shining on text-dense charts and web pages where DiffPure drops to ~68% retention.
Figure 5. Clean input utility of each defense, relative to the un- defended model (100%, dashed) on four VLMs. The further out, the better. Axes show MM-Vet, MMBench, MME (perception and cognition), and Ret., the mean retention over all 13 utility bench- marks. AVERT retains about 98% on average.
  • Best overall balance: Using the Defense-Utility F-score ($F_{DU}$, harmonic mean of attacks stopped and utility retained), AVERT scores 98.0–99.1, ranking #1 on every model ahead of GTM (89.0–97.6), DiffPure (80.6–94.3), and ASTRA (31.2–86.1).
  • Genuine recovery: Rather than outputting canned safety refusals, regenerated answers actually answer the user's real question about the image.

Limitations and Future Work

The gate isn't completely infallible on benign inputs: its thresholds are calibrated on development data to allow a ~5% false-positive budget on clean answers. When a clean image gets mistakenly flagged, regenerating it without its top anomalous directions strips away some legitimate visual nuance—which accounts for nearly all of AVERT's remaining 1.5–4% utility dip. The authors highlight tightening these detection tests to drive down false positives on clean answers as the primary avenue for future work.

Summary updated

Abstract

Vision Language Models (VLMs) are vulnerable to visual prompt injection, in which an adversarially perturbed image forces the model to respond with the attacker's chosen content, such as malicious tool calls, website links, or advertisements, sometimes regardless of the user's question. Existing defenses, such as diffusion-based purification and image-token masking, mitigate these attacks at a substantial cost to the model's utility on benign inputs. To address this challenge, we propose AVERT, which removes adversarial feature directions only when the model's answer depends on them. Our key procedures involve identifying anomalous value subspaces and detecting answer dependence. To identify the anomalous value subspace, we compare the statistics of each input's attention-head outputs with those of clean images and extract the directions along which the input deviates the most. We then project out these directions to remove the injected content. Because the same directions also carry benign visual information, we apply the removal only to answers that depend on them, namely answers whose likelihood collapses once the directions are removed or that are as likely under unrelated questions as under the user's question. Against white-box attacks on four VLMs (Qwen2-VL, Qwen2.5-VL, LLaVA, InternVL2.5) and four injection benchmarks, AVERT lowers average attack success from 86-90% to at most 0.6% while retaining at least 96% of undefended utility averaged over thirteen benchmarks. Its defense-utility F-score ($F_{DU}$), the harmonic mean of attacks stopped and utility retained, is 98.0-99.1 and the highest among all compared defenses on every model.
BibTeX
@misc{nguyen2026avert,
  author = {Newt Hue-Nam K. Nguyen and Jui-Yu Ho and Wei-Han Chen and Pin-Yen Ting and Yangqiu Song and Shang-Tse Chen and Jun-Cheng Chen},
  title = {{AVERT: Anomalous Value Erasure with Response Testing against Visual Prompt Injection}},
  year = {2026},
  eprint = {2611.33532},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.33532},
}
Figure