Abstract
Optimization-based meta-learning typically assumes tasks are sampled from a single distribution - an assumption that oversimplifies and limits the diversity of tasks that meta-learning can model. Handling tasks from multiple distributions is challenging for meta-learning because it adds ambiguity to task identities. This paper proposes a novel method, ST-MAML, that empowers model-agnostic meta-learning (MAML) to learn from multiple task distributions. ST-MAML encodes tasks using a stochastic neural network module, that summarizes every task with a stochastic representation. The proposed Stochastic Task (ST) strategy learns a distribution of solutions for an ambiguous task and allows a meta-model to self-adapt to the current task. ST-MAML also propagates the task representation to enhance input variable encodings. Empirically, we demonstrate that ST-MAML outperforms the state-of-the-art on two few-shot image classification tasks, one curve regression benchmark, one image completion problem, and a real-world temperature prediction application.
Introduction
Most meta-learning algorithms, such as the popular Model-Agnostic Meta-Learning (MAML), operate under a "homogeneous" assumption: they assume every task the model encounters is sampled from a single, unified distribution. In real-world scenarios, tasks are often heterogeneous. For example, a handwriting recognition model might face tasks from children, adults, and elderly writers, each representing a different "meta-distribution."
The core challenge in heterogeneous settings is task ambiguity. In few-shot scenarios with limited data points, it is mathematically difficult to determine which distribution a task belongs to. A deterministic model might pick a single, incorrect "average" solution. ST-MAML addresses this by treating the task identity itself as a random variable, allowing the model to quantify uncertainty and self-adapt its parameters and input encodings.
Methodology
ST-MAML (Stochastic-Task Model-Agnostic Meta-Learning) introduces a framework to handle task heterogeneity through three core components:
- Stochastic Task Encoding ($Z_{\mathcal{T}}$): Instead of a fixed embedding, ST-MAML uses a neural network to encode a task into a Gaussian distribution (mean and variance). This captures the uncertainty of the task's identity. The encoder is permutation-invariant, treating training samples as an unordered set.
- Model Tailoring (Gating): The stochastic variable $Z_{\mathcal{T}}$ is used to "tailor" global model parameters. A gating mechanism applies element-wise scaling to the weights of task-specific layers, effectively navigating the model toward a solution space that fits the current task's inferred distribution.
- Input Augmentation: ST-MAML propagates the task representation $Z_{\mathcal{T}}$ directly into the input. It generates an "augmented feature" that is concatenated with the raw data, helping the model re-contextualize input variables based on the specific task.
The entire system is trained using Variational Inference, specifically by maximizing the Evidence Lower Bound (ELBO). This allows the model to learn a distribution of potential solutions rather than just one.
Experimental Evaluation
The authors evaluated ST-MAML across a diverse set of benchmarks, including synthetic 2D regression, image classification (Plain-Multi, CelebA), image completion, and a real-world temperature prediction task (NOAA GSOD).
Key Results
ST-MAML consistently outperformed baseline methods across all evaluated tasks:
- Temperature Prediction: ST-MAML achieved an MSE of 86.56, outperforming standard MAML (141.43) by roughly 40%.
- 2D Regression: In highly ambiguous scenarios, ST-MAML's sampled solutions spanned a wide range of possible curves while remaining faithful to the provided data points, whereas baselines often collapsed to a single, poor fit.
- Classification: On the Plain-Multi dataset, ST-MAML consistently outperformed other heterogeneous meta-learners like MMAML and HSMAML across all four data categories (Bird, Texture, Aircraft, Fungi).
Discussion and Insights
The success of ST-MAML stems from its ability to embrace ambiguity. By using a stochastic variable ($Z_{\mathcal{T}}$), the model can represent multiple "potential truths" simultaneously. Unlike Bayesian MAML variants that attempt to model high-dimensional weight distributions, ST-MAML shifts the stochastic burden to a low-dimensional task representation, making it more stable and computationally efficient. The combination of parameter gating and input augmentation provides a robust inductive bias for adaptation in complex, multi-distribution environments.
Conclusion
ST-MAML provides a powerful framework for meta-learning in heterogeneous environments. By representing tasks as stochastic variables, the model can quantify uncertainty and self-adapt to diverse distributions. While the gating mechanism currently requires specific architectural considerations, the model's performance on messy, real-world data highlights its potential. Future work will explore incorporating domain generalization to further improve the model's ability to handle completely unseen task distributions.
Summary updated