Manuscript Offprint

arXiv:2608.24354

Not All Tokens Are Equal: Region-Aware Consistency Repair of Backdoors in MLLMs

Jiali Wei, Ming Fan, Mingkun Zhang, Haoyu Wang, Jun Sun, Guoheng Sun, Xiaoning Ren, Haijun Wang, Ting Liu

Jiali Wei†, Ming Fan†*, Mingkun Zhang†, Haoyu Wang‡, Jun Sun‡, Guoheng Sun†, Xiaoning Ren†, Haijun Wang†, Ting Liu†

†Xi'an Jiaotong University, ‡Singapore Management University

Abstract—Multimodal large language models (MLLMs) are increasingly deployed in user-facing applications, yet they inherit backdoor risks from the pipelines used to construct them: triggers may reside in images, texts, or both. Existing model-level backdoor removal methods, largely designed for conventional classifiers, show limited effectiveness on MLLMs, while MLLM-specific defenses mainly operate at inference time, filtering suspicious inputs without removing the backdoor embedded in the model. To address this gap and eliminate latent backdoors from MLLMs at their source, we present RACER, a model-level repair framework motivated by a key observation: backdoors induce abnormal layer-to-layer evolution in internal representations, which we term the layer-wise inconsistency anomaly. Importantly, this anomaly is modality-dependent, concentrating primarily in the token region encoding the trigger features that the backdoor model actually relies on. RACER therefore decomposes the fused representation into visual and textual token regions, normalizes their layer-wise inconsistency separately, and recomposes them using modality-aware weights over a deep-layer window, yielding a region-aware inconsistency objective that better captures localized backdoor-induced anomalies. Through a min-max optimization, this objective drives worst-case perturbation synthesis and adversarial fine-tuning against the resulting perturbation to repair the model, suppressing the deep representational directional shifts on which backdoor behaviors rely. RACER requires only 100 clean samples and no knowledge of the trigger, attack objective, or even whether the input model contains a backdoor. Evaluations on three open-source MLLMs across 36 backdoor settings spanning image, text, and multimodal triggers show that RACER reduces the average attack success rate (ASR) to 1.1%, reaching 0% in 32 of the 36 settings, while preserving clean-task utility on both backdoor and clean models.

I. INTRODUCTION

Multimodal large language models (MLLMs), such as LLaVA [1], [2] and Qwen-VL [3], [4], increasingly power visual question answering [5]–[7], document understanding [8]–[10], and agentic assistants [11]–[13]. Yet their development pipelines often rely on potentially untrusted components, including web-scale image-text corpora [14], [15], third-party pretrained weights [16], [17], and community-published fine-tuning recipes [18], [19]. This fragmented supply chain exposes MLLMs to backdoor attacks [20]–[24], in which poisoning a small fraction of the training data can implant a hidden association between a trigger and an attacker-specified behavior. A backdoor model behaves normally on clean inputs but produces attacker-specified content once the trigger is present [20], [25], [26].

The multimodal setting further expands the attack surface: triggers may appear as localized patches [20], blended watermarks [25], or periodic signals [27] in images; rare words or inserted sentences [28], [29] in text; or combinations of both. Recent attacks further demonstrate covert manipulation of open-ended generation [30], poisoning with only out-of-distribution data [31], robustness to domain shift [32], and even implicit activation by particular visual objects without explicit triggers [33]. These diverse attack forms make it difficult for defenders to anticipate either the trigger type or its modality.

Existing defenses remain inadequate for this setting. Classical approaches based on trigger inversion [34], neuron pruning [35], [36], and input filtering [37] were primarily designed for conventional classifiers and rely on identifying compact triggers, backdoor-related neurons, or anomalous inputs. These assumptions do not readily transfer to billion-parameter autoregressive MLLMs with open-ended outputs, limiting their effectiveness for model-level backdoor removal [38]. Meanwhile, existing MLLM-specific defenses mainly operate at inference time [39], [40], leaving the poisoned weights intact and allowing the backdoor to persist in the redistributed checkpoint.

