Lune

NeurIPS2023Top-tier venue

What Makes Good Examples for Visual In-Context Learning?

Yuanhan Zhang, Kaiyang Zhou, Ziwei Liu

Abstract

Large-scale models trained on broad data have recently become the mainstream architecture in computer vision due to their strong generalization performance. In this paper, the main focus is on an emergent ability in large vision models, known as in-context learning, which allows inference on unseen tasks by conditioning on in-context examples (a.k.a. prompt) without updating the model parameters. This concept has been well-known in natural language processing but has only been studied very recently for large vision models. We for the first time provide a comprehensive investigation on the impact of in-context examples in computer vision, and find that the performance is highly sensitive to the choice of in-context examples. To overcome the problem, we propose a prompt retrieval framework to automate the selection of in-context examples. Specifically, we present (1) an unsupervised prompt retrieval method based on nearest example search using an off-the-shelf model, and (2) a supervised prompt retrieval method, which trains a neural network to choose examples that directly maximize in-context learning performance. The results demonstrate that our methods can bring non-trivial improvements to visual in-context learning in comparison to the commonly-used random selection. The code and models are available at https: //github.com/ZhangYuanhan-AI/ visual_prompt_retrieval.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

63 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Towards In-context Scene Understanding cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Towards In-context Scene Understanding cites Language Models are Few-Shot Learners
  • Towards In-context Scene Understanding cites Learning Transferable Visual Models From Natural Language Supervision
  • Towards In-context Scene Understanding cites Flamingo: a Visual Language Model for Few-Shot Learning
  • ImageBrush: Learning Visual In-Context Instructions for Exemplar-Based Image Manipulation cites Language Models are Few-Shot Learners
  • ImageBrush: Learning Visual In-Context Instructions for Exemplar-Based Image Manipulation cites Learning Transferable Visual Models From Natural Language Supervision
  • ImageBrush: Learning Visual In-Context Instructions for Exemplar-Based Image Manipulation cites Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
  • In-Context Learning Unlocked for Diffusion Models cites Language Models are Few-Shot Learners
  • In-Context Learning Unlocked for Diffusion Models cites Learning Transferable Visual Models From Natural Language Supervision
  • In-Context Learning Unlocked for Diffusion Models cites Flamingo: a Visual Language Model for Few-Shot Learning
  • In-Context Learning Unlocked for Diffusion Models cites Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
  • OmniSVG: A Unified Scalable Vector Graphics Generation Model cites Learning Transferable Visual Models From Natural Language Supervision
  • Visual Instruction Inversion: Image Editing via Image Prompting cites Language Models are Few-Shot Learners
  • Visual Instruction Inversion: Image Editing via Image Prompting cites Learning Transferable Visual Models From Natural Language Supervision
  • Visual Instruction Inversion: Image Editing via Image Prompting cites Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding
  • An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
  • Learning Transferable Visual Models From Natural Language Supervision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Learning Transferable Visual Models From Natural Language Supervision cites Language Models are Few-Shot Learners
  • Flamingo: a Visual Language Model for Few-Shot Learning cites Language Models are Few-Shot Learners
  • Flamingo: a Visual Language Model for Few-Shot Learning cites Learning Transferable Visual Models From Natural Language Supervision
  • Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding cites Language Models are Few-Shot Learners
  • Photorealistic Text-to-Image Diffusion Models with Deep Language Understanding cites Learning Transferable Visual Models From Natural Language Supervision
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers63

  1. In-Context Learning Unlocked for Diffusion ModelsZhendong Wang, Yifan Jiang, Yadong Lu, Yelong Shen et al.NeurIPS 2023 · 128 citations
  2. OmniSVG: A Unified Scalable Vector Graphics Generation ModelYiying Yang, Wei Cheng, Sijin Chen, Xianfang Zeng et al.NeurIPS 2025 · 90 citations
  3. ImageBrush: Learning Visual In-Context Instructions for Exemplar-Based Image ManipulationYasheng Sun, Yifan Yang, Houwen Peng, Yifei Shen et al.NeurIPS 2023 · 71 citations
  4. Towards In-context Scene UnderstandingIvana Balazevic, David Steiner, Nikhil Parthasarathy, Relja Arandjelovic et al.NeurIPS 2023 · 62 citations
  5. Visual Instruction Inversion: Image Editing via Image PromptingThao Nguyen, Yuheng Li, Utkarsh Ojha, Yong Jae LeeNeurIPS 2023 · 53 citations

Builds on11

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Learning Transferable Visual Models From Natural Language SupervisionAlec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh et al.ICML 2021 · 47,906 citations
  3. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  4. Photorealistic Text-to-Image Diffusion Models with Deep Language UnderstandingChitwan Saharia, William Chan, Saurabh Saxena, Lala Li et al.NeurIPS 2022 · 8,965 citations
  5. Flamingo: a Visual Language Model for Few-Shot LearningJean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech et al.NeurIPS 2022 · 6,707 citations

Related papers

  1. Cropper: Vision-Language Model for Image Cropping through In-Context LearningSeung Hyun Lee, Jijun Jiang, Yiran Xu, Zhuofang Li et al.CVPR 2025
  2. Fairness-guided Few-shot Prompting for Large Language ModelsHuan Ma, Changqing Zhang, Yatao Bian, Lemao Liu et al.NeurIPS 2023 · 87 citations
  3. How Does the Textual Information Affect the Retrieval of Multimodal In-Context Learning?Yang Luo, Zangwei Zheng, Zirui Zhu, Yang YouEMNLP 2024 · 2 citations
  4. Visual in-Context PromptingFeng Li, Qing Jiang, Hao Zhang, Tianhe Ren et al.CVPR 2024
  5. Stable Diffusion Models Are Secretly Good at Visual In-Context LearningTrevine Oorloff, Vishwanath Sindagi, Wele Gedara Chaminda Bandara, Ali Shafahi et al.ICCV 2025 · 11 citations
Dusk over the sea between two cliffs drawn in fine vertical lines