Context-Based Meta-Reinforcement Learning With Bayesian Nonparametric Models

Zhenshan Bing, Yuqi Yun, Kai Huang, Alois KnollIEEE TPAMI 2024

Introduction

Meta-Reinforcement Learning (meta-RL) aims to enable agents to learn new tasks quickly by leveraging experience from a set of related training tasks. However, existing methods face two major hurdles. First, most algorithms excel at "parametric" variations (e.g., a robot running at different target speeds) but struggle with "nonparametric" variations—qualitatively different tasks like "reaching for a puck" vs. "opening a window." Second, current context-based methods often use a single Gaussian prior or a fixed-size mixture model, which fails when the number of task types is unknown or when the environment is non-stationary.

This paper introduces MELTS (Meta-reinforcement Learning with Task Self-discovery), an off-policy context-based meta-RL algorithm that allows agents to adaptively discover and cluster qualitatively different tasks without prior knowledge of the task distribution.

Methodology: Task Self-Discovery via DPMM-VAE

The core of MELTS is the DPMM-VAE module. It uses a Dirichlet Process Mixture Model (DPMM) to dynamically "birth" or "merge" task clusters in the latent space. Unlike standard Gaussian Mixture Models (GMMs), it doesn't require a predefined number of clusters.

The stick-breaking process (a) and a sample draw from a Dirichlet process (b) illustrate how MELTS handles an infinite number of potential task clusters.

The stick-breaking process provides a constructive way to define the Dirichlet process, allowing for an infinite number of potential task clusters. The probabilistic graphical model for this process is shown below, illustrating how task assignments ($V_i$) and cluster parameters ($ heta_k$) are structured.

Probabilistic graphical model of the Dirichlet Process Mixture Model (DPMM) used for task self-discovery.

Key innovations in the MELTS framework include:

  • Zero-Shot Adaptation: By using a GRU-based context encoder that processes only a short window of recent transitions, the agent can infer the task and adapt its policy at every timestep, even in non-stationary settings.
  • Decoupled Inference: Task inference is trained via reconstruction (predicting next states and rewards) rather than just through the RL objective. This provides a stronger, more stable signal for learning task representations.

Experimental Evaluation

The researchers evaluated MELTS across several domains, including MNIST for unsupervised clustering and MuJoCo continuous control benchmarks. A particularly challenging benchmark, the Half-Cheetah 8-Task, was introduced to test the model's ability to handle eight qualitatively different base tasks combined with parametric variations.

Key Results and Insights

  • Clustering Accuracy: On MNIST, DPMM-VAE achieved 91.9% unsupervised clustering accuracy, significantly outperforming the state-of-the-art GMVAE (77.3%).
  • Sample Efficiency: In the Half-Cheetah 8-Task environment, MELTS reached peak performance with roughly 10x fewer samples than baselines like PEARL.
  • Dynamic Task Discovery: The DPMM-VAE successfully "discovers" the number of base tasks. On the 8-task benchmark, it correctly identified 8 clusters, whereas standard VAEs produced a tangled latent space.
  • Zero-Shot Success: MELTS demonstrated the ability to switch behaviors instantly when tasks were changed sequentially in a single episode, a feat that baselines struggled to achieve.

Conclusion

MELTS demonstrates that a structured latent space is vital for preventing "task interference," where learning one task accidentally degrades performance on another. While the DPMM-VAE update involves iterative variational inference steps that add some computational cost, the resulting gains in sample efficiency and zero-shot adaptation capability represent a significant step forward for meta-RL in complex, non-stationary environments.

Summary updated

BibTeX
@article{bing2024context,
  author = {Zhenshan Bing and Yuqi Yun and Kai Huang and Alois Knoll},
  title = {{Context-Based Meta-Reinforcement Learning With Bayesian Nonparametric Models}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2024},
  doi = {10.1109/tpami.2024.3386780},
}
Figure