Visual RAG: Expanding MLLM visual knowledge without fine-tuning
Mirco Bonomo, Simone Bianco
TL;DR
This work tackles the problem of outdated knowledge and limited context in Multimodal Large Language Models by proposing Visual RAG, a retrieval-augmented framework that dynamically expands visual knowledge without fine-tuning. It integrates an image-based knowledge base with CLIP embeddings and FAISS indexing to retrieve highly relevant visual demonstrations, which are then provided to a Gemini-based generator via a carefully designed prompt. Across eight diverse datasets, Visual RAG matches or exceeds the performance of many-shot in-context learning while using substantially fewer demonstrations (about 23% on average), and even achieves notable efficiency gains by reducing context size and computation. The approach enables rapid updates to visual capabilities and scalable expansion into new domains, with future work aimed at refining retrieval methods and extending to other computer vision tasks.
Abstract
Multimodal Large Language Models (MLLMs) have achieved notable performance in computer vision tasks that require reasoning across visual and textual modalities, yet their capabilities are limited to their pre-trained data, requiring extensive fine-tuning for updates. Recent researches have explored the use of In-Context Learning (ICL) to overcome these challenges by providing a set of demonstrating examples as context to augment MLLMs performance in several tasks, showing that many-shot ICL leads to substantial improvements compared to few-shot ICL. However, the reliance on numerous demonstrating examples and the limited MLLMs context windows presents significant obstacles. This paper aims to address these challenges by introducing a novel approach, Visual RAG, that synergically combines the MLLMs capability to learn from the context, with a retrieval mechanism. The crux of this approach is to ensure to augment the MLLM knowledge by selecting only the most relevant demonstrating examples for the query, pushing it to learn by analogy. In this way, relying on the new information provided dynamically during inference time, the resulting system is not limited to the knowledge extracted from the training data, but can be updated rapidly and easily without fine-tuning. Furthermore, this greatly reduces the computational costs for improving the model image classification performance, and augments the model knowledge to new visual domains and tasks it was not trained for. Extensive experiments on eight different datasets in the state of the art spanning several domains and image classification tasks show that the proposed Visual RAG, compared to the most recent state of the art (i.e., many-shot ICL), is able to obtain an accuracy that is very close or even higher (approx. +2% improvement on average) while using a much smaller set of demonstrating examples (approx. only 23% on average).
