Abstract
The task of Few-shot Learning (FSL) aims to perform inference on novel categories containing only a few labeled examples, leveraging knowledge learned from base categories with abundant training samples. While Vision Transformers (ViTs) have demonstrated state-of-the-art performance across various vision tasks, efficiently adapting them for FSL remains non-trivial due to the high risk of overfitting on small datasets. We propose efficient Transformer Tuning (eTT), a novel method that facilitates finetuning ViTs in FSL scenarios. Our approach introduces Attentive Prefix Tuning (APT) for task-specific adaptation and Domain Residual Adapters (DRA) for backbone finetuning. By utilizing learnable offset vectors and prototypical regularization, eTT achieves outstanding performance on the challenging Meta-Dataset while updating only a small fraction of the model's parameters.
Introduction
Few-Shot Learning (FSL) requires models to recognize new categories after seeing only one or a few labeled examples. While Convolutional Neural Networks (CNNs) have been the standard backbone for FSL, Vision Transformers (ViTs) have struggled to adapt efficiently. The core challenge lies in balancing efficiency and expressiveness: finetuning an entire ViT backbone on a handful of images leads to catastrophic overfitting, whereas tuning only the final classification layer often fails to bridge the "domain gap" between training and testing data.
To address this, the eTT framework seeks a middle ground by "nudging" the ViT’s internal logic without retraining the entire architecture. As shown in the parameter analysis, eTT allows for high-performance adaptation using only approximately 9% of the total parameters compared to full backbone finetuning.
The eTT Framework
The eTT method consists of three primary innovations designed to make ViT adaptation both stable and effective:
1. Attentive Prefix Tuning (APT)
Inspired by natural language processing, prefix tuning adds learnable tokens to the input of each attention layer. However, eTT improves upon this by using Attentive Prototypes. Instead of random initialization, the model calculates a weighted average of image patches—guided by the ViT's own attention maps—to create a task-specific starting point. These prefixes are then projected into new key and value pairs attached to each self-attention layer.
2. Domain Residual Adapter (DRA)
To handle domain shifts (e.g., moving from natural images to sketches), simple learnable "offset vectors" ($\delta_a, \delta_f$) are added to the Multi-Head Self-Attention (MSA) and Feed-Forward Network (FFN) layers. These act as a lightweight correction mechanism for the model’s internal features.
3. Prototypical Regularization
To prevent the model from deviating too far from the initial task-specific information during the few update steps available in FSL, a novel loss term is introduced. This regularization minimizes the similarity between the projected distribution of the prefix and the initial prototypes, ensuring the update procedure remains grounded.
Experimental Evaluation
Datasets and Protocol
The primary benchmark for eTT is the Meta-Dataset, a rigorous test for FSL containing ten diverse sub-datasets ranging from natural images (ImageNet, CUB) to specialized domains (Omniglot, QuickDraw, Traffic Signs). The authors utilized a "single-source" protocol, training exclusively on the ImageNet split and testing on all other domains to evaluate true generalization capabilities.
Key Results
- State-of-the-Art Performance: eTT achieved an average rank of 1.6 across all Meta-Dataset tasks, outperforming established ResNet-based methods and standard ViT finetuning.
- Domain Adaptation: The model showed massive gains in specialized domains, with accuracy boosts of 19.74% on the Aircraft dataset and 36.97% on Traffic Signs compared to classic ProtoNet baselines.
- Efficiency: By tuning only the adapters and prefixes, the model avoids the overfitting that plagues full-backbone finetuning while maintaining a small memory footprint.
Discussion and Conclusion
A critical insight of this work is the importance of initialization and self-supervision. The authors found that DINO-pretrained models produce richer semantic attention maps, which are vital for generating effective Attentive Prototypes. While eTT excels in complex domains, standard patch-based ViTs still face challenges with very low-resolution, simple datasets like Omniglot where convolutions may be more naturally suited.
Future work may involve exploring more sophisticated Transformer variants, such as Swin Transformers, and developing adaptive test-time iteration strategies to further enhance the efficiency of few-shot adaptation.
Summary updated