Make LVLMs Focus: Context-Aware Attention Modulation for Better Multimodal In-Context Learning

Yanshu Li, Jianjiang Yang, Ziteng Yang, Bozheng Li, Ligong Han +6 more
5/21/2025
cs.CVcs.CL
transformer-attention

No confident code implementation found for this paper.

Abstract

Multimodal in-context learning (ICL) is becoming a key capability that allows large vision-language models (LVLMs) to adapt to novel tasks without parameter updates, which expands their usefulness in many real-world applications. However, ICL performance remains unstable even when the in-context demonstrations (ICDs) are well matched, showing that LVLMs still struggle to make full use of the provided context.

Show full abstract

While existing work mainly focuses on prompt engineering or post-hoc logit calibration, we study the attention mechanisms inside LVLMs to address their inherent limitations. We identify two important weaknesses in their self-attention that hinder effective ICL. To address these weaknesses, we propose Context-Aware Modulated Attention (CAMA), a training-free and plug-and-play method that dynamically adjusts attention logits based on the input in-context sequence. CAMA uses a two-stage modulation process that strengthens attention to semantically important tokens, especially visual ones. Across four LVLMs and seven benchmarks, CAMA consistently outperforms vanilla models and baselines, showing clear effectiveness and generalization. It can also activate the intended benefits of prompt engineering methods and remains robust across different sequence configurations. Therefore, CAMA opens up new directions for improving multimodal reasoning through a deeper understanding of attention dynamics.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2025make,
  title  = {Make LVLMs Focus: Context-Aware Attention Modulation for Better Multimodal In-Context Learning},
  author = {Yanshu Li and Jianjiang Yang and Ziteng Yang and Bozheng Li and Ligong Han and Hongyang He and Zhengtao Yao and Yingjie Victor Chen and Songlin Fei and Dongfang Liu and Ruixiang Tang},
  year   = {2025},
  eprint = {2505.17097},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.17097v4}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.17097.svg)](https://codeofpaper.com/paper/2505.17097)

Discussion