Cross-modal RAG: Sub-dimensional Text-to-Image Retrieval-Augmented Generation

Mengdan Zhu, Senhao Cheng, Guangji Bai, Yifei Zhang, Liang Zhao

TL;DR

Cross-modal RAG introduces a "divide-and-conquer" framework for retrieval-augmented text-to-image generation. By decomposing complex user queries and candidate images into sub-dimensional components, it retrieves a Pareto-optimal set of complementary images that collectively cover all aspects of a prompt. This fine-grained retrieval strategy guides a multimodal LLM to synthesize highly accurate images, significantly outperforming global retrieval baselines on complex, multi-entity, and long-tailed descriptions.

What Problem Does This Paper Address?

While modern text-to-image (T2I) diffusion models and Multimodal Large Language Models (MLLMs) generate stunning visuals, they often fail when prompts require domain-specific, fine-grained, or rapidly evolving knowledge. Retrieval-Augmented Generation (RAG) addresses this by sourcing reference images from an external database.

However, existing T2I-RAG methods rely on coarse, global image-text matching (like standard CLIP). This poses a major problem for complex queries containing multiple distinct entities or attributes (e.g., "A Cybertruck with a third-generation Labubu on the roof parked in front of a Tesla store on Venus ground"). Because it is highly unlikely that a single database image contains all of these elements, global retrievers return redundant images matching only the dominant concepts (e.g., multiple pictures of a Cybertruck in front of a Tesla store) while completely missing rare or long-tailed details (like the "Labubu" toy).

Figure 1: Visualization of retrieval and gen- eration in Cross-modal RAG (ours) versus previous RAG.

Methods

The authors propose Cross-modal RAG, a novel four-stage framework designed to handle subquery-level alignment and generation:

  1. Subquery Decomposition: An off-the-shelf LLM breaks down a complex user query into atomic subqueries representing individual entities or attributes.
  2. Sub-dimensional Sparse Retriever: A lightweight, text-based lexical match filters the database, discarding images that do not satisfy any of the subqueries to drastically reduce the search space.
  3. Sub-dimensional Dense Retriever: To avoid computationally expensive image cropping, the authors introduce a trained vision adapter on top of a frozen CLIP vision encoder. Using cross-attention, it maps full images into fine-grained, sub-dimensional vision embeddings that align directly with specific textual subqueries.
  4. Multi-objective Joint Retrieval: The framework treats retrieval as a multi-objective optimization problem. It identifies a Pareto-optimal set of images—meaning the smallest, most diverse set of complementary images that collectively maximize subquery coverage while minimizing redundancy.
  5. Subquery-aware Generation: The retrieved images are fed into a pretrained MLLM alongside explicit, fine-grained instructions detailing exactly which subquery features to extract from which image (e.g., [Image 1] Use only [Venus ground] in [Image 1]). This prevents irrelevant background noise from leaking into the final synthesis.
Figure 2: Overview of the Cross-modal RAG framework. The framework consists of four stages: (1) Sub-dimensional Sparse Retriever, where images are filtered based on lexical subquery matches; (2) Sub-dimensional Dense Retriever, where candidate images are re-ranked using the mean of pairwise cosine similarities between sub-dimensional vision embeddings and subquery embeddings; (3) Multi-objective Joint Retrieval, where a Pareto-optimal set of images is selected by Eq.6 to collectively cover the subqueries. Pf is composed of three orange points( ) (solid points are on the line while dashed points are off the line); and (4) Generation, where a MLLM composes a final image by aligning subquery-level visual components from retrieved images.

Datasets

The framework was evaluated across two core tasks using several distinct datasets:

  • Text-to-Image Retrieval (T2I-R): Evaluated on the standard MS-COCO (5K test split) and Flickr30K (1K test split) benchmarks.
  • Text-to-Image Generation (T2I-G): Evaluated across three domain-specific challenges:
  • WikiArt: Used for evaluating artistic style transfer.
  • CUB (Caltech-UCSD Birds-200-2011): Used for fine-grained bird species generation.
  • ImageNet-LT: A long-tailed distribution dataset used to test generation performance on rare, unseen entities.

Key Insights and Ideas

  • Dual Decomposition: Unlike prior fine-grained RAG methods that only decompose text, Cross-modal RAG decomposes both the text query and the visual embeddings, enabling precise subquery-to-visual-feature alignment.
  • Retrieval as a Pareto Optimization: Treating retrieval as a multi-objective problem ensures the system selects a diverse, non-redundant set of images. Instead of retrieving three identical-looking images, the system gets one Cybertruck, one Venus landscape, and one Labubu toy.
  • Attention-Based Sub-embeddings: The dense retriever extracts localized semantic features directly from full images using cross-attention, bypassing the need for noisy and slow region-cropping algorithms.
  • Explicit Instruction Overcomes Visual Noise: Simply giving an MLLM reference images can cause irrelevant details to leak into the final image. Explicitly telling the MLLM what to look at in each reference image dramatically improves generation fidelity.

Key Results

  • State-of-the-Art Retrieval: On MS-COCO, Cross-modal RAG achieved a Recall@1 of 81.82%, vastly outperforming the best baseline, BLIP-2 (59.10%). On Flickr30K, it achieved a near-perfect zero-shot Recall@1 of 97.50%.
  • Superior Generation Quality: Across WikiArt, CUB, and ImageNet-LT, the method consistently outperformed strong generation baselines (including FLUX.1-dev, SDXL, and GILL) across CLIP, DINO, and SigLIP image-text alignment metrics, while achieving the lowest style loss on WikiArt.
  • High Efficiency: The hybrid sparse-dense approach keeps computational overhead incredibly low. The dense adapter uses only 0.01× of CLIP's GPU memory and cuts query latency significantly compared to a pure dense search over the entire database.
Figure 3: The retrieved pareto optimal images with their corresponding satisfied subqueries in (a) WikiArt, (b) CUB and (c) ImageNet-LT datasets and generation results of Cross-modal RAG.

Limitations and Future Work

The authors note that the framework's success is fundamentally bounded by the contents of the external database. If the retrieval database contains absolutely no images relevant to any of the subqueries, the retrieval mechanism cannot provide any benefit to the generator. Future work could explore expanding the database dynamically or incorporating synthetic image generation within the retrieval loop to fill knowledge gaps.

Summary updated

BibTeX
@misc{zhu2025cross,
  author = {Mengdan Zhu and Senhao Cheng and Guangji Bai and Yifei Zhang and Liang Zhao},
  title = {{Cross-modal RAG: Sub-dimensional Text-to-Image Retrieval-Augmented Generation}},
  year = {2025},
  eprint = {2505.21956},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.21956},
}
Figure