Visual Haystacks: A Vision-Centric Needle-In-A-Haystack Benchmark

Tsung-Han Wu, Giscard Biamby, Jerome Quenum, Ritwik Gupta, Joseph E. Gonzalez, Trevor Darrell, David M. Chan

TL;DR

This paper introduces Visual Haystacks (VHs), a new vision-centric "Needle-In-A-Haystack" benchmark that reveals severe limitations in how current Large Multimodal Models (LMMs) retrieve and reason over large sets of images. To solve this, the authors present MIRAGE, an open-source visual-RAG framework that compresses image tokens and uses a query-aware filter to successfully scale multi-image processing up to 10,000 images on a single GPU.

What Problem Does This Paper Address?

While Large Multimodal Models (LMMs) excel at single-image tasks, real-world applications like searching photo albums or analyzing satellite imagery require processing thousands of images simultaneously. Recent long-context LMMs claim to handle massive token windows, but does a larger window guarantee effective retrieval and reasoning?

Prior "Visual Needle-In-A-Haystack" (NIAH) benchmarks suggested they could, showing near-perfect model performance. However, the authors point out a major flaw: these benchmarks often use artificial setups, like overlaying text onto an image (e.g., "The secret word is X"). This tests a model's optical character recognition (OCR) capabilities rather than true visual retrieval.

Unlike text-overlay benchmarks, Visual Haystacks requires models to retrieve and reason about actual visual objects within natural images.

To address this gap, the authors introduce Visual Haystacks (VHs), a benchmark featuring natural images and truly visual "needles" to evaluate multi-image question answering (MIQA) at scale.

Methods

To overcome the context-length and computational bottlenecks of current LMMs, the authors introduce MIRAGE (Multi-Image Retrieval Augmented Generation), a lightweight visual-RAG framework built on LLaVA-v1.5-7B and Llama-v3.1-8B.

MIRAGE operates via a three-pronged approach:

  1. Token Compression: Standard LMMs use 576 tokens per image. MIRAGE employs a lightweight Transformer module (Q-Former) to compress this down to just 32 tokens per image—a massive 18x reduction in token intensity.
  2. Query-Aware Retriever: Processing 10,000 images is still inefficient even with compressed tokens. MIRAGE integrates a lightweight retriever module that calculates a relevance score for each image based on the text query, filtering out distractor images before they reach the LLM.
  3. End-to-End Co-Training: The retriever is trained jointly alongside the LLM's next-token prediction task, ensuring the filtering process directly benefits the final reasoning stage.
The MIRAGE architecture utilizes a Q-Former for token compression and a query-aware retriever to filter out irrelevant images before final LLM reasoning.

Datasets

The authors constructed the Visual Haystacks (VHs) benchmark using the COCO dataset. Questions are framed around an anchor object (used for retrieval) and a target object (used for QA), resulting in binary (yes/no) answers curated to ensure a 50% baseline guess rate. VHs scales from 1 to 10,000 images and includes:

  • Single-needle challenges: Only one image in the haystack contains the anchor object.
  • Multi-needle challenges: Two or three images contain the anchor object, forcing the model to synthesize information across multiple images.

For training MIRAGE, the authors combined existing MIQA datasets (RetVQA, SlideVQA, WebQA) with a custom 600K-sample instruction-tuning dataset generated by adapting LLaVA's single-image data into a multi-image format with hard distractors.

Key Insights and Ideas

Evaluating state-of-the-art open and closed-source models on VHs revealed three critical vulnerabilities in current LMM architectures:

  • Extreme Susceptibility to Distractors: As the haystack size grows, model accuracy plummets. LMMs frequently get confused by visual distractors that contain the target object but lack the anchor object.
  • The Cross-Image Reasoning Penalty: Models struggle significantly more when a query requires integrating information across multiple "needle" images, even when no distractor images are present. This suggests a lack of multi-image training data in modern pipelines.
  • Severe Positional Biases: Just like text-based LLMs, LMMs suffer from placement biases. Proprietary models like GPT-4o display a distinct "lost-in-the-middle" effect, performing poorly when the needle image is placed in the center of the context window. Open-source models, conversely, heavily favor images placed closest to the text prompt.
LMM performance degrades significantly when the needle image is placed unfavorably within the context window, revealing distinct positional biases.

Key Results

  • Unprecedented Scalability: MIRAGE is the only open-source framework capable of scaling to 10,000 input images on a single 40GB A100 GPU, far surpassing the ~1,000-image physical limit of contemporary models.
  • VHs Benchmark Performance: In single-needle challenges with large haystacks (>50 images), MIRAGE outperformed top proprietary models like GPT-4o and Gemini 1.5 Pro, demonstrating the power of its RAG-based filtering.
  • State-of-the-Art on RetVQA: MIRAGE achieved a new SOTA score of 67.6% on the RetVQA benchmark, more than doubling the performance of standard LLaVA-v1.5-7B (30.6%).
  • Preserved Single-Image QA: Despite an 18x reduction in tokens per image, MIRAGE maintained highly competitive performance on standard single-image benchmarks (e.g., VQAv2, GQA, POPE).

Limitations and Future Work

While MIRAGE represents a major leap forward for large-scale MIQA, the authors note several limitations:

  • Dataset Bias: Because VHs relies on MS-COCO, it inherits existing dataset biases regarding gender, race, and location, and is constrained to COCO's 80 object categories.
  • Template-Based Evaluation: VHs uses template-based questions, meaning it doesn't deeply evaluate complex linguistic reasoning or multi-hop logic across open-domain object sets.
  • Single-Image Performance Trade-off: MIRAGE does suffer minor performance degradation on certain single-image QA tasks compared to its uncompressed LLaVA base, highlighting an area for future optimization in multi-task training.

Summary updated

BibTeX
@inproceedings{wu2025visual,
  author = {Tsung-Han Wu and Giscard Biamby and Jerome Quenum and Ritwik Gupta and Joseph E. Gonzalez and Trevor Darrell and David M. Chan},
  title = {{Visual Haystacks: A Vision-Centric Needle-In-A-Haystack Benchmark}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=9JCNPFL1f9},
}
Figure