Learning Embedding Adaptation for Few-Shot Learning

Han-Jia Ye, Hexiang Hu, De-Chuan Zhan, Fei Sha

TL;DR

FEAT (Few-shot Embedding Adaptation with Transformer) moves beyond "one-size-fits-all" feature extractors in few-shot learning by introducing a task-specific adaptation step. By using a Transformer as a set-to-set function, the model contextualizes the embeddings of a few labeled examples, making them more discriminative for the specific categories at hand and achieving state-of-the-art results across multiple benchmarks.

What Problem Does This Paper Address?

Few-shot learning (FSL) aims to recognize new visual concepts from just a handful of examples. Most modern approaches follow a two-step process: first, learn a powerful "embedding function" (a feature extractor) on a large set of seen classes, and then use that fixed function to map unseen classes into a feature space where simple classifiers (like nearest neighbors) can work.

The authors argue this approach is task-agnostic. A fixed embedding space assumes that the features useful for distinguishing "cats" from "dogs" are the same ones needed to distinguish "cats" from "tigers." In reality, the most discriminative features depend on the specific set of classes in a task. A feature that is crucial for one task might just be noise in another. What’s missing is an adaptation strategy that tailors visual knowledge to the specific "unseen" classes of a target task.

Methods

The core innovation is the introduction of a set-to-set adaptation function. Instead of treating every image independently, the model looks at the entire "support set" (the few labeled examples provided for a task) as a single set and transforms their embeddings collectively.

Comparison between standard instance embedding and the proposed embedding adaptation approach.

The authors explored several architectures for this set-to-set transformation:

  • BiLSTM: A sequence model, but problematic because sets don't have a natural order.
  • DeepSets: Inherently permutation-invariant but limited in how it models interactions.
  • GCN (Graph Convolutional Networks): Propagates relationships but can be difficult to optimize jointly with a backbone.
  • Transformer (FEAT): This emerged as the winner. Its self-attention mechanism naturally satisfies the needs of FSL: it is permutation-invariant and allows every instance in the set to "attend" to every other instance, enabling strong co-adaptation.

To further boost performance, they added a contrastive loss during training. This encourages adapted embeddings to be closer to their own class centers and further from others, ensuring the adaptation process truly enhances discriminative power.

Datasets

The model was evaluated on several standard and extended benchmarks:

  • MiniImageNet & TieredImageNet: The "gold standards" for few-shot classification.
  • CUB (Caltech-UCSD Birds): Used for fine-grained recognition.
  • OfficeHome: Used to test Few-Shot Domain Generalization (e.g., training on sketches and testing on real photos).

Key Insights and Ideas

  • Contextualization is Key: The "aha moment" is that an embedding shouldn't be static. By allowing embeddings to "see" their task-mates, they can emphasize features that distinguish them from their current competitors.
  • The "Push" Effect: Qualitatively, the adaptation step acts like a specialized force. As seen in Figure 1, it pushes class prototypes away from the "clutter" of the general feature space and toward distinct clusters that better fit the test data.
Figure 1: Qualitative visualization of model-based embedding adaptation procedure (implemented using FEAT) on test tasks (refer to § 5.2.2 for more details). Each figure shows the locations of PCA projected support embeddings (class prototypes) before and after the adaptation of FEAT. Values below are the 1-shot 5-way classification accuracy before and after the the adaptation. Interestingly, the embedding adaptation step of FEAT pushes the support embeddings apart from the clutter and toward their own clusters, such that they can better fits the test data of its categories. (Best view in colors!)
  • Transformer Synergy: While Transformers are often associated with massive datasets, this paper shows they are exceptionally efficient as "set-to-set" adapters in low-data regimes due to their architectural properties (like permutation invariance).

Key Results

FEAT established new state-of-the-art (SOTA) results at the time of publication:

  • Standard FSL: On MiniImageNet (1-shot, 5-way), FEAT achieved 66.78% accuracy with a ResNet backbone, significantly outperforming the task-agnostic ProtoNet baseline (62.39%).
  • Way Extrapolation: FEAT showed remarkable robustness when trained on 5-way tasks but tested on 20-way tasks, maintaining higher accuracy than competing set functions like DeepSets or BiLSTM.
  • Extended Tasks: The model excelled in Transductive FSL (where unlabeled test instances are used to help adaptation) and Generalized FSL (where the model must distinguish between both seen and unseen classes simultaneously).

Limitations and Future Work

The authors noted that simply making the Transformer deeper or adding more attention heads didn't necessarily help. In fact, more complex structures often led to overfitting on the small support sets or made optimization significantly harder.

Future work could involve finding better regularization techniques to allow for more complex adaptation functions without the risk of overfitting. Additionally, exploring how to adapt the embedding function itself (the CNN/ResNet backbone) rather than just the resulting vectors remains a challenging but promising direction.

Summary updated

Abstract

Learning with limited data is a key challenge for visual recognition. Many few-shot learning methods address this challenge by learning an instance embedding function from seen classes and apply the function to instances from unseen classes with limited labels. This style of transfer learning is task-agnostic: the embedding function is not learned optimally discriminative with respect to the unseen classes, where discerning among them leads to the target task. In this paper, we propose a novel approach to adapt the instance embeddings to the target classification task with a set-to-set function, yielding embeddings that are task-specific and are discriminative. We empirically investigated various instantiations of such set-to-set functions and observed the Transformer is most effective -- as it naturally satisfies key properties of our desired model. We denote this model as FEAT (few-shot embedding adaptation w/ Transformer) and validate it on both the standard few-shot classification benchmark and four extended few-shot learning settings with essential use cases, i.e., cross-domain, transductive, generalized few-shot learning, and low-shot learning. It archived consistent improvements over baseline models as well as previous methods and established the new state-of-the-art results on two benchmarks.
BibTeX
@inproceedings{ye2020learning,
  author = {Han-Jia Ye and Hexiang Hu and De-Chuan Zhan and Fei Sha},
  title = {{Learning Embedding Adaptation for Few-Shot Learning}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00883},
}
Figure