Skip to main content
QUICK REVIEW

[Paper Review] Many-Shot In-Context Learning in Multimodal Foundation Models

Yixing Jiang, Jeremy Irvin|arXiv (Cornell University)|May 16, 2024
Domain Adaptation and Few-Shot LearningComputer Science4 citations
TL;DR

This paper investigates many-shot in-context learning (ICL) in multimodal foundation models using up to nearly 2,000 multimodal demonstrations. It demonstrates that both GPT-4o and Gemini 1.5 Pro achieve substantial performance gains with many-shot ICL, with Gemini 1.5 Pro showing superior data efficiency and log-linear performance improvement, while query batching reduces per-example latency and cost without sacrificing accuracy.

ABSTRACT

Large language models are effective at few-shot in-context learning (ICL). Recent advancements in multimodal foundation models have enabled unprecedentedly long context windows, presenting an opportunity to explore their capability to perform ICL with many more demonstrating examples. In this work, we evaluate the performance of multimodal foundation models scaling from few-shot to many-shot ICL. We benchmark GPT-4o and Gemini 1.5 Pro across 14 datasets spanning multiple domains (natural imagery, medical imagery, remote sensing, and molecular imagery) and tasks (image classification, visual QA, and object localization). We observe that many-shot ICL, including up to almost 2,000 demonstrating examples, leads to substantial improvements compared to few-shot (<100 examples) ICL across all of the datasets. Further, Gemini 1.5 Pro performance continues to improve log-linearly up to the maximum number of tested examples on many datasets. We also find open-weights multimodal foundation models like Llama 3.2-Vision do not benefit from the demonstrating examples, highlighting an important gap between open and closed multimodal foundation models. Given the high inference costs required for many-shot ICL, we also explore the impact of batching multiple queries in a single API call. We show that batching up to 50 queries can lead to performance improvements under zero-shot and many-shot ICL, with substantial gains in the zero-shot setting on multiple datasets, while drastically reducing per-query cost and latency. Finally, while GPT-4o and Gemini 1.5 Pro achieve similar zero-shot performance across the datasets, Gemini 1.5 Pro learns more quickly than GPT-4o on most datasets. Our results suggest that many-shot ICL could enable users to efficiently adapt multimodal foundation models to new applications and domains. Our codebase is publicly available at https://github.com/stanfordmlgroup/ManyICL .

Motivation & Objective

  • To evaluate the performance of multimodal foundation models in in-context learning (ICL) as the number of demonstrating examples increases from few-shot to many-shot.
  • To compare the data efficiency and performance scaling of GPT-4o and Gemini 1.5 Pro across diverse multimodal datasets.
  • To investigate the impact of batching multiple queries in a single API call on inference cost, latency, and performance in both zero-shot and many-shot ICL settings.
  • To analyze the mechanisms behind performance improvements observed in batched zero-shot ICL, including domain calibration and self-generated demonstrations.
  • To assess the practical feasibility of using many-shot ICL for adapting foundation models to new tasks without fine-tuning.

Proposed method

  • Benchmarking GPT-4o and Gemini 1.5 Pro on 10 multimodal datasets spanning natural imagery, medical imaging, remote sensing, and molecular imagery across multi-class, multi-label, and fine-grained classification tasks.
  • Scaling in-context learning from few-shot (<100 examples) to many-shot (up to 1,999 examples) by including a large number of multimodal demonstrations in the prompt.
  • Measuring performance improvements, data efficiency, and inference cost/latency across different shot settings and with and without query batching.
  • Using query batching with up to 50 queries per API call to reduce per-example latency and cost while maintaining or improving performance.
  • Analyzing the source of performance gains in batched zero-shot ICL through ablation studies, identifying domain calibration, class calibration, and autoregressive self-generation of demonstrations as key contributors.
  • Conducting experiments with the same hardware and location to ensure fair comparison and minimize data transfer artifacts.
Figure 1: Many-shot multimodal in-context learning compared to zero-shot and few-shot multimodal ICL. In zero-shot and few-shot settings, respectively, no demonstrating examples or only a small number of demonstrating examples are provided in the context before the test query. In a many-shot ICL set
Figure 1: Many-shot multimodal in-context learning compared to zero-shot and few-shot multimodal ICL. In zero-shot and few-shot settings, respectively, no demonstrating examples or only a small number of demonstrating examples are provided in the context before the test query. In a many-shot ICL set

Experimental results

Research questions

  • RQ1How does increasing the number of in-context demonstrations from few-shot to many-shot affect the performance of multimodal foundation models across diverse datasets?
  • RQ2How do GPT-4o and Gemini 1.5 Pro compare in terms of data efficiency and performance scaling under many-shot ICL?
  • RQ3Can batching multiple queries into a single API call reduce per-example inference cost and latency while maintaining or improving performance?
  • RQ4What mechanisms underlie the observed performance improvements in batched zero-shot ICL?
  • RQ5To what extent can many-shot ICL replace fine-tuning for adapting foundation models to new tasks and domains?

Key findings

  • Gemini 1.5 Pro performance improves log-linearly with increasing numbers of in-context examples, while GPT-4o shows less stable improvements.
  • Gemini 1.5 Pro exhibits higher in-context learning data efficiency than GPT-4o on most of the 10 datasets evaluated.
  • Batching up to 50 queries reduces per-example latency by up to 35x and cost by up to 45x in many-shot ICL settings compared to single queries.
  • Query batching leads to substantial performance gains in the zero-shot setting, with improvements attributed to domain calibration, class calibration, and self-generated demonstrations.
  • On HAM10000, batching reduces per-example latency from 17.3s to 0.54s and cost from $0.8420 to $0.0877 in 350-shot ICL.
  • On TerraIncognita, batching reduces per-example latency from 34.9s to 1.7s and cost from $1.8420 to $0.0406 in 810-shot ICL.
Figure 2: Gemini 1.5 Pro and GPT-4o performance from zero-shot to many-shot ICL. X-axis is in log scale. For Gemini 1.5 Pro, we observe log-linear improvement on 9 out of the 10 datasets and for GPT-4o we observe improvement from more demonstrating examples on most datasets, albeit substantially les
Figure 2: Gemini 1.5 Pro and GPT-4o performance from zero-shot to many-shot ICL. X-axis is in log scale. For Gemini 1.5 Pro, we observe log-linear improvement on 9 out of the 10 datasets and for GPT-4o we observe improvement from more demonstrating examples on most datasets, albeit substantially les

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.