Skip to main content
QUICK REVIEW

[Paper Review] What does a platypus look like? Generating customized prompts for zero-shot image classification

Sarah I. Pratt, Covert, Ian|arXiv (Cornell University)|Sep 7, 2022
Domain Adaptation and Few-Shot LearningComputer Science5 citations
TL;DR

This paper proposes CuPL (Customized Prompts via Language models), a zero-shot method that uses large language models (LLMs) to generate rich, category-specific prompts for open-vocabulary image classification. By replacing generic templates with descriptive, discriminative captions—such as 'a tree frog with large eyes'—the approach improves zero-shot accuracy across benchmarks, achieving a 1.1% top-1 accuracy gain on ImageNet and over 6% on the Describable Textures dataset, without any fine-tuning or labeled data.

ABSTRACT

Open-vocabulary models are a promising new paradigm for image classification. Unlike traditional classification models, open-vocabulary models classify among any arbitrary set of categories specified with natural language during inference. This natural language, called "prompts", typically consists of a set of hand-written templates (e.g., "a photo of a {}") which are completed with each of the category names. This work introduces a simple method to generate higher accuracy prompts, without relying on any explicit knowledge of the task domain and with far fewer hand-constructed sentences. To achieve this, we combine open-vocabulary models with large language models (LLMs) to create Customized Prompts via Language models (CuPL, pronounced "couple"). In particular, we leverage the knowledge contained in LLMs in order to generate many descriptive sentences that contain important discriminating characteristics of the image categories. This allows the model to place a greater importance on these regions in the image when making predictions. We find that this straightforward and general approach improves accuracy on a range of zero-shot image classification benchmarks, including over one percentage point gain on ImageNet. Finally, this simple baseline requires no additional training and remains completely zero-shot. Code available at https://github.com/sarahpratt/CuPL.

Motivation & Objective

  • To address the limitations of hand-crafted, generic prompt templates in zero-shot open-vocabulary image classification.
  • To improve classification accuracy—especially on fine-grained and visually similar categories—by incorporating discriminative visual attributes into prompts.
  • To eliminate the need for task-specific prompt engineering by leveraging LLMs to automatically generate high-quality, category-specific prompts.
  • To maintain a fully zero-shot setting by avoiding any fine-tuning or labeled data for prompt generation.
  • To create a generalizable, scalable method that works across diverse datasets without requiring prior knowledge of dataset-specific representations.

Proposed method

  • Use a large language model (LLM) to generate multiple descriptive captions for each image category, focusing on distinguishing visual features.
  • Transform each LLM-generated caption into a prompt by replacing the category placeholder with the actual class name.
  • Feed these customized prompts into a pre-trained open-vocabulary image classifier (e.g., CLIP) to compute image-text similarity scores.
  • Use the prompt with the highest similarity score to classify the input image, maintaining a zero-shot inference pipeline.
  • Leverage the LLM’s world knowledge to generate prompts rich in discriminative attributes—such as 'large eyes' for tree frogs—without requiring dataset-specific templates.
  • Ensure the method remains completely zero-shot by not retraining or adapting the vision model, and by using only prompt generation via LLMs.

Experimental results

Research questions

  • RQ1Can LLM-generated, category-specific prompts improve zero-shot image classification accuracy compared to standard hand-crafted templates?
  • RQ2Does incorporating discriminative visual attributes (e.g., 'large eyes' for tree frogs) into prompts enhance model performance on fine-grained classification tasks?
  • RQ3Can a single, fixed set of LLM prompt instructions generalize across diverse datasets without prior knowledge of the dataset’s content?
  • RQ4What is the impact of prompt quality and diversity on zero-shot accuracy, especially for visually ambiguous or similar categories?
  • RQ5How does the performance of LLM-generated prompts compare to hand-curated prompts on standard benchmarks like ImageNet and Describable Textures?

Key findings

  • CuPL achieves a 1.1% absolute improvement in top-1 accuracy on ImageNet compared to standard hand-crafted prompt templates.
  • On the Describable Textures dataset, CuPL improves zero-shot accuracy by more than 6 percentage points, demonstrating strong gains on fine-grained visual recognition.
  • The method outperforms standard prompt templates across 15 diverse zero-shot image classification benchmarks, showing broad generalization.
  • LLM-generated prompts contain more discriminative visual attributes (e.g., 'long floppy ears' for Cocker Spaniels) that help the vision model focus on relevant image regions.
  • The approach requires no additional training, maintains full zero-shot capability, and scales efficiently with minimal human effort—only a few prompt instructions are needed to generate thousands of category-specific prompts.
  • Qualitative analysis shows that CuPL prompts better capture distinguishing features (e.g., 'red hourglass shape' for southern black widows), leading to improved model attention on key discriminative regions.

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.