TL;DR
This paper introduces Coreset-based Dual Retrieval (CoDR), a novel framework for efficiently selecting high-quality demonstrations for in-context learning (ICL) in Large Visual Language Models (LVLMs). CoDR constructs a diverse "coreset" of potential demonstrations and uses a dual retrieval mechanism to select the most relevant ones, significantly improving ICL performance and reducing hallucinations compared to existing methods.
What Problem Does This Paper Address?
In-context learning (ICL) allows Large Visual Language Models (LVLMs) to perform tasks with just a few examples provided in the prompt. However, the effectiveness of ICL hinges on selecting the right examples (demonstrations). This selection process is computationally challenging (NP-hard) and existing methods like random sampling, similarity-based, or "infoscore"-based approaches often struggle to balance efficiency and performance. Random sampling can be suboptimal, similarity-based methods can lead to "hallucinations" (incorrect predictions based on superficial similarities), and infoscore-based methods can be too slow for practical use. This paper aims to bridge this gap by proposing a method that is both efficient and effective in selecting demonstrations.
Methods
The core of CoDR lies in its two-stage approach:
- Coreset Construction: Instead of random sampling, CoDR first constructs a diverse subset of the support set called a "coreset." This is achieved through a novel "cluster-pruning" method. The method uses LVLM embeddings of the support set, clusters them using K-means, and then prunes clusters based on a "complexity score" that considers both intra-cluster (within-cluster) and inter-cluster (between-cluster) distances. This ensures that diverse and informative clusters are well-represented in the coreset. The paper theoretically demonstrates that a diverse coreset leads to higher expected mutual information, which is crucial for effective knowledge transfer.
- Dual Retrieval: Once the diverse coreset is established, CoDR employs a "dual retrieval" mechanism. It first pre-computes a "C-score" for each sample in the support set, quantifying how well it acts as a demonstration for samples in the coreset. For a given query, CoDR then calculates its similarity to each sample in the coreset. This similarity score is multiplied by the pre-computed C-score to get a weighted score. These weighted scores are used to rank and select the final demonstrations from the entire support set, not just the coreset. This allows for global selection while being guided by the diverse coreset, balancing relevance and diversity.
Datasets
The paper evaluates CoDR on three standard tasks and datasets:
- Image Captioning (IC): MS-COCO dataset.
- Visual Question Answering (VQA): VQAv2 dataset.
- Fine-grained Image Classification (FIC): StanfordDogs dataset.
These tasks were performed using two popular open-source LVLM frameworks: OpenFlamingo-v2 (OFv2) and Idefics-v2 (IDEv2).
Key Insights and Ideas
- Diversity is Key for Mutual Information: The paper provides theoretical backing that a diverse set of demonstrations, even if not perfectly similar to the query, leads to higher mutual information and better knowledge transfer.
- Coreset as a "Smart Guide": The coreset isn't just a smaller subset to pick from; it acts as a representative guide that helps the dual retrieval process efficiently navigate the larger support set.
- Balancing Efficiency and Effectiveness: CoDR achieves a significant speedup over traditional infoscore methods while outperforming them and similarity-based methods in terms of accuracy and reducing hallucinations.
- Cluster Complexity for Pruning: The novel cluster-pruning metric, considering both intra- and inter-cluster distances, is crucial for creating a truly representative and diverse coreset.
Key Results
- Image Captioning: CoDR significantly improves CIDEr scores and reduces hallucinations (CHAIRI/CHAIRS metrics) compared to random, similarity-based (SITR/SITRL), and infoscore-based (IRL) methods. For example, on IDEv2, CoDR achieved a CIDEr score of 117.54 in the 4-shot setting, outperforming IDEv2-IRL (111.29).
- VQA and FIC: CoDR consistently achieves state-of-the-art or near state-of-the-art performance. For instance, in the 4-shot VQA setting on OFv2, CoDR reached an accuracy of 53.49, significantly higher than SITR (47.50) and IRL (52.15).
- Efficiency: CoDR's inference time is comparable to fast similarity-based methods (around 3.7-3.9 seconds), making it practical for large-scale applications, a stark contrast to slower methods.
- Robustness: CoDR shows consistent performance across different LVLM architectures (OFv2 and IDEv2) and tasks.
Limitations and Future Work
- Coreset Scale Hyperparameter: The optimal coreset size is a hyperparameter that needs to be tuned for different tasks (e.g., ~50 for IC/VQA, ~300 for FIC).
- Handling "Challenging" Queries: In rare cases where queries fall outside the coreset's distribution or represent very rare visual categories, CoDR's similarity-weighted dual retrieval might still prioritize semantically distant samples, though it still produces fewer hallucinations than alternatives.
- Future Work: The authors plan to extend CoDR to better combine multiple selected demonstrations (ensemble learning) and explore combining multiple coreset configurations for increased robustness. They also aim to extend CoDR to knowledge-intensive tasks, where identifying demonstrations with factual and relational knowledge is critical.
Summary updated