Test-Time Attention Purification for Backdoored Large Vision Language Models

Zhifang Zhang, Bojun Yang, Shuo He, Weitong Chen, Wei Emma Zhang, Olaf Maennel, Lei Feng, Miao Xu · 2026

Read Test-Time Attention Purification for Backdoored Large Vision Language Models by Zhifang Zhang, Bojun Yang, Shuo He, Weitong Chen, Wei Emma Zhang, Olaf Maennel, Lei Feng, Miao Xu (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-12989.txt.

Introduction

Zhifang Zhang and co-authors defend large vision-language models against backdoor attacks with a test-time attention fix. Attackers plant trigger samples in fine-tuning data to hijack later behavior. The team finds triggers act not through raw visual patterns, but by stealing attention from text. Their CleanSight flags poisoned inputs by the visual-text attention ratio in fusion layers. It then prunes suspect high-attention visual tokens to disarm the trigger. Tests beat pixel-based defenses while keeping clean performance.

Catalog record

CREATORZhifang Zhang, Bojun Yang, Shuo He, Weitong Chen, Wei Emma Zhang, Olaf Maennel, Lei Feng, Miao Xu
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE60642
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2603.12989

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Test-Time Attention Purification for Backdoored Large Vision Language Models Zhifang Zhang, Bojun Yang, Shuo He, Weitong Chen, Wei Emma Zhang, Olaf Maennel, Lei Feng, Miao Xu Abstract Despite the strong multimodal performance, large vision–language models (LVLMs) are vulnerable during fine-tuning to backdoor attacks, where adversaries insert trigger-embedded samples into the training data to implant behaviors that can be maliciously activated at test time. Existing defenses typically rely on retraining backdoored parameters (e.g., adapters or LoRA modules) with clean data, which is computationally expensive and often degrades model performance. In this work, we provide a new mechanistic understanding of backdoor behaviors in LVLMs: the trigger does not influence prediction through low-level visual patterns, but through abnormal cross-modal attention redistribution, where trigger-bearing visual tokens steal attention away from the textual context — a phenomenon we term attention stealing. Motivated by this, we propose CleanSight, a training-free, plug-and-play defense that operates purely at test time. CleanSight (i) detects poisoned inputs based on the relative visual–text attention ratio in selected cross-modal fusion layers, and (ii) purifies the input by selectively pruning the suspicious high-attention visual tokens to neutralize the backdoor activation. Extensive experiments show that CleanSight significantly outperforms existing pixel-based purification defenses across diverse datasets and backdoor attack types, while preserving the model’s utility on both clean and poisoned samples. Figure 1 : Comparison between pixel-based and attention-based perturbation defenses. We compare the attack success rate (ASR) of backdoored LLaVA Liu et al. 2024 and CLIP Radford et al. 2021 under pixel perturbation (transformation-based defense Li et al. 2020 ) and attention perturbation (interpolating the visual attention with a uniform distribution) with varying intensity. Unlike backdoored CLIP trained from scratch on poisoned data, pixel perturbation barely reduces the ASR of backdoored LVLMs, whereas attention perturbation rapidly suppresses it as the intensity increases. Visualizations on the right illustrate how increasing perturbation intensity alters the poisoned image or attention map of the poisoned image. 1 Introduction Large vision–language models (LVLMs) ( Liu et al. 2023a ; Bai et al. 2023 ; Wenliang Dai 2023 ; Hurst et al. 2024 ) achieve strong multimodal performance ( Kuang et al. 2025 ; Cheng et al. 2025a ; Sima et al. 2024 ; Fu et al. 2025b ; Fu et al. 2025c ) by projecting visual features into the language space of an LLM through a lightweight adapter. This design also grants LVLMs remarkable adaptability: by fine-tuning only the visual adapter, they can be efficiently customized to diverse downstream tasks ( Dong et al. 2025 ; Sun et al. 2025 ; Cheng et al. 2025b ; Wu et al. 2024 ; Zhang et al. 2025c ; Zhang et al. 2025f ; Ti et al. 2025 ; Fu et al. 2025a ) , enabling widespread deployment in real-world applications. However, this fine-tuning stage also introduces security risks ( Ye et al. 2025 ; Ma et al. 2025 ; Zhao et al. 2025 ) . In particular, backdoor attacks ( Gu et al. 2019 ) can implant hidden malicious behaviors by injecting poisoned samples with stealthy image triggers and corresponding target responses into the fine-tuning data, causing the poisoned LVLM to output attacker-specified results whenever the trigger appears at inference time, thereby threatening the reliability and safety of deployed LVLM systems. To counteract this threat, existing approaches focus on training-required defenses, which retrain backdoored parameters such as adapter or LoRA modules ( Hu et al. 2022 ) using newly collected clean data ( Ni et al. 2024 ) or re-examined fine-tuning datasets ( Rong et al. 2025 ) . However, these methods incur heavy data and computation costs, and often degrade the downstream performance, since retraining disrupts the tuned parameters specialized for downstream tasks. These limitations motivate us to develop the first test-time defense framework that avoids perturbing model parameters and instead intervenes on the non-parametric data flow of the poisoned inputs. Specifically, we note that prior active test-time defenses ( Shi et al. 2023 ; Li et al. 2020 ; Yang et al. 2024 ) , which attempt to correct poisoned predictions, are largely tailored to models trained from scratch on poisoned datasets (e.g., ViT ( Dosovitskiy et al. 2020 ) , CLIP ( Radford et al. 2021 ) ) and primarily perturb the poisoned input in pixel space, i.e., pixel perturbation to disrupt the trigger–target correlation. However, we find that the spurious relationship concealed in backdoored LVLMs remains largely insensitive to pixel perturbations but highly fragile to attention perturbations, such as flattening the visual attention weights. As shown in Figure 1 , different from backdoored CLIP that is trained from scratch on poisoned data, pixel perturbation only slightly reduces the attack success rate of backdoored LVLM, whereas attention perturbation rapidly suppresses it as the perturbation intensity increases. Interestingly, when the visual attention weights received from the output tokens are fully averaged, the backdoor effect disappears even though the pixels of the trigger pattern remain intact (see Figure 1 when attention perturbation intensity equals 1). To summarize, this observation suggests that backdoor correlations in LVLMs are not tied to low-level visual trigger features but rather abnormal cross-modal attention interactions. Building on this observation, we further examine the abnormal cross-modal attention patterns in backdoored LVLMs and find that their core abnormality manifests as attention stealing . In contrast to prior findings ( Chen et al. 2024 ; Yang et al. 2025a ) , where image tokens typically receive much lower attention than textual ones in the middle layers of LVLMs, the poisoned inputs exhibit a clear reversal of this trend: the overall visual attention sharply increases while the textual attention correspondingly declines, as if the image tokens are stealing attention from the text prompt (see Figure 2 (a)(b)). This shift suggests that the trigger redirects the model’s attention from the textual context to the visual regions, thereby weakening instruction following of the backdoored LVLM. Further, Figure 2 (c) shows that the visual tokens receiving abnormally high attention precisely align with the trigger regions, demonstrating that the surge of visual attention is localized and induced by the trigger tokens themselves, which in turn strengthens the backdoor-associated semantics. Crucially, when we explicitly suppress the tokens with attention spikes at test time, the backdoor behavior disappears while the clean semantics are preserved, establishing attention stealing as a causal rather than merely correlative factor in activating the backdoor. Inspired by this finding, we introduce CleanSight , a training-free, plug-and-play defense framework that operates purely at test time. CleanSight first detects poisoned inputs by measuring head-specific vision-to-text attention ratios in a set of middle cross-modal fusion layers and scoring them against a clean reference distribution via a whitened \ell_{2} distance. Once an input is flagged as poisoned, CleanSight aggregates visual tokens with abnormally high attention across heads and prunes them, thereby preventing these trigger-dominated tokens from stealing attention in subsequent layers and the decoding process. Extensive experiments show that CleanSight achieves substantially better performance than pixel-level purification defenses across multiple datasets and backdoor attack settings, while preserving model utility on both clean and poisoned inputs. Figure 2 : Visualization of attention stealing in backdoored LVLMs. (x.1) shows patch-triggered attention stealing, while (x.2) shows global-triggered attention stealing. (a) Cross-modal attention allocation showing abnormal attention stealing from text

Read the complete text