Multimodal Needle in a Haystack: Benchmarking Long-Context Capability of Multimodal Large Language Models

Hengyi Wang, Haizhou Shi, Shiwei Tan, Weiyi Qin, Wenyuan Wang, Tunyu Zhang, Akshay Nambi, Tanuja Ganu, Hao Wang

Abstract

As Large Language Models (LLMs) expand their context windows to millions of tokens, their multimodal counterparts (MLLMs) face a significant evaluation gap. We introduce MMNeedle, a rigorous benchmark that adapts the "Needle-in-a-Haystack" test to the visual domain. By stitching hundreds of sub-images into high-resolution grids across multiple input images, MMNeedle tests a model's ability to retrieve specific visual information from extensive contexts. Our evaluation of leading models, including GPT-4o and Gemini Pro 1.5, reveals that retrieval accuracy degrades sharply as context density increases, with models frequently exhibiting "edge bias" and hallucinations in negative test cases.

Introduction

The ability to process vast amounts of data is a hallmark of modern AI. While text-based LLMs can now ingest entire libraries, Multimodal Large Language Models (MLLMs) are often evaluated on single or few-image tasks. Real-world applications—such as video analysis or large-scale visual search—require models to identify a specific "needle" within a massive visual "haystack." Existing benchmarks often lack the scale or complexity to push these models to their limits. MMNeedle addresses this by providing a framework to measure precise visual retrieval across high-resolution, multi-image contexts.

Methodology

The MMNeedle benchmark utilizes a novel Image Stitching technique to circumvent API limits on the number of individual images allowed in a single prompt.

Benchmark Design

  1. Stitching: Sub-images are arranged into $N \times N$ grids (from $2 \times 2$ to $8 \times 8$) and stitched into single high-resolution frames.
  2. The Haystack: Models are presented with a sequence of $M$ images. At the maximum configuration ($M=10, N=8$), the model must search through 640 distinct sub-images.
  3. The Query: A text caption describes a specific sub-image. The model must return the precise location: image index, row, and column.
  4. Negative Testing: The benchmark includes cases where the target sub-image is absent, testing the model's propensity for hallucination.
Overview of the MMNeedle benchmark, showing the needle sub-image, the haystack of stitched images, the text query, and sample model outputs.

Data Source

The benchmark is constructed using the MS COCO 2014 validation set. It comprises 40,000 images and 560,000 captions, resulting in 280,000 unique needle-haystack pairs. Each sub-image is maintained at $256 \times 256$ pixels to ensure recognizability for both humans and models.

Results and Analysis

Our evaluation highlights a significant performance gap between commercial APIs and open-source models, as well as inherent biases in visual retrieval.

GPT-4o emerged as the top performer, yet its accuracy plummeted from 97.00% in a simple 10-image haystack to just 26.90% when those images contained $4 \times 4$ grids. Gemini Pro 1.5 performed well on single stitched images but struggled with multi-image sequences. Open-source models like LLaVA-Llama-3 and Fuyu-8B failed almost entirely on complex retrieval tasks, often achieving near-zero accuracy in dense grids.

Heatmaps showing the retrieval accuracy of various MLLMs across different haystack sizes (M) and stitching grid densities (N).

Key Insights

  • Edge Bias: Models are significantly more accurate at retrieving information located at the corners of a stitched image compared to the center.
  • Coarse-to-Fine Failure: While models can often identify the correct image index (existence accuracy), they struggle to pinpoint the exact row and column as the grid density increases.
  • Hallucination Trap: In negative samples, models like GPT-4o frequently "hallucinate" the presence of the needle, suggesting a tendency toward over-confidence in long-context scenarios.

Conclusion

MMNeedle reveals that current MLLMs, while capable in short-context visual tasks, struggle significantly with high-density visual retrieval. The benchmark underscores the need for improved long-context visual processing and more robust mechanisms to prevent hallucinations. Future work will explore extending this framework to video-based inputs and investigating how internal visual labeling might aid model navigation through massive visual haystacks.

Summary updated

BibTeX
@inproceedings{wang2025multimodal,
  author = {Hengyi Wang and Haizhou Shi and Shiwei Tan and Weiyi Qin and Wenyuan Wang and Tunyu Zhang and Akshay Nambi and Tanuja Ganu and Hao Wang},
  title = {{Multimodal Needle in a Haystack: Benchmarking Long-Context Capability of Multimodal Large Language Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.166},
}
Figure