NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Fast and Flexible Multi-Task Classification using Conditional Neural Adaptive Processes

James Requeima, Jonathan Gordon, John Bronskill, Sebastian Nowozin, Richard E. Turner

Overview

CNAPS is a meta-learning framework that allows image classification models to instantly adapt to new, diverse tasks without the need for slow, gradient-based fine-tuning. By using a specialized adaptation network to modulate a pre-trained feature extractor, it achieves state-of-the-art performance on the challenging META-DATASET benchmark while being significantly faster than competing methods.

The Challenge of Heterogeneous Tasks

Standard deep learning models are notoriously "brittle"—they perform exceptionally well on their training data distributions but struggle to adapt to new tasks without extensive retraining. While few-shot learning and meta-learning aim to solve this, most existing methods assume that all tasks come from the same distribution (e.g., a model trained to recognize different types of birds adapting to a new species of bird).

When faced with a "heterogeneous" environment—where one task might be identifying fungi and the next might be recognizing handwritten characters—current models face a dilemma:

  1. Under-fitting: Adapting only the final classification layer isn't flexible enough to handle massive domain shifts.
  2. Over-fitting: Adapting the entire feature extractor via gradient descent is computationally expensive, slow, and highly prone to over-fitting when labeled data is scarce.

CNAPS seeks a middle ground: a system flexible enough to change its internal feature representations for each task, yet robust enough to do so instantly and reliably.

Methods: Conditional Neural Adaptive Processes

CNAPS is built on the framework of Conditional Neural Processes (CNPs). The core idea is to separate the model into global shared parameters and local task-specific parameters.

Computational graph of CNAPs showing the adaptation network modulating the classification model.

Amortized Adaptation

Instead of relying on gradient descent at test time, CNAPS uses an adaptation network. This network takes a small "context set" (a few labeled examples of the new task) and directly predicts the parameters needed to modify the main classifier. Because this is a simple forward pass, adaptation is virtually instantaneous.

FiLM Layers for Efficient Modulation

To keep the adaptation computationally efficient, the authors utilize Feature-wise Linear Modulation (FiLM). Rather than changing every weight in a deep architecture like a ResNet, the adaptation network only produces a small set of "scales" ($\gamma$) and "shifts" ($\beta$) for the existing feature maps.

Illustration of a FiLM layer and its integration into a ResNet block.

These FiLM parameters constitute less than 0.7% of the total model parameters but allow for significant, dynamic changes in how the model "sees" features for a specific task.

Auto-regressive Parameterization

A key innovation in CNAPS is that the adaptation network is auto-regressive. When it decides how to modulate a deeper layer in the ResNet, it is conditioned on how it already modulated the shallower layers, ensuring coherent feature transformations throughout the network.

Two-Stage Training

  1. Pre-training: The main feature extractor is trained on a large, diverse dataset (like ImageNet) to learn robust general features.
  2. Meta-training: The feature extractor's core weights are frozen. The adaptation network is then trained to produce the best FiLM parameters across a wide variety of tasks.

Key Insights

  • The Power of FiLM: You don't need to rewrite a whole model to adapt to a new domain. Subtle, targeted shifts in feature map activations are often enough to repurpose a strong pre-trained backbone.
  • Avoiding the "Gradient Trap": By using a forward-pass adaptation network (amortization), CNAPS avoids the instability and hyperparameter tuning (like learning rates) required by gradient-based meta-learners such as MAML.
  • Task-Specific Encodings: A "global set encoder" allows the model to look at the entire context set and extract a summary of what the current task requires before it starts processing individual images.
  • Versatility: Because the adaptation is fast and gradient-free, the model is immediately deployable to other settings like continual learning (learning tasks in a sequence without forgetting) and active learning (choosing which data points to label).

Datasets and Results

The primary benchmark used to evaluate CNAPS is META-DATASET, a rigorous collection designed to test generalization across different domains (including ImageNet, Omniglot, Aircraft, Birds, Textures, Quick Draw, Fungi, and VGG Flower). The model was also tested on unseen datasets like Traffic Signs, MSCOCO, MNIST, and CIFAR-10/100.

Key Findings: * State-of-the-Art Performance: CNAPS outperformed existing methods on 7 out of 8 datasets in the META-DATASET benchmark, often by significant margins (e.g., a ~10% accuracy boost on the "Quick Draw" dataset compared to previous bests). * Speed: CNAPS is at least 5x faster at test-time adaptation than gradient-based methods. * Robustness: Unlike many few-shot methods that fail or under-fit when given too much data, CNAPS continues to improve as the number of "shots" (examples) increases. * Resisting Catastrophic Forgetting: In continual learning tests on Split MNIST and Split CIFAR100, CNAPS naturally resisted forgetting previous tasks, performing as well as or better than specialized continual learning algorithms.

Limitations and Future Work

While powerful, CNAPS has a few limitations. Its performance is heavily tied to the quality of the pre-trained feature extractor; if the initial backbone hasn't seen features remotely similar to the target task, FiLM modulation may struggle to bridge the gap. Additionally, the final classification weights are generated per-class, which assumes a linear relationship in the final feature space.

Future directions suggested by the authors include exploring "distributional" extensions to better handle uncertainty, and potentially hybrid approaches that combine the sheer speed of amortization with the fine-tuning precision of gradient updates.

Summary updated

BibTeX
@inproceedings{requeima2019fast,
  author = {James Requeima and Jonathan Gordon and John Bronskill and Sebastian Nowozin and Richard E. Turner},
  title = {{Fast and Flexible Multi-Task Classification using Conditional Neural Adaptive Processes}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=dC3P0jL6Ah},
}
Figure