ImageRAG: Dynamic Image Retrieval for Reference-Guided Image Generation

Rotem Shalev Arkushin, Rinon Gal, Amit H. Bermano, Ohad Fried

Introduction

While recent generative models can synthesize stunningly high-quality visual content, they consistently struggle with generating rare or fine-grained concepts. To address this "long tail" challenge, researchers have introduced ImageRAG, a training-free framework that brings the power of Retrieval-Augmented Generation (RAG) to text-to-image (T2I) models. By dynamically retrieving reference images for unfamiliar concepts, ImageRAG provides visual context to existing models, significantly reducing hallucinations without requiring any model fine-tuning.

The Challenge of Rare Concepts

Even state-of-the-art T2I models like SDXL or FLUX struggle with the long tail of data distribution. If prompted for a "rhinoceros auklet" or a "Bergamasco shepherd," the model might generate a generic bird or dog because it hasn't seen enough specific examples during training to distinguish fine-grained features. In these cases, models often "hallucinate"—generating something visually plausible but factually incorrect.

While RAG is a staple in Large Language Models (LLMs) for providing factual context, applying it to images has traditionally required training specialized retrieval-aware models. ImageRAG seeks to bring the benefits of RAG to image generation using off-the-shelf, pre-trained models.

How ImageRAG Works

The core of ImageRAG is a Guided Chain-of-Thought (CoT) process that uses a Vision Language Model (VLM), such as GPT-4o, as a reasoning engine. The pipeline operates in four main steps:

  1. Initial Generation: The T2I model generates a first-pass image based on the user's prompt.
  2. VLM Diagnosis: The VLM compares the original prompt to the generated image. It acts as a quality gate, deciding if they match. If they do not, it identifies exactly which visual concepts are missing (e.g., "the specific beak shape of an auklet").
  3. Dynamic Retrieval: The VLM generates detailed captions for these missing concepts. ImageRAG then uses these captions to retrieve relevant reference images from an external database (like a 350K image subset of LAION-5B) using CLIP or SigLIP embeddings.
  4. Reference-Guided Generation: The original prompt and the retrieved images are fed back into the T2I model. Crucially, ImageRAG uses existing image-conditioning tools—like IP-Adapter for SDXL, OminiControl for FLUX, or the native multi-modal capabilities of OmniGen—to guide the final output.

Key Insights and Performance

ImageRAG treats the T2I model, the VLM, and the retriever as modular components, making it entirely "plug-and-play." A fascinating insight from the research is that retrieval is often easier than generation: models like CLIP can successfully find a rare concept in a database even when the T2I model fails to generate it from scratch. Furthermore, using the VLM to generate detailed captions for retrieval performs significantly better than simply using the raw names of the missing concepts.

Evaluated across datasets like ImageNet (tail classes), iNaturalist, CUB, and specialized domains (Oxford Flowers, Stanford Dogs, Stanford Cars), ImageRAG consistently outperformed base models and other iterative methods. In human evaluations, users preferred ImageRAG's outputs over base models by a landslide, often with win rates exceeding 90% for rare concept accuracy.

Personalization and Advanced Use Cases

Beyond standard generation, ImageRAG can be seamlessly combined with personalization techniques. For example, a user can provide an image of their own pet alongside a prompt like "Wearing a halloween costume."

Input image and prompt for personalization

The system can retrieve appropriate reference images for the "costume" concept while maintaining the specific visual identity of the user's subject, resulting in a highly accurate and personalized final image.

Final generated output of the personalized subject in a Halloween costume

Limitations and Future Directions

Despite its strong performance, ImageRAG has a few limitations:

  • Database Dependency: If a rare concept does not exist in the retrieval database, the method cannot provide the necessary visual guidance.
  • VLM Reliability: The system's reasoning is only as good as its VLM. While advanced models like GPT-4o perform exceptionally well, smaller or open-source VLMs currently struggle with the diagnosis step.
  • Inference Latency: The iterative nature of generating, diagnosing, retrieving, and re-generating adds 10–30 seconds of overhead per image, making it less suitable for real-time applications.
  • Text Rendering: While ImageRAG excels at correcting visual concepts, it still inherits the limitations of its underlying T2I backbones when it comes to generating specific, accurate text within images.

Summary updated

BibTeX
@inproceedings{arkushin2026imagerag,
  author = {Rotem Shalev Arkushin and Rinon Gal and Amit H. Bermano and Ohad Fried},
  title = {{ImageRAG: Dynamic Image Retrieval for Reference-Guided Image Generation}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=VT3tTfXrDi},
}
Figure