Research Question. We therefore ask: given an MLLM and only a small clean set, can a defender remove a potential backdoor from the model without any knowledge of the backdoor or trigger, or even whether the model contains a backdoor at all? Addressing this question requires an attack-agnostic signal intrinsic to the model itself, rather than one that relies on identifying or reconstructing the trigger.

We seek such a signal in the model’s internal representation dynamics. Prior studies suggest that a backdoor forms an abnormal association between a trigger and a specific behavior, disrupting the otherwise smooth layer-to-layer evolution of hidden representations when activated [38], [41], [42]. We characterize this disturbance through layer-wise inconsistency and refer to the resulting abnormality as the layer-wise inconsistency anomaly. However, because an MLLM processes a fused sequence comprising modality-specific visual and textual token regions, a critical question arises: where does this anomaly emerge when a backdoor is activated?

Observation: The Layer-Wise Inconsistency Anomaly Is Modality-Dependent. Our analysis reveals that the anomaly is not uniformly distributed across the multimodal sequence, but concentrates primarily in the token region encoding the trigger

∗^{*}Corresponding author.

features that the backdoor model actually relies on: image triggers predominantly increase inconsistency among visual tokens, whereas text triggers predominantly affect textual tokens. This effect becomes more pronounced in deeper layers, where representations become increasingly relevant to the model's output behavior. By aggregating visual and textual tokens into a single scalar, a sequence-level inconsistency metric obscures this modality-specific localization and may therefore weaken the repair signal. Together, these observations motivate a region-aware inconsistency objective that preserves modality-specific anomaly information and restricts the repair constraint to the deeper layers.

Our Approach. We present RACER, a region-aware consistency repair framework. To more precisely and effectively eliminate the layer-wise inconsistency anomaly and remove backdoors, RACER decomposes the layer-wise inconsistency of the fused representation into regions corresponding to the visual and textual modalities, performs normalization within each modality region, and recombines the normalized inconsistency scores under modality-aware weights over a deep-layer window. This design yields a region-aware inconsistency objective that faithfully reflects backdoor-induced anomalies localized to individual modality regions. Building on this objective, RACER constructs a worst-case perturbation and adversarially fine-tunes the model through a min-max optimization.

Because the defender has no information about backdoors or triggers, an inner maximization constructs a perturbation to the fused input embedding that maximally disrupts region-aware consistency within a bounded neighborhood; an outer minimization updates the model against the resulting perturbation, while a standard autoregressive loss over the clean repair set preserves utility. As a result, jointly solving this min-max optimization over the perturbation and the model parameters yields a model in which the deep representational directional shifts underlying backdoor behaviors are suppressed throughout the perturbation neighborhood, thereby effectively removing backdoors associated with diverse types of triggers. RACER requires no knowledge of the trigger or the backdoor, nor does it assume that the received model contains a backdoor. Accordingly, it applies the same repair procedure to every received model, removing potential backdoors while preserving clean-task utility with negligible degradation.

We evaluate RACER on three open-source MLLMs across 36 backdoor settings, covering six attacks spanning image, text, and multimodal triggers and two attack objectives. Compared with four representative model-level baselines and a sequence-level consistency repair baseline, RACER achieves substantially stronger backdoor removal, reducing the average attack success rate (ASR) from 98.6%98.6\% without defense to 1.1%1.1\% after repair and reaching 0%0\% ASR in 32 of the 36 settings. These gains are consistent across all three trigger modalities, while clean-task utility remains close to its pre-repair level on both backdoor and clean models.

Contributions. We make the following contributions.

  • A modality-dependent internal anomaly. We identify a

∣T∣≈20−60|\mathcal{T}| \approx 20 - 60

SYSvisual tokens VTanswer

∣V∣=576|\mathcal{V}| = 576 (LLaVA) or dynamic (Qwen-VL)

Fig. 1: Structure of a fused MLLM sequence.

