CoMemo: LVLMs Need Image Context with Image Memory

Shi Liu, Weijie Su, Xizhou Zhu, Wenhai Wang, Jifeng Dai

Introduction

Large Vision-Language Models (LVLMs) have demonstrated remarkable capabilities in multimodal understanding. However, as conversation lengths increase or high-resolution images are processed, these models often suffer from a "lost in the middle" phenomenon, where visual details are neglected. CoMemo addresses this by introducing a dual-path architecture and a novel positional encoding scheme, ensuring robust visual memory and spatial awareness.

Problem Statement: The "Lost in the Middle" Phenomenon

Current LVLMs typically adopt one of two architectural paradigms:

  1. LVLM-S (Sequence-based): Image tokens are treated as part of the text sequence. Due to the inherent attention biases of LLMs, tokens in the middle of long sequences are often ignored.
  2. LVLM-X (Cross-attention-based): Visual features are injected into the text via cross-attention. While this avoids some sequence length issues, it can struggle with fine-grained alignment.

Furthermore, standard 1D Rotary Positional Encodings (RoPE) fail to maintain 2D structural relationships in high-resolution images, leading to "remote decay" as the distance between image tiles increases.

Methodology

CoMemo introduces two primary innovations to mitigate these issues.

Dual-Path Architecture

CoMemo combines the strengths of both LVLM-S and LVLM-X through a dual-path design. The Context Path follows the LVLM-S approach, concatenating image tokens with text for standard autoregressive processing. Simultaneously, the Memory Path utilizes Mixin Layers (cross-attention) interleaved with transformer blocks. This path allows the model to retrieve visual information based on the current context, bypassing the causal attention bottleneck that causes information neglect.

Comparison of LVLM architectures: (a) LVLM-S, (b) LVLM-X, and (c) the proposed CoMemo dual-path architecture.

RoPE-DHR (Dynamic High Resolution)

To preserve 2D spatial awareness, CoMemo employs RoPE-DHR. This hierarchical encoding uses a low-resolution "thumbnail" as an anchor. High-resolution tile patches are mapped to the coordinates of their corresponding thumbnail patch, effectively compressing the positional index space and preventing remote decay in long sequences.

Experimental Results

CoMemo was evaluated across diverse benchmarks, including LLaVABench, MM-NIAH, and MathVista. The dual-path architecture significantly outperforms standard baselines in long-context comprehension and multi-image reasoning.

Radar chart comparing CoMemo with LVLM-S and LVLM-X baselines across multiple evaluation categories.

Key performance gains include:

  • Captioning: +17.2% relative improvement.
  • Long-Context: +5.6% improvement.
  • Needle In A Haystack (NIAH): CoMemo maintains high accuracy for middle-sequence retrieval, where standard models typically see a sharp performance drop.

Conclusion

CoMemo effectively solves the information neglect problem in LVLMs by providing a dedicated "Memory Path" for visual features. Combined with RoPE-DHR for spatial consistency, it establishes a new standard for long-context multimodal understanding without sacrificing inference efficiency.

Summary updated

BibTeX
@inproceedings{liu2025comemo,
  author = {Shi Liu and Weijie Su and Xizhou Zhu and Wenhai Wang and Jifeng Dai},
  title = {{CoMemo: LVLMs Need Image Context with Image Memory}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Hw6MDsaor9},
}
Figure