Improved Few-Shot Image Classification Through Multiple-Choice Questions

Dipika Khullar, Emmett Goodman, Negin SokhandanarXiv 2024

Abstract

Through a simple multiple choice language prompt a VQA model can operate as a zero-shot image classifier, producing a classification label. Compared to typical image encoders, VQA models offer an advantage: VQA-produced image embeddings can be infused with the most relevant visual information through tailored language prompts. Nevertheless, for most tasks, zero-shot VQA performance is lacking, either because of unfamiliar category names, or dissimilar pre-training data and test data distributions. We propose a simple method to boost VQA performance for image classification using only a handful of labeled examples and a multiple-choice question. This few-shot method is training-free and maintains the dynamic and flexible advantages of the VQA model. Rather than relying on the final language output, our approach uses multiple-choice questions to extract prompt-specific latent representations, which are enriched with relevant visual information. These representations are combined to create a final overall image embedding, which is decoded via reference to latent class prototypes constructed from the few labeled examples. We demonstrate this method outperforms both pure visual encoders and zero-shot VQA baselines to achieve impressive performance on common few-shot tasks including MiniImageNet, Caltech-UCSD Birds, and CIFAR-100. Finally, we show our approach does particularly well in settings with numerous diverse visual attributes such as the fabric, article-style, texture, and view of different articles of clothing, where other few-shot approaches struggle, as we can tailor our image representations only on the semantic features of interest.

Introduction

Standard image classification typically relies on fine-tuning large models on hundreds of examples per class—a process that is computationally expensive and data-hungry. While "zero-shot" models like CLIP or Visual Question Answering (VQA) systems offer flexibility, they often struggle with domain-specific data or unfamiliar category names. This research addresses the "few-shot" challenge: how to accurately classify images when only 1 to 5 labeled examples per class are available. The authors propose leveraging the reasoning power of Large Language Models (LLMs) within VQA architectures to extract more relevant visual features than a standard "vision-only" encoder could provide.

Methodology

The proposed method uses BLIP-2, a state-of-the-art VQA model, as a "language-steerable" image encoder. Crucially, this approach is training-free, requiring no gradient updates or hyperparameter tuning for new tasks.

Overview of the training-free VQA-based few-shot classification pipeline.

The pipeline follows several key steps:

  1. Multiple-Choice Prompting: Instead of a simple image input, the model receives a prompt such as: "Question: Is this a picture of a) [Class A], b) [Class B]...? Answer: ".
  2. Latent Representation Extraction: Rather than using the generated text, the method extracts internal embeddings from the Visual Encoder, Q-Former, LLM-encoder, and LLM-decoder.
  3. The "Second Token" Trick: The researchers discovered that the embedding of the second token in the LLM decoder's output sequence contains the richest information for classification.
  4. Feature Concatenation: The final image representation is created by concatenating the LLM-decoder embedding with the raw visual encoder embedding.
  5. Prototype Matching: To classify a new image, its combined embedding is compared to "prototypes" (averaged embeddings) of the few labeled examples using a simple Nearest Neighbor (K=1) lookup.

Results

The method was evaluated on a diverse set of benchmarks, including MiniImageNet, CUB200 (Caltech-UCSD Birds), CIFAR-100, and DeepFashion MultiModal.

Performance comparison across different model components and number of shots.

The proposed method consistently outperformed pure visual encoders and zero-shot VQA baselines. For instance, on MiniImageNet (1-shot), it achieved 75.96% accuracy, compared to 62.99% for a standard visual encoder. In specialized tasks like identifying fabric or patterns in the DeepFashion dataset, the language-infused embeddings outperformed visual-only models by 10% to 32%. The results suggest that more descriptive language labels actually provide better guidance to the model than simple ones.

Discussion and Conclusion

A striking insight from this work is that language prompts act as a semantic "lens." By asking specific questions, the VQA model's internal embeddings shift to prioritize relevant visual information (e.g., color vs. species). Furthermore, the model's internal "latent" representations proved far more powerful and robust than the final text output. Performance generally improved as features were extracted from deeper layers of the VQA pipeline, representing a higher degree of "vision-language mixing."

While the method struggles when class labels are textually very similar, it offers a dynamic and flexible alternative to traditional few-shot learning. Future work may explore why specific layers and tokens are so effective and how to further optimize this variability across different tasks.

Summary updated

BibTeX
@misc{khullar2024improved,
  author = {Dipika Khullar and Emmett Goodman and Negin Sokhandan},
  title = {{Improved Few-Shot Image Classification Through Multiple-Choice Questions}},
  year = {2024},
  eprint = {2407.16145},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.16145},
}
Figure