layer-wise inconsistency anomaly in backdoor MLLMs and show that it concentrates primarily in the token region encoding the trigger features that the backdoor model actually relies on and becomes more pronounced in deeper layers.

  • RACER, a region-aware repair framework. We introduce a region-aware inconsistency objective that separately normalizes visual and textual token regions, recombines them with modality-aware weights, and applies the consistency constraint over a deep-layer window. Built on this objective, RACER performs adversarial consistency repair through a min-max optimization without any backdoor-specific information.

  • Extensive evaluation. We evaluate RACER across 36 backdoor settings on three MLLMs against five model-level baselines, demonstrating consistently superior effectiveness across all trigger modalities with limited utility cost.

References (55)

  • Visual instruction tuning
  • Improved baselines with visual instruction tuning
  • Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution
  • Qwen2.5-VL Technical Report
  • Vqa: Visual question answering
  • Making the v in vqa matter: Elevating the role of image understanding in visual question answering
  • Mmbench: Is your multi-modal model an all-around player?
  • Docvqa: A dataset for vqa on document images
  • Layoutlm: Pre-training of text and layout for document image understanding
  • ChartQA: A benchmark for question answering about charts with visual and logical reasoning
  • Cogagent: A visual language model for gui agents
  • Mind2web: Towards a generalist agent for the web
  • Gpt-4v(ision) is a generalist web agent, if grounded
  • Laion-5b: An open large-scale dataset for training next generation image-text models
  • Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning
  • Transformers: State-of-the-art natural language processing
  • The Hugging Face model hub
  • Llamafactory: Unified efficient fine-tuning of 100+ language models
  • Lora: Low-rank adaptation of large language models
  • Badnets: Identifying vulnerabilities in the machine learning model supply chain (opens arXiv in a new tab)
  • Trojaning attack on neural networks
  • Backdoor learning: A survey
  • Poisoning web-scale training datasets is practical
  • Poisoning and backdooring contrastive learning
  • Targeted backdoor attacks on deep learning systems using data poisoning (opens arXiv in a new tab)
  • Hidden trigger backdoor attacks
  • A new backdoor attack in cnns by training set corruption without label poisoning
  • Bite: Textual backdoor attacks with iterative trigger injection
  • A backdoor attack against lstm-based text classification systems
  • Trojvlm: Backdoor attack against vision language models
  • Backdooring vision-language models with out-of-distribution data
  • Revisiting backdoor attacks against large vision-language models from domain shift
  • Shadow-activated backdoor attacks on multimodal large language models
  • Neural cleanse: Identifying and mitigating backdoor attacks in neural networks
  • Fine-pruning: Defending against backdooring attacks on deep neural networks
  • Adversarial neuron pruning purifies backdoored deep models
  • Strip: A defence against trojan attacks on deep neural networks
  • Crow: eliminating backdoors from large language models via internal consistency regularization
  • Purmm: Attention-guided test-time backdoor purification in multimodal large language models
  • Test-time attention purification for backdoored large vision language models (opens arXiv in a new tab)
  • Similarity of neural network representations revisited
  • Tracing representation progression: Analyzing and enhancing layer-wise similarity
  • Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models
  • Flamingo: a visual language model for few-shot learning
  • Instructblip: Towards general-purpose vision-language models with instruction tuning
  • Towards deep learning models resistant to adversarial attacks
  • Microsoft coco: Common objects in context
  • Microsoft coco captions: Data collection and evaluation server (opens arXiv in a new tab)
  • Backdoorvlm: A benchmark for backdoor attacks on vision-language models (opens arXiv in a new tab)
  • Qlora: Efficient finetuning of quantized llms
  • Cider: Consensus-based image description evaluation
  • Backdoorllm: A comprehensive benchmark for backdoor attacks and defenses on large language models
  • Instruction backdoor attacks against customized {LLMs}
  • Backdoor cleaning without external guidance in mllm fine-tuning
  • Freelb: Enhanced adversarial training for natural language understanding