Visual Haystacks: Answering Harder Questions About Sets of Images

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

Abstract

Large Multimodal Models (LMMs) have made significant strides in visual question-answering for single images. Recent advancements like long-context LMMs have allowed them to ingest larger, or even multiple, images. However, the ability to process a large number of visual tokens does not guarantee effective retrieval and reasoning for multi-image question answering (MIQA), especially in real-world applications like photo album searches or satellite imagery analysis. In this work, we first assess the limitations of current benchmarks for long-context LMMs. We address these limitations by introducing a new vision-centric, long-context benchmark, "Visual Haystacks (VHs)". We comprehensively evaluate both open-source and proprietary models on VHs, and demonstrate that these models struggle when reasoning across potentially unrelated images, perform poorly on cross-image reasoning, as well as exhibit biases based on the placement of key information within the context window. Towards a solution, we introduce MIRAGE (Multi-Image Retrieval Augmented Generation), an open-source, lightweight visual-RAG framework that processes up to 10k images on a single 40G A100 GPU -- far surpassing the 1k-image limit of contemporary models. MIRAGE demonstrates up to 13% performance improvement over existing open-source LMMs on VHs, sets a new state-of-the-art on the RetVQA multi-image QA benchmark, and achieves competitive performance on single-image QA with state-of-the-art LMMs.

Introduction: Beyond OCR-Based Retrieval

In the domain of Large Language Models (LLMs), the "Needle-In-A-Haystack" (NIAH) test is the gold standard for evaluating a model's ability to retrieve specific information from massive contexts. As researchers transition to Multimodal models (LMMs), they have attempted to replicate this test by overlaying text onto images. However, this approach often reduces a complex visual task to a simple Optical Character Recognition (OCR) problem, which models can solve without true visual understanding.

Comparison of visual NIAH benchmarks and model performance. (A) illustrates the difference between artificial OCR-based challenges and the proposed realistic Visual Haystack. (B) shows that while models like GPT-4o and Gemini 1.5 Pro excel at OCR tasks, their performance drops significantly on vision-centric retrieval.

Furthermore, while state-of-the-art models like GPT-4o or Gemini 1.5 Pro can ingest large context windows, increasing token capacity does not inherently improve retrieval or reasoning across multiple images. Real-world tasks—such as searching a massive photo album for "the dog that was near the red truck"—require the model to first locate the relevant image (retrieval) and then perform visual reasoning. This paper addresses the lack of realistic, vision-centric benchmarks for this Multi-Image Question Answering (MIQA) challenge.

The Visual Haystacks (VHs) Benchmark

To address the flaws in existing benchmarks, the authors introduce Visual Haystacks (VHs). Unlike previous tests, VHs utilizes natural images from the COCO dataset. It defines an "anchor" object (the needle) and a "target" object for the query. For example, a model might be asked: "For the image containing a truck, is there a dog?" To succeed, the model must search through a "haystack" of up to 10,000 images, identify the specific image containing the anchor (the truck), and then answer a question about the target object (the dog) within that same image.

MIRAGE: A Scalable Visual-RAG Framework

To overcome the computational and performance bottlenecks of current LMMs, the authors developed MIRAGE (Multi-Image Retrieval Augmented Generation). This framework introduces three key innovations:

  1. Token Compression: Standard models often use hundreds of tokens per image, leading to memory exhaustion. MIRAGE employs a Q-Former to compress 576 tokens down to just 32 per image—an 18x reduction that significantly expands the context window.
  2. Query-Aware Retriever: Rather than forcing the LLM to process every image in the haystack, MIRAGE uses a lightweight retriever to calculate relevance scores based on the query. Only the most pertinent images are passed to the LLM for final reasoning.
  3. Instruction Tuning: The model was trained on a newly curated 1.2M-image dataset specifically designed for multi-image tasks, teaching it to distinguish relevant needles from distractors.

Key Insights and Results

The "Lost-in-the-Middle" Phenomenon

Evaluation on VHs reveals that LMMs suffer from a visual version of positional bias. GPT-4o, for instance, shows a marked decrease in accuracy when the "needle" image is placed in the middle of a sequence compared to the beginning or end. This suggests that simply scaling context windows is insufficient for reliable retrieval.

Performance and Scalability

  • Efficiency: MIRAGE can process 10,000 images on a single 40GB A100 GPU, whereas most open-source models fail or crash beyond 1,000 images.
  • Accuracy: MIRAGE achieved a 13% performance improvement over existing open-source LMMs on the VHs benchmark and set a new state-of-the-art on the RetVQA benchmark with a score of 67.6%.
  • Retrieval as a Bottleneck: The study confirms that as the number of images increases, performance drops by up to 40% for general-purpose models. This failure is primarily due to retrieval errors rather than a lack of reasoning logic, highlighting the necessity of RAG-based approaches for vision.

Limitations and Future Work

While VHs and MIRAGE represent significant steps forward, limitations remain. The VHs benchmark is currently limited to the 80 object categories found in COCO; future iterations should expand to open-vocabulary settings. Additionally, while MIRAGE excels at multi-image tasks, the aggressive token compression leads to a slight performance trade-off in some single-image benchmarks. Future research will focus on balancing this compression with high-fidelity single-image reasoning and introducing more complex, multi-hop reasoning tasks.

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: Answering Harder Questions About Sets of Images}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=9JCNPFL1f9},
}
Figure