Multi-Task Neural Processes

Jiayi Shen, Xiantong Zhen, Marcel Worring, Ling Shao

TL;DR

Multi-Task Neural Processes (MTNPs) extend neural processes to the multi-task setting by modeling task relatedness directly in the network’s function space. By introducing a hierarchical Bayesian prior, MTNPs allow tasks to selectively borrow shared knowledge from other domains while avoiding negative transfer caused by domain shift—delivering strong performance improvements when labeled data is scarce.

What Problem Does This Paper Address?

Multi-task learning (MTL) aims to improve generalization across several related tasks by sharing information. In many real-world settings, however, tasks suffer from both limited labeled data (making deep networks prone to overfitting) and domain shift (each task has a distinct input distribution despite sharing label spaces).

Vanilla Neural Processes (NPs) bridge deep networks and Gaussian processes to offer lightweight, uncertainty-aware prediction functions. However, standard NPs implicitly assume all context and target observations come from the exact same data distribution, aggregating context points via simple average pooling. Naïvely pooling context across heterogeneous tasks degrades performance due to task distribution mismatch. This paper fills the theoretical and practical gap of how to formulate Neural Processes for multi-task learning under domain shift.

Methods

Rather than sharing representations or applying rigid heuristics, MTNPs formulate multi-task learning through hierarchical context modeling:

  1. Function-Space Parameters as Latents ($\psi_l$): For each task $l$, the model defines the prediction function via a task-specific latent parameter $\psi_l$ (e.g., classifier weights).
  2. Global Knowledge Base ($M$): A global matrix aggregates summary statistics (class- or task-level feature averages) across all context sets $\{D_l\}$.
  3. Hierarchical Task-Gating Variable ($\alpha_l$): To prevent negative transfer from disparate distributions, a task-specific latent variable $\alpha_l \sim p_{\theta_2}(\alpha_l | D_l)$ acts as a controller. A learnable neural network $h(\alpha_l, M)$ extracts only the relevant knowledge $m_l$ from the global pool $M$ to parameterize the function prior $p_{\theta_1}(\psi_l | \alpha_l, M)$.
  4. Variational Hierarchical Inference: The framework optimizes an Evidence Lower Bound (ELBO) using amortized variational posterior distributions $q_{\phi_1}(\psi_l | D_l^*)$ and $q_{\phi_2}(\alpha_l | D_l^*)$ with the local reparameterization trick.

The authors formally prove that MTNPs satisfy both exchangeability and consistency, ensuring the model constitutes a mathematically valid stochastic process.

       M (Global Context)
       │
       ▼
D_l ──► α_l (Task Filter) ──► m_l = h(α_l, M)
                               │
                               ▼
                             ψ_l (Task Classifier/Function)
                               │
X_l* ──────────────────────────► Y_l* (Predictions)

Datasets

The authors evaluated MTNPs on synthetic regression, multi-domain classification, angle estimation, and medical image segmentation:

  • 1-D Synthetic Multi-Task Regression: Four tasks with non-overlapping input intervals across $[ -2\pi, 2\pi ]$ evaluating composite trigonometric functions.
  • Real-World Classification Benchmarks:
  • Office-Home: 65 classes across 4 domains (Artistic, Clipart, Product, Real-World).
  • Office-Caltech: 10 shared categories across 4 domains (Amazon, Webcam, DSLR, Caltech-256).
  • ImageCLEF: 12 shared categories across 4 domains (Caltech-256, ImageNet, Pascal VOC, Bing).
  • Rotated MNIST: Multi-task regression estimating rotation angles ($0^\circ$ to $90^\circ$ in steps of $10^\circ$) per digit class.
  • Brain Image Segmentation (LGG-110): Magnetic resonance imaging of lower-grade gliomas from 110 patients, reformulated as pixel-wise regression where local neighborhoods serve as context.

Key Insights and Ideas

  • Sharing via Function Priors, Not Hidden Layers: Standard deep MTL typically shares intermediate feature representations. MTNPs place priors over prediction functions ($\psi_l$), enabling probabilistic uncertainty estimation alongside parameter sharing.
  • Adaptive Context Retrieval via $\alpha_l$: Rather than pooling all context points equally (which violates the i.i.d. assumption of NPs), $\alpha_l$ learns to query $M$ dynamically, tailoring global knowledge to each task's local domain.
  • Dense Prediction as MTL: Casting medical image segmentation as a dense multi-task regression problem lets the model naturally treat spatial neighborhoods as context to capture long-range pixel dependencies.

Key Results

  • Classification with Scarce Data (5% Labels):
  • On Office-Home, MTNPs reached 60.0% average accuracy, outperforming Single-Task Learning (49.2%), vanilla NPs (54.7%), and standard NP context-pooling (59.1%).
  • On Office-Caltech and ImageCLEF, MTNPs scored 94.6% and 76.1%, outperforming competitive multi-task baselines such as Multilinear Relationship Networks.
  • Angle Regression: MTNPs yielded the lowest average Normalized Mean Squared Error (NMSE) on Rotated MNIST (0.106 vs. 0.112 for NPs and 0.215 for single-task baselines), widening the margin when training data dropped to 0.05% (0.159 vs. 0.173).
  • Brain Segmentation: Surpassed the baseline U-Net by +0.5% in Dice Similarity Coefficient (DSC), predicting tumor margins closer to ground truth.

Limitations and Future Work

  • Shared Output Space Assumption: The formulation assumes all tasks share a common label/target space (e.g., same classification categories or angle targets), limiting applicability to heterogeneous label spaces.
  • Inference Overhead: Sampling two sets of latent variables ($\psi_l$ and $\alpha_l$) requires Monte Carlo estimation during both training and evaluation, increasing computational latency relative to standard deterministic multi-task backbones.
  • Societal and Clinical Fairness: The authors note that when applying the method to sensitive applications like medical diagnosis, incomplete datasets risk propagating hidden dataset biases or fairness issues across tasks.

Summary updated

BibTeX
@inproceedings{shen2022multi,
  author = {Jiayi Shen and Xiantong Zhen and Marcel Worring and Ling Shao},
  title = {{Multi-Task Neural Processes}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=wfRZkDvxOqj},
}
Figure