Abstract
Visual In-Context Learning (ICL) allows vision models to adapt to new tasks using only a few example image-label pairs. However, current methods are highly sensitive to the quality and semantic similarity of these prompts. We introduce Instruct Me More (InMeMo), a parameter-efficient transfer learning approach that enhances visual prompts with learnable, task-specific perturbations. By adding a "visual nudge" to the example images, InMeMo significantly improves performance in foreground segmentation and object detection tasks while keeping the underlying large-scale vision model frozen. Our results demonstrate that InMeMo is more robust to poor prompt selection and achieves state-of-the-art performance with minimal additional parameters.
Introduction
In-context learning has emerged as a powerful paradigm in Large Language Models (LLMs), enabling them to perform tasks like translation or summarization based on a few provided examples. Translating this capability to computer vision involves creating a "visual canvas"—typically a grid containing an example image, its label (e.g., a segmentation mask), and a query image. A pre-trained, frozen vision model then predicts the missing label for the query.
Despite its potential, visual ICL faces a significant challenge: prompt sensitivity. If the provided example is not semantically similar to the query, the model's performance often degrades sharply. Finding the optimal reference pair is difficult and computationally expensive. InMeMo addresses this by making visual ICL more robust, reducing the dependency on perfectly matched prompts through learnable task identifiers.
Methodology: The InMeMo Framework
InMeMo utilizes a Parameter-Efficient Transfer Learning (PETL) strategy. The core vision backbone, a pre-trained MAE-VQGAN, remains entirely frozen. The innovation lies in how the input prompts are processed and enhanced.
The framework consists of several key components:
- Prompt Retriever: This module uses CLIP features to identify the most similar image-label pair from a support dataset to serve as the initial in-context prompt.
- Prompt Enhancer: This is the primary contribution of the work. It applies a learnable, pixel-level perturbation—appearing as a colorful border—to the edges of the retrieved in-context pair. These perturbations act as a "task identifier," signaling the specific objective (e.g., "segment the foreground") to the frozen model.
- The Canvas Construction: The enhanced example image, its enhanced label, and the query image are arranged in a 2x2 grid. The fourth quadrant is left blank for the model to fill.
- Efficient Training: Only the parameters of the perturbation (approximately 69,840 parameters) are optimized. This allows for rapid training on consumer-grade hardware.
Experimental Setup and Datasets
The researchers evaluated InMeMo on two fundamental computer vision tasks:
- Foreground Segmentation: Benchmarked on the Pascal-5i dataset, a standard for few-shot segmentation.
- Single Object Detection: Evaluated on a subset of PASCAL VOC 2012 where objects are prominent and occupy less than half the image area.
- Cross-Domain Generalization: To test robustness, the model was trained on COCO-5i and evaluated on Pascal images, simulating real-world domain shifts.
Results and Discussion
InMeMo achieved state-of-the-art results across both primary tasks. In segmentation, it improved the mean Intersection over Union (mIoU) from a baseline of 35.79 to 43.14 on Pascal-5i. In object detection, the improvement was even more pronounced, with mIoU jumping from 28.08 to 43.21.
Robustness to Suboptimal Prompts
A key finding is InMeMo's resilience to poor prompt selection. While baseline models fail when the reference image is semantically distant from the query, the learned perturbations in InMeMo provide a consistent task signal that maintains high performance. This "task identifier" effectively bridges the gap between the prompt and the query.
Efficiency and Generalization
By training only a tiny fraction of the total model parameters, InMeMo remains highly efficient. Furthermore, the domain-shift experiments (COCO to Pascal) showed that the learned prompts capture the essence of the task rather than just memorizing specific dataset features, indicating strong generalization capabilities.
Limitations
Despite its successes, InMeMo requires a minimum amount of data to be effective, typically needing at least 64 images per class to significantly outperform baselines. Additionally, while the prompts generalize well within broad categories, they may struggle when applied to entirely different semantic domains (e.g., from vehicles to animals).
Conclusion
InMeMo presents a simple yet effective method for enhancing visual in-context learning. By introducing learnable visual perturbations as task identifiers, it overcomes the traditional bottleneck of prompt sensitivity. This approach offers a path toward more robust and efficient few-shot vision systems that can be easily adapted to new tasks without the need for extensive retraining of large-scale models.
Summary updated