MetaKernel: Learning Variational Random Features With Limited Labels

Yingjun Du, Haoliang Sun, Xiantong Zhen, Jun Xu, Yilong Yin, Ling Shao, Cees G. M. Snoek

TL;DR

This paper introduces MetaKernel, a novel meta-learning approach for few-shot learning that learns task-specific kernels using variational random features. By leveraging shared knowledge across tasks with an LSTM and enriching kernel expressiveness with normalizing flows, MetaKernel achieves state-of-the-art performance on various few-shot classification and regression benchmarks.

What Problem Does This Paper Address?

Humans excel at learning new concepts from just a few examples and generalizing that knowledge. In contrast, deep learning models typically require vast amounts of labeled data for satisfactory performance. This "learnability gap" is particularly evident in few-shot learning, where the goal is to adapt a model to new tasks with very limited labeled data. The core challenge in few-shot learning is effectively extracting and leveraging prior knowledge from related tasks to enable rapid adaptation. While meta-learning has shown promise in learning good initializations or optimization strategies, the problem of how to properly define and exploit this shared knowledge to create powerful, adaptable base-learners for individual tasks remains an open question. This paper specifically addresses this by focusing on learning adaptive kernels for these base-learners.

Methods

MetaKernel combines several key ideas:

  • Kernel Learning with Random Fourier Features (RFFs): Instead of relying on fixed kernels, MetaKernel learns task-specific kernels. RFFs are used to approximate kernels efficiently, and the paper frames the learning of these random feature bases as a variational inference problem. This allows for data-driven kernel adaptation.
  • Variational Inference: The random feature bases are treated as latent variables. Variational inference is employed to estimate a posterior distribution over these bases, making the kernel learning process probabilistic and adaptable.
  • LSTM-based Context Inference: To leverage shared knowledge from previously encountered tasks, a Long Short-Term Memory (LSTM) network is used. This LSTM acts as a "meta-learner" that accumulates and refines this shared knowledge, which is then used to inform the inference of the random feature bases for the current task. This context inference helps create more informative kernels.
  • Conditional Normalizing Flows (CNFs): To further enhance the expressiveness of the learned kernels, conditional normalizing flows are introduced. CNFs transform a simple base distribution into a richer, more complex posterior distribution over the random Fourier bases. This allows for more informative and discriminative kernels.

Datasets

The paper evaluates MetaKernel on a wide range of datasets for both classification and regression tasks:

  • Few-Shot Classification Benchmarks: Omniglot, miniImageNet, CIFAR-FS, and Meta-Dataset (which itself comprises ten diverse datasets).
  • Few-Shot Domain Generalization: DomainNet.
  • Few-Shot Regression: Synthetic sine function fitting.

Key Insights and Ideas

  • Kernels as Adaptable Base-Learners: The paper successfully integrates kernel methods, specifically RFFs, into the meta-learning framework as adaptable base-learners for few-shot tasks. This offers a principled way to learn task-specific representations.
  • Leveraging Shared Knowledge via LSTM: The LSTM's ability to capture long-term dependencies is effectively utilized to distill and transfer knowledge across tasks, significantly improving the quality of learned random features and thus the kernels.
  • Normalizing Flows for Richer Kernels: The introduction of conditional normalizing flows is a novel contribution that allows for more expressive posterior distributions over random features, leading to more informative and powerful kernels. This is a key enabler for MetaKernel's strong performance.
  • Robustness to Domain Shifts: The strong performance on the few-shot domain generalization benchmark highlights MetaKernel's ability to adapt to tasks from unseen domains, a crucial aspect for real-world applicability.

Key Results

MetaKernel consistently achieves state-of-the-art or competitive performance across various few-shot learning benchmarks:

  • Few-Shot Classification: On miniImageNet, CIFAR-FS, and Omniglot, MetaKernel consistently outperforms existing methods, often by a significant margin, especially in challenging 1-shot settings. For instance, it achieves 55.5% accuracy on the 5-way 1-shot miniImageNet task.
  • Meta-Dataset: MetaKernel outperforms previous methods on 7 out of 10 datasets in the challenging Meta-Dataset benchmark.
  • Few-Shot Domain Generalization: MetaKernel demonstrates strong performance, surpassing prior methods by up to 2.0% on the 5-way 1-shot setting.
  • Few-Shot Regression: MetaKernel fits target functions effectively even with only three shots and consistently outperforms MAML across different shot configurations.
  • Ablation Studies: The paper provides thorough ablation studies showing that each component (RFFs, task context inference, normalizing flows) contributes significantly to the overall performance gains. For example, RFFs alone provide a substantial improvement over standard RBF kernels.

Limitations and Future Work

  • Computational Cost: While RFFs offer efficiency, the use of LSTMs and normalizing flows can introduce computational overhead. The paper does not explicitly detail the exact computational complexity or training times compared to baselines.
  • Hyperparameter Sensitivity: Like many deep learning models, MetaKernel likely has hyperparameters that require careful tuning. The paper mentions setting D=780 for MetaKernel's bases, suggesting a need for optimization.
  • Future Work: The authors suggest exploring deeper embeddings and more powerful feature extraction architectures, as MetaKernel is shown to be architecture-agnostic and benefits from better feature representations. Further investigation into the interplay between different components and their impact on generalization could also be a fruitful direction.

Summary updated

Abstract

Few-shot learning deals with the fundamental and challenging problem of learning from a few annotated samples, while being able to generalize well on new tasks. The crux of few-shot learning is to extract prior knowledge from related tasks to enable fast adaptation to a new task with a limited amount of data. In this paper, we propose meta-learning kernels with random Fourier features for few-shot learning, we call MetaKernel. Specifically, we propose learning variational random features in a data-driven manner to obtain task-specific kernels by leveraging the shared knowledge provided by related tasks in a meta-learning setting. We treat the random feature basis as the latent variable, which is estimated by variational inference. The shared knowledge from related tasks is incorporated into a context inference of the posterior, which we achieve via a long-short term memory module. To establish more expressive kernels, we deploy conditional normalizing flows based on coupling layers to achieve a richer posterior distribution over random Fourier bases. The resultant kernels are more informative and discriminative, which further improves the few-shot learning. To evaluate our method, we conduct extensive experiments on both few-shot image classification and regression tasks. A thorough ablation study demonstrates that the effectiveness of each introduced component in our method. The benchmark results on fourteen datasets demonstrate MetaKernel consistently delivers at least comparable and often better performance than state-of-the-art alternatives.
BibTeX
@article{du2024metakernel,
  author = {Yingjun Du and Haoliang Sun and Xiantong Zhen and Jun Xu and Yilong Yin and Ling Shao and Cees G. M. Snoek},
  title = {{MetaKernel: Learning Variational Random Features With Limited Labels}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2024},
  doi = {10.1109/tpami.2022.3154930},
}
Figure