Skip to main content
QUICK REVIEW

[Paper Review] Tip-Adapter: Training-free Adaption of CLIP for Few-shot Classification

Renrui Zhang, Wěi Zhāng|arXiv (Cornell University)|Jul 19, 2022
Domain Adaptation and Few-Shot LearningComputer Science18 citations
TL;DR

This paper proposes Tip-Adapter, a training-free method that enhances CLIP for few-shot image classification by using a non-parametric key-value cache of few-shot support images and their labels. The method retrieves relevant few-shot knowledge via feature similarity during inference and combines it with CLIP’s zero-shot predictions via residual connection, achieving performance comparable to fine-tuned models with zero training cost and further boosting accuracy via only 20 fine-tuning epochs on the cache.

ABSTRACT

Contrastive Vision-Language Pre-training, known as CLIP, has provided a new paradigm for learning visual representations using large-scale image-text pairs. It shows impressive performance on downstream tasks by zero-shot knowledge transfer. To further enhance CLIP's adaption capability, existing methods proposed to fine-tune additional learnable modules, which significantly improves the few-shot performance but introduces extra training time and computational resources. In this paper, we propose a training-free adaption method for CLIP to conduct few-shot classification, termed as Tip-Adapter, which not only inherits the training-free advantage of zero-shot CLIP but also performs comparably to those training-required approaches. Tip-Adapter constructs the adapter via a key-value cache model from the few-shot training set, and updates the prior knowledge encoded in CLIP by feature retrieval. On top of that, the performance of Tip-Adapter can be further boosted to be state-of-the-art on ImageNet by fine-tuning the cache model for 10$ imes$ fewer epochs than existing methods, which is both effective and efficient. We conduct extensive experiments of few-shot classification on 11 datasets to demonstrate the superiority of our proposed methods. Code is released at https://github.com/gaopengcuhk/Tip-Adapter.

Motivation & Objective

  • To address the limitation of zero-shot CLIP in few-shot classification by enabling effective adaptation without fine-tuning.
  • To design a lightweight, non-parametric adapter that leverages few-shot support data without updating CLIP’s weights.
  • To achieve state-of-the-art performance on ImageNet with only 20 fine-tuning epochs on the cache model, significantly reducing training cost.
  • To demonstrate that knowledge retrieval from a cached few-shot dataset can rival or surpass fine-tuned methods in accuracy-efficiency trade-off.

Proposed method

  • Constructs a key-value cache from few-shot support images and their one-hot encoded labels, where keys are CLIP-embedded features and values are class labels.
  • During inference, computes cosine similarity between the test image’s CLIP feature and cached keys to retrieve relevant label predictions.
  • Aggregates retrieved label predictions from the cache and combines them with CLIP’s original zero-shot prediction via a residual connection.
  • Introduces Tip-Adapter-F by fine-tuning only the cached keys (not CLIP weights or labels), enabling performance boost with minimal training.
  • Uses ViT-Large as the CLIP visual backbone and maintains frozen CLIP encoders throughout, ensuring parameter efficiency.
  • Employs a single GPU for inference and fine-tuning, with training time measured in minutes for Tip-Adapter-F.

Experimental results

Research questions

  • RQ1Can a non-parametric, training-free adapter rival fine-tuned models in few-shot image classification?
  • RQ2Does caching support-set features and labels enable effective knowledge transfer without updating CLIP’s parameters?
  • RQ3Can fine-tuning only the cache keys achieve state-of-the-art performance with drastically reduced training time?
  • RQ4How does the performance gain of Tip-Adapter vary across datasets with different domain gaps from CLIP’s pre-training distribution?

Key findings

  • Tip-Adapter achieves 62.03% top-1 accuracy on 16-shot ImageNet, a 1.70% improvement over zero-shot CLIP, without any training.
  • Tip-Adapter-F, fine-tuned for only 20 epochs on the cache, reaches 65.51% accuracy on 16-shot ImageNet, surpassing both zero-shot CLIP and fine-tuned CoOp and CLIP-Adapter.
  • On 11 diverse few-shot datasets, Tip-Adapter achieves a median performance gain of over 10% over zero-shot CLIP, with gains of 33.02% on EuroSAT and 23.87% on Flowers102.
  • Fine-tuning CLIP’s visual or textual encoders leads to performance collapse or degradation, while fine-tuning only the cache keys yields stable and significant gains.
  • Tip-Adapter-F achieves 79.4% accuracy on ImageNet with only 6.2M parameters and 6 minutes of training, outperforming DeiT-S (79.9%) and ResNet-50 (74.2%) trained on full datasets.
  • The method maintains inference speed of 10.42ms per image and 2227MiB GPU memory, comparable to zero-shot CLIP, demonstrating high efficiency.

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.