Abstract
Recent advances demonstrate that multimodal large language models (MLLMs) exhibit strong multimodal in-context learning (ICL) capabilities, enabling them to adapt to novel vision-language tasks from a few contextual examples. However, existing ICL approaches face challenges in reconciling scalability with robustness across diverse tasks and noisy contextual examples: manually selecting examples produces clean contexts but is labor-intensive and task-specific, while similarity-based retrieval improves scalability but could introduce irrelevant or structurally inconsistent samples that degrade ICL performance. To address these limitations, we propose ContextNav, the first agentic framework that integrates the scalability of automated retrieval with the quality and adaptiveness of human-like curation, enabling noise-robust and dynamically optimized contextualization for multimodal ICL. ContextNav unifies context management and noise-robust contextualization within a closed-loop workflow driven by graph-based orchestration. Specifically, it builds a resource-aware multimodal embedding pipeline, maintains a retrievable vector database, and applies agentic retrieval and structural alignment to construct noise-resilient contexts. An Operational Grammar Graph (OGG) further supports adaptive workflow planning and optimization, enabling the agent to refine its operational strategies based on downstream ICL feedback. Experimental results demonstrate that ContextNav achieves state-of-the-art performance across various datasets, underscoring the promise of agentic workflows for advancing scalable and robust contextualization in multimodal ICL.
Introduction
In-context learning (ICL) has emerged as a powerful paradigm for adapting Large Multimodal Models (LMMs) to new tasks using only a few demonstration examples. While effective in text-only domains, Multimodal ICL faces significant hurdles. Current methods typically rely on either manual curation, which is high-quality but lacks scalability, or similarity-based retrieval, which scales well but often introduces performance-degrading noise.
As illustrated in Figure 1, standard retrieval often suffers from two types of noise:
- Semantic Noise: Retrieved examples may look visually similar to the query but are irrelevant to the specific question asked.
- Structural Noise: Examples may follow a different reasoning format (e.g., narrative vs. direct answer), confusing the model's reasoning path.
The ContextNav Framework
ContextNav introduces an "agentic" workflow where an LMM acts as an active manager to curate, filter, and structurally align contextual examples. The framework consists of three core modules:
- Agentic Context Management: This module is resource-aware, evaluating hardware constraints to select optimal embedding models from a "zoo" to maintain a high-quality vector database.
- Noise-Robust Contextualization: The agent performs a second-pass filter (Agentic Retrieval) to ensure semantic relevance and then Structural Alignment, where it rewrites example text to match the linguistic style of the user's query.
- Graph-driven Workflow Orchestration: The agent's actions are governed by an Operational Grammar Graph (OGG), ensuring a logical sequence of tool use. This closed-loop system uses feedback from ICL performance to optimize future retrieval strategies.
Experimental Results
ContextNav was evaluated across eight diverse datasets, including composite benchmarks like BlindTest and MathVision, and single-task benchmarks like CLEVR and TextOCR. The framework achieved a significant 16.8% average performance gain across multiple models, including Phi-3.5V, InternLM, Qwen, and Gemini.
As shown in the results, ContextNav more than doubles the gains of previous state-of-the-art methods like MMICES (7.6%). Key insights from the study highlight that structural alignment is as critical as content relevance; by reformatting examples to match the query's "reasoning mode," the model's internal consistency improves dramatically.
Discussion and Limitations
While ContextNav sets a new state-of-the-art for multimodal ICL, it introduces an "Agent Tax." The multi-step reasoning process adds an average latency of 3.26 seconds per request and consumes approximately 22.5K tokens per iteration. Future research will focus on distilling these agentic capabilities into smaller, more efficient models to mitigate these overhead costs while preserving the high quality of curated contexts.
Summary updated