LaFTer: Label-Free Tuning of Zero-shot Classifier using Language and Unlabeled Image Collections

Muhammad Jehanzeb Mirza, Leonid Karlinsky, Wei Lin, Mateusz Kozinski, Horst Possegger, Rogério Feris, Horst Bischof · DOI

TL;DR

This paper introduces LaFTer, a novel method for improving zero-shot image classification by fine-tuning Vision-Language (VL) models without any labeled data. By leveraging Large Language Models (LLMs) to generate descriptive text for categories and then using this text to train a classifier, LaFTer significantly boosts performance, even outperforming some few-shot supervised methods.

What Problem Does This Paper Address?

Vision-Language (VL) models like CLIP have revolutionized zero-shot image classification, allowing recognition of arbitrary categories described by text. However, their performance often lags behind models trained with supervised fine-tuning on specific datasets. Traditionally, closing this performance gap requires labeled data from the target domain, which can be expensive and time-consuming to acquire, especially for specialized applications like traffic surveillance or quality control. This paper tackles the challenge of improving VL model performance on target tasks without relying on any labeled data, aiming to bridge the gap between flexible zero-shot capabilities and high-performance supervised methods.

Methods

LaFTer employs a two-stage, label-free approach:

  1. Text-Only Pre-training of a Visual Classifier: The core idea is cross-modal transfer. Instead of using labeled images, LaFTer uses a Large Language Model (LLM) (e.g., GPT-3) to generate descriptive text for each target category. These generated texts, combined with handcrafted templates, form a text-only dataset. A neural network (a "Text Classifier") is trained on this dataset to classify text embeddings. Crucially, this text-trained classifier can then be used to classify image embeddings from a pre-trained VL model (like CLIP). This stage leverages the inherent alignment between text and image embeddings in VL models.
  2. Unsupervised Finetuning on Target Domain Images: The text-only pre-trained classifier is then used in a pseudo-labeling pipeline to further fine-tune the VL model's vision encoder on an unlabeled image collection. For each training image, two views are created: a weakly-augmented view (used to generate a pseudo-label via the text classifier) and a strongly-augmented view. The model is trained to predict the pseudo-label for the strongly-augmented view. To keep the finetuning parameter-efficient and prevent overfitting, LaFTer utilizes Visual Prompt Tuning (VPT) and adapts the scale and shift parameters of normalization layers, while keeping the rest of the vision encoder frozen.

Datasets

LaFTer is evaluated on a diverse set of 12 image classification benchmarks:

  • Common Natural Categories: ImageNet, CIFAR-10, CIFAR-100, Caltech-101
  • Specialized Domains: EuroSat (satellite images), UCF-101 (action recognition), SUN-397 (scenes), Flowers-102 (fine-grained flower classification)
  • Adversarial/Robustness Benchmarks: ImageNet-A (Adversarial), ImageNet-S (Sketch), ImageNet-R (Rendition)

The paper also discusses the construction of a text dataset using LLMs and handcrafted templates, and explores scenarios with "unrelated samples" added to the unlabeled adaptation set from CIFAR-100 and within EuroSat/CIFAR-100.

Key Insights and Ideas

  • Cross-Modal Transfer is Powerful: The paper demonstrates that a classifier trained solely on text embeddings can effectively classify image embeddings, highlighting the strong alignment learned by modern VL models. This is a key enabler for the label-free approach.
  • LLMs as Synthetic Labelers: LLMs can generate rich, descriptive text that effectively substitutes for labeled image data, allowing for unsupervised training on target categories.
  • Text-Only Pre-training Boosts Unsupervised Finetuning: The text-only pre-trained classifier acts as a strong initializer for the unsupervised finetuning stage, leading to significant performance gains compared to using the base VL model directly or other unsupervised methods.
  • Parameter Efficiency is Key: By using techniques like Visual Prompt Tuning and adapting only normalization layer parameters, LaFTer achieves significant improvements with a very small number of trainable parameters (<0.4%).
  • Robustness to Noisy Data: LaFTer shows resilience to the presence of unrelated images in the unlabeled adaptation set, a common scenario in real-world applications.

Key Results

LaFTer consistently improves zero-shot performance across all 12 evaluated datasets.

  • Absolute Improvement: Achieves up to 11.7% (3.8% on average) absolute improvement over contemporary label-free methods.
  • Comparison to Base CLIP: Shows significant gains over the base CLIP zero-shot performance, with up to 28% absolute improvement on EuroSat and 2.3% on ImageNet.
  • Few-Shot Comparison: Outperforms leading few-shot prompting baselines (like CoOp) by an average of 1.3% even when LaFTer uses no labeled samples, and in some cases, even surpasses 10-shot supervised methods on datasets like ImageNet.
  • Parameter Efficiency: Achieves these results with less than 0.4% of the model parameters being trained.
  • Ablation Studies: Removing the text-only pre-trained classifier leads to the most significant degradation, underscoring its importance. Removing learnable visual prompts also causes a notable drop in performance.

Limitations and Future Work

  • Classifier Complexity: The paper uses a single linear layer as the text classifier. The authors suggest that exploring more complex classifier architectures, potentially coupled with expanding the text dataset, could be a promising future direction.
  • LLM Dependence: The reliance on LLMs for text generation implies a dependency on their capabilities and potential biases.
  • Generalizability of Text-Only Classifier: While effective, the text-only classifier's performance on image embeddings is still an area for further exploration.

The authors suggest future work could focus on more expressive classifier heads and further exploring the cross-modal transfer capabilities of VL models.

Summary updated

BibTeX
@inproceedings{mirza2023lafter,
  author = {Muhammad Jehanzeb Mirza and Leonid Karlinsky and Wei Lin and Mateusz Kozinski and Horst Possegger and Rogério Feris and Horst Bischof},
  title = {{LaFTer: Label-Free Tuning of Zero-shot Classifier using Language and Unlabeled Image Collections}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=elPtHcfjpH},
}
Figure