Tracing and Mitigating Hallucinations in Multimodal LLMs via Dynamic Attention Localization

Tiancheng Yang, Lin Zhang, Jiaye Lin, Guimin Hu, Di Wang, Li Hu · DOI

Abstract

Multimodal Large Language Models (MLLMs) achieve strong performance on tasks like image captioning and visual question answering, but remain prone to hallucinations, where generated text conflicts with the visual input. Prior work links this partly to insufficient visual attention, but existing attention-based detectors and mitigation typically apply uniform adjustments across layers and heads, obscuring where errors originate. In this paper, we first show these methods fail to accurately localize problematic layers. Then, we introduce two diagnostics: Layer Image Attention Entropy (LIAE) which flags anomalous layers, and Image Attention Focus (IAF) which scores attention heads within those layers. Analysis shows that LIAE pinpoints faulty layers and IAF reliably ranks heads that warrant correction. Guided by these signals, we propose Dynamic Layer-wise Entropy and Attention Fusion (D-LEAF), a task-agnostic, attention-guided method that dynamically localizes and corrects errors during inference with negligible overhead. Furthermore, by establishing a connection between D-LEAF and DPO, we provide theoretical justification for the effectiveness of D-LEAF. Results show our D-LEAF delivers a 53% relative improvement on standard captioning benchmarks, and on VQA both accuracy and F1-score improve by approximately 4%, substantially suppressing hallucinations while preserving efficiency.

Introduction

Multimodal Large Language Models (MLLMs) often suffer from "hallucinations"—generating text that sounds plausible but contradicts the visual input. This is frequently caused by "textual inertia," where the model relies too heavily on its internal language patterns and ignores the image tokens. Current state-of-the-art mitigation strategies usually fall into two camps: resource-heavy fine-tuning or "blanket" inference-time adjustments. The latter often applies uniform suppression to attention heads across all layers. However, problematic attention behavior isn't distributed evenly throughout the model. Blindly suppressing heads can actually harm functionally correct modules, leading to shorter, less descriptive, or even less accurate outputs.

Methodology: The D-LEAF Framework

To address these limitations, we propose D-LEAF (Dynamic Layer-wise Entropy and Attention Fusion), which operates during the forward pass using a two-stage diagnostic process to "localize before correcting."

  1. Layer Image-Attention Entropy (LIAE): This metric identifies "anomalous" layers. It uses a Maximum Attention Matrix (MAM) to determine if a layer's collective attention is overly diffuse (high entropy) across image tokens.
  2. Image Attention Focus (IAF): Once a layer is flagged, IAF scores individual heads within that layer based on how much they actually attend to visual regions.
The D-LEAF pipeline: identifying high-entropy layers and adjusting attention values via fusion to correct hallucinations.

The Correction Mechanism

Instead of simply muting "bad" heads, D-LEAF performs Attention Fusion. It identifies the "best" head in a flagged layer and mixes its attention matrix with the underperforming heads using a mixing coefficient. This "steers" the problematic heads back toward the visual evidence. Crucially, we provide a theoretical bridge showing that this update rule is an implicit reparameterization of the Direct Preference Optimization (DPO) gradient. In essence, D-LEAF performs preference alignment on-the-fly without needing a training phase.

Experimental Results

The method was evaluated across five major MLLMs (LLaVA-1.5, MiniGPT-4, Shikra, InstructBLIP, and Qwen-VL) using benchmarks like CHAIR, POPE, and MMHal-Bench.

  • Hallucination Reduction: On the CHAIR benchmark, D-LEAF achieved a 53% relative improvement over SOTA methods like SPIN.
  • VQA Performance: On the POPE benchmark, it improved both accuracy and F1-score by approximately 4% across various models.
  • Efficiency: Unlike some contrastive decoding methods that can double or triple inference time, D-LEAF incurs only an 8% throughput overhead relative to standard greedy decoding.
A comparison of LLaVA output versus indiscriminate modification and D-LEAF's selective modification, showing the successful correction of a color hallucination.

Key Insights

  • Hallucinations are Localized: Our analysis demonstrates that "bad" attention heads are not uniformly distributed; they cluster within specific layers, validating the localization approach.
  • The "Visual Processing" Window: Through "Logit Lens" analysis, we found that visual feature integration primarily happens in the first ~25 layers of models like MiniGPT-4. Applying corrections outside this window is less effective and can degrade language fluency.
  • Fusion > Suppression: Simply muting heads often leads to a "brevity bias" where the model stops hallucinating only because it stops talking. Fusing attention preserves more descriptive detail while maintaining factuality.

Conclusion

D-LEAF provides a highly efficient, training-free method to mitigate hallucinations in MLLMs by dynamically localizing and fusing attention. By achieving significant performance gains with minimal computational cost, it offers a practical path toward more reliable multimodal generation. Future work will explore how these dynamic diagnostics can guide the creation of better synthetic datasets for fine-tuning or more efficient early-exit strategies.

Summary updated

BibTeX
@misc{yang2025tracing,
  author = {Tiancheng Yang and Lin Zhang and Jiaye Lin and Guimin Hu and Di Wang and Li Hu},
  title = {{Tracing and Mitigating Hallucinations in Multimodal LLMs via Dynamic Attention Localization}},
  year = {2025},
  eprint = {2509.07864},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.07864},
}
Figure