Skip to main content
QUICK REVIEW

[Paper Review] HyperTransformer: Model Generation for Supervised and Semi-Supervised Few-Shot Learning

Andrey Zhmoginov, M. Sandler|arXiv (Cornell University)|Jan 11, 2022
Domain Adaptation and Few-Shot LearningComputer Science18 citations
TL;DR

HyperTransformer proposes a Transformer-based model that generates all weights of a small convolutional neural network (CNN) directly from few-shot support sets, decoupling task-specific complexity from the target model. It achieves state-of-the-art performance on few-shot benchmarks, especially for smaller CNNs, and extends naturally to semi-supervised learning with unlabeled data by generating all layers or just the final logits.

ABSTRACT

In this work we propose a HyperTransformer, a Transformer-based model for supervised and semi-supervised few-shot learning that generates weights of a convolutional neural network (CNN) directly from support samples. Since the dependence of a small generated CNN model on a specific task is encoded by a high-capacity Transformer model, we effectively decouple the complexity of the large task space from the complexity of individual tasks. Our method is particularly effective for small target CNN architectures where learning a fixed universal task-independent embedding is not optimal and better performance is attained when the information about the task can modulate all model parameters. For larger models we discover that generating the last layer alone allows us to produce competitive or better results than those obtained with state-of-the-art methods while being end-to-end differentiable.

Motivation & Objective

  • Address the limitations of metric-based and optimization-based few-shot learning methods that rely on fixed, universal embeddings or limited parameter updates.
  • Decouple the complexity of the task space from individual models by using a high-capacity Transformer to generate task-specific CNN weights.
  • Enable end-to-end differentiable training for few-shot learning without nested gradients or complex optimization schemes.
  • Extend the framework to semi-supervised few-shot learning by incorporating unlabeled samples into the support set.
  • Investigate the trade-off between generating all CNN layers versus only the final logits layer, depending on model size and task complexity.

Proposed method

  • Use a Transformer-based weight generator that takes support set images and labels as input and produces all CNN weights in a single forward pass.
  • Leverage self-attention mechanisms to process variable-sized support sets and handle class imbalance, with no positional encodings or masking.
  • Train the HyperTransformer end-to-end to minimize cross-entropy loss on query sets using generated CNN weights.
  • Support semi-supervised learning by appending a special token to encode unlabeled examples in the support set.
  • Allow flexible architecture design: generate only the final logits layer (for larger models) or all convolutional layers (for smaller models).
  • Use UMAP to visualize the semantic clustering of generated CNN weights across different classes, indicating semantic dependence in weight generation.

Experimental results

Research questions

  • RQ1Can a Transformer-based model effectively generate all weights of a small CNN directly from few-shot support sets, improving few-shot generalization?
  • RQ2Does generating all convolutional layers (not just the final logits) lead to better performance than generating only the last layer, especially for small models?
  • RQ3How does the inclusion of unlabeled samples in the support set affect few-shot performance, and what role does Transformer depth play in leveraging them?
  • RQ4What is the performance trade-off between using a static CNN backbone and generating all model parameters via the HyperTransformer?
  • RQ5At what model size threshold does generating only the final layer become sufficient, and what factors influence this threshold?

Key findings

  • HyperTransformer outperforms MAML++ and RFS on smaller CNNs (e.g., 4- and 6-channel models) by generating all convolutional layers and the final logits layer.
  • For larger models (e.g., 8-channel and above), generating only the final logits layer achieves peak performance comparable to state-of-the-art methods, indicating diminishing returns from generating intermediate layers.
  • The inclusion of unlabeled samples improves performance significantly, especially when the Transformer has two or more layers, enabling nearest-neighbor-style generalization.
  • A two-layer Transformer can encode a nearest-neighbor algorithm, allowing the model to associate unlabeled examples with similar labeled ones without explicit optimization objectives.
  • Visualizations using UMAP show that generated CNN weights cluster by class, indicating that semantic information is encoded in the weight generation process.
  • In models with large kernels and strides (e.g., 9x9, stride 4), generating at least one additional convolutional layer beyond the final logits improved test accuracy by ~1% compared to generating only the final layer.

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.