VideoICL: Confidence-based Iterative In-context Learning for Out-of-Distribution Video Understanding

Kangsan Kim, Geon Park, Youngwan Lee, Woongyeong Yeo, Sung Ju Hwang

Introduction

Video Large Multimodal Models (LMMs), such as LLaVA-Video or Qwen2-VL, demonstrate remarkable proficiency in describing general everyday scenes. However, their performance often degrades significantly when encountering "out-of-distribution" (OOD) content—specialized domains like surgical procedures, rare athletic maneuvers, or specific security incidents that are underrepresented in general training datasets.

While fine-tuning is a common remedy, it is computationally expensive and difficult to scale across numerous niche domains. In-Context Learning (ICL) offers a training-free alternative by providing the model with a few demonstration examples. However, video data is exceptionally dense; a single short clip can consume thousands of tokens, quickly exhausting the context window of most models. This "token bottleneck" prevents models from leveraging a diverse set of examples to understand complex OOD scenarios.

Comparison of VideoICL against standard zero-shot OOD inference and regular ICL, which suffers from context length limitations.

Methodology: The VideoICL Framework

VideoICL addresses these limitations through a two-stage framework designed to maximize the utility of demonstration examples without overflowing the context window.

1. Similarity-based Example Selection

Rather than selecting random demonstrations, VideoICL employs a dual-encoder approach to identify the most relevant examples from a database. It utilizes SentenceBERT for text features and InternVideo2 for video features, calculating a weighted cosine similarity to rank examples based on their relevance to the specific query video and question.

2. Confidence-based Iterative Inference

This core innovation bypasses the context window limit by iterating through small batches of high-quality examples. Instead of cramming all top-ranked examples into one prompt, VideoICL takes the top $m$ examples (typically 2) and performs inference. It then calculates a confidence score based on the minimum token probability of the generated response.

  • Acceptance: If the confidence exceeds a predefined threshold ($c_{th}$), the answer is accepted.
  • Iteration: If confidence is low, the framework discards the current examples, fetches the next most relevant set, and retries.
  • Selection: After a set number of iterations, the system selects the response that yielded the highest overall confidence.
The VideoICL pipeline: Similarity-based selection followed by an iterative inference loop that retries with new examples until a high-confidence answer is found.

Key Results and Insights

VideoICL was evaluated across six diverse OOD benchmarks, including surgical videos (PitVQA), security footage (UCF-Crime), and complex animal behaviors (Animal Kingdom). The results highlight several critical advantages:

  • Significant Performance Gains: VideoICL achieved an average improvement of 25.6%p across QA and classification tasks compared to zero-shot baselines. On the specialized PitVQA dataset, accuracy improved by 54.6%p.
  • Efficiency Over Scale: A 7B parameter model using VideoICL outperformed a 72B parameter model in zero-shot settings, suggesting that smart retrieval and context management can be more impactful than raw model size for specialized tasks.
  • Outperforming Proprietary Models: Using a LLaVA-Video-7B backbone, VideoICL outperformed GPT-4o by an average of 17.8%p and Gemini 1.5 Pro by 14.2%p on these specific OOD tasks.
  • Surpassing Fine-Tuning: In certain scenarios like UCF-Crime, VideoICL outperformed LoRA fine-tuned models, likely because the similarity-based selection provides highly specific "local" knowledge that global fine-tuning may fail to capture.

Conclusion and Future Work

VideoICL demonstrates that iterative inference with high-quality, retrieved examples is a powerful, training-free method for enhancing video AI on unfamiliar data. While the approach introduces some additional inference latency due to multiple passes, it effectively circumvents the context window limitations of current LMMs. Future research may focus on more sophisticated confidence measures and applying this iterative logic to extremely long video sequences or multi-modal "many-shot" scenarios.

Summary updated

BibTeX
@inproceedings{kim2025videoicl,
  author = {Kangsan Kim and Geon Park and Youngwan Lee and Woongyeong Yeo and Sung Ju Hwang},
  title = {{VideoICL: Confidence-based Iterative In-context Learning for Out-of-Distribution Video Understanding}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.00313},
}
Figure